GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LRA / V5-2-0 > lra / rad750


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 "LATC/latc.h"
#include <string.h>
#include "LRA/LRA_cmpnt.h"

Defines

#define CHECK_BIT(bit, arr)   ((1 << ((bit) & 0x1f)) & arr[(bit) >> 5])
#define RNDUP_CL(nb)   ((nb + LCBD_CL_ALIGN - 1) & ~(LCBD_CL_ALIGN - 1))
#define RNDUP_RL(nb)   ((nb + LCBD_RL_ALIGN - 1) & ~(LCBD_RL_ALIGN - 1))
#define RNDUP_DL(nb)   ((nb + 3) & ~3)
#define PAD_CL(nb)   (LCBD_RNDDOWN_TO_CACHELINE(nb) + LCBD_CL_PAD)

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_initCrl (void *lists, unsigned int len, LEM_micr *crl)
 Initialize a multi-item command/response list.
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.15 2009/07/31 22:05:22 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

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

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.

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.

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.

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.

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.

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.

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.

unsigned LRA_initCrl ( void *  lists,
unsigned int  len,
LEM_micr *  crl 
)

Initialize a multi-item command/response list.

This routine optimally assigns portions of a supplied region to the various components of a LEM-style multi-item command/response list, and initializes the supplied list anchor block.

Because of RAD750 hardware restrictions, the assigned command list, rounded down to a cache line boundary (32-byte aligned) then extended by six cache lines (192 bytes), must not be accessed by the CPU while the operation is in progress. The result list, on the other hand, cannot have simultaneous CPU acces of the first six cache lines beyond the beginning of the list proper. These restrictions mean that the effective length of these lists is increased when determining whether they fit within the supplied region, but impose no extra restrictions on the relative arrangement of the three lists within the region.

Parameters:
lists The address of the region to be used.
len The length of the region to be used.
crl The address of the list's anchor block to be filled.
Return values:
LRA_SUCCESS Success
LRA_CRLSMALL Region too small for a MICR

CDR

CRD

DCR

DRC

RCD

RDC

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

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


Generated on Fri Jul 31 15:37:09 2009 by  doxygen 1.5.3