GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSE / V2-3-2 > qse / sun-gcc
#include <QSE/QSE_tkrUnpack.h>
#include <QSE/QSE_tkr.h>
#include <QSE/QSE_map.h>
#include <EDS/EBF_tkr.h>
#include <EDS/EBF_dir.h>
#include <EDS/EBF_ctb.h>
#include <PBI/Endianness.h>
#include <PBI/PTR.h>
#include <string.h>
Classes | |
struct | _TKR_2strips_bf |
Maps out the first word containing strip addresses. More... | |
struct | _TKR_8strips0_bf |
Maps out the first word of the 3 strip address pattern words as bit fields. More... | |
struct | _TKR_8strips1_bf |
Maps out the second word of the 3 strip address pattern words as bit fields. More... | |
struct | _TKR_8strips2_bf |
Maps out the third word of the 3 strip address pattern words as bit fields. More... | |
struct | _TKR_2strips |
Maps out the first word containing strip addresses. More... | |
union | _TKR_8strips0 |
Maps out the first word of the 3 strip address pattern words as bit fields and uninterpretted 32-bit integer. More... | |
union | _TKR_8strips1 |
Maps out the second word of the 3 strip address pattern words as bit fields and uninterpretted 32-bit integer. More... | |
union | _TKR_8strips2 |
Maps out the third word of the 3 strip address pattern words as bit fields and uninterpretted 32-bit integer. More... | |
Defines | |
#define | BYTE_ACCESS(_ba, _idx) _ba[_idx]; |
Addresses the TOT oriented byte array in a way that is compatiable with big or little endian machines. | |
#define | INIT_LAYERS(_lyrs, _accepts, _mlayers, _map, _layers, _hiLo, _cnt) |
Process the layer bit masks associated with the either X or Y layers. | |
#define | S2(_d0, _d1) ((_d0.bf.s2a << 4) | _d1.bf.s2b) |
Assembles the 2nd strip address from its two pieces. | |
#define | S5(_d1, _d2) ((_d1.bf.s5a << 8) | _d2.bf.s5b) |
Assembles the 5th strip address from its two pieces. | |
#define | RPROCESS(_strip, _cur, _lyrCnt, _lyr, _lyrs, _n, _c) |
Macro to process a strip address when starting a new cluster. | |
Typedefs | |
typedef struct _TKR_2strips_bf | TKR_2strips_bf |
Typedef for struct _TKR_2strips_bf. | |
typedef struct _TKR_8strips0_bf | TKR_8strips0_bf |
Typedef for struct _TKR_8strips0_bf. | |
typedef struct _TKR_8strips1_bf | TKR_8strips1_bf |
Typedef for struct _TKR_8strips1_bf. | |
typedef struct _TKR_8strips2_bf | TKR_8strips2_bf |
Typedef for struct _TKR_8strips2_bf. | |
typedef union _TKR_2strips | TKR_2strips |
Typedef for struct _TKR_2strips_bf. | |
typedef union _TKR_8strips0 | TKR_8strips0 |
Typedef for union _TKR_8strips0. | |
typedef union _TKR_8strips1 | TKR_8strips1 |
Typedef for union _TKR_8strips1. | |
typedef union _TKR_8strips2 | TKR_8strips2 |
Typedef for union _TKR_8strips2. | |
Functions | |
static int | init (QSE_tkrTwr *twr, QSE_tkrLyr *lyrsBuf[72], unsigned int a0, unsigned int a1, unsigned int a2) |
Initializes/extracts the layer information from the accept masks. | |
static void | unpackTots (QSE_tkrTwr *twr, const unsigned char *tots) |
Unpacks the TOTs. | |
static int | unpackTwr (QSE_tkrTwr *twr, const EBF_tkr *tkr, int maxwrds) |
Unpacks the data from one tower. | |
int | QSE_tkrUnpack (QSE_tkr *tkr, const EBF_dir *dir) |
Driver routine to unpack the specified TKR towers. | |
int | QSE_tkrUnpackInit (QSE_tkr *tkr) |
Performs one time initialization of a Track LAT record. | |
int | QSE_tkrUnpackSizeof (void) |
Returns the size, in bytes, of a QSE_tkr. | |
Variables | |
static const unsigned char | Map [18] |
The mapping of the entries in the layer accept list to the physical layer numbers. |
CVS $Id: QSE_tkrUnpack.c,v 1.7 2011/03/27 01:45:45 russell Exp $
#define BYTE_ACCESS | ( | _ba, | |||
_idx | ) | _ba[_idx]; |
Addresses the TOT oriented byte array in a way that is compatiable with big or little endian machines.
_ba | the byte array to access | |
_idx | The value to be transformed |
Referenced by unpackTots().
#define INIT_LAYERS | ( | _lyrs, | |||
_accepts, | |||||
_mlayers, | |||||
_map, | |||||
_layers, | |||||
_hiLo, | |||||
_cnt | ) |
Value:
{ \ _mlayers = 0; \ while (_accepts) \ { \ int n; \ int layerNum; \ QSE_tkrLyr *layer; \ \ n = QSE_mapScanR (_accepts); \ _accepts = QSE_mapRemove (_accepts, n^31); \ layerNum = _map[n]; \ layer = &_layers[layerNum]; \ *_lyrs++ = layer; \ \ /* KLUDGE */ \ layer->tots[_hiLo] = _cnt; \ layer->nstrips = 0; \ _mlayers |= 1 << layerNum; \ _cnt += 1; \ } \ }
_lyrs | An array which receives the address of the layer structure for each of the struck layers. | |
_accepts | The 18 bits representing on end of the layers | |
_mlayers | Bit mask of the struck y layers in layer order, as opposed to readin order of the _accepts. | |
_map | A an array mapping readin bit position order to the canonical layer order. | |
_layers | The array layer structures. | |
_hiLo | 0 is doing the low end, 1 is doing the high end | |
_cnt | Current number of active layers |
Referenced by init().
#define RPROCESS | ( | _strip, | |||
_cur, | |||||
_lyrCnt, | |||||
_lyr, | |||||
_lyrs, | |||||
_n, | |||||
_c | ) |
Value:
{ \ int adr = _strip; \ \ /* Store the strip, without the terminator */ \ *_cur++ = adr & ~(1 << 11); \ \ /* Check if their was a terminator */ \ if ((adr & (1 << 11))) \ { \ int cnt; \ QSE_tkrStrip *beg; \ \ /* Do the usual end of layer processing */ \ _lyrCnt -= 1; \ beg = _lyr->beg; \ cnt = _cur - beg; \ _lyr->nsplit = _lyr->nstrips; \ _lyr->nstrips = cnt; \ \ /* Is this the last layer ? */ \ if (_lyrCnt <= 0) { _c = _n; break; } \ \ _lyr = *_lyrs++; \ _cur = _lyr->beg + _lyr->nstrips; \ } \ }
_strip | The strip address to process | |
_cur | Current address to store the strip address. | |
_lyrCnt | Number of layers left to process. | |
_lyr | The current QSE_tkrTwr layer address | |
_lyrs | A stack of the QSE_tkrTwr layer addresses. may be a member of the strips in progress | |
_n | The number of strips processed in the current group of 8 This number may be negative | |
_c | Returned as _n if hit the last strip |
Referenced by unpackTwr().
#define S2 | ( | _d0, | |||
_d1 | ) | ((_d0.bf.s2a << 4) | _d1.bf.s2b) |
Assembles the 2nd strip address from its two pieces.
_d0 | The 32 bit word holding the upper 8 bits of the strip address | |
_d1 | The 32 bit word holding the lower 4 bits of the strip address |
Referenced by QSE_aemRepack(), and unpackTwr().
#define S5 | ( | _d1, | |||
_d2 | ) | ((_d1.bf.s5a << 8) | _d2.bf.s5b) |
Assembles the 5th strip address from its two pieces.
_d1 | The 32 bit word holding the upper 4 bits of the strip address | |
_d2 | The 32 bit word holding the lower 8 bits of the strip address |
Referenced by unpackTwr().
Typedef for struct _TKR_2strips_bf.
The first 32-bit word containing strip addresses also contains the last 8 bits of the accept list. This structure maps these fields out as both an uninterpreted 32 bit value and as bit fields for easy access.
Typedef for struct _TKR_2strips_bf.
The first 32-bit word containing strip addresses also contains the last 8 bits of the accept list. This structure maps these fields out for easy access.
int init | ( | QSE_tkrTwr * | twr, | |
QSE_tkrLyr * | lyrsBuf[72], | |||
unsigned int | a0, | |||
unsigned int | a1, | |||
unsigned int | a2 | |||
) | [static] |
Initializes/extracts the layer information from the accept masks.
twr | The TKR tower record | |
lyrsBuf | Buffer to hold a pointer to a pointer to the next layer structure to receive the unpacked hits | |
a0 | The first of the 3 accept masks | |
a1 | The second of the 3 accept masks | |
a2 | The last of the 3 accept masks |
References INIT_LAYERS, _QSE_tkrTwr::lecnt, _QSE_tkrTwr::lexycnts, _QSE_tkrTwr::loHiLyrMaps, _QSE_tkrTwr::lyrMaps, _QSE_tkrTwr::lyrs, Map, and _QSE_tkrTwr::xyLoHiCnts.
Referenced by unpackTwr().
int QSE_tkrUnpack | ( | QSE_tkr * | tkr, | |
const EBF_dir * | dir | |||
) |
Driver routine to unpack the specified TKR towers.
tkr | The QSE_tkr record structure to receive the unpacked data | |
dir | The standard directory structure allowing the routine to traverse the LAT event record. |
References _QSE_tkr::map, _QSE_tkr::nstrips, QSE_mapRemove(), QSE_mapScanR(), _QSE_tkr::twrs, and unpackTwr().
int QSE_tkrUnpackInit | ( | QSE_tkr * | tkr | ) |
Performs one time initialization of a Track LAT record.
tkr | Pointer to the structure to initialize |
References _QSE_tkrLyr::beg, _QSE_tkrTwr::lyrs, _QSE_tkr::map, _QSE_tkr::nstrips, _QSE_tkrLyr::num, _QSE_tkrTwr::num, QSE_TKR_K_STRIPS_PER_LAYER_MAX, _QSE_tkr::strips, _QSE_tkrLyr::twr, and _QSE_tkr::twrs.
int QSE_tkrUnpackSizeof | ( | void | ) |
Returns the size, in bytes, of a QSE_tkr.
After allocating an QSE_tkr structure, the structure should be initialized using QSE_tkrUnpackInit().
static void unpackTots | ( | QSE_tkrTwr * | twr, | |
const unsigned char * | tots | |||
) | [static] |
Unpacks the TOTs.
twr | The target tower | |
tots | The TOT data |
References BYTE_ACCESS, _QSE_tkrLyr::hiLo, _QSE_tkrTwr::loHiLyrMaps, _QSE_tkrTwr::lyrs, QSE_mapRemove(), QSE_mapScanf(), and _QSE_tkrLyr::tots.
Referenced by unpackTwr().
int unpackTwr | ( | QSE_tkrTwr * | twr, | |
const EBF_tkr * | tkr, | |||
int | maxwrds | |||
) | [static] |
Unpacks the data from one tower.
The number of strips on this tower
twr | Pointer to the data structure to receive the unpacked data | |
tkr | The tracker data as received from the hardware | |
maxwrds | The maximum number of words in tkr. |
References _QSE_tkrLyr::beg, _TKR_8strips1::bf, _TKR_8strips0::bf, _TKR_8strips2::bf, init(), _QSE_tkrTwr::nstrips, RPROCESS, _TKR_8strips0_bf::s0, _TKR_8strips0_bf::s1, S2, _TKR_8strips1_bf::s3, _TKR_8strips1_bf::s4, S5, _TKR_8strips2_bf::s6, _TKR_8strips2_bf::s7, _TKR_8strips1::ui, _TKR_8strips0::ui, _TKR_8strips2::ui, and unpackTots().
Referenced by QSE_tkrUnpack().
Map [static] |
Initial value:
{ 1, 3, 5, 7, 9, 11, 13, 15, 17, 0, 2, 4, 6, 8, 10, 12, 14, 16 }
The accept list is processed as 4 pairs of cables. The first cable of the pair carries the even layers, the second carries the odd layers. The 4 pairs represent the X lo, X hi and Y lo, Y hi cable pairs. In general one would need to map all 72 layer ends, but because all cable pairs are identical, so the same map can be used for each.
This mapping could have been easily handled in the INIT_LAYERS macro, but the cost would have been some additional arthimetic. The current set bit would have to be translated into a layer number by doubling it and adding 1 iff the current bit was greater than 8. The lookup method seems simpler and faster.
Referenced by init().