GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LSEP / V1-2-0

Constituent: lsepw     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

LSEPW.c File Reference

Manages information and adds the application specific root contribution to the output datagram. More...

#include "LSEPW_pvtdef.h"
#include "LSEP/LSEPW.h"
#include "LSEP/LSEP_ids.h"
#include "LSEP/LSEP_etxCtb.h"
#include "LSEP/LSEPW_evt0.h"
#include "LSEP/LSEP_evtBdy0.h"
#include "LSE/LSEW_dgmFw.h"
#include "LDT/BFP.h"
#include "EDS/EDS_fw.h"
#include "EDS/EDS_rsd.h"
#include "EDS/EBF_gemLocate.h"
#include "EDS/FFS.h"
#include <string.h>

Include dependency graph for LSEPW.c:


Defines

#define ADVANCE(_ptr, _nbytes)   (void *)(((unsigned char *)(_ptr) + (_nbytes)))
 Advance a generic pointer by the specified number of bytes.

Functions

static __inline unsigned int pack_rsdDscs (unsigned int *wrds, unsigned int position, unsigned int active, const EDS_rsdDsc dscs[32])
 Packs the byte length of the result summary data specified by active into the output bit array.
static __inline unsigned int pack_rsds (unsigned int *wrds, unsigned int position, unsigned int active, unsigned int rsd, const EDS_rsdDsc dscs[32])
 Packs the result summary information for those handlers that are both active and have non-zero result summary data.
static __inline unsigned int pack_cfgs (unsigned int *wrds, unsigned int position, unsigned int active, const unsigned char cfgs[32])
 Packs the cfgs ids specified by active into the output bit array.
int LSEPW_sizeof (int level)
 Return the size of the LSEP data structure.
const EDS_fwPostServices * LSEPW_constructC (LSEPW *lsepw, int level, const void *cfg, unsigned short int apid, unsigned int dgm_id, LSF_CPU_K cpu, LSF_ORIGIN_K origin, unsigned int sw_key, LSEW_dgmFwPoster postRtn, void *postPrm, unsigned int *buf, int buf_size)
 Constructs/initializes the physics application specific context.
const EDS_fwPostServices * LSEPW_construct (LSEPW *lsepw, int level, unsigned short int apid, unsigned int dgm_id, LSF_CPU_K cpu, LSF_ORIGIN_K origin, unsigned int sw_key, LSEW_dgmFwPoster postRtn, void *postPrm, unsigned int *buf, int buf_size)
 Constructs/initializes the physics application specific context.
int LSEPW_start (LSEPW *lsepw, LSF_REASON_OPEN_K reason, unsigned int run_id, unsigned int startTime, LSF_MODE_K mode, unsigned int hw_key, unsigned int lpa_key)
 Start or more accurately, prepare a posting stream to receive events.
int LSEPW_flush (LSEPW *lsepw, int reason)
 Flushes the current datagram.
int LSEPW_levelSet (LSEPW *lsepw, int level)
 Modifies to the current working level to the minimum of level and the maximum allowable compression level that LSEPW is configured to.
int LSEPW_notify (LSEPW *lsepw, unsigned int mode, unsigned int active, const unsigned char cfgs[32], const EDS_rsdTbl *rsdTbl)
 Called when the configuration has changed, for example by a mode change.
unsigned int * LSEPW_ctbAdd (LSEPW *lsepw, unsigned int *cur, int len32)
 Adds the Physics specific context contribution to the datagram.
int LSEPW_evtAdd (LSEPW *lsepw, EDS_fwIxb *ixb)
 Formats the event specified in by the EDS_fw Information Exchange block, flushing the current record to the output stream if the datagram is full.

Detailed Description

Manages information and adds the application specific root contribution to the output datagram.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: LSEPW.c,v 1.10 2007/02/14 06:19:23 russell Exp $

