GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LRA / V5-2-4 > lra / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

LRA_utils.c File Reference

Utility routines for register access. More...

#include <LRA_p.h>
#include <LRA/LRA_msgs.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/MBA.h>
#include <LEM/list.h>
#include <LEM/decode.h>
#include <LCBD/LCBD_rst.h>
#include <LCFG/LCFG.h>
#include <string.h>
#include <LRA/LRA_cmpnt.h>

Defines

#define CHECK_BIT(bit, arr)   ((1 << ((bit) & 0x1f)) & arr[(bit) >> 5])

Functions

unsigned LRA_bufSize (const LRA_regSpec *rSpec, unsigned *size)
 Get the size needed for the returned data buffer.
unsigned LRA_check (int func, const LRA_regSpec *rSpec, const LRA_cmptDesc **desc)
 Validate register operation parameters.
unsigned LRA_lookupBlk (const LRA_cmptDesc *cDesc, const char *bName, int *block)
 Lookup register block in list.
unsigned LRA_maxBufSize (unsigned *size)
 Get the maximum size needed for the register data buffer.
void LRA_decodeAFE (const unsigned short *pkt, unsigned short *value)
 Decode an ACD front-end register value.
void LRA_decodeARC (const unsigned short *pkt, unsigned short *value)
 Decode an ACD readout controller register value.
void LRA_decodeCFE (const unsigned short *pkt, unsigned short *value)
 Decode a calorimeter front-end register value.
void LRA_decodeCRC (const unsigned short *pkt, unsigned short *value)
 Decode a calorimeter readout controller register value.
void LRA_decodeTDC (const unsigned short *pkt, long long *value)
 Decode a tracker DAC register value.
void LRA_decodeTFE (const unsigned short *pkt, long long *value)
 Decode a tracker front-end register value.
void LRA_decodeTRC (const unsigned short *pkt, long long *value)
 Decode a tracker readout controller register value.


Detailed Description

Utility routines for register access.

Author:
Owen H Saxton
$Id: LRA_utils.c,v 1.18 2011/03/28 16:18:25 saxton Exp $

Function Documentation

unsigned LRA_bufSize ( const LRA_regSpec rSpec,
unsigned *  size 
)

Get the size needed for the returned data buffer.

This routine returns the size needed for the buffer used to hold the read register data.

Parameters:
rSpec The specifier for the register(s) to be read
size The address of the returned size, in bytes
Return values:
LRA_SUCCESS Register specifier is valid
LRA_INVCMPT Invalid component number
LRA_INVREG Invalid register number
LRA_INVBLOCK Invalid register block number
LRA_INVTEM Invalid TEM number
LRA_INVCC Invalid cable controller number
LRA_INVRC Invalid readout controller number
LRA_INVFE Invalid front-end number

References _LRA_cmptDesc::bDesc, _LRA_regSpec::block, _LRA_regSpec::cc, _LRA_regSpec::cmpnt, _LRA_regSpec::fe, LRA_ACTIVE, LRA_check(), LRA_FNC_READ, LRA_WILD, _LRA_cmptDesc::maxCc, _LRA_cmptDesc::maxFe, _LRA_cmptDesc::maxRc, _LRA_blkDesc::maxReg, _LRA_cmptDesc::maxTem, _LRA_cmptDesc::nBlock, _LRA_blkDesc::nReg, _LRA_regSpec::rc, _LRA_regSpec::reg, _LRA_blkDesc::rWidth, and _LRA_regSpec::tem.

unsigned LRA_check ( int  func,
const LRA_regSpec rSpec,
const LRA_cmptDesc **  desc 
)

Validate register operation parameters.

The parameters of a register operation are checked for validity.

Parameters:
func The function to be performed.
rSpec The specifier for the register(s).
desc The address of a pointer to receive the address of the component descriptor.
Return values:
LRA_SUCCESS Parameters are valid
LRA_INVCMPT Invalid component number
LRA_INVREG Invalid register number
LRA_INVCNTRL Invalid control operation
LRA_INVBLOCK Invalid register block number
LRA_INVTEM Invalid TEM number
LRA_INVCC Invalid cable controller number
LRA_INVRC Invalid readout controller number
LRA_INVFE Invalid front-end number

