GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > EMP / V1-3-5

Constituent: asc     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

LSD_sdi.h File Reference

Interface to the generic formatting of an LSD data structure (LSF datagram encapsulated in CCSDS packet) and writing to SDI. More...

This graph shows which files directly or indirectly include this file:


Data Structures

struct  _LSD_sdiWriteCbp
 Binds the routine to write an ITC queue item with its context parameter. More...

Typedefs

typedef _LSD_sdi LSD_sdi
 Typedef for struct _LSD_sdi.
typedef _LSD_sdiPds LSD_sdiPds
 Typedef for the LSD_sdi Packet Descriptor Structure.
typedef _LSF_datagram LSF_datagram
typedef unsigned int(* LSD_sdiWriteRtn )(void *prm, LSD_sdiPds *pds)
 Function to post a completed packet to the SDI.
typedef _LSD_sdiWriteCbp LSD_sdiWriteCbp
 Typedef for struct _LSD_sdiWriteCbp.

Functions

unsigned int LSD_sdiSizeof (void)
 Returns the size, in bytes of LSD_sdi context handle.
unsigned int LSD_sdiConstruct (LSD_sdi *sdi, int apid, int ringSize, int ringOverflow, LSD_sdiWriteRtn writeRtn, void *writePrm)
 Creates an instance of an LSD_sdi stream.
LSD_sdiPdsLSD_sdiGetW (LSD_sdi *sdi, int dgmSize, unsigned int ts_secs, unsigned int ts_usecs)
 Allocate and fill a packet for SDI, except for payload.
unsigned int LSD_sdiShrink (LSD_sdi *sdi, LSD_sdiPds *pds, int shinkSize)
 Shrink the allocation of the created packet for changes in the payload length.
void LSD_sdiDestruct (LSD_sdi *sdi)
 Destroy the SDI context.
unsigned int LSD_sdiSend (LSD_sdi *sdi, LSD_sdiPds *pds)
 Send out filled-in packet to the SDI.
unsigned int LSD_sdiWrite (void *prm, LSD_sdiPds *pds)
 Default routine to send completed queue item to the ITC queue.
unsigned int LSD_sdiPdsLenGet (LSD_sdiPds *pds)
 Access function to return the length, in bytes, of the packet This includes the CCSDS header.
void * LSD_sdiPdsCcsdsGet (LSD_sdiPds *pds)
 Access function to return a pointer to CCSDS header.
LSF_datagram * LSD_sdiPdsDgmGet (LSD_sdiPds *pds)
 Access function to return a pointer to LSF datagram header.

Detailed Description

Interface to the generic formatting of an LSD data structure (LSF datagram encapsulated in CCSDS packet) and writing to SDI.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: LSD_sdi.h,v 1.2 2007/10/12 23:14:09 russell Exp $

Typedef Documentation

unsigned int(* LSD_sdiWriteRtn)(void *prm, LSD_sdiPds *pds)
 

Function to post a completed packet to the SDI.

Parameters:
prm User parameter
pds The packet descriptor structure of the data to be written
This callback normally would call ITC_send. Making this a callback, allows the user to intercept the call.


Function Documentation

unsigned int LSD_sdiConstruct LSD_sdi sdi,
int  apid,
int  ringSize,
int  ringOverflow,
LSD_sdiWriteRtn  writeRtn,
void *  writePrm
 

Creates an instance of an LSD_sdi stream.

Return values:
0,Success 
-1,Failed to create the RBM ring buffer
Parameters:
sdi The LSD_sdi context handle to construct
apid The CCSDS APID to associate with this stream. Due to the single threaded nature of the SDI, a stream can only control one APID at a time
ringSize Size, in bytes, of the ring buffer to create
ringOverflow Size, in bytes, of the amount to be reserved from ringSize as an overflow buffer. This must be less than ringSize.
writeRtn The routine to perform the physical write. If NULL is specified, the default routine, LSD_sdiWrite is used.
writePrm The parameter to pass to the write routine. This parameter is irrelevant if writeRtn is specified as NULL.

void LSD_sdiDestruct LSD_sdi sdi  ) 
 

Destroy the SDI context.

Parameters:
sdi The LSD SDI context handle to destroy

LSD_sdiPds * LSD_sdiGetW LSD_sdi sdi,
int  dgmSize,
unsigned int  ts_secs,
unsigned int  ts_usecs
 

Allocate and fill a packet for SDI, except for payload.

Returns:
The allocated pointer or NULL on failure
Parameters:
sdi The LSD SDI context handler
dgmSize Size of the datagram (including any headers)
ts_secs The seconds part of the timestamp to associate with this datagram
ts_usecs The useconds part of the timestamp to associate with this datagram
Note:
The allocations are of the wait variety. This means that one should not use this call when waiting for a resource to free is not allowed.

The only 2 failure modes, allocation failure and unable to format the CCSDS header are both likely due a memory corruption. Recovery is unlikely. The correct response should likely be to bugcheck.

void * LSD_sdiPdsCcsdsGet LSD_sdiPds pds  ) 
 

Access function to return a pointer to CCSDS header.

Returns:
Pointer to the CCSDS header
Parameters:
pds The packet descriptor

void * LSD_sdiPdsDgmGet LSD_sdiPds pds  ) 
 

Access function to return a pointer to LSF datagram header.

Returns:
Pointer to the datagram header
Parameters:
pds The packet descriptor

unsigned int LSD_sdiPdsLenGet LSD_sdiPds pds  ) 
 

Access function to return the length, in bytes, of the packet This includes the CCSDS header.

Returns:
the length, in bytes, of the packet; includes the length of the CCSDS header plus the datagram itself
Parameters:
pds The packet descriptor

unsigned int LSD_sdiSend LSD_sdi sdi,
LSD_sdiPds pds
 

Send out filled-in packet to the SDI.

Returns:
status
Parameters:
sdi The LSD SDI context handler
pds The packet descriptor structure

unsigned int LSD_sdiShrink LSD_sdi sdi,
LSD_sdiPds pds,
int  shrinkSize
 

Shrink the allocation of the created packet for changes in the payload length.

Returns:
Status, currently the status of RBM shrink operation
Parameters:
sdi The LSD SDI context handler
pds The packet descriptor structure
shrinkSize The amount, in bytes, to shrink

unsigned int LSD_sdiSizeof void   ) 
 

Returns the size, in bytes of LSD_sdi context handle.

Returns:
The size, in bytes of LSD_sdi context handle

static unsigned int LSD_sdiWrite void *  prm,
LSD_sdiPds pds
 

Default routine to send completed queue item to the ITC queue.

Returns:
Status
Parameters:
prm User context parameter
pds The packet descriptor


Generated on Sun Jun 14 02:07:59 2009 by  doxygen 1.4.4