GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > EMP / V1-2-0

Constituent: asc     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

ASC.c File Reference

ACD Software Rate Counters, implementation file. More...

#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"

Include dependency graph for ASC.c:


Data Structures

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 _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.

Detailed Description

ACD Software Rate Counters, implementation file.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: ASC.c,v 1.8 2006/03/01 01:44:41 russell Exp $

SYNOPSIS
Defines the the implementation for accumulating the ACD software rate counters

Define Documentation

#define _ADVANCE _ptr,
_nbytes   )     (void *)((unsigned char *)(_ptr) + (_nbytes))
 

Advances _ptr by _nbytes. The return value is always recast to the type of _ptr.

Parameters:
_ptr The pointer to advance
_nbytes The number of nbytes to advance _ptr by.
Returns:
The advanced pointer, the pointer is recast to a void *.

#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.

Parameters:
_ptr The pointer to advance
Returns:
The advanced pointer, the pointer is recast to a void *.

#define LCB_EXTRACT_CID hdr_clen   )     (((hdr_clen) >> 17) & 0x1f)
 

Extracts the contributor id from the first word of the LCB header.

Parameters:
hdr_clen The first word of the LCB header
Returns:
The contributor id

#define LCB_EXTRACT_CLEN hdr_clen   )     ((hdr_clen) & 0xffff)
 

Extracts the contributor length (in bytes) from the first word of the LCB header.

Parameters:
hdr_clen The first word of the LCB header
Returns:
The contributor's length (in bytes)


Function Documentation

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.

Parameters:
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

static void accumulate_cno ASC_cno cno,
unsigned int  cnoReqvec
[static]
 

Accumulates the number of CNO triggers from each FREE board.

Parameters:
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.

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.

Parameters:
counters The statistics counters
gem Pointer to the GEM record
acd Pointer to an unpacked ACD record
This function is called on the assumption that the GEM record has been located and the ACD data has been both located and successfully unpacked.

int ASC_acd_sizeof void   ) 
 

Returns the size, in bytes, of the data structure needed to hold an unpacked ACD event.

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.

Return values:
A pointer to the AEM contribution.
NULL is return if the AEM contribution cannnot be found
Parameters:
edata Pointer to the event data structure
esize Size, in bytes, of the event

void ASC_clear ASC_counters counters  ) 
 

Clears the specified statistics counters.

Parameters:
counters The statistics counters to be cleared
Warning:
Currently this is a NON-interlocked operation.

const struct _EBF_gem * ASC_gem_locate const unsigned int *  edata,
int  esize
 

Locates GEM contribution in an event.

Return values:
A pointer to the GEM contribution.
NULL is return if the GEM contribution cannnot be found
Parameters:
edata Pointer to the event data structure
esize Size, in bytes, of the event

void clear void *  ptr,
int  nbytes
[static]
 

Zeroes the specified memory.

Parameters:
ptr Pointer to the memory to zero
nbytes The number of bytes to zero
This provides a fast way of zeroing large chunks of memory on PPC platforms using the dcbz instruction. This instruction zeroes a cache line at a time. The savings in speed various by processor, but factors of 5 or more are in the ballpark. For example, on the mv2304, zeroing 32K of memory

On other platforms, the generic memset routine is used.

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.

Returns:
A word that can be used to increment the statistics pattern counter.
Parameters:
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)

static __inline const unsigned int * locate_aem const unsigned int *  evt,
int  elen
[static]
 

Composes the directory of the contributors.

Parameters:
evt The source event.
elen The size of the event in bytes
Returns:
Pointer to the ACD data or NULL if it cannot be located.

static __inline unsigned int prepare unsigned int  w  )  [static]
 

Prepares the initial word of being used in the formation of the pattern word.

Returns:
The prepared word
Parameters:
w The word to prepare
On the PowerPC, 1 instruction in the accumulation loop is saved by preshifting the intial word used in the formation of the pattern word. All other platforms do the straightforward thing of shifting and oring each bit and this routine is a NOOP. By doing defining this routine, the bulk of the code is portable across platforms.


Generated on Mon Oct 16 23:51:00 2006 by  doxygen 1.4.4