GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EMP / V1-4-1 > asc / rhel5-32
#include <string.h>
#include <PBS/FFS.ih>
#include <PBI/Endianness.h>
#include <EMP/ASC.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_gem.h>
#include <EDS/EDA_acd.h>
#include <EDS/EDR_acd.h>
#include <EMP/ASC_pubdefs.h>
Classes | |
struct | _LCB_header |
Layouts out the header for an LCB packet. The header is represented in terms of 32-bit quantities to avoid BIG/ LITTLE endian problems. More... | |
Defines | |
#define | LCB_M_PACKET_ALIGN 0xf |
The size of a contributor must be an even multiple of this number. Currently an LCB packet is 128 bits or 16 bytes. This means that the low nibble of each length contributor's field must be zero. | |
#define | LCB_EXTRACT_CID(hdr_clen) (((hdr_clen) >> 17) & 0x1f) |
Extracts the contributor id from the first word of the LCB header. | |
#define | LCB_EXTRACT_CLEN(hdr_clen) ((hdr_clen) & 0xffff) |
Extracts the contributor length (in bytes) from the first word of the LCB header. | |
#define | _ADVANCE(_ptr, _nbytes) (void *)((unsigned char *)(_ptr) + (_nbytes)) |
Advances _ptr by _nbytes. The return value is always recast to the type of _ptr. | |
#define | _SKIP_EHDR(_ptr) (void *)((unsigned char *)(_ptr)+sizeof(LCB_header)) |
Skips over the event header (LATp header + summary word) recast to the type of _ptr. | |
Typedefs | |
typedef struct _LCB_header | LCB_header |
Typedef for struct _LCB_header. | |
Functions | |
static void | clear (void *ptr, int nbytes) |
Zeroes the specified memory. | |
static void | accumulate_cno (ASC_cno *cno, unsigned int cnoReqVec) |
Accumulates the number of CNO triggers from each FREE board. | |
static void | accumulate (ASC_list *list, unsigned int v, unsigned int hb, unsigned int ha, unsigned int pb, unsigned int pa) |
Accumulates the statistics for list (32-bits) of ACD hits. | |
static __inline unsigned int | prepare (unsigned int w) |
Prepares the initial word of being used in the formation of the pattern word. | |
static __inline const unsigned int * | locate_aem (const unsigned int *evt, int elen) |
Composes the directory of the contributors. | |
static __inline unsigned int | form (unsigned int v, unsigned int hb, unsigned int ha, unsigned int pb, unsigned int pa, int left) |
Forms the 5 bit pattern word from the bits in column left and appropriately shifts the pattern word so that it may be used directly as a byte offset into the correct statistics counters. | |
void | ASC_clear (ASC_counters *counters) |
Clears the specified statistics counters. | |
void | ASC_accumulateU (ASC_counters *counters, const struct _EBF_gem *gem, const struct _EDR_acd *acd) |
Accumulates the proper pattern words for each ACD hit. | |
const __inline struct _EBF_gem * | ASC_gem_locate (const unsigned int *edata, int esize) |
Locates GEM contribution in an event. | |
const __inline unsigned int * | ASC_aem_locate (const unsigned int *edata, int esize) |
Locates AEM contribution in an event. | |
int | ASC_acd_sizeof (void) |
Returns the size, in bytes, of the data structure needed to hold an unpacked ACD event. |
CVS $Id: ASC.c,v 1.10 2011/03/26 20:07:42 russell Exp $
#define _ADVANCE | ( | _ptr, | |||
_nbytes | ) | (void *)((unsigned char *)(_ptr) + (_nbytes)) |
Advances _ptr by _nbytes. The return value is always recast to the type of _ptr.
_ptr | The pointer to advance | |
_nbytes | The number of nbytes to advance _ptr by. |
Referenced by locate_aem().
#define _SKIP_EHDR | ( | _ptr | ) | (void *)((unsigned char *)(_ptr)+sizeof(LCB_header)) |
Skips over the event header (LATp header + summary word) recast to the type of _ptr.
_ptr | The pointer to advance |
Referenced by ASC_gem_locate().
#define LCB_EXTRACT_CID | ( | hdr_clen | ) | (((hdr_clen) >> 17) & 0x1f) |
Extracts the contributor id from the first word of the LCB header.
hdr_clen | The first word of the LCB header |
Referenced by ASC_gem_locate(), and locate_aem().
#define LCB_EXTRACT_CLEN | ( | hdr_clen | ) | ((hdr_clen) & 0xffff) |
Extracts the contributor length (in bytes) from the first word of the LCB header.
hdr_clen | The first word of the LCB header |
Referenced by locate_aem().
static void accumulate | ( | ASC_list * | list, | |
unsigned int | v, | |||
unsigned int | hb, | |||
unsigned int | ha, | |||
unsigned int | pb, | |||
unsigned int | pa | |||
) | [static] |
Accumulates the statistics for list (32-bits) of ACD hits.
list | Pointer to the statistics for this list of ACD hits | |
v | The GEM list of veto bits | |
hb | The ACD hit bits for side b | |
ha | The ACD hit bits for side a | |
pb | The ACD pulse height accept bits for side b | |
pa | The ACD pulse height accept bits for side a |
References _ASC_list::chns, form(), and prepare().
Referenced by ASC_accumulateU().
static void accumulate_cno | ( | ASC_cno * | cno, | |
unsigned int | cnoReqvec | |||
) | [static] |
Accumulates the number of CNO triggers from each FREE board.
cno | The CNO statistics block | |
cnoReqvec | The CNO and trigger request vector. The CNO trigger information occupies the lower 12 of the upper 16 bits. |
References _ASC_cno::cnts.
Referenced by ASC_accumulateU().
void ASC_accumulateU | ( | ASC_counters * | counters, | |
const struct _EBF_gem * | gem, | |||
const struct _EDR_acd * | acd | |||
) |
Accumulates the proper pattern words for each ACD hit.
counters | The statistics counters | |
gem | Pointer to the GEM record | |
acd | Pointer to an unpacked ACD record |
References accumulate(), accumulate_cno(), ASC_SUMMARY_AEM_ERR__GEM_MISS, ASC_SUMMARY_AEM_ERR__GEM_OKAY, ASC_SUMMARY_AEM_MISS_GEM_MISS, ASC_SUMMARY_AEM_MISS_GEM_OKAY, ASC_SUMMARY_AEM_OKAY_GEM_MISS, ASC_SUMMARY_AEM_OKAY_GEM_OKAY, _ASC_counters::cno, _ASC_counters::gec, _ASC_cnts::lists, and _ASC_counters::summary.
Referenced by AscEdsProcess().
int ASC_acd_sizeof | ( | void | ) |
Returns the size, in bytes, of the data structure needed to hold an unpacked ACD event.
const __inline unsigned int* ASC_aem_locate | ( | const unsigned int * | edata, | |
int | esize | |||
) |
Locates AEM contribution in an event.
A | pointer to the AEM contribution. | |
NULL | is return if the AEM contribution cannnot be found |
edata | Pointer to the event data structure | |
esize | Size, in bytes, of the event |
References locate_aem().
Referenced by set_aem().
void ASC_clear | ( | ASC_counters * | counters | ) |
const struct _EBF_gem * ASC_gem_locate | ( | const unsigned int * | edata, | |
int | esize | |||
) | [read] |
Locates GEM contribution in an event.
A | pointer to the GEM contribution. | |
NULL | is return if the GEM contribution cannnot be found |
edata | Pointer to the event data structure | |
esize | Size, in bytes, of the event |
References _SKIP_EHDR, and LCB_EXTRACT_CID.
void clear | ( | void * | ptr, | |
int | nbytes | |||
) | [static] |
Zeroes the specified memory.
The ACD data structure consists of the standard header word followed by 3 major blocks. The first two blocks, the veto hit map and the accept block are fixed length. The final block is a variable length block containing the ADC pulse values. The number of ADC values is determined by the count field in the accept block.
Header Word Event sequence number and contributor id Veto Hit Map One 18 bit vector for each of the 12 ACD FREE boards Accept Block One 24 bit vector for each of the 12 ACD FREE boards ACD ADCs The ACD ADC pulse values, variable length.
Veto Hit Map
The Veto Hit Map is packed densely into 7 32 bit words. There is one unused byte at the end. Picturally this block looks like
11111111 11111111 fedcba98 76543210 fedcba98 76543210 +--------+--------+--------+--------+ 0 |11111111 11111100 00000000 00000000| 1 |33333333 33222222 22222222 22221111| 2 |55555544 44444444 44444444 333333331 3 |77666666 66666666 66665555 55555555| 4 |88888888 88888888 77777777 77777777| 5 |AAAAAAAA AAAA9999 99999999 99999988| 6 |-------- BBBBBBBB BBBBBBBB BBAAAAAA| +--------+--------+--------+--------+
Where the numbers represent the 12 ADC FREE boards. (Note that each string of numbers has 18 bits.
ADC Accept Block
The Accept block is a densely packed array of words 24 bits in length. Each 24 bit word is formatted as follows
11111111 76543210 fedcba98 76543210 +--------+--------+--------+ |aaaaaaaa aaaaaaaa aaCccccc| +--------+--------+--------+
Where
c( 5 bits) Count of number of ADC accepted for this board. Because the number of ADCs from the ACD can be limited, this count must be less than or equal to the number of bits set in accept mask. C( 1 bit ) The CNO bit for this board. a(18 bits) A bit map of the number of pulse heights over threshold on this board. If the number of bits exceeds the count (c) then only the first 'count' are present in the ADC array.
These 12 Accept vectors are packed densely into 9 32 bit words.
11111111 11111111 fedcba98 76543210 fedcba98 76543210 +--------+--------+--------+--------+ 0 |11111111 00000000 00000000 00000000| 1 |22222222 22222222 11111111 11111111| 2 |33333333 33333333 33333333 222222221 3 |55555555 44444444 44444444 44444444| 4 |66666666 66666666 55555555 55555555| 5 |77777777 77777777 77777777 66666666| 6 |99999999 88888888 88888888 88888888| 7 |aaaaaaaa aaaaaaaa 99999999 99999999| 8 |bbbbbbbb bbbbbbbb bbbbbbbb aaaaaaaa| +--------+--------+--------+--------+
Again the numbers represent the accept words for each of the 12 ACD FREE boards.
ACD ADC Pulse Heights
Each ACD ADC pulse height is 16 bits in length. The total number of ADC values is determined by the count field in the accept word. The mapping is determined by accept map in each accept word. Only the first count bits of ADC values are used. That is, if there are more bits set in the accept map, there will be only count number of ADC pulse heights from this board.
ptr | Pointer to the memory to zero | |
nbytes | The number of bytes to zero |
On other platforms, the generic memset routine is used.
Referenced by ASC_clear().
unsigned int form | ( | unsigned int | v, | |
unsigned int | hb, | |||
unsigned int | ha, | |||
unsigned int | pb, | |||
unsigned int | pa, | |||
int | left | |||
) | [static] |
Forms the 5 bit pattern word from the bits in column left and appropriately shifts the pattern word so that it may be used directly as a byte offset into the correct statistics counters.
v | The GEM list of veto bits | |
hb | The ACD hit bits for side b | |
ha | The ACD hit bits for side a | |
pb | The ACD pulse height accept bits for side b | |
pa | The ACD pulse height accept bits for side a | |
left | The bit number of the channel (counting from the left or MSB) |
Referenced by accumulate().
static __inline const unsigned int * locate_aem | ( | const unsigned int * | evt, | |
int | elen | |||
) | [static] |
Composes the directory of the contributors.
evt | The source event. | |
elen | The size of the event in bytes |
References _ADVANCE, LCB_EXTRACT_CID, and LCB_EXTRACT_CLEN.
Referenced by ASC_aem_locate().
static __inline unsigned int prepare | ( | unsigned int | w | ) | [static] |
Prepares the initial word of being used in the formation of the pattern word.
w | The word to prepare |
Referenced by accumulate().