GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-1 > lsew / linux-gcc
#include "LSF/LSF_reason.h"
#include "LSE/LSEW_dgmFw.h"
#include "LSE/LSEW_dgm.h"
#include <string.h>
Classes | |
struct | _LSEW_dgmFw |
Control structure for outputing events. More... | |
Typedefs | |
typedef struct _LSEW_dgmFw | LSEW_dgmFw |
Functions | |
static __inline LSEW_dgm * | locate (const LSEW_dgmFw *dgmFw) |
Give the LSEW_dgmFw, locates the LSEW_dgm. | |
static unsigned int * | datagram_open (LSEW_dgmFw *dgmFw, unsigned int reason, unsigned int evt_seq, const EBF_gem *gem) |
Opens a new event datagram. | |
static unsigned int | datagram_close (LSEW_dgmFw *dgmFw, unsigned int reason) |
Unconditionally writes out whatever is in the current buffer. | |
static unsigned int * | datagram_retry (LSEW_dgmFw *dgmFw, void *evt, unsigned int evt_seq, const EBF_gem *gem) |
Attempts to retry the adding of an event by closing the current datagram and opening a new one. If this attempt fails, it is because the datagram is not large enough to accomodate the overhead (beginning contributions) and the event. | |
unsigned int | LSEW_dgmFwSizeof (void) |
The size, in bytes, of the control structure. | |
unsigned int | LSEW_dgmFwInit (LSEW_dgmFw *dgmFw, unsigned short int apid, unsigned int dgm_id, LSF_CPU_K cpu, LSF_ORIGIN_K origin) |
Initializes the control structure. | |
LSEW_dgmFwBegAddCbp | LSEW_dgmFwBegAddSet (LSEW_dgmFw *dgmFw, LSEW_dgmFwBegAdder begRtn, void *begPrm) |
Sets the callback to add a user specified Begin Context Contribution record. | |
LSEW_dgmFwEvtAddCbp | LSEW_dgmFwEvtAddSet (LSEW_dgmFw *dgmFw, LSEW_dgmFwEvtAdder evtRtn, void *evtPrm) |
Sets the callback to add an event to the event datagram. | |
LSEW_dgmFwUsrAddCbp | LSEW_dgmFwUsrAddSet (LSEW_dgmFw *dgmFw, LSEW_dgmFwUsrAdder usrRtn, void *usrPrm) |
Sets the callback to add an event to the event datagram. | |
LSEW_dgmFwEndAddCbp | LSEW_dgmFwEndAddSet (LSEW_dgmFw *dgmFw, LSEW_dgmFwEndAdder endRtn, void *endPrm) |
Sets the callback to add a user specified End Context Contribution record. | |
LSEW_dgmFwPostCbp | LSEW_dgmFwPostSet (LSEW_dgmFw *dgmFw, LSEW_dgmFwPoster postRtn, void *postPrm) |
Sets the callback to add a user specified End Context Contribution record. | |
void | LSEW_dgmFwBufSet (LSEW_dgmFw *dgmFw, unsigned int *buf, int bufSize) |
Sets the buffer to be used for the event datagram and its size. | |
void | LSEW_dgmFwRunStart (LSEW_dgmFw *dgmFw, unsigned int runId, unsigned int startTime, LSF_MODE_K mode, LSF_REASON_OPEN_K reason) |
Sets the context for a new run. | |
void | LSEW_dgmFwModeChange (LSEW_dgmFw *dgmFw, LSF_MODE_K mode) |
Changes the current data-taking mode. | |
unsigned int | LSEW_dgmFwEvtAdd (LSEW_dgmFw *dgmFw, void *evt, unsigned int evt_seq, const EBF_gem *gem) |
Formats the specified event, flushing the current event datagram if the event datagram is full. | |
unsigned int | LSEW_dgmFwUsrAdd (LSEW_dgmFw *dgmFw, void *usrInfo, int usrLen) |
Formats the specified event, flushing the current event datagram if the event datagram is full. | |
unsigned int | LSEW_dgmFwFlush (LSEW_dgmFw *dgmFw, int reason) |
Flushes the last events out. | |
const LSEW_ctxPub * | LSEW_dgmFwCtxPub (const LSEW_dgmFw *dgmFw) |
Returns a pointer to the public portion of the standard context. | |
unsigned int | LSEW_dgmFwLeft32 (LSEW_dgmFw *dgmFw) |
Returns the number of 32 words left in the datagram. | |
Variables | |
static const unsigned char | OpenReasons [16] |
Maps a closing reason into its complimentary open reason. |
CVS $Id: LSEW_dgmFw.c,v 1.13 2008/01/31 23:31:41 russell Exp $
static unsigned int datagram_close | ( | LSEW_dgmFw * | dgmFw, | |
unsigned int | reason | |||
) | [static] |
Unconditionally writes out whatever is in the current buffer.
0,If | successful | |
-1,If | the user close contribution did not fit. In this case the datagram is left open. A reasonable course of action on the user's part would be to manually flush the datagram, specifying it is being closed due to error. |
dgmFw | The framework's control block | |
reason | One of an enumerated list describing why this event datagram is being closed |
static unsigned int * datagram_open | ( | LSEW_dgmFw * | dgmFw, | |
unsigned int | reason, | |||
unsigned int | evt_seq, | |||
const EBF_gem * | gem | |||
) | [static] |
Opens a new event datagram.
dgmFw | The framework's control block | |
reason | One of enumerated list describing why this datagram is being opened | |
evt_seq | The event sequence number | |
gem | The GEM contribution |
static unsigned int * datagram_retry | ( | LSEW_dgmFw * | dgmFw, | |
void * | evt, | |||
unsigned int | evt_seq, | |||
const EBF_gem * | gem | |||
) | [static] |
Attempts to retry the adding of an event by closing the current datagram and opening a new one. If this attempt fails, it is because the datagram is not large enough to accomodate the overhead (beginning contributions) and the event.
dgmFw | The framework's control block | |
evt | The event to add | |
evt_seq | The event sequence number | |
gem | The GEM data |
static __inline LSEW_dgm * locate | ( | const LSEW_dgmFw * | dgmFw | ) | [static] |
Give the LSEW_dgmFw, locates the LSEW_dgm.
dgmFw | The framework's control block |
LSEW_dgmFwBegAddCbp LSEW_dgmFwBegAddSet | ( | LSEW_dgmFw * | dgmFw, | |
LSEW_dgmFwBegAdder | begRtn, | |||
void * | begPrm | |||
) |
Sets the callback to add a user specified Begin Context Contribution record.
dgmFw | The framework control block to initialize | |
begRtn | The begin context contribution add routine | |
begPrm | The begin context contribution add routine's user parameter |
void LSEW_dgmFwBufSet | ( | LSEW_dgmFw * | dgmFw, | |
unsigned int * | buf, | |||
int | bufSize | |||
) |
Sets the buffer to be used for the event datagram and its size.
dgmFw | The target framework control block | |
buf | The first, preallocated buffer to fill | |
bufSize | The size, in bytes, of the ouptut buffer. Events will be packed into this buffer until full |
unsigned int LSEW_dgmFwCtxPub | ( | const LSEW_dgmFw * | dgmFw | ) |
Returns a pointer to the public portion of the standard context.
dgmFw | The framework's control block |
LSEW_dgmFwEndAddCbp LSEW_dgmFwEndAddSet | ( | LSEW_dgmFw * | dgmFw, | |
LSEW_dgmFwEndAdder | endRtn, | |||
void * | endPrm | |||
) |
Sets the callback to add a user specified End Context Contribution record.
dgmFw | The target framework control block | |
endRtn | The end context contribution add routine | |
endPrm | The end context contribution add routine's context parameter |
unsigned int LSEW_dgmFwEvtAdd | ( | LSEW_dgmFw * | dgmFw, | |
void * | evt, | |||
unsigned int | evt_seq, | |||
const EBF_gem * | gem | |||
) |
Formats the specified event, flushing the current event datagram if the event datagram is full.
0,Record | use succesfully added | |
-1,User | callback routine refused to add the event because not only did it not fit in the current datagram, it would not fit in a new datagram. Either the user accepts that the event is too big or he must change recompile with a larger datagram size. |
dgmFw | The framework's control block | |
evt | Dynamic (i.e. associated with this event) context parameter | |
evt_seq | The event sequence number | |
gem | The GEM contributor |
LSEW_dgmFwEvtAddCbp LSEW_dgmFwEvtAddSet | ( | LSEW_dgmFw * | dgmFw, | |
LSEW_dgmFwEvtAdder | evtRtn, | |||
void * | evtPrm | |||
) |
Sets the callback to add an event to the event datagram.
dgmFw | The target framework control block | |
evtRtn | The event add routine | |
evtPrm | The event add routine's context parameter |
unsigned int LSEW_dgmFwFlush | ( | LSEW_dgmFw * | dgmFw, | |
int | reason | |||
) |
Flushes the last events out.
dgmFw | The framework's control block | |
reason | The reason the flush is being called |
unsigned int LSEW_dgmFwInit | ( | LSEW_dgmFw * | dgmFw, | |
unsigned short int | apid, | |||
unsigned int | dgm_id, | |||
LSF_CPU_K | cpu, | |||
LSF_ORIGIN_K | origin | |||
) |
Initializes the control structure.
dgmFw | The framework control block 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 originating CPU | |
origin | The data source type |
unsigned int LSEW_dgmFwLeft32 | ( | LSEW_dgmFw * | dgmFw | ) |
Returns the number of 32 words left in the datagram.
dgmFw | The framework's control block |
void LSEW_dgmFwModeChange | ( | LSEW_dgmFw * | dgmFw, | |
LSF_MODE_K | mode | |||
) |
Changes the current data-taking mode.
dgmFw | The destination event datagram framework handle | |
mode | The new data-taking mode |
LSEW_dgmFwBegAddCbp LSEW_dgmFwPostSet | ( | LSEW_dgmFw * | dgmFw, | |
LSEW_dgmFwPoster | postRtn, | |||
void * | postPrm | |||
) |
Sets the callback to add a user specified End Context Contribution record.
dgmFw | The target framework control block | |
postRtn | The post event datagram routine | |
postPrm | The post event datagram routine's context parameter |
void LSEW_dgmFwRunStart | ( | LSEW_dgmFw * | dgmFw, | |
unsigned int | runId, | |||
unsigned int | startTime, | |||
LSF_MODE_K | mode, | |||
LSF_REASON_OPEN_K | reason | |||
) |
Sets the context for a new run.
dgmFw | The framework's control block | |
runId | The run identifier | |
startTime | The start time to the nearest second | |
mode | The running mode | |
reason | The start reason |
unsigned int LSEW_dgmFwUsrAdd | ( | LSEW_dgmFw * | dgmFw, | |
void * | usrInfo, | |||
int | usrLen | |||
) |
Formats the specified event, flushing the current event datagram if the event datagram is full.
0,if | the user information was added | |
-1,if | the user information was not added because the datagram did not have enough room. In this case the likely strategy is to for the user to have an ADD BEGIN contribution add this information This will happen automatically when the new datagram is opened, ie when the next event is inserted. |
dgmFw | The framework's control block | |
usrInfo | A pointer to the user information | |
usrLen | Meant to be the length of the user information, but since it is passed transparently the callback routine that does the adding, it can be any 32-bit parameter you wish. |
LSEW_dgmFwEvtAddCbp LSEW_dgmFwUsrAddSet | ( | LSEW_dgmFw * | dgmFw, | |
LSEW_dgmFwUsrAdder | usrRtn, | |||
void * | usrPrm | |||
) |
Sets the callback to add an event to the event datagram.
dgmFw | The target framework control block | |
usrRtn | The user contribution add routine | |
usrPrm | The user contribution add rotuines's context parameter |
unsigned char OpenReasons[16] [static] |
Initial value:
{ LSF_REASON_OPEN_K_START, LSF_REASON_OPEN_K_START_OP, LSF_REASON_OPEN_K_AUTO_TIME, LSF_REASON_OPEN_K_AUTO_COUNT, LSF_REASON_OPEN_K_START, LSF_REASON_OPEN_K_START_OP, LSF_REASON_OPEN_K_START_AUTO, LSF_REASON_OPEN_K_START, LSF_REASON_OPEN_K_RESUME, LSF_REASON_OPEN_K_RESUME_OP, LSF_REASON_OPEN_K_RESUME_AUTO, LSF_REASON_OPEN_K_AUTO, LSF_REASON_OPEN_K_AUTO_MODE, LSF_REASON_CLOSE_K_AUTO_TIME, LSF_REASON_CLOSE_K_AUTO_COUNT, LSF_REASON_CLOSE_K_AUTO_FULL }