GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-0-1 > lsew / sun-gcc
#include "dprintf.h"
#include "LSEW_ctx.h"
#include "LSE_time.ih"
#include "LSE/LSE_etxCtb.h"
#include "LSE/LSE_timCtb.h"
#include "EDS/EBF_gem.h"
#include "EDS/EBF_evt.h"
#include <string.h>
Functions | |
static __inline unsigned int * | add_tim (unsigned int *cur, unsigned int len32, unsigned int full_id, unsigned int abrv_id, unsigned int prv_pps, unsigned int prv_secs, unsigned int cur_pps, unsigned int cur_secs, unsigned int cur_flags, unsigned int force) |
Add either a full or abbreviated Time Specification Contribution. | |
static __inline void | fill_and_update_did (LSE_did *dst, LSE_did *src) |
Completes the Datagram Identification portion of the contribution. | |
static __inline unsigned int * | complete_etxFull (LSE_etxCtbFull *etx, unsigned int id, unsigned int bridge, unsigned int prv_secs, unsigned int prv_flags, unsigned int prv_pps, unsigned int cur_secs, unsigned int cur_flags, unsigned int cur_pps) |
Completes a LSE_etxCtbFull contribution. | |
static __inline unsigned int * | complete_etxAbbreviated (LSE_etxCtbAbbreviated *etx, unsigned int id, unsigned int bridge, unsigned int cur_secs, unsigned int prv_pps, unsigned int cur_pps) |
Completes a LSE_etxCtbAbbreviated contribution. | |
static __inline void | update_counter (unsigned short int *ext, unsigned int *base, unsigned int evt_counter) |
Updates the extended and base values of one counter. | |
static __inline void | update_xcr (LSEW_ctxGem *ctx, unsigned int sequence, const EBF_gem *gem) |
Updates the extended range counter information. | |
static __inline void | copy_xcr (LSE_xcr *dst, LSE_xcr *src) |
Copies the extended range counters. | |
static __inline unsigned int * | complete_etx (LSEW_ctx *ctx, LSE_etxCtb *etx, unsigned int reason, unsigned int gem_pps) |
Completes the event context portion of the event datagram by filling in the bridge word and time information. | |
static __inline unsigned int * | ctx_update (LSEW_ctx *ctx, unsigned int *cur, unsigned int len32, unsigned int gem_pps) |
Updates the time contribution. | |
void | LSEW_ctxInit (LSEW_ctx *ctx, LSF_CPU_K cpu, LSF_ORIGIN_K origin) |
Initializes the initial context structure. | |
unsigned int * | LSEW_ctxOpenAdd (LSEW_ctx *ctx, unsigned int *cur, unsigned int len32, unsigned int reason, unsigned int sequence, const EBF_gem *gem) |
Updates the Time/Counter context structure and inserts the the start of the appropriate (full or abbreviated) LSE_etxCtb contribution into the event datagram. | |
void | LSEW_ctxRunStart (LSEW_ctx *ctx, unsigned int runId, unsigned int startTime, LSF_MODE_K mode) |
Sets the context for a new run. | |
void | LSEW_ctxModeChange (LSEW_ctx *ctx, LSF_MODE_K mode) |
Changes the current data-taking mode. | |
unsigned int * | LSEW_ctxUpdateAdd (LSEW_ctx *ctx, unsigned int *cur, unsigned int len32, unsigned int sequence, const EBF_gem *gem) |
Updates the Time/Counter context structure and inserts an Time contribution in the data stream if necessary. | |
unsigned int * | LSEW_ctxCloseAdd (LSEW_ctx *ctx, unsigned int *cur, unsigned int len32, unsigned int reason) |
Called when an event datagram is filled, it completes the opening LSE_etxCtb contribution by filling in the bridge field from the specified context. |
CVS $Id: LSEW_ctx.c,v 1.19 2008/01/31 23:31:35 russell Exp $
static __inline unsigned int * add_tim | ( | unsigned int * | cur, | |
unsigned int | len32, | |||
unsigned int | full_id, | |||
unsigned int | abrv_id, | |||
unsigned int | prv_pps, | |||
unsigned int | prv_secs, | |||
unsigned int | cur_pps, | |||
unsigned int | cur_secs, | |||
unsigned int | cur_flags, | |||
unsigned int | force | |||
) | [static] |
Add either a full or abbreviated Time Specification Contribution.
cur | Current output pointer | |
len32 | The number of 32-bit words that are available | |
full_id | The LSF id to use for a FULL time contribution | |
abrv_id | The LSF id to use for an ABBREVIATED time contribution | |
prv_pps | The previous (old) value of the GEM 1PPS register | |
prv_secs | The previous (old) elapsed seconds since the Spectrum-Astro epoch | |
cur_pps | The value of the GEM 1PPS register | |
cur_secs | The current elapsed seconds since the Spectrum-Astro epoch | |
cur_flags | The Spectrum-Astro and FSW flag words | |
force | Force the addition |
static __inline unsigned int complete_etx | ( | LSEW_ctx * | ctx, | |
LSE_etxCtb * | etx, | |||
unsigned int | reason, | |||
unsigned int | gem_ppstime | |||
) | [static] |
Completes the event context portion of the event datagram by filling in the bridge word and time information.
ctx | The context structure | |
etx | The extended context contribution to fill | |
reason | One of an enumerated list indicating why the datagram is being opened | |
gem_ppstime | The value of the GEM's 1PPS register |
static __inline unsigned int * complete_etxAbbreviated | ( | LSE_etxCtbAbbreviated * | etx, | |
unsigned int | id, | |||
unsigned int | bridge, | |||
unsigned int | cur_secs, | |||
unsigned int | prv_pps, | |||
unsigned int | cur_pps | |||
) | [static] |
Completes a LSE_etxCtbAbbreviated contribution.
etx | A pointer to the beginning of the LSE_ctxCtbAbbreviated contribution to fill | |
id | The identifier to use for an ABBREVIATED event context contribution | |
bridge | The value of the bridge field | |
cur_secs | The current elapsed seconds since the Spectrum-Astro epoch | |
prv_pps | The value of the GEM 1PPS register at the previous 1 PPS time hack | |
cur_pps | The value of the GEM 1PPS register at the current 1 PPS time hack |
static __inline unsigned int * complete_etxFull | ( | LSE_etxCtbFull * | etx, | |
unsigned int | id, | |||
unsigned int | bridge, | |||
unsigned int | prv_secs, | |||
unsigned int | prv_flags, | |||
unsigned int | prv_pps, | |||
unsigned int | cur_secs, | |||
unsigned int | cur_flags, | |||
unsigned int | cur_pps | |||
) | [static] |
Completes a LSE_etxCtbFull contribution.
etx | A pointer to the beginning of the LSE_etxCtbFull contribution to fill | |
id | The LSF identifier for a full event context contribution | |
bridge | The value of the bridge word | |
prv_secs | The previous elapsed seconds since the Spectrum-Astro epoch | |
prv_flags | The previous flags | |
prv_pps | The value of the GEM 1PPS register at the previous 1 PPS time hack | |
cur_secs | The current elapsed seconds since the Spectrum-Astro epoch | |
cur_flags | The current flags | |
cur_pps | The value of the GEM 1PPS register at the current 1 PPS time |
Copies the extended range counters.
dst | The destination extended range counter contribution | |
src | The source extended ranged counter information |
static __inline unsigned int * ctx_update | ( | LSEW_ctx * | ctx, | |
unsigned int * | cur, | |||
unsigned int | len32, | |||
unsigned int | gem_pps | |||
) | [static] |
Updates the time contribution.
ctx | The context structure | |
cur | The current output location | |
len32 | The number of 32-bit words that are available | |
gem_pps | The value of the GEM's 1PPS counter |
Completes the Datagram Identification portion of the contribution.
dst | The Datagram Identification to complete | |
src | The Datagram Identification used to complete the dst |
unsigned int * LSEW_ctxCloseAdd | ( | LSEW_ctx * | ctx, | |
unsigned int * | cur, | |||
unsigned int | len32, | |||
unsigned int | reason | |||
) |
Called when an event datagram is filled, it completes the opening LSE_etxCtb contribution by filling in the bridge field from the specified context.
cur | The current fill point in the event datagram. | |
len32 | The number of 32-bit words available. | |
ctx | The context structure. | |
reason | One of an enumerated list of reasons why this datagram is being closed. |
void LSEW_ctxInit | ( | LSEW_ctx * | ctx, | |
LSF_CPU_K | cpu, | |||
LSF_ORIGIN_K | origin | |||
) |
Initializes the initial context structure.
!!! KLUDGE - None of the stuff following belongs here (except the INIT)
ctx | The Timer/Counter context structure to initialize | |
cpu | The CPU producing this data | |
origin | The originating data source (the LAT, GLEAM, etc) |
void LSEW_ctxModeChange | ( | LSEW_ctx * | ctx, | |
LSF_MODE_K | mode | |||
) |
Changes the current data-taking mode.
ctx | The destination context | |
mode | The new data-taking mode |
unsigned int * LSEW_ctxOpenAdd | ( | LSEW_ctx * | ctx, | |
unsigned int * | cur, | |||
unsigned int | len32, | |||
unsigned int | reason, | |||
unsigned int | sequence, | |||
const EBF_gem * | gem | |||
) |
Updates the Time/Counter context structure and inserts the the start of the appropriate (full or abbreviated) LSE_etxCtb contribution into the event datagram.
ctx | The context structure | |
cur | The current write pointer | |
len32 | The number of 32-bit words that are available | |
reason | One of an enumerated list describing why the datagram is being opened. | |
sequence | The sequence number of the next event. If the MSB of this value is set, no updating of extended counters is done. The caller may wish to by-pass this updating because it was already done. For example, this happens in the case of event failing to fit into the previous datagram. Here the update has already occurred. | |
gem | The GEM data record of the next event |
void LSEW_ctxRunStart | ( | LSEW_ctx * | ctx, | |
unsigned int | runId, | |||
unsigned int | startTime, | |||
LSF_MODE_K | mode | |||
) |
Sets the context for a new run.
ctx | The destination context | |
runId | The run identifier | |
startTime | The run start time rounded to the nearest second | |
mode | The running mode |
unsigned int * LSEW_ctxUpdateAdd | ( | LSEW_ctx * | ctx, | |
unsigned int * | cur, | |||
unsigned int | len32, | |||
unsigned int | sequence, | |||
const EBF_gem * | gem | |||
) |
Updates the Time/Counter context structure and inserts an Time contribution in the data stream if necessary.
ctx | The context structure | |
cur | The current write pointer | |
len32 | The number of 32-bit words available. | |
sequence | The sequence number of the next event | |
gem | The GEM data record of the next event |
static __inline void update_counter | ( | unsigned short int * | ext, | |
unsigned int * | base, | |||
unsigned int | evt_counter | |||
) | [static] |
Updates the extended and base values of one counter.
ext | Pointer to the current extended counter value | |
base | Pointer to the current base counter value | |
evt_counter | The value of the counter from the current event |
static __inline void update_xcr | ( | LSEW_ctxGem * | ctx, | |
unsigned int | sequence, | |||
const EBF_gem * | gem | |||
) | [static] |
Updates the extended range counter information.
ctx | The GEM context to update, holds the extended counters and their base values. | |
sequence | The event sequence number of the current event. | |
gem | The GEM data of the current event |