GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / V2-12-1 > eds / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

EBF_dir.c File Reference

EBF dir Utilities. More...

#include <EDS/EBF_match.h>
#include <EBF_matchPvt.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_ctb.h>
#include <EDS/EBF_pkt.h>
#include <EDS/EBF_evt.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_siv.h>
#include <EDS/EBF_cal.h>
#include <EDS/EBF_err.h>
#include <EDS/EBF_tkr.h>
#include <PBI/FFS.ih>
#include <PBI/Check.h>
#include <string.h>
#include <stddef.h>

Defines

#define print_pkt_dscs(_dscs, _ndscs)
#define print_pkt_dsc_idxs(_idxs, _cids)
#define MAX_FIFO_FULL   (1 + 8 * (1 + 7*2))

Functions

static __inline int update_status (EBF_dir *dir, unsigned int ebw_mismatch, unsigned int esw_mismatch)
 Updates the status based on the mismatches found in EBW and ESW.
static __inline int finalize_status (EBF_dir *dir, unsigned int cids, int elen)
 Sets the status when the end of data is reached.
static __inline unsigned int check_tkr_normal (const unsigned int *tkr, unsigned int cidmsk)
 This does a fast check on the track layer accept masks. It assumes that all 3 masks are within the packet.
static __inline unsigned int check_tkr_nonempty (EBF_dirTruncated *truncated, int state, unsigned int cidmsk, const unsigned int *tkr, int elen)
 Handles either the first, middle or last in a series of truncated packets.
static __inline unsigned int process_tem_normal (EBF_dir *dir, EBF_dirCtbDsc *contributor, const EBF_ctb *ctb, unsigned int cidmsk, int range, unsigned int ctids, unsigned int mask)
 Process a normal (non-truncated) TEM, computing the number of CAL logs present, the offset the TKR data and determining whether either or both of CAL/TKR have data.
static __inline unsigned int process_tem_truncated (EBF_dir *dir, EBF_dirCtbDsc *contributor, const EBF_ctb *ctb, int clen, unsigned int cidmsk, int range, unsigned int ctids, unsigned int mask)
 Process a truncated) TEM, computing the number of CAL logs present, the offset the TKR data and determining whether either or both of CAL/TKR have data. It is possible that the TKR layer accepts, used in determining whether the TKR has or does not have data are inaccessible. In this case a state variable is left in the directory structure to indicate where processing should be resumed.
static __inline void init_dir_redux (EBF_dirRedux *redux, unsigned int pktBytes, unsigned int esw_expected)
 Initializes the EBF_dirRedux structure when a new event is encountered.
static void __inline init_pkt_dscs (EBF_dirTruncated *truncated, int pktBytes, EBF_pkt *pkt, int siv)
 Initializes the list of packet descriptors for this event.
static void __inline update_pkt_dscs (EBF_dirTruncated *truncated, int cid, unsigned int cidmsk, unsigned int left, const unsigned short int *lpw, unsigned int latp_node)
 Updates the current packet descriptor with information about the truncated contributor.
static int __inline add_pkt_dscs (EBF_dirTruncated *truncated, EBF_pkt *pkt, int pktBytes)
 Adds a packet descriptors for truncated events.
static __inline int condense_pkt_dscs (EBF_dirPktDsc *srcDscs, int nsrcDscs, int begIdx, unsigned char *idxs, unsigned int cids)
 Condenses the specified list of packet descriptors by eliminating those descriptors of 0 length.
int EBF_dirCompose (EBF_dir *dir, unsigned int pktBytes, EBF_pkt *pkt, int siv)
 Composes the directory of the contributor descriptors.
unsigned int EBF_dirAuxFill (EBF_dir *dir, unsigned int cids, EBF_dirAuxDscFillRtn fill_rtn, void *fill_ctx)
 Fills the auxillary descriptor with the specified list of TEM TKR lengths and ERR lengths.
