GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LRA / V5-2-1 > lra / mv2304
#include "LRA/LRA.h"
#include "PBS/FPA.h"
#include "PBS/MTX.h"
#include "PBS/SEM.h"
#include "PBS/WUT.h"
#include "ITC/ITC_pubdefs.h"
#include "IMM/RBM_pubdefs.h"
#include "LEM/list.h"
Classes | |
struct | _LRA_return |
Request return block. More... | |
struct | _LRA_cmdList |
Command list structure. More... | |
struct | _LRA_rspList |
Response list structure. More... | |
struct | _LRA_dataItem |
Read data item structure. More... | |
struct | _LRA_dcdItem |
Decode list item structure. More... | |
struct | _LRA_crl |
struct | _LRA_sregData |
Structure to hold raw statistics registers. More... | |
struct | _LRA_crReg |
Command/response statistics register. More... | |
struct | _LRA_rcvReg |
Receive statistics register. More... | |
struct | _LRA_xmtReg |
Transmit statistics register. More... | |
struct | _LRA_aemCstReg |
AEM common status register. More... | |
struct | _LRA_aemFstReg |
AEM FREE board status register. More... | |
struct | _LRA_aemTstReg |
AEM trigger message statistics register. More... | |
struct | _LRA_temStReg |
TEM status register. More... | |
struct | _LRA_ticStReg |
TIC status register. More... | |
struct | _LRA_cccStReg |
CCC status register. More... | |
struct | _LRA_tccStReg |
TCC status register. More... | |
struct | _LRA_control |
Control structure. More... | |
struct | _LRA_whiteBox |
White-box access structure. More... | |
Defines | |
#define | NELEM(x) (sizeof x / sizeof x[0]) |
Array size macro. | |
Typedefs | |
typedef enum _LRA_function | LRA_function |
Function codes. | |
typedef enum _LRA_miscP | LRA_miscP |
Miscellaneous private constants. | |
typedef enum _LRA_gctWidth | LRA_gctWidth |
GEM counter register widths. | |
typedef struct _LRA_return | LRA_return |
Request return block. | |
typedef struct _LRA_cmdList | LRA_cmdList |
Command list structure. | |
typedef struct _LRA_rspList | LRA_rspList |
Response list structure. | |
typedef void(* | LRA_decodeFn )(const unsigned short *pkt, void *data) |
Decode function type. | |
typedef struct _LRA_dataItem | LRA_dataItem |
Read data item structure. | |
typedef struct _LRA_dcdItem | LRA_dcdItem |
Decode list item structure. | |
typedef struct _LRA_crl | LRA_crl |
Command/response list anchor block. | |
typedef struct _LRA_sregData | LRA_sregData |
Structure to hold raw statistics registers. | |
typedef struct _LRA_crReg | LRA_crReg |
Command/response statistics register. | |
typedef struct _LRA_rcvReg | LRA_rcvReg |
Receive statistics register. | |
typedef struct _LRA_xmtReg | LRA_xmtReg |
Transmit statistics register. | |
typedef struct _LRA_aemCstReg | LRA_aemCstReg |
AEM common status register. | |
typedef struct _LRA_aemFstReg | LRA_aemFstReg |
AEM FREE board status register. | |
typedef struct _LRA_aemTstReg | LRA_aemTstReg |
AEM trigger message statistics register. | |
typedef struct _LRA_temStReg | LRA_temStReg |
TEM status register. | |
typedef struct _LRA_ticStReg | LRA_ticStReg |
TIC status register. | |
typedef struct _LRA_cccStReg | LRA_cccStReg |
CCC status register. | |
typedef struct _LRA_tccStReg | LRA_tccStReg |
TCC status register. | |
typedef struct _LRA_control | LRA_control |
Control structure. | |
typedef unsigned | LRA_fnCheck (int func, const LRA_regSpec *rSpec, const LRA_cmptDesc **desc) |
Typedefs for private functions. | |
typedef void | LRA_fnDecodeAFE (const unsigned short *pkt, unsigned short *value) |
typedef void | LRA_fnDecodeARC (const unsigned short *pkt, unsigned short *value) |
typedef void | LRA_fnDecodeCFE (const unsigned short *pkt, unsigned short *value) |
typedef void | LRA_fnDecodeCRC (const unsigned short *pkt, unsigned short *value) |
typedef void | LRA_fnDecodeTDC (const unsigned short *pkt, long long *value) |
typedef void | LRA_fnDecodeTFE (const unsigned short *pkt, long long *value) |
typedef void | LRA_fnDecodeTRC (const unsigned short *pkt, long long *value) |
typedef unsigned | LRA_fnDoCtrl (LEM_micr *crl, const LRA_regSpec *rSpec) |
typedef unsigned | LRA_fnDoLam (LEM_micr *crl, unsigned cmpt, unsigned tem) |
typedef unsigned | LRA_fnDoLamLcb (LEM_micr *crl, unsigned cmpt, unsigned value, unsigned mask) |
typedef unsigned | LRA_fnDoLoad (LEM_micr *crl, const LRA_regSpec *rSpec, const long long *value) |
typedef unsigned | LRA_fnDoRead (LEM_micr *crl, const LRA_regSpec *rSpec, LRA_regData *data) |
typedef unsigned | LRA_fnDoReadEsr (LEM_micr *crl, LRA_esrData *esr) |
typedef unsigned | LRA_fnDoSend (const LRA_regSpec *rSpec, int ssr) |
typedef unsigned | LRA_fnDoSendEsr (void) |
typedef unsigned | LRA_fnDoSendStats (void) |
typedef unsigned | LRA_fnFreeStats (LRA_control *ctrl) |
typedef unsigned | LRA_fnInitStats (LRA_control *ctrl) |
typedef unsigned | LRA_fnGetCtrl (LRA_control **ctrl) |
typedef unsigned | LRA_fnProcess (void *prm, const ITC_QueueItem *qItem, void *pay, unsigned len) |
typedef unsigned | LRA_fnUpdateStats (LRA_control *ctrl, int clear) |
typedef struct _LRA_whiteBox | LRA_whiteBox |
White-box access structure. | |
Enumerations | |
enum | _LRA_function { LRA_FNC_READ = 0, LRA_FNC_LOAD = 1, LRA_FNC_CONTROL = 2, LRA_FNC_SEND = 10, LRA_FNC_SENDESR = 11, LRA_FNC_SENDSTATS = 12 } |
Function codes. More... | |
enum | _LRA_miscP { LRA_NUM_RQSTS = 4, LRA_NUM_UPDATE = 1, LRA_NUM_PKTS = 10, LRA_MAX_DATA = 4096, LRA_NUM_DGMS = 5, LRA_MAX_CNTRL = 15, LRA_MAX_CRL = 160, LRA_CTR_OFLOW = 0x3fff, LRA_DFLT_PRD = 100, LRA_DFLT_TEMS = 0xffff } |
Miscellaneous private constants. More... | |
enum | _LRA_gctWidth { LRA_GCW_TIMEBASE = 25, LRA_GCW_LIVETIME = 25, LRA_GCW_PRESCALE = 24, LRA_GCW_DISCARD = 24, LRA_GCW_SENT = 16, LRA_GCW_DEADZONE = 16 } |
GEM counter register widths. More... | |
Functions | |
unsigned | LRA_check (int func, const LRA_regSpec *rSpec, const LRA_cmptDesc **desc) |
Validate register operation parameters. | |
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. | |
unsigned | LRA_doCtrl (LEM_micr *crl, const LRA_regSpec *rSpec) |
Internal routine to handle a control operation request. | |
unsigned | LRA_doLam (LEM_micr *crl, unsigned cmpt, unsigned tem) |
Internal routine to handle a look-at-me request. | |
unsigned | LRA_doLamLcb (LEM_micr *crl, unsigned cmpt, unsigned value, unsigned mask) |
Internal routine to handle a look-at-me request directed to an LCB. | |
unsigned | LRA_doLoad (LEM_micr *crl, const LRA_regSpec *rSpec, const long long *value) |
Internal routine to handle a register load request. | |
unsigned | LRA_doRead (LEM_micr *crl, const LRA_regSpec *rSpec, LRA_regData *data) |
Internal routine to handle a register read request. | |
unsigned | LRA_doReadEsr (LEM_micr *crl, LRA_esrData *esr) |
Internal routine to read the error and status registers. | |
unsigned | LRA_doSend (const LRA_regSpec *rSpec, int ssr) |
Send register data to the spacecraft. | |
unsigned | LRA_doSendEsr (void) |
Send ESR data to the spacecraft. | |
unsigned | LRA_doSendStats (void) |
Send statistics data to the spacecraft. | |
unsigned | LRA_freeStats (LRA_control *ctrl) |
Free statistics processing resources. | |
unsigned | LRA_initStats (LRA_control *ctrl) |
Initialize for statistics processing. | |
unsigned | LRA_getCtrl (LRA_control **ctrl) |
Get the control structure address. | |
unsigned | LRA_process (void *prm, const ITC_QueueItem *qItem, void *pay, unsigned len) |
Process a received request. | |
unsigned | LRA_updateStats (LRA_control *ctrl, int clear) |
Update the register statistics. |
$Id: LRA_p.h,v 1.13 2009/08/14 17:07:21 saxton Exp $
enum _LRA_function |
Function codes.
enum _LRA_gctWidth |
enum _LRA_miscP |
Miscellaneous private constants.
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.
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. |
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_doCtrl | ( | LEM_micr * | crl, | |
const LRA_regSpec * | rSpec | |||
) |
Internal routine to handle a control operation request.
The specified control operation is performed on the specified component.
crl | The address of a multi-item command/response list to be used in the register operations. | |
rSpec | The register specifier, specifying which instances of which component are to be operated on. It contains the component, the register block (EBM only), the TEM number, cable controller number, readout controller number, front-end number, and control function. The TEM, CC, RC and FE may be set individually to the value LRA_WILD to cause the operation to be performed on all instances. |
LRA_SUCCESS | The operation was successful | |
LRA_INVCMPT | Invalid component number | |
LRA_INVCNTRL | Invalid control operation | |
LRA_INVTEM | Invalid TEM number | |
LRA_INVCC | Invalid cable controller number | |
LRA_INVRC | Invalid readout controller number | |
LRA_INVFE | Invalid front-end number | |
LCBD_RTOERR | Operation timed out |
unsigned LRA_doLam | ( | LEM_micr * | crl, | |
unsigned | cmpnt, | |||
unsigned | tem | |||
) |
Internal routine to handle a look-at-me request.
This routine sends a look-at-me to the specified component.
crl | The address of a multi-item command/response list to be used in the register operations. | |
cmpnt | The ID of the component to be sent a look-at-me | |
tem | The TEM number to use if the component is TEM |
LRA_SUCCESS | The operation was successful | |
LRA_INVCMPT | Invalid component number | |
LRA_INVTEM | Invalid TEM number | |
LCBD_RTOERR | Operation timed out |
unsigned LRA_doLamLcb | ( | LEM_micr * | crl, | |
unsigned | cmpnt, | |||
unsigned | value, | |||
unsigned | mask | |||
) |
Internal routine to handle a look-at-me request directed to an LCB.
This routine sends a look-at-me to the specified LCB component.
crl | The address of a multi-item command/response list to be used in the register operations. | |
cmpnt | The ID of the LCB component to be sent a look-at-me | |
value | The value to be sent | |
mask | The mask specifying which bits of value to use |
LRA_SUCCESS | The operation was successful | |
LRA_INVCMPT | Invalid component number | |
LCBD_RTOERR | Operation timed out |
unsigned LRA_doLoad | ( | LEM_micr * | crl, | |
const LRA_regSpec * | rSpec, | |||
const long long * | value | |||
) |
Internal routine to handle a register load request.
This routine loads the specified value into one or more instances of the specified register.
crl | The address of a multi-item command/response list to be used in the register operations. | |
rSpec | The register specifier, specifying which register (or set of registers) is (are) to be loaded. This contains the device, the register block, the TEM number, cable controller number, readout controller number, front-end number, and register number. The four parameters tem, cc, rc and fe may be set individually to the value LRA_WILD to cause the value to be loaded in all places. | |
value | The address of the value to be loaded into the specified instances of the register. |
LRA_SUCCESS | Load was successful | |
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 | |
LCBD_RTOERR | Operation timed out |
unsigned LRA_doRead | ( | LEM_micr * | crl, | |
const LRA_regSpec * | rSpec, | |||
LRA_regData * | data | |||
) |
Internal routine to handle a register read request.
This routine reads one or more instances of the specified register into the supplied data area.
crl | The address of a multi-item command/response list to be used in the register operations. | |
rSpec | The register specifier, specifying which register (or set of registers) is (are) to be read. This contains the component, the register block, the TEM number, cable controller number, readout controller number, front-end number, and register number. The latter five parameters may be set individually to the value LRA_WILD to cause all values to be used. | |
data | The address of an area to receive the read register values. This is a formatted block designed to be almost stand-alone. It contains the register specifier, counts of the number of values used for each of the last five parameters, the size of each register value, and the array of register values arranged with outer loop to inner loop ordered TEM, CC, RC, FE and register. |
LRA_SUCCESS | Read was successful | |
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 | |
LCBD_RTOERR | Operation timed out |
unsigned LRA_doReadEsr | ( | LEM_micr * | crl, | |
LRA_esrData * | esr | |||
) |
Internal routine to read the error and status registers.
This routine reads and stores the contents of a pre-determined set of LAT error and status registers. No error is produced if any of the reads times out.
crl | The address of a multi-item command/response list to be used in the register operations. | |
esr | The address of an area to receive the register values |
LRA_SUCCESS | The registers were read successfully |
unsigned LRA_doSend | ( | const LRA_regSpec * | rSpec, | |
int | ssr | |||
) |
Send register data to the spacecraft.
This routine is called indirectly whenever a READ telecommand arrives. It calls the register read routine and sends back the status and register data.
rSpec | The register specifier, specifying which register (or set of registers) is (are) to be read. This contains the component, the register block, the TEM number, cable controller number, readout controller number, front-end number, and register number. The latter five parameters may be set individually to the value LRA_WILD to cause all values to be used. | |
ssr | If TRUE, the data is sent on the science stream, and can be maximum sized. Otherwise it is sent on the diagnostic stream, and is limited to 4 KBytes. |
LRA_SUCCESS | The registers were read and sent successfully | |
LRA_NOTINIT | LRA not initialized | |
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 | |
LRA_EXCSDATA | Too much data for the diagnostic stream | |
LCBD_RTOERR | Operation timed out | |
ITC_SENDNID | Destination node not reachable | |
ITC_SENDPRX | Proxy task for destination node not started | |
ITC_SENDQID | Destination queue not available | |
ITC_SENDTID | Destination task not started |
unsigned LRA_doSendEsr | ( | void | ) |
Send ESR data to the spacecraft.
This routine reads the error and status register data and sends it to the spacecraft via the science stream.
LRA_SUCCESS | The registers were read and sent successfully | |
LRA_NOTINIT | LRA not initialized | |
ITC_SENDNID | Destination node not reachable | |
ITC_SENDPRX | Proxy task for destination node not started | |
ITC_SENDQID | Destination queue not available | |
ITC_SENDTID | Destination task not started |
unsigned LRA_doSendStats | ( | void | ) |
Send statistics data to the spacecraft.
This routine sends the accumulated register statistics to the spacecraft via the science stream.
LRA_SUCCESS | The statistics were sent successfully | |
LRA_NOTINIT | LRA not initialized | |
ITC_SENDNID | Destination node not reachable | |
ITC_SENDPRX | Proxy task for destination node not started | |
ITC_SENDQID | Destination queue not available | |
ITC_SENDTID | Destination task not started |
unsigned LRA_freeStats | ( | LRA_control * | ctrl | ) |
Free statistics processing resources.
The command lists used for reading statistics registers are freed.
ctrl | The address of the LRA control block |
LRA_SUCCESS | Success always |
unsigned LRA_getCtrl | ( | LRA_control ** | ctrl | ) |
Get the control structure address.
This routine returns the address of the internal control structure. It is internal to the LRA system.
ctrl | The address of a pointer to receive the address of the control structure. |
LRA_SUCCESS | Address obtained successfully | |
LRA_NOTINIT | LRA not initialized |
unsigned LRA_initStats | ( | LRA_control * | ctrl | ) |
Initialize for statistics processing.
The command lists needed for reading statistics registers are created and initialized.
ctrl | The address of the LRA control block |
LRA_SUCCESS | Success | |
LRA_INSFMEM | Not enough memory |
unsigned LRA_process | ( | void * | prm, | |
const ITC_QueueItem * | qItem, | |||
void * | pay, | |||
unsigned | len | |||
) |
Process a received request.
This routine runs within the LRA task and handles the queued raw requests for service.
prm | User parameter (not used) | |
qItem | The address of the queue item (not used) | |
pay | The address of the request payload | |
len | The length of the request payload (not used) |
LRA_INVFCODE | The received function code was invalid |
unsigned LRA_updateStats | ( | LRA_control * | ctrl, | |
int | clear | |||
) |
Update the register statistics.
The statistics registers are read (and reset). Normally the counters in the stats block are then updated using the read values, but if there is a time discontinuity or the clear option is specified, the counters are cleared instead.
ctrl | The address of the LRA control block | |
clear | If TRUE, the counters are cleared instead of being updated. |
LRA_SUCCESS | Success always |