GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LSE / V2-1-0 > lsew / linux-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.20 2011/03/26 17:35:24 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 |
References _LSE_timCtbAbbreviated::bdy, _LSE_timCtbFull::bdy, _LSE_ppsReg::bf, _LSE_timBdyFull::flags, _LSE_timCtbAbbreviated::hdr, _LSE_timCtbFull::hdr, _LSE_ppsReg_bf::idx, LSE_CTXTIMFLAGS_M_IS_SOURCE_GPS, LSE_PPSREG_N_IDX, _LSE_timBdyAbbreviated::pps, _LSE_timBdyFull::pps, _LSE_timBdyFull::secs, _LSE_ppsReg::ui, and _LSE_timFlags::ui.
Referenced by ctx_update().
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 |
References _LSE_etxCtb::abv, _LSE_etxBridge::bf, complete_etxAbbreviated(), complete_etxFull(), _LSEW_ctxPub::cur, DPRINTF, _LSEW_ctxIds::etx_abrv, _LSEW_ctxIds::etx_full, _LSEW_ctxTim::flags, _LSE_etxCtb::full, _LSEW_ctxPvt::ids, LSE__timetonesGet(), LSE_CTXTIMFLAGS_M_IS_SOURCE_GPS, _LSE_etxBridge_bf::open, _LSEW_ctxTim::pps, _LSEW_ctxPub::prv, _LSEW_ctx::pub, _LSEW_ctx::pvt, _LSEW_ctxTim::secs, _LSE_etxBridge::ub, and _LSE_ppsReg::ui.
Referenced by LSEW_ctxOpenAdd().
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 |
References _LSE_etxCtbAbbreviated::bdy, _LSE_etxBdyAbbreviated::cur_pps, _LSE_etxCtbAbbreviated::hdr, _LSE_etxBdyAbbreviated::prv_pps, _LSE_etxBdyAbbreviated::secs, and _LSE_ppsReg::ui.
Referenced by complete_etx().
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 |
References _LSE_etxCtbFull::bdy, _LSE_etxBdyFull::cur, _LSE_timBdyFull::flags, _LSE_etxCtbFull::hdr, _LSE_etxBdyTimFull::pps, _LSE_etxBdyFull::prv, _LSE_timBdyFull::secs, _LSE_etxBdyTimFull::tim, _LSE_ppsReg::ui, and _LSE_timFlags::ui.
Referenced by complete_etx().
Copies the extended range counters.
dst | The destination extended range counter contribution | |
src | The source extended ranged counter information |
References _LSE_xcr::deadzone, _LSE_xcr::discarded, _LSE_xcr::elapsed, _LSE_xcr::livetime, _LSE_xcr::prescaled, and _LSE_xcr::sequence.
Referenced by LSEW_ctxOpenAdd().
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 |
References add_tim(), _LSEW_ctxPub::cur, _LSEW_ctxTim::flags, _LSEW_ctxPvt::ids, LSE__timetoneGet(), LSE_CTXTIMFLAGS_M_IS_SOURCE_GPS, _LSEW_ctxTim::pps, _LSEW_ctxPub::prv, _LSEW_ctx::pub, _LSEW_ctx::pvt, _LSEW_ctxTim::secs, _LSEW_ctxIds::tim_abrv, and _LSEW_ctxIds::tim_full.
Referenced by LSEW_ctxUpdateAdd().
Completes the Datagram Identification portion of the contribution.
dst | The Datagram Identification to complete | |
src | The Datagram Identification used to complete the dst |
References _LSE_did_mcd::bf, _LSE_did_mcd_bf::dgm, _LSE_did::mcd, _LSE_did::pid, _LSE_did::tim, _LSE_did_mcd::ui, and _LSE_did_pid::ui.
Referenced by LSEW_ctxOpenAdd().
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. |
References _LSE_etxBridge::bf, _LSE_etxBridge_bf::close, _LSEW_ctxPvt::etx, _LSE_etxCtb::hdr, _LSEW_ctx::pvt, and _LSE_etxBridge::ub.
Referenced by LSEW_dgmClose().
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) |
References _LSE_did_pid::bf, _LSE_did_pid_bf::cpu, _LSEW_ctxPub::did, _LSEW_ctxIds::etx_abrv, _LSEW_ctxIds::etx_full, _LSEW_ctxPvt::ids, LSE_ID_K_ETX_ABBREVIATED, LSE_ID_K_ETX_FULL, LSE_ID_K_TIM_ABBREVIATED, LSE_ID_K_TIM_FULL, _LSE_did_pid_bf::origin, _LSE_did::pid, _LSEW_ctx::pub, _LSEW_ctx::pvt, _LSEW_ctxIds::tim_abrv, and _LSEW_ctxIds::tim_full.
Referenced by LSEW_dgmInit().
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 |
References _LSE_did_mcd::bf, _LSE_did_mcd_bf::chg, _LSEW_ctxPub::did, _LSE_did::mcd, _LSE_did_mcd_bf::mode, and _LSEW_ctx::pub.
Referenced by LSEW_dgmModeChange().
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 |
References _LSE_etxCtbCommon::bdy, _LSE_etxCtb::com, complete_etx(), copy_xcr(), _LSEW_ctxPub::did, _LSE_etxBdyCommon::did, _LSEW_ctxPvt::etx, fill_and_update_did(), _LSEW_ctxPub::gem, _LSEW_ctx::pub, _LSEW_ctx::pvt, update_xcr(), _LSEW_ctxGem::xcr, and _LSE_etxBdyCommon::xcr.
Referenced by LSEW_dgmOpen().
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 |
References _LSE_did_mcd::bf, _LSE_did_pid::bf, _LSE_did_mcd_bf::chg, _LSE_did_mcd_bf::dgm, _LSEW_ctxPub::did, _LSEW_ctxPub::gem, _LSE_did::mcd, _LSE_did_mcd_bf::mode, _LSE_did::pid, _LSEW_ctx::pub, _LSE_did_pid_bf::run, and _LSE_did::tim.
Referenced by LSEW_dgmRunStart().
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 |
References ctx_update(), _LSEW_ctxPub::gem, LSE__elapsedSet(), _LSEW_ctx::pub, and update_xcr().
Referenced by LSEW_dgmUpdate().
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 |
Referenced by update_xcr().
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 |
References _LSEW_ctxGem::base, _LSEW_ctxGemBase::deadzone, _LSE_xcr::deadzone, _LSEW_ctxGemBase::discarded, _LSE_xcr::discarded, _LSEW_ctxGemBase::elapsed, _LSE_xcr::elapsed, _LSEW_ctxGemBase::livetime, _LSE_xcr::livetime, _LSEW_ctxGemBase::prescaled, _LSE_xcr::prescaled, _LSEW_ctxGemBase::sequence, _LSE_xcr::sequence, update_counter(), and _LSEW_ctxGem::xcr.
Referenced by LSEW_ctxOpenAdd(), and LSEW_ctxUpdateAdd().