GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LIM / V1-22-4 > lim / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

LIM_pool.c File Reference

Memory pool management for the LIM package. More...

#include <string.h>
#include <ITC/ITC_pubdefs.h>
#include <LIM/LIM_msgs.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/FPA.h>
#include <PBS/MBA.h>
#include <LIM_pool.h>

Classes

struct  _LIM_Pool
 Control information for LIM memory pools. More...
struct  _LIM_Pool_Pkt
 Header information for a packet from a LIM memory pool. More...

Defines

#define LIM_POOL_VALID_KEY   (('L'<<24)+('I'<<16)+('M'<<8)+'P')
 Value that indicates LIM pool control info is valid.

Typedefs

typedef struct _LIM_Pool_Pkt LIM_Pool_Pkt
 Typedef for _LIM_Pool_Pkt structure.

Functions

static unsigned int lim_pool_info_check (LIM_Pool *pool_p)
 Validate a LIM pool control information block.
unsigned int LIM_pool_init (LIM_Pool **pool_pp, unsigned int num_pkts, unsigned int pkt_bytes)
 Initialize a memory pool.
unsigned int LIM_pool_shutdown (LIM_Pool *pool_p)
 Shutdown a memory pool by freeing its memory.
static void pool_free (ITC_QueueItem *qitem_p, unsigned int status_in, void *parm_0, void *parm_1, void *parm_2, unsigned int tx)
 Free a packet from a memory pool.
void * LIM_pool_alloc (void *prm, unsigned int size, ITC_cb_Completion **free_cb, void **cb_parm_0, void **cb_parm_1, void **cb_parm_2)
 Allocate a packet from a memory pool.


Detailed Description

Memory pool management for the LIM package.

**  CVS $Id: LIM_pool.c,v 1.8 2011/03/29 21:20:29 apw Exp $
**  

These functions are wrappers around the FPA fixed packet allocator functions, which allow them to be used with the ITC memory management scheme.


Function Documentation

void * LIM_pool_alloc ( void *  prm,
unsigned int  size,
ITC_cb_Completion **  free_cb,
void **  cb_parm_0,
void **  cb_parm_1,
void **  cb_parm_2 
)

Allocate a packet from a memory pool.

Parameters:
prm Context parm (pointer to pool control info).
size Size of allocation request, in bytes.
free_cb Location to store pointer to 'free' callback function.
cb_parm_0 Location to store callback parameter 0.
cb_parm_1 Location to store callback parameter 1.
cb_parm_2 Location to store callback parameter 2.
Returns:
Pointer to allocated packet.

References _LIM_Pool::fcb_p, _LIM_Pool::in_use, lim_pool_info_check(), _LIM_Pool::pkt_bytes, pool_free(), and _LIM_Pool_Pkt::pool_p.

Referenced by LIM_initialize(), LIM_pig_record(), lim_pkt_send_pkt(), and LIM_shutdown().

unsigned int lim_pool_info_check ( LIM_Pool pool_p  )  [static]

Validate a LIM pool control information block.

Parameters:
pool_p Pointer to pool control information.
Returns:
MSG code.

References _LIM_Pool::key, and LIM_POOL_VALID_KEY.

Referenced by LIM_pool_alloc(), LIM_pool_shutdown(), and pool_free().

unsigned int LIM_pool_init ( LIM_Pool **  pool_pp,
unsigned int  num_pkts,
unsigned int  pkt_bytes 
)

Initialize a memory pool.

Parameters:
pool_pp Location to return pool control info pointer.
num_pkts Number of packets to include in the pool.
pkt_bytes Size of each packet, in bytes.
Returns:
MSG code.

References _LIM_Pool::fcb_p, _LIM_Pool::key, LIM_POOL_VALID_KEY, and _LIM_Pool::pkt_bytes.

Referenced by LIM_initialize().

unsigned int LIM_pool_shutdown ( LIM_Pool pool_p  ) 

Shutdown a memory pool by freeing its memory.

Parameters:
pool_p Pointer to pool control information.
Returns:
MSG code.

References _LIM_Pool::fcb_p, _LIM_Pool::in_use, _LIM_Pool::key, and lim_pool_info_check().

Referenced by LIM_shutdown().

void pool_free ( ITC_QueueItem *  qitem_p,
unsigned int  status_in,
void *  parm_0,
void *  parm_1,
void *  parm_2,
unsigned int  tx 
) [static]

Free a packet from a memory pool.

Parameters:
qitem_p Pointer to queue item.
status_in Completion code.
parm_0 Callback parameter 0 (pointer to packet header info).
parm_1 Callback parameter 1 (pointer to callback function).
parm_2 Callback parameter 2 (parameter for callback func).
tx Flag indicating sender-side failure (unused).
Returns:
Nothing.

References _LIM_Pool::fcb_p, _LIM_Pool::in_use, lim_pool_info_check(), and _LIM_Pool_Pkt::pool_p.

Referenced by LIM_pool_alloc().


Generated on Wed Nov 21 21:17:41 2012 by  doxygen 1.5.8