References _LRA_cmptDesc::bDesc, _LRA_regSpec::block, _LRA_regSpec::cc, _LRA_blkDesc::cfgMask, _LRA_regSpec::cmpnt, _LRA_cmptDesc::ctlFns, _LRA_regSpec::fe, _LRA_cmptDesc::id, LRA_ACTIVE, LRA_FNC_CONTROL, LRA_FNC_LOAD, LRA_FNC_READ, LRA_MAX_CNTRL, LRA_WILD, _LRA_cmptDesc::maxCc, _LRA_cmptDesc::maxFe, _LRA_cmptDesc::maxRc, _LRA_blkDesc::maxReg, _LRA_cmptDesc::maxTem, _LRA_cmptDesc::nBlock, NELEM, _LRA_regSpec::rc, _LRA_regSpec::reg, _LRA_blkDesc::regMask, and _LRA_regSpec::tem.

Referenced by LRA_bufSize(), LRA_doCtrl(), LRA_doLoad(), and LRA_doRead().

void LRA_decodeAFE ( const unsigned short *  pkt,
unsigned short *  value 
)

Decode an ACD front-end register value.

This routine decodes ACD front-end register data by extracting the register contents from the returned structure.

Referenced by LRA_doRead(), and LRA_doReadEsr().

void LRA_decodeARC ( const unsigned short *  pkt,
unsigned short *  value 
)

Decode an ACD readout controller register value.

This routine decodes ACD readout controller register data by extracting the register contents from the returned structure.

Referenced by LRA_doRead(), and LRA_doReadEsr().

void LRA_decodeCFE ( const unsigned short *  pkt,
unsigned short *  value 
)

Decode a calorimeter front-end register value.

This routine decodes calorimeter front-end register data by extracting the register contents from the returned structure.

Referenced by LRA_doRead().

void LRA_decodeCRC ( const unsigned short *  pkt,
unsigned short *  value 
)

Decode a calorimeter readout controller register value.

This routine decodes calorimeter readout controller register data by extracting the register contents from the returned structure.

Referenced by LRA_doRead(), and LRA_doReadEsr().

void LRA_decodeTDC ( const unsigned short *  pkt,
long long *  value 
)

Decode a tracker DAC register value.

This routine decodes tracker DAC register data by extracting the register contents from the returned structure.

Referenced by LRA_doRead().

void LRA_decodeTFE ( const unsigned short *  pkt,
long long *  value 
)

Decode a tracker front-end register value.

This routine decodes tracker front-end register data by extracting the register contents from the returned structure.

Referenced by LRA_doRead().

void LRA_decodeTRC ( const unsigned short *  pkt,
long long *  value 
)

Decode a tracker readout controller register value.

This routine decodes tracker readout controller register data by extracting the register contents from the returned structure.

Referenced by LRA_doRead(), and LRA_doReadEsr().

unsigned LRA_lookupBlk ( const LRA_cmptDesc cDesc,
const char *  bName,
int *  block 
)

Lookup register block in list.

The register block name is used to locate and return the matching block number in the list of valid blocks for the given component.

Parameters:
cDesc The component descriptor.
bName The register block name.
block The address of an integer to receive the register block number.
Return values:
LRA_SUCCESS Success
LRA_INVBLOCK Invalid register block name

References _LRA_cmptDesc::bDesc, _LRA_blkDesc::name, and _LRA_cmptDesc::nBlock.

unsigned LRA_maxBufSize ( unsigned *  size  ) 

Get the maximum size needed for the register data buffer.

This routine returns the maximum size needed for the buffer used to hold the read register data. It assumes the maximum possible wild carding of the register description.

Parameters:
size The address of the returned maximum size, in bytes
Return values:
LRA_SUCCESS Always success

References _LRA_cmptDesc::bDesc, _LRA_cmptDesc::maxCc, _LRA_cmptDesc::maxFe, _LRA_cmptDesc::maxRc, _LRA_blkDesc::maxReg, _LRA_cmptDesc::maxTem, _LRA_cmptDesc::nBlock, NELEM, _LRA_blkDesc::nReg, and _LRA_blkDesc::rWidth.

Referenced by LRA_initialize().


Generated on Wed Nov 21 20:40:32 2012 by  doxygen 1.5.8