static int count_bits (unsigned short int esw)
 Count the number of erroring TKR GTCC in the error summary word.
const EBF_err * EBF_errLocate (const EBF_ctb *ctb, int *nerr)
 Find the beginning of error contributions consisting only of TKR FIFO overflow errors.
int EBF_errTkrCheck (const EBF_err *err, int max, unsigned int mask)
 Checks the error contribution for only TKR FIFO errors and that once a FIFO FULL error is detected, the failing RCs never begin before RC 2 (that's because the FIFO is 128 and so can alway absorb the first two RCs) and continue, in order until the maximum RC of 8.
unsigned int EBF_dirTkrErrEvaluate (EBF_dir *dir, unsigned int err_ids, int abort)
 Evaluates which error contributions selected from the set of err_ids are purely due to TKR FIFO overflows.
int EBF_dirInit (EBF_dir *dir)
 One-time intialization function for the specified EBF_dir structure.
void EBF_dirReset (EBF_dir *dir)
 Resets the specified EBF_dir structure, thus preparing it for the next event.
int EBF_dirSizeof (void)
 Returns the size, in bytes, of an EBF_dir structure.
int EBF_dirReassemble (EBF_dir *dir, unsigned int cids)
 Reassembles (that is, makes contigious) the specified contributors.
int EBF_dirCalTkrReassemble (EBF_dir *dir, unsigned int ctids)
 Reassembles (that is, makes contigious) the specified CAL and TKR contributors.


Detailed Description

EBF dir Utilities.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: EBF_dir.c,v 1.24 2012/09/27 20:28:51 russell Exp $

Function Documentation

static int __inline add_pkt_dscs ( EBF_dirTruncated truncated,
EBF_pkt pkt,
int  pktBytes 
) [static]

Adds a packet descriptors for truncated events.

Return values:
>= The current contributor id
<0 Too many packets
Parameters:
truncated The target directory truncated structure
pkt The new event packet to add
pktBytes The number of bytes in the packet

References _EBF_dirCtbRestart::cid, EBF_DIR_K_PKTS_MAX, _EBF_dirPktDsc::nbytes, _EBF_dirTruncated::npktDscs, _EBF_dirPktDsc::pkt, _EBF_dirTruncated::pktDscs, and _EBF_dirTruncated::restart.

Referenced by EBF_dirCompose().

static __inline unsigned int check_tkr_nonempty ( EBF_dirTruncated truncated,
int  state,
unsigned int  cidmsk,
const unsigned int *  tkr,
int  elen 
) [static]

Handles either the first, middle or last in a series of truncated packets.

Return values:
== 0, if the TKR is empty
!= 0, If the tracker has hits, the appropriately shift contributor mask
Parameters:
truncated The truncation control structure
state The state information (only state, not state + offset) This must be one of 1,2 or 3
tkr Pointer to where to be looking in the input event for the TKR data to be processed
cidmsk The contributor mask (appropriate for TKR usage)
elen The number of available bytes in ptr

References _EBF_dirTruncated::restart, and _EBF_dirCtbRestart::state.

Referenced by EBF_dirCompose(), and process_tem_truncated().

static __inline unsigned int check_tkr_normal ( const unsigned int *  tkr,
unsigned int  cidmsk 
) [static]

This does a fast check on the track layer accept masks. It assumes that all 3 masks are within the packet.

Return values:
== 0 if the tracker is empty,
!= 0 If the tracker has hits, the appropriately shift contributor mask
Parameters:
tkr Pointer to the tracker's layer accept words
cidmsk The contributor mask (left justified, appropriate for TKR usage)

Referenced by process_tem_normal().

static __inline int condense_pkt_dscs ( EBF_dirPktDsc srcDscs,
int  nsrcDscs,
int  begIdx,
unsigned char *  idxs,
unsigned int  cids 
) [static]

Condenses the specified list of packet descriptors by eliminating those descriptors of 0 length.

Returns:
The count of non-zero packet descriptors
Parameters:
srcDscs The list of packet descriptors to condense
nsrcDscs The count of packet descriptors to condense
begIdx Index of first packet eliminated
idxs Array mapping contributor ID to packet number
cids The bit-map of active contributors

References _EBF_dirPktDsc::nbytes, and _EBF_dirPktDsc::pkt.

Referenced by EBF_dirReassemble().

static int count_bits ( unsigned short int  esw  )  [inline, static]

Count the number of erroring TKR GTCC in the error summary word.

Returns:
The number of erroring TKR GTCC in the error summary word. This is a value from 1-8, although 0 is technically okay
Parameters:
[in] esw The error summary word. The TKR mask is in the middle 8 bits.

Referenced by EBF_errLocate().

unsigned int EBF_dirAuxFill ( EBF_dir dir,
unsigned int  cids,
EBF_dirAuxDscFillRtn  fill_rtn,
void *  fill_ctx 
)

Fills the auxillary descriptor with the specified list of TEM TKR lengths and ERR lengths.

Returns:
The set of auxilliary lengths that are filled
Parameters:
dir The EBF directory
cids The list of TKR and ERR lengths to fill. This is really two 16 bit lists, with the
  • Upper 16 bits specifying the TKR lengths to fill
  • Lower 16 bits specifying the AUX lengths to fill
fill_rtn An optional user provided fill routine. Since the calculation of these lengths is potentially computationally expensive, if the user has apriori knowledge of these values, this allows the user to avoid a recomputation. If this routine is not provided, the lengths will be computed using EBF_tkrLenCalc and EBF_errLenCalc. See EBF_dirAuxTemFillRtn for the exact calling sequence.
fill_ctx An arbitrary context parameter provided to fill_rtn
Note:
Since the calculation of the ERR length necessarily involves calculating the size of the TKR length, the user may wish to ensure that ERR length set is a subset of the TKR set.

References _EBF_dir::auxs, _EBF_dir::ctbs, _EBF_dirRedux::dgn_ids, EBF__dirCtbTkrLocate(), EBF__errLocate(), EBF__errSize(), EBF_tkrLenCalc(), _EBF_dirAuxDsc::errLen, _EBF_dir::redux, _EBF_dirRedux::te_aux_ids, and _EBF_dirAuxDsc::tkrLen.

int EBF_dirCalTkrReassemble ( EBF_dir dir,
unsigned int  ctids 
)

Reassembles (that is, makes contigious) the specified CAL and TKR contributors.

Returns:
Status
Parameters:
dir The directory structure
ctids Bit map of the CAL/TKR contributors to reassemble, (MSB = CAL contributor 0).
On any given TEM contributor, it is possible that
  • The CAL is chopped in two pieces
  • The TKR is chopped in two pieces
  • Both are chopped

This routine performs a rather trivial optimization, only reassembling those packets that have the contributor in question chopped. It does not go the whole way and only make the contributor in question contigious. This would be possible if, say the CAL was perfectly in tack, but the TKR spanned packets. In this case, the CAL could be left in place and the upper portion of the TKR could be moved down to join its remaining piece. It could also be possible that the CAL was chopped. In this case the lower portion of the CAL could be moved up to join the upper portion, leaving the TKR in place. If both were chopped, the most optimal move would be to move the smaller of each piece towards the large. This is way more code than can be undertaken at this time. The data structures are rich enough to accommodate this, so implementation will be deferred and the trivial optimization of only reassembly the whole contributor if either portion is requested will be made.

References _EBF_dirTruncated::ctids, EBF_DIR_TEMS_CAL, EBF_DIR_TEMS_TKR, EBF_dirReassemble(), _EBF_dirTruncated::rctids, and _EBF_dir::truncated.

int EBF_dirCompose ( EBF_dir dir,
unsigned int  pktBytes,
EBF_pkt pkt,
int  siv 
)

Composes the directory of the contributor descriptors.

Returns:
A bit mask of status values, see EBF_DIR_STATUS_M If < 0, there is a serious error that likely calls into question the structural integrity of the event. Other non-zero values indicate less serious conditions. In These cases the event is can be navigated, but some of the data may be missing or in error.
Parameters:
dir An array of directories to be filled in
pktBytes The size of the packet, in bytes. This includes the 8-word packet header
pkt The source event packet
siv The state information vector. This is from EBF_sivUpdate and is used for dealing with truncated packets.
This is used to add packets to either a new or, in the case of an event spanning multiple packets, existing an existing directory. The siv, state information vector, comes from EBF_sivUpdate provides the context so that the routine knows whether the packet being added is the only packet in the event or the first, middle or last in a sequence.
A design choice was made to make the user responsible for constructing the siv. The state information vector is useful in many applications independent of the EBF_dir facility that wish to also know the context of a packet.

References _EBF_CID_IS_TEM, _EBF_CID_MASK, add_pkt_dscs(), _EBF_esw::bf, _EBF_ebw::bf, check_tkr_nonempty(), _EBF_dirCtbDsc::cid, _EBF_dirRedux::cids, _EBF_dirCtbDsc::ctb, _EBF_dirRedux::ctberr_ids, _EBF_dir::ctbs, _EBF_dirTruncated::ctids, _EBF_dirRedux::ctids, _EBF_dirRedux::dgn_ids, _EBF_esw_bf::dgnblk, _EBF_dirExpected::dgns, EBF__ctbAdvance(), EBF__matchEbwCheck(), EBF__matchEswCheck(), EBF__sivIsLast(), EBF__sivIsNotFirst(), EBF_CALLOGCNT_MASK, EBF_DIR_STATUS_SF_M_CTB_BADLEN, EBF_DIR_STATUS_SF_M_SIV, EBF_DIR_STATUS_SF_M_SUMMARY, EBF_EBW_LEN_TO_BYTES, EBF_EBW_M_DSTU, EBF_EBW_V_DSTU, EBF_ESW_M_DGNBLK, EBF_ESW_M_ERRBLK, EBF_ESW_M_RANGE, EBF_SIV_M_ERR, EBF_SIV_M_STATE_MORE, _EBF_ctbHdr::ebw, _EBF_dirRedux::ebw_mismatch, _EBF_dirRedux::err_ids, _EBF_esw_bf::errblk, _EBF_ctbHdr::esw, _EBF_dirExpected::esw_dynamic, _EBF_dirRedux::esw_expected, _EBF_dirRedux::esw_mismatch, _EBF_dirExpected::esw_static, _EBF_dir::evt, _EBF_dirRedux::evt_len, _EBF_dir::expected, finalize_status(), _EBF_ctb::hdr, _EBF_pkt::hdr, init_dir_redux(), init_pkt_dscs(), _EBF_dirCtbRestart::latp_node, _EBF_dirCtbRestart::left, _EBF_dirCtbRestart::lpw_expected, _EBF_dirExpected::lpws, _EBF_dirRedux::ncids, _EBF_dirRedux::nosup_ids, _EBF_dir::pkt, process_tem_normal(), process_tem_truncated(), _EBF_esw_bf::range, _EBF_dir::redux, _EBF_dirTruncated::restart, _EBF_dirRedux::rng_ids, _EBF_dirRedux::siv_err, _EBF_dirCtbRestart::state, _EBF_dirRedux::status, _EBF_esw_bf::suppress, _EBF_dir::truncated, _EBF_ebw::ui, _EBF_esw::ui, update_pkt_dscs(), and update_status().

Referenced by EDS_fwHandlerProcess().

void EBF_dirInit ( EBF_dir dir  ) 

int EBF_dirReassemble ( EBF_dir dir,
unsigned int  cids 
)

Reassembles (that is, makes contigious) the specified contributors.

Returns:
Status
Parameters:
dir The directory structure
cids Bit map of the contributors to reassemble, (MSB = contributor 0).
Function
This routine is used in the case of an event spanning multiple packets. It can be called only when all the packets of an event have been added by EBF_dirCompose. It is safe, but unnecessary, to call in the case of an event being confined to a single packet.
Reasemble Philosophy
The EBF directory philosophy is to do the minimum work possible. To that end, in the case of an event spanning multiple packets, EBF_dirReassembly will only make a list of specified contributors contigious in memory by eliminating the header pad area and the restart word separating subsequent packets. Contrast this with the idea of making the whole event contigious in memory.
Future Improvement
Two future improvements can be to made to the TEM contributors. The first improvement has to do with how to make a block contigious. Currently the lower portion of the block is moved up to meet the upper portion. However, the wise thing to do is move that smallest piece towards the larger. In some cases this will indeed involve moving the lower piece upwards. However in some cases this will involve moving the upper piece downwards.
A second improvement can be made because the TEM is itself composed of multiple pieces, the CAL, the TKR and optionally the TEM diagnostic block and the TKR error block. The philosophy of laziness can be taken extended to making only these sub-blocks contigious. The user can protect himself against this eventuality by using the access functions EBF_calLocate and EBF_tkrLocate to point to these subblocks.

References _EBF_ebw::bf, _EBF_dirTruncated::cids, condense_pkt_dscs(), _EBF_dirCtbDsc::ctb, _EBF_dir::ctbs, EBF_EBW_LEN_TO_BYTES, _EBF_ctbHdr::ebw, _EBF_pkt::hdr, _EBF_ctb::hdr, _EBF_dirPktDsc::nbytes, _EBF_dirTruncated::npktDscs, _EBF_dirPktDsc::pkt, _EBF_dirTruncated::pktDscIdxs, _EBF_dirTruncated::pktDscs, _EBF_dirTruncated::rcids, _EBF_dirTruncated::rctids, _EBF_dir::redux, _EBF_dirRedux::status, _EBF_dir::truncated, and _EBF_ebw::ui.

Referenced by EBF_dirCalTkrReassemble().

void EBF_dirReset ( EBF_dir dir  ) 

Resets the specified EBF_dir structure, thus preparing it for the next event.

Parameters:
dir The directory structure

References EBF__dirReset().

Referenced by initIxbObjTbl().

int EBF_dirSizeof ( void   ) 

Returns the size, in bytes, of an EBF_dir structure.

Returns:
The size, in bytes, of an EBF_dir structure
This function, while on the face of it unnecessary because the EBF_dir structure is public, allows one to construct an abstract interfaces to event decoding objects. The core interface is generally something like

  • sizeof - To get the necessary amount of memory
  • init - To initialize the object once allocated
  • reset - To prepare it for the next event

unsigned int EBF_dirTkrErrEvaluate ( EBF_dir dir,
unsigned int  err_ids,
int  abort 
)

Evaluates which error contributions selected from the set of err_ids are purely due to TKR FIFO overflows.

Returns:
The set of TEMs error contributions known to be purely due to TKR FIFO overflows. Note that this may contain more or fewer than the err_ids.
Parameters:
[in,out] dir The EBF directory structure
[in] err_ids The set of TEMs to evaluate. This is a left justified 16-bit mask.
[in] abort If non-zero, abort the scanning of any remaining TEMs when a non-complying TEM is encountered.
The set of err_ids is always trimmed to include only the set of TEMs that actually have an error contribution. Thus, the value 0xffff0000 (or even 0xffffffff could be entered to have all TEMs with error contributions evaluated.

Note also that this routine may be called multiple times with different or even overlapping sets of err_ids. The results of TEMs that have been previously evaluated are saved, so that they are not reevaluated.

As a side effect the auxillary block is filled in with the length of the tracker contribution and the length of the error contribution.

Warning:
In a bow to efficiency, the tracker length entered here is only accurate to a 32-bit value. The only way to be the byte-level definition is to parse the tracker contribution. This is computationally expensive, particularly for error contributions that have FIFO overflows, by far the most common type now that the flood gates where opened on the hardware. (Somewhere around 4/2012.)
A search through flight software revealed that the tracker length in the auxilliary block is only used to locate the error contribution. For this purpose, the 32-bit accuracy is fine.

References _EBF_dir::auxs, _EBF_dirCtbDsc::ctb, _EBF_dir::ctbs, _EBF_dirRedux::dgn_ids, EBF__dirCtbTkrLocate(), EBF__errLocate(), EBF__errSize(), EBF_errLocate(), EBF_errTkrCheck(), _EBF_dirRedux::err_ids, _EBF_dirAuxDsc::errLen, _EBF_dir::redux, _EBF_dirRedux::te_aux_ids, _EBF_dirAuxDsc::tkrLen, _EBF_dirCtbDsc::tkroff, and _EBF_dirRedux::tov_ids.

const EBF_err* EBF_errLocate ( const EBF_ctb ctb,
int *  nerr 
)

Find the beginning of error contributions consisting only of TKR FIFO overflow errors.

Return values:
!= NULL, the beginning of an error contribution consisting only of TKR FIFO overflow errors.
== NULL, this error contribution is not one consisting only of TKR FIFO overflow errors.
Parameters:
[in] ctb The contribution for this TEM.
[out] nerr The number of 16-bit words in the error contribution. This value is set if and only if the returned pointer to the error contribution is not NULL.
Note:
This is a optimized routine to find the beginning of error contributions consisting only of TKR FIFO overflow errors. Since the change to allow the TKR FIFO to overflow, this error makes up the vast majority of the error contributions.
The usual method of locating the beginning of the error contribution is potentially to costly. This method must serially parse through the TKR contribution (the CAL is fairly easy to skip). Almost by definition, when there is a TKR FIFO overflow, the TKR contribution is fairly chunky (128 hits per GTCC * 1-8 GTCCs => 128 - 1024 hits), i.e. a lot of data to scan.

Therefore this alternate method is used. Here the start of the error contribution is attempted to be found by starting at the end of the contribution and working backwards. This is not a good technique for other errors, but for TKR FIFO overflow only, this works.

Many consistency checks are performed as one goes performs this backwards scan to verify this is pristine TKR FIFO overflow only error contribution.

  1. The scan is contained within the contributor
  2. The first word encountered on every new GTCC must be 0x0408, i.e. only a FIFO overflow on GTRC 8
  3. The next word must be a value <= 0x40, the maximum overflow that can occur
  4. The next words must progress 0x0407, 0x0406 etc, with each of its overflow words <= 0x040
  5. This series must terminate at 0x0402, since GTRC 2 is the first GTRC that can have a overflow.
  6. When the series terminates, the next word encountered must match the number of words encountered on this GTCC.
  7. The number GTCCs encountered is incremented and checked to ensure that the scan is terminated at a maximum of 8 cables
  8. The scan is then restarted looking for either the next GTCC (assuming the preceding step does not abort the scan).
  9. The value encounter may be either a new GTRC (i.e. a 0x0408) or the error summary word.
  10. If it is not an new GTRC, the word is checked for consistency with the expected error summary word (i.e. only TKR errors and only the right number GTCCs)

References count_bits(), and EBF__ctbSize().

Referenced by EBF_dirTkrErrEvaluate().

int EBF_errTkrCheck ( const EBF_err *  err,
int  max,
unsigned int  mask 
)

Checks the error contribution for only TKR FIFO errors and that once a FIFO FULL error is detected, the failing RCs never begin before RC 2 (that's because the FIFO is 128 and so can alway absorb the first two RCs) and continue, in order until the maximum RC of 8.

Return values:
== mask if only a TKR FIFO error
== 0 if other errors
Parameters:
[in] err The list of error words
[in] max The number of error words
[in] mask The bit mask for this tower
Note:
This routine is exposed only for diagnostic and debugging purposes. The user should generally call EBF_dirTkrErrEvaluate.

References _EBF_errGTRC::bf, EBF_ERR_GTRC_M_FIFOFULL, EBF_ERR_GTRC_M_ID, EBF_ERR_TEM_SUMMARY_M_TKR, EBF_ERR_TEM_SUMMARY_V_TKR, _EBF_errGTRC_bf::id, and _EBF_errGTRC::us.

Referenced by EBF_dirTkrErrEvaluate().

static __inline int finalize_status ( EBF_dir dir,
unsigned int  cids,
int  elen 
) [static]

Sets the status when the end of data is reached.

Returns:
The final status
Parameters:
dir The directory structure
cids The bit mask of contributors
elen The amount of data remaining, may be negative
This function should only be called when all processing is complete. That is, at the end of the last packet.

References _EBF_dirExpected::cids, EBF_DIR_STATUS_SF_M_CTB_MISSING, EBF_DIR_STATUS_SF_M_OVERRUN, EBF_DIR_STATUS_SF_M_SUMMARY, EBF_DIR_STATUS_SF_M_UNDERRUN, _EBF_dirRedux::evt_len, _EBF_dir::expected, _EBF_dirTruncated::npktDscs, _EBF_dirRedux::npkts, _EBF_dir::redux, _EBF_dirRedux::status, and _EBF_dir::truncated.

Referenced by EBF_dirCompose().

static __inline void init_dir_redux ( EBF_dirRedux redux,
unsigned int  pktBytes,
unsigned int  esw_expected 
) [static]

Initializes the EBF_dirRedux structure when a new event is encountered.

Parameters:
redux Pointer to the EBF_dirRedux structure to initialize
pktBytes Number of bytes (including header and restart cell)
esw_expected Template for the expected Event Summary Word

References _EBF_dirRedux::ctberr_ids, _EBF_dirRedux::dgn_ids, EBF_EBW_M_ERR, _EBF_dirRedux::ebw_mismatch, _EBF_dirRedux::err_ids, _EBF_dirRedux::esw_expected, _EBF_dirRedux::esw_mismatch, _EBF_dirRedux::evt_len, _EBF_dirRedux::nosup_ids, _EBF_dirRedux::rng_ids, _EBF_dirRedux::status, _EBF_dirRedux::te_aux_ids, and _EBF_dirRedux::tov_ids.

Referenced by EBF_dirCompose().

static void __inline init_pkt_dscs ( EBF_dirTruncated truncated,
int  pktBytes,
EBF_pkt pkt,
int  siv 
) [static]

Initializes the list of packet descriptors for this event.

Parameters:
truncated The target directory truncated structure
pktBytes The number of bytes in the packet
pkt The first packet in the new event
siv The state information vector.

References _EBF_dirTruncated::cids, _EBF_dirTruncated::ctids, EBF__sivIsList(), _EBF_pkt::hdr, _EBF_dirPktDsc::nbytes, _EBF_dirTruncated::npktDscs, _EBF_dirPktDsc::pkt, _EBF_dirTruncated::pktDscs, _EBF_dirTruncated::rcids, _EBF_dirTruncated::rctids, and _EBF_pktHdr::undef.

Referenced by EBF_dirCompose().

static __inline unsigned int process_tem_normal ( EBF_dir dir,
EBF_dirCtbDsc contributor,
const EBF_ctb ctb,
unsigned int  cidmsk,
int  range,
unsigned int  ctids,
unsigned int  mask 
) [static]

Process a normal (non-truncated) TEM, computing the number of CAL logs present, the offset the TKR data and determining whether either or both of CAL/TKR have data.

Returns:
A contributor mask for both the CAL and TKR indicating which had data present
Parameters:
dir The EBF directory structure
contributor The contributor descriptor to fill in
ctb The contributor data
cidmsk The contributor mask
range Non-zero if in 4-range readout
ctids The current value of the CAL/TRK contributor mask
mask Obscure variable used when calculating the number of struck logs in the CAL.

References check_tkr_normal(), _EBF_ctb::dat, EBF__calLogCntM(), _EBF_dirCtbDsc::logcnt, and _EBF_dirCtbDsc::tkroff.

Referenced by EBF_dirCompose().

static __inline unsigned int process_tem_truncated ( EBF_dir dir,
EBF_dirCtbDsc contributor,
const EBF_ctb ctb,
int  clen,
unsigned int  cidmsk,
int  range,
unsigned int  ctids,
unsigned int  mask 
) [static]

Process a truncated) TEM, computing the number of CAL logs present, the offset the TKR data and determining whether either or both of CAL/TKR have data. It is possible that the TKR layer accepts, used in determining whether the TKR has or does not have data are inaccessible. In this case a state variable is left in the directory structure to indicate where processing should be resumed.

Returns:
A contributor mask for both the CAL and TKR indicating which had data present
Parameters:
dir The EBF directory structure
contributor The contributor descriptor to fill in
ctb The contributor data
clen The length, in bytes, of the contributor data
cidmsk The contributor mask
range Non-zero if in 4-range readout
ctids The current value of the CAL/TRK contributor mask
mask Obscure variable used when calculating the number of struck logs in the CAL.

References check_tkr_nonempty(), _EBF_dirTruncated::ctids, _EBF_ctb::dat, EBF__calLogCntM(), _EBF_dirCtbDsc::logcnt, _EBF_dirTruncated::restart, _EBF_dirCtbRestart::state, _EBF_dirCtbDsc::tkroff, and _EBF_dir::truncated.

Referenced by EBF_dirCompose().

static void __inline update_pkt_dscs ( EBF_dirTruncated truncated,
int  cid,
unsigned int  cidmsk,
unsigned int  left,
const unsigned short int *  lpw,
unsigned int  latp_node 
) [static]

Updates the current packet descriptor with information about the truncated contributor.

Parameters:
truncated The target directory truncated structure
cid The target contributor id
cidmsk The target contributor mask
left The number of bytes left unprocessed in this contributor that is, the spill over into the next packet.
lpw The address to lookup for next expected LAT Protocol Word.
latp_node The seed LATp destination node.

References _EBF_dirCtbRestart::cid, _EBF_dirTruncated::cids, EBF_EBW_V_DSTU, _EBF_dirCtbRestart::latp_node, _EBF_dirCtbRestart::left, _EBF_dirCtbRestart::lpw_expected, _EBF_dirTruncated::npktDscs, _EBF_dirTruncated::pktDscIdxs, and _EBF_dirTruncated::restart.

Referenced by EBF_dirCompose().

static __inline int update_status ( EBF_dir dir,
unsigned int  ebw_mismatch,
unsigned int  esw_mismatch 
) [static]

Updates the status based on the mismatches found in EBW and ESW.

Returns:
The updated status;
Parameters:
dir The EBF directory structure
ebw_mismatch The mismatch fields in the EBW
esw_mismatch The mismatch fields in the ESW

References EBF_DIR_STATUS_SF_M_EBW_MISMATCH, EBF_DIR_STATUS_SF_M_ESW_MISMATCH, EBF_DIR_STATUS_SF_M_SUMMARY, EBF_DIR_STATUS_SW_M_EBW_MISMATCH, EBF_DIR_STATUS_SW_M_ESW_MISMATCH, EBF_MATCH_M_EBW_ERRORS, EBF_MATCH_M_EBW_EXCEPTIONS, EBF_MATCH_M_ESW_ERRORS, EBF_MATCH_M_ESW_EXCEPTIONS, _EBF_dirRedux::ebw_mismatch, _EBF_dirRedux::esw_mismatch, _EBF_dir::redux, and _EBF_dirRedux::status.

Referenced by EBF_dirCompose().


Generated on Thu Sep 27 13:52:19 2012 by  doxygen 1.5.8