GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCM / V1-4-4

Constituent: lcm_siu     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

CSSR.c File Reference

Utility to compress a packet and send to SSR. More...

#include <string.h>
#include <stdio.h>
#include "PBS/TMR.h"
#include "PBS/MBA.h"
#include "PBS/FPA.h"
#include "PBS/FORK.h"
#include "PBS/SEM.h"
#include "LCM/LCM_msgs.h"
#include "LCBD/LCBD.h"
#include "MSG/MSG_pubdefs.h"
#include "ITC/ITC_pubdefs.h"
#include "IMM/RBM_pubdefs.h"
#include "LSF/LSF.h"
#include "LSF/LSF_ids.h"
#include "CCSDS/CCSDS_pkt.h"
#include "ZLIB/zlib.h"
#include "src/CSSR.h"

Include dependency graph for CSSR.c:


Functions

int CSSR_forkBuffSizeof ()
 return size of CSSR control structure
int CSSR_ssrRingOverhead ()
 return size of overhead per packet to use in ssrRingBuffsize calc
unsigned int CSSR_init (void *cssrH, char *taskName, int taskPriority, int numQueuedSends, int apidBase, int lsfDatagramId, int lsfDatagramVer, int ssrRingBuffsize, int ssrRingOverflow)
 init the Compress and Send SSR utility
void CSSR_stop (void *cssrH)
 stop the forked task
unsigned int CSSR_sendRtn (void *cssrH, int lsfId, int lsfVer, CSSR_collectRtn collectRtn, CSSR_compressRtn compressRtn, CSSR_freeRtn freeRtn, void *uParm)
 send a request to task with a "collect" task to run in task context
unsigned int CSSR_sendBuff (void *cssrH, int lsfId, int lsfVer, unsigned int *buff, unsigned int buffLen, CSSR_compressRtn compressRtn, CSSR_freeRtn freeRtn, void *uParm)
 send a request to task with a pre-filled buffer
unsigned int CSSR_zlibCompress (void *uParm, unsigned int *dst, int dstLen, unsigned int *src, int srcLen)
 compression routine that does standard ZIP compression
void CSSR_stats (void *cssrH, int clear)
 print stats on CSSR task

Detailed Description

Utility to compress a packet and send to SSR.

Author:
Ed BAcho - ebacho@slac.stanford.edu
    CVS $Id: CSSR.c,v 1.5 2007/10/29 00:29:03 apw Exp $

SYNOPSIS
This utility sets up a forked task to be used to compress packets and send out on the SSR. One can send a buffer to the task or send it a routine to run that produces a buffer. The buffer is then compressed (usually by zlin), packed in a CCSDS/LSF format and sent to the SSR.

Function Documentation

int CSSR_forkBuffSizeof  ) 
 

return size of CSSR control structure

Returns:
size of handle in bytes

unsigned int CSSR_init void *  cssrH,
char *  taskName,
int  taskPriority,
int  numQueuedSends,
int  apidBase,
int  lsfDatagramId,
int  lsfDatagramVer,
int  ssrRingBuffsize,
int  ssrRingOverflow
 

init the Compress and Send SSR utility

Parameters:
cssrH memory for control structure of len CSSR_sizeof()
taskName name of compress and send SSR task
taskPriority priority of compress and send SSR task
numQueuedSends number of queued requests to task
apidBase base APID in CCSDS header, the CPU offset will be added to it (0=SIU,1=EPU0,...)
lsfDatagramId id in LSF datagram header for all SSR packets sent
lsfDatagramVer version of LSF datagram header for all SSR packets sent
ssrRingBuffsize size of ring buffer between task and LCB
ssrRingOverflow overflow part of ring buffer betweem task and LCB
Returns:
status

unsigned int CSSR_sendBuff void *  cssrH,
int  lsfId,
int  lsfVer,
unsigned int *  buff,
unsigned int  buffLen,
CSSR_compressRtn  compressRtn,
CSSR_freeRtn  freeRtn,
void *  uParm
 

send a request to task with a pre-filled buffer

Parameters:
cssrH handle of size CSSR_sizeof()
lsfId id to be put in LSF contributor header
lsfVer version of LSF contributor
buff ptr to allocated and filled buffer
buffLen length of buff in bytes
compressRtn routine to compress the buffer, can use CSSR_zlibCompress or NULL for no compress
freeRtn routine to free buffer
uParm parameter provided to above 3 routines
Returns:
status
Alterntive routine where stats collected in task other than CSSR forked task, this allow caller to send a buffer to be compressed and output to SSR

Send a filled buffer to the forked task to compress and send. The "free" routine should free that buffer The caller may provide own compress routine or use the provided CSSR_zlibCompress

unsigned int CSSR_sendRtn void *  cssrH,
int  lsfId,
int  lsfVer,
CSSR_collectRtn  collectRtn,
CSSR_compressRtn  compressRtn,
CSSR_freeRtn  freeRtn,
void *  uParm
 

send a request to task with a "collect" task to run in task context

Parameters:
cssrH handle of size CSSR_sizeof()
lsfId id to be put in LSF contributor header
lsfVer version of LSF contributor
collectRtn routine to alloc and fill buffer to compress and send
compressRtn routine to compress the buffer, can use CSSR_zlibCompress or NULL for none
freeRtn routine to free buffer allocated in collectRtn
uParm parameter provided to above 3 routines
Returns:
status
Send a "collect" routine to the forked task to run before compress and send op. The "collect" routine should alloc buff, determines stats, and fills buff The "free" routine should free that same buffer The caller may provide own compress routine or use the provided CSSR_zlibCompress()

int CSSR_ssrRingOverhead  ) 
 

return size of overhead per packet to use in ssrRingBuffsize calc

Returns:
size of overhead in bytes

void CSSR_stats void *  cssrH,
int  clear
 

print stats on CSSR task

Parameters:
cssrH handle for CSSR task, if NULL will use last one allocated
clear clear stats counters used in this routine
Returns:
none

void CSSR_stop void *  cssrH  ) 
 

stop the forked task

Returns:
none

unsigned int CSSR_zlibCompress void *  uParm,
unsigned int *  dst,
int  dstLen,
unsigned int *  src,
int  srcLen
 

compression routine that does standard ZIP compression

Parameters:
uParm not used
dst destination buffer (where compressed data put)
dstLen max length of dest buffer
src source buffer (that to be comporessed)
srcLen length of source
Returns:
status
Predefined compression routines to use as CSSR_compressRtn in CSSR_sendBuff or CSSR_sendRtn. (note parm is not used in these cases)


Generated on Mon Nov 5 02:22:13 2007 by  doxygen 1.4.4