GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSD / dev > qsdccsds / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

CCSDS_apidDsc.c File Reference

APID descriptor management. More...

#include <QSD/CCSDS_apidDsc.h>
#include <QSD/CCSDS_istream.h>
#include <QSD/CCSDS_header.h>

Classes

struct  _CCSDS_apidDscTbl
 The table of APID descriptors. More...

Functions

static __inline CCSDS_apidDscNodeinsert (CCSDS_apidDscNode *head, CCSDS_apidDscNode *node)
 Inserts an APID descriptor on the que.
void CCSDS_apidDscConstruct (CCSDS_apidDsc *dsc, void *ctx, unsigned short int apid, CCSDS_APIDDSC_BRIDGE_K bridge, unsigned char *buf, unsigned int buf_size)
 Constructs (initializes) an CCSDS_apidDsc, an APID descriptor.
int CCSDS_apidDscRegister (CCSDS_apidDscTbl *tbl, CCSDS_apidDsc *dsc, void *ctx, unsigned short int apid, CCSDS_APIDDSC_BRIDGE_K bridge, unsigned char *buf, unsigned int buf_size)
 Registers an APID descriptor.
void CCSDS_apidDscReset (CCSDS_apidDsc *dsc)
 Resets the specified APID descriptor to its initial state. This routine is used mainly for error recovery.
CCSDS_apidDscCCSDS_apidDscFind (CCSDS_apidDscTbl *tbl, const CCSDS_header *hdr)
 Built-in method to locate the descriptor associated with the specified APID as read from the header.
static __inline void swap32bN (unsigned int *a32, int n32)
 Swaps the specified number of 32-bit integers, presumed to be in a big endian representation to the local endianness.. This is a NOOP on big endian machines.
static __inline void swap16bN (unsigned short int *a16, int n16)
 Swaps the specified number of 16-bit integers, presumed to be in a big endian representation to the local endianness. This is a NOOP on big endian machines.
int CCSDS_apidDscSwap32 (CCSDS_apidDsc *dsc)
 Convenience routine to 32-bit swap all the words in the current buffer, presumed to be in a big-endian, to the local representation.
int CCSDS_apidDscSwap16 (CCSDS_apidDsc *dsc)
 Convenience routine to 16-bit swap all the words in the current buffer, presumed to be in a big-endian, to the local representation.


Detailed Description

APID descriptor management.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: CCSDS_apidDsc.c,v 1.4 2011/03/26 21:06:58 russell Exp $

Function Documentation

void CCSDS_apidDscConstruct ( CCSDS_apidDsc dsc,
void *  ctx,
unsigned short int  apid,
CCSDS_APIDDSC_BRIDGE_K  bridge,
unsigned char *  buf,
unsigned int  buf_size 
)

Constructs (initializes) an CCSDS_apidDsc, an APID descriptor.

Parameters:
dsc The descriptor to construct/initialize
ctx User provided context parameter
apid The apid used as a key to identify this descriptor
bridge Dictates how the odd 16-bit word following the normal 7 x 16-bit word CCSDS header is to be treated.
buf A buffer to receive the data for this apid
buf_size The size, in bytes, of buf. This needs to be as large as the biggest CCSDS packet (including data that spans multiple packets).

References _CCSDS_apidDsc::apid, _CCSDS_apidDsc::bridge, _CCSDS_apidDsc::buf, CCSDS_APIDDSC_K_SEQ_RESET, CCSDS_istreamSivConstruct(), _CCSDS_apidDsc::ctx, _CCSDS_apidDsc::cur, _CCSDS_apidDsc::max, _CCSDS_apidDsc::seq, and _CCSDS_apidDsc::siv.

Referenced by CCSDS_apidDscRegister().

CCSDS_apidDsc * CCSDS_apidDscFind ( CCSDS_apidDscTbl tbl,
const CCSDS_header hdr 
)

Built-in method to locate the descriptor associated with the specified APID as read from the header.