Overview
This gathers all the stuff need to add both the public and private application specific contributions to the datagram. This structure should be allocated and pasted to LSEPW_construct routine.
Private
The private aspects are driven by the needs of event formatting and deformatting. These needs break into two pieces,
  1. Those that are static
  2. Those that dependent of the event data
The private static needs are things such as the CAL pedestals used in the encoding. The dynamic needs are the compression tables that are built on the fly from the data.
Public
The public aspects also fall into two pieces
  1. Those that are static
  2. Those that change in response to changes in the operating conditions
The public static needs are things such as the file keys for the relevant configuration files, LATc, LPA_DB, etc. The dynamics needs are the list of active handlers and their active configuration.
The challenge is how to gather this information and, particularly, for those values that change when the conditions change, to decide how to update the information. Here one has to choices
  1. Query EDS_fw everytime the information is needed
  2. Have EDS_fw notify one of such at change.

Define Documentation

#define ADVANCE _ptr,
_nbytes   )     (void *)(((unsigned char *)(_ptr) + (_nbytes)))
 

Advance a generic pointer by the specified number of bytes.

Returns:
The advanced pointer, recast to a void
Parameters:
_ptr The pointer to advance
_nbytes The nubmer of bytes to advance


Function Documentation

const EDS_fwPostServices* LSEPW_construct LSEPW lsepw,
int  level,
unsigned short int  apid,
unsigned int  dgm_id,
LSF_CPU_K  cpu,
LSF_ORIGIN_K  origin,
unsigned int  sw_key,
LSEW_dgmFwPoster  postRtn,
void *  postPrm,
unsigned int *  buf,
int  buf_size
 

Constructs/initializes the physics application specific context.

Parameters:
lsepw The physics application specific context to construct
level The maximum compression level that will be used
apid The application id to use in the CCSDS packets
dgm_id The LAT Science Format Data Id (LSF) to use
cpu The originating CPU
origin The data source type
sw_key The master software configuration key; this is the key to the Secondary Boot File.
postRtn Routine used to post a formatted event
postPrm Parameter passed to the post routine
buf The first, preallocated buffer to fill
buf_size The size, in bytes, of the ouptut buffer. Events will be packed into this buffer until full

const EDS_fwPostServices* LSEPW_constructC LSEPW lsepw,
int  level,
const void *  cfg,
unsigned short int  apid,
unsigned int  dgm_id,
LSF_CPU_K  cpu,
LSF_ORIGIN_K  origin,
unsigned int  sw_key,
LSEW_dgmFwPoster  postRtn,
void *  postPrm,
unsigned int *  buf,
int  buf_size
 

Constructs/initializes the physics application specific context.

Parameters:
lsepw The physics application specific context to construct
level The maximum compression level that will be used
cfg Level level specific configuration parameters
apid The application id to use in the CCSDS packets
dgm_id The LAT Science Format Data Id (LSF) to use
cpu The originating CPU
origin The data source type
sw_key The master software configuration key; this is the key to the Secondary Boot File.
postRtn Routine used to post a formatted event
postPrm Parameter passed to the post routine
buf The first, preallocated buffer to fill
buf_size The size, in bytes, of the ouptut buffer. Events will be packed into this buffer until full
This routine is something of a royal kludge. The original call for LSEPW_construct did not include a configuration parameter. To keep things backwardly compatiable, this routine was invented. It should be become LSEPW_construct if a reorganization permits it.

unsigned int* LSEPW_ctbAdd LSEPW lsepw,
unsigned int *  cur,
int  len32
 

Adds the Physics specific context contribution to the datagram.

Parameters:
lsepw The physics application specific context
cur Pointer to the where to add the informaton
len32 The length, in 32-bit words, of the available space in the datagram

int LSEPW_evtAdd LSEPW lsepw,
EDS_fwIxb *  ixb
 

Formats the event specified in by the EDS_fw Information Exchange block, flushing the current record to the output stream if the datagram is full.

Returns:
Status
Parameters:
lsepw The physics application specific context
ixb The Information Exchange Block

