GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > IMM / V0-3-2

Constituent: imm     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

RBM_memory.c File Reference

Memory allocation/free routines for an managed ring buffer. More...

#include "PBS/FFS.ih"
#include "PBS/FPA.h"
#include "PBS/RW.ih"
#include "MSG/MSG_pubdefs.h"
#include "IMM/RBM_pubdefs.h"
#include "IMM/RBM_msgs.h"
#include "RBM_prvdefs.h"

Include dependency graph for RBM_memory.c:


Functions

void * RBM_allocAny (unsigned int typ, RBM_Ring *rcb, unsigned int siz, const TOC *toc, unsigned int *status)
 Allocate a packet from a managed ring buffer.
unsigned int RBM_freeAny (RBM_Ring *rcb, void *pkt, unsigned int siz, unsigned int tx)
 Free memory back to a managed ring buffer.
void RBM_freeITC (void *pkt, unsigned int status, void *prm0, void *prm1, void *prm2, unsigned int tx)
 Free memory packet (ITC courtesy entry point).
void * RBM_alloc (RBM_Ring *rcb, unsigned int siz, unsigned int *status)
 Allocate a packet from a managed ring buffer.
void * RBM_allocITC (RBM_Ring *rcb, unsigned int siz, void **rtn, void **cb0, void **cb1, void **cb2)
 Allocate memory packet without timeout (ITC courtesy entry point).
void * RBM_allocW (RBM_Ring *rcb, unsigned int siz, unsigned int *status)
 Allocate a packet from a managed ring buffer.
void * RBM_allocW_toc (RBM_Ring *rcb, unsigned int siz, const TOC *toc, unsigned int *status)
 Allocate a packet from a managed ring buffer.
unsigned int RBM_free (RBM_Ring *rcb, void *pkt, unsigned int siz)
 Free memory back to a managed ring buffer (from the tail).
unsigned int RBM_shrink (RBM_Ring *rcb, void *pkt, unsigned int siz)
 Free memory back to a managed ring buffer (from the head).

Detailed Description

Memory allocation/free routines for an managed ring buffer.

CVS $Id: RBM_memory.c,v 1.5 2007/01/03 20:44:14 apw Exp $
Author:
A.P.Waite
RBM_memory.c provides the memory allocation and free routines for RBM.

Function Documentation

void* RBM_alloc RBM_Ring rcb,
unsigned int  siz,
unsigned int *  status
 

Allocate a packet from a managed ring buffer.

Parameters:
rcb (in) Ring buffer manager control block
siz (in) Number of bytes to allocate
status (out) Completion status (pointer can be NULL)
Return values:
NULL Memory allocation failed
x Pointer to allocated memory
Values returned through status parameter

Return values:
RBM_RINGDRY No memory left in ring to satisfy allocation
RBM_RINGPTR Ring control block pointer invalid
RBM_RINGSTAT Ring control block not in state started
RBM_RINGSIZE Ring not big enough
RBM_SUCCESS Success
RBM_alloc() allocates a memory packet from an RBM memory ring without pending.

void * RBM_allocAny unsigned int  typ,
RBM_Ring rcb,
unsigned int  siz,
const TOC *  toc,
unsigned int *  status
 

Allocate a packet from a managed ring buffer.

Parameters:
typ (in) Type of allocation (what pending style)
rcb (in) Ring buffer manager control block
siz (in) Number of bytes to allocate
toc (in) Time-out control
status (out) Completion status (pointer can be NULL)
Return values:
NULL Memory allocation failed
x Pointer to allocated memory
Values returned through status parameter

Return values:
RBM_RINGDRY No memory left in ring to satisfy allocation
RBM_RINGPTR Ring control block pointer invalid
RBM_RINGSTAT Ring control block not in state started
RBM_RINGSIZE Ring not big enough
RBM_SUCCESS Success
RBM_allocW_toc() allocates a memory from an RBM managed ring buffer.

void* RBM_allocITC RBM_Ring rcb,
unsigned int  siz,
void **  rtn,
void **  cb0,
void **  cb1,
void **  cb2
 

Allocate memory packet without timeout (ITC courtesy entry point).

Parameters:
rcb (in) Ring buffer manager control block
siz (in) Number of bytes to allocate
rtn (out) Processing completion callback routine
cb0 (out) Processing completion callback user parameter 0
cb1 (out) Processing completion callback user parameter 1
cb2 (out) Processing completion callback user parameter 2
Return values:
NULL Memory allocation failed
x Pointer to allocated memory
RBM_allocITC() is a courtesy entry point, compatible with the signature for an ITC "abstract memory allocator". In keeping with ITC's planned usage, this is an allocation without wait. The callback is set up to simply free the memory. rtn is set to RBM_freeITC(), cb0 is set to the ring control block rcb, cb1 is set to the number of bytes allocated. cb2 is unused.

void* RBM_allocW RBM_Ring rcb,
unsigned int  siz,
unsigned int *  status
 