Return values:
Non-NULL,the descriptor
NULL,error,either the descriptor with the specified APID does not exist or the APID cannot be gotten from the header because the header is unreadable (rare)
Parameters:
tbl The table to search
hdr The CCSDS header containing the APID to locate

References _CCSDS_apidDsc::apid, CCSDS__headerApid(), _CCSDS_apidDscNode::flnk, _CCSDS_apidDsc::node, and _CCSDS_apidDscTbl::que.

int CCSDS_apidDscRegister ( CCSDS_apidDscTbl tbl,
CCSDS_apidDsc dsc,
void *  ctx,
unsigned short int  apid,
CCSDS_APIDDSC_BRIDGE_K  bridge,
unsigned char *  buf,
unsigned int  buf_size 
)

Registers an APID descriptor.

Return values:
0,Successful 
-1,APID has been previously registered
Parameters:
tbl The apid table
dsc The descriptor to construct/initialize
ctx User provided context parameter
apid The apid used as a key to identify this descriptor
bridge Dictates how the odd 16-bit word following the normal 7 x 16-bit word CCSDS header is to be treated.
buf A buffer to receive the data for this apid
buf_size The size, in bytes, of buf. This needs to be as large as the biggest CCSDS packet (including data that spans multiple packets).

References CCSDS_apidDscConstruct(), insert(), _CCSDS_apidDsc::node, and _CCSDS_apidDscTbl::que.

void CCSDS_apidDscReset ( CCSDS_apidDsc dsc  ) 

Resets the specified APID descriptor to its initial state. This routine is used mainly for error recovery.

Parameters:
dsc The descriptor to reset

References _CCSDS_apidDsc::buf, CCSDS_APIDDSC_K_SEQ_RESET, CCSDS_istreamSivConstruct(), _CCSDS_apidDsc::cur, _CCSDS_apidDsc::seq, and _CCSDS_apidDsc::siv.

Referenced by CCSDS_istreamPktResynch().

int CCSDS_apidDscSwap16 ( CCSDS_apidDsc dsc  ) 

Convenience routine to 16-bit swap all the words in the current buffer, presumed to be in a big-endian, to the local representation.

Returns:
The number of 16-bit words that where swapped
Parameters:
dsc The descriptor for the data to be swapped
Note:
On big-endian machine, except for the return value, this is a NOOP.

References _CCSDS_apidDsc::buf, _CCSDS_apidDsc::cur, and swap16bN().

int CCSDS_apidDscSwap32 ( CCSDS_apidDsc dsc  ) 

Convenience routine to 32-bit swap all the words in the current buffer, presumed to be in a big-endian, to the local representation.

Returns:
The number of 32-bit words that where swapped
Parameters:
dsc The descriptor for the data to be swapped
Note:
On big-endian machine, except for the return value, this is a NOOP.

References _CCSDS_apidDsc::buf, _CCSDS_apidDsc::cur, and swap32bN().

Referenced by CCSDS_istreamProcess().

static __inline CCSDS_apidDscNode insert ( CCSDS_apidDscNode head,
CCSDS_apidDscNode node 
) [static]

Inserts an APID descriptor on the que.

Returns:
The previous last descriptor on the que
Parameters:
head The que head
node The node to insert on the que

References _CCSDS_apidDscNode::blnk, and _CCSDS_apidDscNode::flnk.

Referenced by CCSDS_apidDscRegister().

void swap16bN ( unsigned short int *  a16,
int  n16 
) [static]

Swaps the specified number of 16-bit integers, presumed to be in a big endian representation to the local endianness. This is a NOOP on big endian machines.

Parameters:
a16 The array of 16-bit words to swap
n16 The number of words to half_word swap

Referenced by CCSDS_apidDscSwap16().

void swap32bN ( unsigned int *  a32,
int  n32 
) [static]

Swaps the specified number of 32-bit integers, presumed to be in a big endian representation to the local endianness.. This is a NOOP on big endian machines.

Parameters:
a32 The array of 32-bit words to swap
n32 The number of words to word swap

Referenced by CCSDS_apidDscSwap32().


Generated on Thu Sep 27 16:31:57 2012 by  doxygen 1.5.8