GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-2 > mem_unit_test / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

mem_util_pool.c File Reference

Provide a memory pool for command and telemetry packets. More...

#include <ITC/ITC_pubdefs.h>
#include <PBS/FPA.h>
#include <PBS/MBA.h>
#include <mem_unit_test.h>
#include <mem_util_pool.h>

Functions

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 the memory pool.
void * 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 the memory pool.
int POOL_init (test_Test_Descriptor *td_p, unsigned int num_pkts, unsigned int pkt_bytes)
 Create the memory pool for packets.
int POOL_shutdown (test_Test_Descriptor *td_p)
 Shutdown the memory pool.


Detailed Description

Provide a memory pool for command and telemetry packets.

**  CVS $Id: mem_util_pool.c,v 1.2 2011/03/29 01:58:52 apw Exp $
**  

Function Documentation

void * 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 the memory pool.

Parameters:
prm Context parm (pointer to test descriptor).
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 _test_Test_Descriptor::pool_fcb_p, pool_free(), _test_Test_Descriptor::pool_in_use, and _test_Test_Descriptor::pool_pkt_bytes.

Referenced by cmd_send(), TASK_add_queue(), and TASK_init().

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 the memory pool.

Parameters:
qitem_p Pointer to queue item.
status_in Completion code.
parm_0 Callback parameter 0 (pointer to test descriptor).
parm_1 Callback parameter 1 (pointer to packet).
parm_2 Callback parameter 2 (pointer to status_in store loc).
tx Flag indicating sender-side failure (unused).
Returns:
Nothing.

References _test_Test_Descriptor::pool_fcb_p, and _test_Test_Descriptor::pool_in_use.

Referenced by POOL_alloc().

int POOL_init ( test_Test_Descriptor td_p,
unsigned int  num_pkts,
unsigned int  pkt_bytes 
)

Create the memory pool for packets.

Parameters:
td_p Pointer to test descriptor.
num_pkts Number of packets to include in the pool.
pkt_bytes Size of each packet in the pool, in bytes.
Return values:
0 Success.
-1 Failure.

References _test_Test_Descriptor::pool_buf_p, _test_Test_Descriptor::pool_fcb_p, _test_Test_Descriptor::pool_in_use, _test_Test_Descriptor::pool_pkt_bytes, test_NULL_Compare(), test_Pop_State(), test_Push_State(), and test_Status_Success().

Referenced by mem_unit_test_func().

int POOL_shutdown ( test_Test_Descriptor td_p  ) 

Shutdown the memory pool.

Parameters:
td_p Pointer to test descriptor.
Return values:
0 Success.
-1 Failure.

References _test_Test_Descriptor::pool_buf_p, _test_Test_Descriptor::pool_fcb_p, _test_Test_Descriptor::pool_in_use, test_Generic_Error(), test_Pop_State(), test_Push_State(), and test_Value32_Compare().

Referenced by mem_unit_test_func().


Generated on Wed Nov 21 21:09:16 2012 by  doxygen 1.5.8