Allocate a packet from a managed ring buffer.

Parameters:
rcb (in) Ring buffer manager control block
siz (in) Number of bytes to allocate
status (out) Completion status (pointer can be NULL)
Return values:
NULL Memory allocation failed
x Pointer to allocated memory
Values returned through status parameter

Return values:
RBM_RINGDRY No memory left in ring to satisfy allocation
RBM_RINGPTR Ring control block pointer invalid
RBM_RINGSTAT Ring control block not in state started
RBM_RINGSIZE Ring not big enough
RBM_SUCCESS Success
RBM_alloc() allocates a memory packet from an RBM memory ring with infinite pending.

void* RBM_allocW_toc RBM_Ring rcb,
unsigned int  siz,
const TOC *  toc,
unsigned int *  status
 

Allocate a packet from a managed ring buffer.

Parameters:
rcb (in) Ring buffer manager control block
siz (in) Number of bytes to allocate
toc (in) Time-out control
status (out) Completion status (pointer can be NULL)
Return values:
NULL Memory allocation failed
x Pointer to allocated memory
Values returned through status parameter

Return values:
RBM_RINGDRY No memory left in ring to satisfy allocation
RBM_RINGPTR Ring control block pointer invalid
RBM_RINGSTAT Ring control block not in state started
RBM_RINGSIZE Ring not big enough
RBM_SUCCESS Success
RBM_allocW_toc() allocates a memory packet from an RBM memory pring. This is the most general entry point, providing both timeout control and an explanation in case of failure (via the status parameter). For simpler applications that don't require timeout control, the entry points RBM_alloc() and RBM_allocW() are more appropriate.

unsigned int RBM_free RBM_Ring rcb,
void *  pkt,
unsigned int  siz
 

Free memory back to a managed ring buffer (from the tail).

Parameters:
rcb (in) Ring buffer manager control block
pkt (in) Pointer to memory to free
siz (in) Length of memory to free
Return values:
RBM_RINGMISS Packet pointer not valid in this ring
RBM_RINGPTR Ring control block pointer invalid
RBM_SUCCESS Success
RBM_free() performs a "tail free" of ring buffer memory. This maps to the routine RNG_free(), though the call is first laundered through the generic routine RBM_freeAny().

unsigned int RBM_freeAny RBM_Ring rcb,
void *  pkt,
unsigned int  siz,
unsigned int  tx
 

Free memory back to a managed ring buffer.

Parameters:
rcb (in) Ring buffer manager control block
pkt (in) Pointer to memory to free
siz (in) Length of memory to free
tx (in) Memory being freed by transmitter
Return values:
RBM_RINGMISS Packet pointer not valid in this ring
RBM_RINGPTR Ring control block pointer invalid
RBM_SUCCESS Success
RBM_freeAny() frees a packet back to a managed ring buffer. Ring buffer can be freed one of two ways: from the tail (the normal operation, performed by the receiver of a ring buffer packet), or from the head (unusual, but sometimes necessary to allow the transmitter of a packet to back out of an operation). The type of free is selected by the tx parameter. If tx is true, the transmitter is trying to free memory and this routine should perform a "head free" (which maps to the routine RNG_shrink). If tx is flase, it's the receiver trying to free memory, and this routine should perform a "tail free" (which maps to the routine RNG_free).

void RBM_freeITC void *  pkt,
unsigned int  status,
void *  prm0,
void *  prm1,
void *  prm2,
unsigned int  tx
 

Free memory packet (ITC courtesy entry point).

Parameters:
pkt (in) Memory to free
status (in) Processing completion status (ignored)
prm0 (out) Processing completion callback user parameter 0
prm1 (out) Processing completion callback user parameter 1
prm2 (out) Processing completion callback user parameter 2
tx (in) If true, perform a "head free"
RBM_freeITC() is a courtesy entry point, compatible with the signature for an ITC "processing completion routine". In keeping with ITC's planned usage, this is simply a memory free (processing completion status is ignored). Note that the style of free ("head" or "tail") must be specified for a ring buffer. A failed transmit of a ring buffer packet will result in the transmitter trying to free from the head of the ring buffer, whereas in the "normal" situation, the receiver is trying to free from the tail of the ring buffer. Hence the use (and name) of the tx parameter to this routine.

unsigned int RBM_shrink RBM_Ring rcb,
void *  pkt,
unsigned int  siz
 

Free memory back to a managed ring buffer (from the head).

Parameters:
rcb (in) Ring buffer manager control block
pkt (in) Pointer to memory to free
siz (in) Length of memory to free
Return values:
RBM_RINGMISS Packet pointer not valid in this ring
RBM_RINGPTR Ring control block pointer invalid
RBM_SUCCESS Success
RBM_shrink() performs a "head free" of ring buffer memory. This maps to the routine RNG_shrink(), though the call is first laundered through the generic routine RBM_freeAny().


Generated on Wed Dec 5 08:28:04 2007 by  doxygen 1.4.4