GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > EDS / V2-10-0
Constituent: eds     Tag: mv2304
#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 "EDS/FFS.h"
#include "PBI/Ofs.h"
#include "PBI/Check.h"
#include <string.h>
Defines | |
#define | print_pkt_dscs(_dscs, _ndscs) |
#define | print_pkt_dsc_idxs(_idxs, _cids) |
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. | |
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. |
CVS $Id: EBF_dir.c,v 1.16 2009/04/29 17:12:04 russell Exp $
static int __inline add_pkt_dscs | ( | EBF_dirTruncated * | truncated, | |
EBF_pkt * | pkt, | |||
int | pktBytes | |||
) | [static] |
Adds a packet descriptors for truncated events.
>= | The current contributor id | |
<0 | Too many packets |
truncated | The target directory truncated structure | |
pkt | The new event packet to add | |
pktBytes | The number of bytes in the packet |
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.
== | 0, if the TKR is empty | |
!= | 0, If the tracker has hits, the appropriately shift contributor mask |
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 |
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.
== | 0 if the tracker is empty, | |
!= | 0 If the tracker has hits, the appropriately shift contributor mask |
tkr | Pointer to the tracker's layer accept words | |
cidmsk | The contributor mask (left justified, appropriate for TKR usage) |
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.
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 |
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.
dir | The EBF directory | |
cids | The list of TKR and ERR lengths to fill. This is really two 16 bit lists, with the
| |
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 |
int EBF_dirCalTkrReassemble | ( | EBF_dir * | dir, | |
unsigned int | ctids | |||
) |
Reassembles (that is, makes contigious) the specified CAL and TKR contributors.
dir | The directory structure | |
ctids | Bit map of the CAL/TKR contributors to reassemble, (MSB = CAL contributor 0). |
Composes the directory of the contributor descriptors.
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. |
void EBF_dirInit | ( | EBF_dir * | dir | ) |
One-time intialization function for the specified EBF_dir structure.
dir | The directory structure |
int EBF_dirReassemble | ( | EBF_dir * | dir, | |
unsigned int | cids | |||
) |
Reassembles (that is, makes contigious) the specified contributors.
dir | The directory structure | |
cids | Bit map of the contributors to reassemble, (MSB = contributor 0). |
void EBF_dirReset | ( | EBF_dir * | dir | ) |
Resets the specified EBF_dir structure, thus preparing it for the next event.
dir | The directory structure |
int EBF_dirSizeof | ( | void | ) |
Returns the size, in bytes, of an EBF_dir structure.
static __inline int finalize_status | ( | EBF_dir * | dir, | |
unsigned int | cids, | |||
int | elen | |||
) | [static] |
Sets the status when the end of data is reached.
dir | The directory structure | |
cids | The bit mask of contributors | |
elen | The amount of data remaining, may be negative |
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.
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 |
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.
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. |
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.
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. |
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.
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. |
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.
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. |
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.
dir | The EBF directory structure | |
ebw_mismatch | The mismatch fields in the EBW | |
esw_mismatch | The mismatch fields in the ESW |