GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> FES / V6-4-2 > fes / i845e


Interface   Data Structures   File List   Data Fields   Globals  

fesBufLib.h File Reference

Definitions for the buffer management routines. More...


Classes

struct  fesBufStats_s
 Buffer statistics block. More...

Typedefs

typedef struct fesBuf_s fesBuf_t
 Buffer handle.
typedef struct
fesBufStats_s 
fesBufStats_t
 Buffer statistics block.

Functions

fesBuf_tfesBufAlloc (void)
 Allocate a buffer.
int fesBufBytesUsedGet (fesBuf_t *buf)
 Get number of bytes used.
int fesBufBytesUsedSet (fesBuf_t *buf, int count)
 Set number of bytes used.
int fesBufDataAlignment (fesBuf_t *buf)
 Get data alignment.
int fesBufDataOffsetGet (fesBuf_t *buf)
 Get data offset.
int fesBufDataOffsetSet (fesBuf_t *buf, int offset)
 Set data offset.
char * fesBufDataStartGet (fesBuf_t *buf)
 Get data address.
void fesBufFree (fesBuf_t *buf)
 Free a buffer.
int fesBufLibDeInit (void)
 De-initialize the buffer allocation system.
int fesBufLibInit (int nBuffers, int size, int alignment)
 Initialize the buffer allocation system.
void fesBufListShow (int list, int first, int count)
 Show contents of a buffer pool list.
void fesBufPoolShow (void)
 Show buffer pool statistics.
void fesBufShow (fesBuf_t *buf)
 Show buffer parameters.
int fesBufSize (fesBuf_t *buf)
 Get buffer size.
char * fesBufStart (fesBuf_t *buf)
 Get buffer address.
void fesBufStatsGet (fesBufStats_t *uStats)
 Get buffer pool statistics.
unsigned int fesBufUserFieldGet (fesBuf_t *buf)
 Get the user field.
void fesBufUserFieldSet (fesBuf_t *buf, unsigned int val)
 Set the user field.


Detailed Description

Definitions for the buffer management routines.

Author:
Mark A McDougald, Owen H Saxton
$Id: fesBufLib.h,v 1.7 2010/07/26 18:44:03 saxton Exp $

Function Documentation

fesBuf_t* fesBufAlloc ( void   ) 

Allocate a buffer.

A buffer is allocated from the available pool, and its various associated parameters (data, offset, bytes used, and user) cleared.

Returns:
The handle of the allocated buffer, or NULL if no buffer is available.

int fesBufBytesUsedGet ( fesBuf_t buf  ) 

Get number of bytes used.

This routine returns the number of bytes used in the specified buffer.

Parameters:
buf The handle for the buffer.
Returns:
The number of bytes used in the buffer.

int fesBufBytesUsedSet ( fesBuf_t buf,
int  count 
)

Set number of bytes used.

This routine sets the number of bytes used in the specified buffer.

Parameters:
buf The handle for the buffer.
count The number of bytes used.
Return values:
FES_SUCCESS The operation was successful.
FES_INVPARMV The bytes used value was invalid.

int fesBufDataAlignment ( fesBuf_t buf  ) 

Get data alignment.

This routine returns the alignment of the data portion of the specified buffer.

Parameters:
buf The handle for the buffer.
Returns:
The alignment of the data portion: 1, 2 or 4.

int fesBufDataOffsetGet ( fesBuf_t buf  ) 

Get data offset.

This routine returns the offset from the beginning of the specified buffer to the start of its data.

Parameters:
buf The handle for the buffer.
Returns:
The offset to the buffer data.

int fesBufDataOffsetSet ( fesBuf_t buf,
int  offset 
)

Set data offset.

This routine sets the offset from the beginning of the specified buffer to the start of the data, thereby changing the data start address as well.

Parameters:
buf The handle for the buffer.
offset The offset value to set.
Return values:
FES_SUCCESS The operation was successful.
FES_INVPARMV The bytes used value was invalid.

char* fesBufDataStartGet ( fesBuf_t buf  ) 

Get data address.

This routine returns the data start address for the specified buffer.

Parameters:
buf The handle for the buffer.
Returns:
The data start address for the buffer.

void fesBufFree ( fesBuf_t buf  ) 

Free a buffer.

The specified buffer is freed, and so made available for later re-allocation.

Parameters:
buf The handle for the buffer to be freed.

int fesBufLibDeInit ( void   ) 

De-initialize the buffer allocation system.

The buffer allocation system is de-initialized by freeing all the allocated memory.

Return values:
FES_SUCCESS Always successful.

int fesBufLibInit ( int  nBuffers,
int  size,
int  alignment 
)

Initialize the buffer allocation system.

This routine initializes the buffer allocation system by allocating a piece of memory containing all the buffers and putting them all on the free list.

Parameters:
nBuffers The number of buffers to allocate.
size The size of each buffer, in bytes.
alignment The alignment of each buffer, which must be a power of 2.
Return values:
FES_SUCCESS Initialization was successful, or had previously been completed.
FES_NOSEMCRE Unable to create interlock semaphore.
FES_NOMEMORY Insufficient memory available.

void fesBufListShow ( int  list,
int  first,
int  count 
)

Show contents of a buffer pool list.

This routine displays the parameters of the specified buffers on the specified (free or allocated) list.

Parameters:
list Specifies which list to use: zero = free, non-zero = allocated.
first The first buffer to be displayed, starting from 1.
count The number of buffers to be displayed.

void fesBufPoolShow ( void   ) 

Show buffer pool statistics.

This routine displays overall statistics for the buffer pool.

void fesBufShow ( fesBuf_t buf  ) 

Show buffer parameters.

This routine displays the parameters of the specified buffer.

Parameters:
buf The handle for the buffer.

int fesBufSize ( fesBuf_t buf  ) 

Get buffer size.

This routine returns the size of the specified buffer.

Parameters:
buf The handle for the buffer.
Returns:
The size of the buffer.

char* fesBufStart ( fesBuf_t buf  ) 

Get buffer address.

This routine returns the address of the specified buffer.

Parameters:
buf The handle for the buffer.
Returns:
The address of the buffer.

void fesBufStatsGet ( fesBufStats_t uStats  ) 

Get buffer pool statistics.

This routine returns the buffer pool statistics.

Parameters:
uStats The address of an area to receive the statistics block.

unsigned int fesBufUserFieldGet ( fesBuf_t buf  ) 

Get the user field.

This routine returns the user field of the specified buffer.

Parameters:
buf The handle for the buffer.
Returns:
The user field of the buffer.

void fesBufUserFieldSet ( fesBuf_t buf,
unsigned int  val 
)

Set the user field.

This routine sets the user field of the specified buffer.

Parameters:
buf The handle for the buffer.
val The user field value.


Generated on Thu Aug 19 17:15:02 2010 by  doxygen 1.5.3