GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-2 > lsew / rad750
#include "LSF/LSF.h"
#include "LSEW_ctx.h"
#include "LSE/LSE_ids.h"
#include "LSE/LSEW_dgm.h"
#include "LSE_time.ih"
#include "CCSDS/CCSDS_pkt.h"
#include <string.h>
Classes | |
struct | _LSEW_dgm |
Control structure for outputing events. More... | |
Defines | |
#define | RND_UP(_x, _r) ( (((int)(_x)) + (_r) - 1) & ~((_r) - 1) ) |
Rounds _x up to the nearest multiple of _r. | |
#define | MAXIMUM_EVENTS_PER_CONTRIBUTION 255 |
Sets the maximum number of events that can be committed to one event contribution. | |
Typedefs | |
typedef struct _LSEW_dgm | LSEW_dgm |
Typedef for struct _LSEW_dgm. | |
Functions | |
static __inline unsigned int | evt_size (void) |
Returns the minimum size of a new event contribution. | |
static __inline unsigned int * | evt_open (unsigned int *beg) |
Opens a new event record contribution. | |
static __inline unsigned int * | evt_close (unsigned int *beg, const unsigned int *end, unsigned int id, unsigned short int bridge) |
Closes out (completes) the current event contribution by filling in the LSF event header. | |
static __inline void | datagram_close (unsigned int *beg, const unsigned int *end, unsigned int dgm_id) |
Closes out (completes) the current data packet by filling in the LSF packet header. | |
static __inline unsigned int * | ccsds_complete (unsigned int *beg, unsigned char *dat, unsigned int *lsf, unsigned int *evt, unsigned int *end, unsigned int nevts, unsigned int apid, unsigned int seq) |
Completes the CCSDS header. | |
unsigned int | LSEW_dgmSizeof (void) |
The size, in bytes, of the control structure. | |
unsigned int | LSEW_dgmInit (LSEW_dgm *dgm, unsigned short int apid, unsigned int dgm_id, LSF_CPU_K cpu, LSF_ORIGIN_K origin) |
Initializes the control structure. | |
int | LSEW_dgmBufSet (LSEW_dgm *dgm, unsigned int *buf, int buf_size) |
Sets the specified buffer as the new output buffer. | |
void | LSEW_dgmRunStart (LSEW_dgm *dgm, unsigned int runId, unsigned int startTime, LSF_MODE_K mode) |
Sets the context for a new run. | |
void | LSEW_dgmModeChange (LSEW_dgm *dgm, LSF_MODE_K mode) |
Changes the current data-taking mode. | |
unsigned int * | LSEW_dgmOpen (LSEW_dgm *dgm, unsigned int reason, unsigned int evt_seq, const EBF_gem *gem) |
Opens a new event datagram. | |
unsigned int * | LSEW_dgmEvtOpen (LSEW_dgm *dgm, unsigned int *cur) |
Opens a new event datagram. | |
void | LSEW_dgmRootClose (LSEW_dgm *dgm, const unsigned int *end) |
unsigned int * | LSEW_dgmEvtCommit (LSEW_dgm *dgm, unsigned int *cur) |
Commits this event. This does two things, updates the current write pointer and increments the number of events in this contribution. | |
unsigned int * | LSEW_dgmEvtClose (LSEW_dgm *dgm) |
Completes the final processing of an event just before it is presented to the output stream. | |
unsigned int * | LSEW_dgmUpdate (LSEW_dgm *dgm, unsigned int evt_seq, const EBF_gem *gem) |
Updates the current datagram, adding a time record if necessary. | |
unsigned int * | LSEW_dgmCommit (LSEW_dgm *dgm, unsigned int *cur) |
Commits the current write by updating the write potnter. | |
unsigned int * | LSEW_dgmClose (LSEW_dgm *dgm, unsigned int *cur, unsigned int reason) |
Closes out the datagram; it is now ready to be written out. | |
const LSEW_ctxPub * | LSEW_dgmCtxPub (const LSEW_dgm *dgm) |
Returns a pointer to the public context structure. | |
unsigned int * | LSEW_dgmBeg (const LSEW_dgm *dgm) |
Returns the value of the beginning of the specified event datagram. | |
unsigned int * | LSEW_dgmCur (const LSEW_dgm *dgm) |
Returns the value of the beginning of the specified event datagram. | |
unsigned int * | LSEW_dgmEnd (const LSEW_dgm *dgm) |
Returns the value of the end of the specified event datagram. | |
unsigned int | LSEW_dgmLeft32 (const LSEW_dgm *dgm) |
Returns the number of 32 words left in the buffer. |
CVS $Id: LSEW_dgm.c,v 1.15 2010/07/26 23:48:36 russell Exp $
#define MAXIMUM_EVENTS_PER_CONTRIBUTION 255 |
Sets the maximum number of events that can be committed to one event contribution.
This value is set by the width of the bridge word in the LSF contribution header (1 byte)
#define RND_UP | ( | _x, | |||
_r | ) | ( (((int)(_x)) + (_r) - 1) & ~((_r) - 1) ) |
Rounds _x up to the nearest multiple of _r.
_x | The value to round | |
_r | The multiple to round up to, must be a power of 2. |
static __inline unsigned int ccsds_complete | ( | unsigned int * | beg, | |
unsigned char * | dat, | |||
unsigned int * | lsf, | |||
unsigned int * | evt, | |||
unsigned int * | end, | |||
unsigned int | nevts, | |||
unsigned int | apid, | |||
unsigned int | seq | |||
) | [static] |
Completes the CCSDS header.
beg | The beginning address of the packet | |
dat | The beginning address of the data portion of the CCSDS packet. | |
lsf | The beginning address of the LSF datagram | |
evt | The beginning address of the current event packet | |
end | The ending address of the packet | |
nevts | The nubmer of events in the event packet | |
apid | The base apid | |
seq | The CCSDS sequence count |
static __inline void datagram_close | ( | unsigned int * | beg, | |
const unsigned int * | end, | |||
unsigned int | dgm_id | |||
) | [static] |
Closes out (completes) the current data packet by filling in the LSF packet header.
beg | The beginning of the event contribution to closeout | |
end | The end of the event contribution to closeout | |
dgm_id | The LAT Science Format datagram identifier |
static __inline unsigned int evt_close | ( | unsigned int * | beg, | |
const unsigned int * | end, | |||
unsigned int | id, | |||
unsigned short int | bridge | |||
) | [static] |
Closes out (completes) the current event contribution by filling in the LSF event header.
beg | The beginning of the event contribution to closeout | |
end | The end of the event contribution to closeout | |
id | The LSF id of the event contribution | |
bridge | Arbitrary bridge word filled into the header. |
static __inline unsigned int * evt_open | ( | unsigned int * | cur | ) | [static] |
Opens a new event record contribution.
cur | The beginning of the event contribution |
static __inline unsigned int * evt_size | ( | void | ) | [static] |
Returns the minimum size of a new event contribution.
unsigned int* LSEW_dgmBeg | ( | const LSEW_dgm * | dgm | ) |
Returns the value of the beginning of the specified event datagram.
dgm | The event datagram to query |
int LSEW_dgmBufSet | ( | LSEW_dgm * | dgm, | |
unsigned int * | buf, | |||
int | buf_size | |||
) |
Sets the specified buffer as the new output buffer.
dgm | The output control block | |
buf | The new buffer | |
buf_size | The size, in bytes, of the new buffer |
unsigned int* LSEW_dgmClose | ( | LSEW_dgm * | dgm, | |
unsigned int * | cur, | |||
unsigned int | reason | |||
) |
Closes out the datagram; it is now ready to be written out.
dgm | The event datagram to close | |
cur | The next write pointer, unless NULL, then it is ignored | |
reason | One of an enumeration describing why this event datagram is being closed. |
unsigned int* LSEW_dgmCommit | ( | LSEW_dgm * | dgm, | |
unsigned int * | cur | |||
) |
Commits the current write by updating the write potnter.
dgm | The output control block | |
cur | The current write pointer. |
const LSEW_ctxPub* LSEW_dgmCtxPub | ( | const LSEW_dgm * | dgm | ) |
Returns a pointer to the public context structure.
dgm | The event datagram to query |
unsigned int* LSEW_dgmCur | ( | const LSEW_dgm * | dgm | ) |
Returns the value of the beginning of the specified event datagram.
dgm | The event datagram to query |
unsigned int* LSEW_dgmEnd | ( | const LSEW_dgm * | dgm | ) |
Returns the value of the end of the specified event datagram.
dgm | The event datagram to query |
unsigned int* LSEW_dgmEvtClose | ( | LSEW_dgm * | dgm | ) |
Completes the final processing of an event just before it is presented to the output stream.
dgm | The datagram to close the event contribution |
unsigned int* LSEW_dgmEvtCommit | ( | LSEW_dgm * | dgm, | |
unsigned int * | cur | |||
) |
Commits this event. This does two things, updates the current write pointer and increments the number of events in this contribution.
dgm | The output control block | |
cur | The current write pointer, if NULL, then the internal value of the write pointer is used. |
unsigned int* LSEW_dgmEvtOpen | ( | LSEW_dgm * | dgm, | |
unsigned int * | cur | |||
) |
Opens a new event datagram.
dgm | The output control block | |
cur | The current write pointer, if NULL, then the internal value of the write pointer is used. |
unsigned int LSEW_dgmInit | ( | LSEW_dgm * | dgm, | |
unsigned short int | apid, | |||
unsigned int | dgm_id, | |||
LSF_CPU_K | cpu, | |||
LSF_ORIGIN_K | origin | |||
) |
Initializes the control structure.
dgm | The output control structure to initialize | |
apid | The application id to use in the CCSDS packets | |
dgm_id | The LAT Science Format Data Id (LSF) to use | |
cpu | The CPU identifier | |
origin | The originating data source (ie LAT, GLEAM, etc) |
unsigned int LSEW_dgmLeft32 | ( | const LSEW_dgm * | dgm | ) |
Returns the number of 32 words left in the buffer.
dgm | The event datagram to query |
void LSEW_dgmModeChange | ( | LSEW_dgm * | dgm, | |
LSF_MODE_K | mode | |||
) |
Changes the current data-taking mode.
dgm | The destination event datagram context | |
mode | The new data-taking mode |
unsigned int* LSEW_dgmOpen | ( | LSEW_dgm * | dgm, | |
unsigned int | reason, | |||
unsigned int | evt_seq, | |||
const EBF_gem * | gem | |||
) |
Opens a new event datagram.
dgm | The output control block | |
reason | One of an enumeration describing why this event datagram is being opened | |
evt_seq | The event sequence number | |
gem | The GEM contributor |
void LSEW_dgmRootClose | ( | LSEW_dgm * | dgm, | |
const unsigned int * | end | |||
) |
dgm | The output control block | |
end | Pointer to the end of the root contribution |
void LSEW_dgmRunStart | ( | LSEW_dgm * | dgm, | |
unsigned int | runId, | |||
unsigned int | startTime, | |||
LSF_MODE_K | mode | |||
) |
Sets the context for a new run.
dgm | The event datagram control handle | |
runId | The run identifier | |
startTime | The run start time to the nearest second | |
mode | The running mode |
unsigned int* LSEW_dgmUpdate | ( | LSEW_dgm * | dgm, | |
unsigned int | evt_seq, | |||
const EBF_gem * | gem | |||
) |
Updates the current datagram, adding a time record if necessary.
dgm | The output control block | |
evt_seq | The event sequence number | |
gem | The GEM contributor |