int LSEPW_flush LSEPW lsepw,
int  reason
 

Flushes the current datagram.

Parameters:
lsepw The physics application specific context
reason The reason for the flush

int LSEPW_levelSet LSEPW lsepw,
int  level
 

Modifies to the current working level to the minimum of level and the maximum allowable compression level that LSEPW is configured to.

Returns:
The actual level is was set to, i.e. the minimum of level and the maximum allowable compression level. On failure this value is -1.
Parameters:
lsepw The physics application specific context
level The new compression level

int LSEPW_notify LSEPW lsepw,
unsigned int  mode,
unsigned int  active,
const unsigned char  cfgs[32],
const EDS_rsdTbl *  rsdTbl
 

Called when the configuration has changed, for example by a mode change.

Returns:
0 if successful, non-zero if not
Parameters:
lsepw The physics application specific context
mode The new mode
active The list of active handlers
cfgs The current configuration for each handler.
rsdTbl The result summary data table

int LSEPW_sizeof int  level  ) 
 

Return the size of the LSEP data structure.

Parameters:
level The maximum compression level that will be used. Resources will be allocated consistent with supporting events written in this and all lesser compression levels.

int LSEPW_start LSEPW lsepw,
LSF_REASON_OPEN_K  reason,
unsigned int  run_id,
unsigned int  startTime,
LSF_MODE_K  mode,
unsigned int  hw_key,
unsigned int  lpa_key
 

Start or more accurately, prepare a posting stream to receive events.

Returns:
Status, currectly what LSEW_dgmFwRunStart returns.
Parameters:
lsepw The physics application specific context
reason The reason why this run is being started
run_id The run identifier. Only the first 24-bits are used.
startTime The run start time rounded to the nearest second
mode The operational mode
hw_key The master hardware configuraion key; this is the key to the LATc file
lpa_key The LPA_DB file key

static __inline unsigned int pack_cfgs unsigned int *  wrds,
unsigned int  position,
unsigned int  active,
const unsigned char  cfgs[32]
[static]
 

Packs the cfgs ids specified by active into the output bit array.

Returns:
The new bit position in the output buffer
Parameters:
wrds The beginning of 32-bit output buffer
position The current bit position in the output buffer
active Bit mask indicating which of the elements of cfgs should be packed
cfgs The array of up-to 32 configuration ids of the handlers
Warning:
This piece of code assumes that active is non-zero

static __inline unsigned int pack_rsdDscs unsigned int *  wrds,
unsigned int  position,
unsigned int  active,
const EDS_rsdDsc  dscs[32]
[static]
 

Packs the byte length of the result summary data specified by active into the output bit array.

Returns:
The new bit position in the output buffer
Parameters:
wrds The beginning of 32-bit output buffer
position The current bit position in the output buffer
active Bit mask indicating which of the elements of rsdDscs should be packed
dscs The result summary data descriptor array

static __inline unsigned int pack_rsds unsigned int *  wrds,
unsigned int  position,
unsigned int  active,
unsigned int  rsd,
const EDS_rsdDsc  dscs[32]
[static]
 

Packs the result summary information for those handlers that are both active and have non-zero result summary data.

Returns:
The new bit position in the output buffer
Parameters:
wrds The beginning of 32-bit output buffer
position The current bit position in the output buffer
active The defining set of bits, i,e. set of all handlers
rsd The set of handlers with non-zero result summary data. This bit list is collapsed by removing all the corresponding bits in active that are zero. Since only active handlers can contribute result summary data, the set is reduced to only the active handlers. Thus for each set bit in active a result bit is emitted that is 0/1 if that handler does/does not produce any summary data.
dscs The result summary data descriptor array
This routine composes a bit field from fld2 considering only the set bits in fld1. For every bit set in fld1, a bit is added to the output which is set to 0/1 if the corresponding bit in fld2 is not/is set. The resulting bits are packed into the output buffer.


Generated on Thu Feb 15 01:58:00 2007 by  doxygen 1.4.4