GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LRA / V5-2-4 > lra / sun-gcc
#include <LRA_p.h>
#include <LRA/LRA_msgs.h>
#include <MSG/MSG_pubdefs.h>
#include <LEM/list.h>
#include <LEM/decode.h>
#include <LEM/encode.h>
#include <PBS/MBA.h>
#include <PBS/MTX.h>
#include <PBS/WCT.h>
#include <string.h>
Functions | |
static unsigned | addListItem (LRA_crl *crl, LEM_FUNCTION cmd, LRA_component cmpt, LEM_REG_BLK block, unsigned int tem, unsigned int cc, unsigned int reg, void *value, LEM_ci **ci) |
Add an item to a command/response list set. | |
static unsigned | encodeCmd (LEM_ci *ci, LEM_FUNCTION cmd, LRA_component cmpt, LEM_REG_BLK block, unsigned int tem, unsigned int cc, unsigned int reg, void *value) |
Encode a command list item. | |
static unsigned | setDecoder (LRA_dcdItem *di, LRA_component cmpt, LEM_REG_BLK block, unsigned int reg) |
Set the decoder for a command list item. | |
static unsigned | decodeData (LRA_crl *crl) |
Decode returned data. | |
static void | updateStats (LRA_sregData *data, LRA_control *ctrl, LRA_stats *stats) |
Update statistics data. | |
static unsigned | updateCrStats (LRA_dataItem *data, LRA_cmdStats *cStats, LRA_xmtStats *rStats) |
Update command/response statistics items. | |
static unsigned | updateRcvStats (LRA_dataItem *data, LRA_rcvStats *rStats) |
Update receive statistics item. | |
static unsigned | updateTrcvStats (LRA_dataItem *data, unsigned int period, LRA_trcvStats *rStats) |
Update TEM receive statistics item. | |
static unsigned | updateXmtStats (LRA_dataItem *data, LRA_xmtStats *tStats) |
Update transmit statistics item. | |
static void | updateFifoStats (unsigned int value, LRA_fifoStats *stats1, LRA_fifoStats *stats2, LRA_fifoStats *stats3, LRA_fifoStats *stats4, LRA_fifoStats *stats5) |
Update FIFO statistics. | |
static unsigned | updateCtrStats (LRA_dataItem *data, LRA_cntrStats *cStats, int width) |
Update simple counter item. | |
static unsigned | newCrl (LRA_crl **crl, int nItem) |
Create a new command/response list. | |
static unsigned | freeCrl (LRA_crl *crl) |
Free a command/response list. | |
static int | findNextSet16 (unsigned int posn, unsigned short word) |
Find the next set bit in a 16-bit word. | |
unsigned | LRA_freeStats (LRA_control *ctrl) |
Free statistics processing resources. | |
unsigned | LRA_initStats (LRA_control *ctrl) |
Initialize for statistics processing. | |
unsigned | LRA_updateStats (LRA_control *ctrl, int clear) |
Update the register statistics. |
$Id: LRA_stats.c,v 1.12 2011/03/28 16:17:40 saxton Exp $
unsigned addListItem | ( | LRA_crl * | crl, | |
LEM_FUNCTION | cmd, | |||
LRA_component | cmpt, | |||
LEM_REG_BLK | block, | |||
unsigned int | tem, | |||
unsigned int | cc, | |||
unsigned int | reg, | |||
void * | value, | |||
LEM_ci ** | ci | |||
) | [static] |
Add an item to a command/response list set.
A command list item is formatted and added to the end of a command/ response list set. The set is extended if necessary to accommodate the new item.
crl | The address of the first list in the command/response set. | |
cmd | The command that the item is to carry out (read, load, or dataless). | |
cmpt | The LRA component to be accessed. | |
block | The register block to be accessed. | |
tem | The TEM number for TEM-based components. | |
cc | The cable controller number. | |
reg | The register number or control function. | |
value | The address of the read data block to be filled for read operations or the address of the data value for load operations. Not used for control operations. | |
ci | The address of a pointer to receive the address of the added list item, or NULL if the address is not wanted. |
LRA_SUCCESS | Success | |
LRA_INSFMEM | Not enough memory | |
LRA_INVCMPT | Invalid component number |
References _LRA_dcdItem::data, encodeCmd(), _LRA_dcdItem::fn, LRA_MAX_CRL, newCrl(), and setDecoder().
Referenced by LRA_initStats().
unsigned decodeData | ( | LRA_crl * | crl | ) | [static] |
Decode returned data.
The data returned in a command/response list is copied to its destination, and errors are checked for.
crl | The address of the command/response list |
LRA_SUCCESS | Success, always |
References _LRA_dcdItem::data, _LRA_dataItem::error, _LRA_dcdItem::fn, and _LRA_dataItem::value.
Referenced by LRA_updateStats().
unsigned encodeCmd | ( | LEM_ci * | ci, | |
LEM_FUNCTION | cmd, | |||
LRA_component | cmpt, | |||
LEM_REG_BLK | block, | |||
unsigned int | tem, | |||
unsigned int | cc, | |||
unsigned int | reg, | |||
void * | value | |||
) | [static] |
Encode a command list item.
A command list item is formatted.
ci | The address of the command list item. | |
cmd | The command to be encoded (read, load, dataless). | |
cmpt | The LRA component to be accessed. | |
block | The register block to be accessed. | |
tem | The TEM number for TEM-based components. | |
cc | The cable controller number. | |
reg | The register number or dataless function. | |
value | The address of the data value to be formatted. |
LRA_SUCCESS | Success | |
LRA_INVCMPT | Invalid component number |
Referenced by addListItem().
int findNextSet16 | ( | unsigned int | posn, | |
unsigned short | word | |||
) | [static] |
Find the next set bit in a 16-bit word.
posn | The current bit position in the word. | |
word | The 16-bit word to test. |
Referenced by LRA_updateStats().
unsigned freeCrl | ( | LRA_crl * | crl | ) | [static] |
Free a command/response list.
crl | The address of the command/response list to free |
LRA_SUCCESS | Success always |
Referenced by LRA_freeStats().
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 |
References freeCrl(), and _LRA_control::sCrl.
Referenced by LRA_terminate().
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 |
References addListItem(), _LRA_sregData::aemCrStat, _LRA_sregData::aemFbStat, _LRA_sregData::aemStatus, _LRA_sregData::aemTrgStat, _LRA_sregData::cccStatus, _LRA_sregData::cruCrStat, _LRA_sregData::ebmAemER, _LRA_sregData::ebmCrStat, _LRA_sregData::ebmEpu0ER, _LRA_sregData::ebmEpu0ES, _LRA_sregData::ebmEpu1ER, _LRA_sregData::ebmEpu1ES, _LRA_sregData::ebmEpu2ER, _LRA_sregData::ebmEpu2ES, _LRA_sregData::ebmGemER, _LRA_sregData::ebmSiu0ER, _LRA_sregData::ebmSiu0ES, _LRA_sregData::ebmSiu1ER, _LRA_sregData::ebmSiu1ES, _LRA_sregData::ebmSiueER, _LRA_sregData::ebmSiueES, _LRA_sregData::ebmSsrES, _LRA_sregData::ebmTem0ER, _LRA_sregData::ebmTem1ER, _LRA_control::ebmTemMuxCi, _LRA_sregData::gemCrStat, _LRA_sregData::gemDeadZone, _LRA_sregData::gemDiscard, _LRA_sregData::gemEvStat, _LRA_sregData::gemLivetime, _LRA_sregData::gemPrescale, _LRA_sregData::gemSent, _LRA_sregData::gemTimebase, LRA_MAX_CRL, LRA_N_CCC, LRA_N_TCC, LRA_N_TEM, newCrl(), _LRA_sregData::pdu0CrStat, _LRA_sregData::pdu1CrStat, _LRA_control::sCrl, _LRA_control::srData, _LRA_sregData::tccStatus, _LRA_sregData::temCrStat, _LRA_sregData::temStatus, and _LRA_sregData::ticStatus.
Referenced by LRA_initialize().
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 |
References decodeData(), _LRA_control::ebmTem0, _LRA_control::ebmTem1, _LRA_control::ebmTemMask, _LRA_control::ebmTemMuxCi, _LRA_stats::endTime, findNextSet16(), _LRA_control::lastTem0, _LRA_control::lastTem1, LRA_N_TEM, LRA_STATS_MAJOR, LRA_STATS_MINOR, _LRA_control::nextTemMask, _LRA_stats::nFail, _LRA_stats::nRead, _LRA_stats::resetTime, _LRA_control::sCrl, _LRA_control::srData, _LRA_stats::startTime, _LRA_control::statMtx, _LRA_control::stats, updateStats(), and _LRA_stats::version.
Referenced by LRA_clearStats(), LRA_startStats(), and procUpdate().
unsigned newCrl | ( | LRA_crl ** | crl, | |
int | nItem | |||
) | [static] |
Create a new command/response list.
crl | The address of a pointer to receive the address of the new command/response list | |
nItem | The maximum number of items the list will hold |
LRA_SUCCESS | Success | |
LRA_LISTBIG | Requested number of items too big | |
LRA_INSFMEM | Not enough memory |
References LRA_MAX_CRL.
Referenced by addListItem(), and LRA_initStats().
unsigned setDecoder | ( | LRA_dcdItem * | di, | |
LRA_component | cmpt, | |||
LEM_REG_BLK | block, | |||
unsigned int | reg | |||
) | [static] |
Set the decoder for a command list item.
The correct decoder function is determined and set in the decode list item.
di | The address of the decode list item. | |
cmpt | The LRA component to be accessed. | |
block | The register block to be accessed. | |
reg | The register number. |
LRA_SUCCESS | Success | |
LRA_INVCMPT | Invalid component number |
References _LRA_dcdItem::fn.
Referenced by addListItem().
unsigned updateCrStats | ( | LRA_dataItem * | data, | |
LRA_cmdStats * | cStats, | |||
LRA_xmtStats * | rStats | |||
) | [static] |
Update command/response statistics items.
A command/response statistics item pair is updated using the value from a C/R statistics register.
data | The address of the data block from the C/R statistics register | |
cStats | The address of the command statistics block | |
rStats | The address of the response statistics block |
0 | Success | |
1 | Error reading register |
References _LRA_crReg::accPerr, _LRA_crReg::datPerr, _LRA_dataItem::error, _LRA_crReg::hdrPerr, LRA_CTR_OFLOW, _LRA_cmdStats::nAccPerr, _LRA_crReg::nCmd, _LRA_cmdStats::nDatPerr, _LRA_cmdStats::nHdrPerr, _LRA_xmtStats::nOflow, _LRA_cmdStats::nOflow, _LRA_xmtStats::nOper, _LRA_cmdStats::nOper, _LRA_xmtStats::nPause, _LRA_xmtStats::nRdErr, _LRA_crReg::nRsp, _LRA_crReg::paused, and _LRA_dataItem::value.
Referenced by updateStats().
unsigned updateCtrStats | ( | LRA_dataItem * | data, | |
LRA_cntrStats * | cStats, | |||
int | width | |||
) | [static] |
Update simple counter item.
A counter statistics item is updated using the value from a counter register.
data | The address of the data block from the counter register | |
cStats | The address of the counter statistics block | |
width | The width (in bits) of the counter register value |
0 | Success | |
1 | Error reading register |
References _LRA_dataItem::error, _LRA_cntrStats::nCount, _LRA_cntrStats::nRdErr, and _LRA_dataItem::value.
Referenced by updateStats().
void updateFifoStats | ( | unsigned int | value, | |
LRA_fifoStats * | stats1, | |||
LRA_fifoStats * | stats2, | |||
LRA_fifoStats * | stats3, | |||
LRA_fifoStats * | stats4, | |||
LRA_fifoStats * | stats5 | |||
) | [static] |
Update FIFO statistics.
Five FIFO statistics blocks are updated using the value of the FIFO status register.
value | The value from the FIFO status register | |
stats1 | The address of the first FIFO statistics block | |
stats2 | The address of the second FIFO statistics block | |
stats3 | The address of the third FIFO statistics block | |
stats4 | The address of the fourth FIFO statistics block | |
stats5 | The address of the fifth FIFO statistics block |
References _LRA_fifoStats::nAFull, _LRA_fifoStats::nEmpty, and _LRA_fifoStats::nFull.
Referenced by updateStats().
unsigned updateRcvStats | ( | LRA_dataItem * | data, | |
LRA_rcvStats * | rStats | |||
) | [static] |
Update receive statistics item.
A receive statistics item is updated using the value from a receive statistics register.
data | The address of the data block from the receive statistics register | |
rStats | The address of the receive statistics block |
0 | Success | |
1 | Error reading register |
References _LRA_rcvReg::datPerr, _LRA_dataItem::error, _LRA_rcvReg::fEmpty, _LRA_rcvReg::fFull, _LRA_rcvReg::hdrPerr, LRA_CTR_OFLOW, _LRA_rcvStats::nDatPerr, _LRA_rcvStats::nEmpty, _LRA_rcvStats::nFull, _LRA_rcvStats::nHdrPerr, _LRA_rcvStats::nOflow, _LRA_rcvStats::nOper, _LRA_rcvReg::nRcvd, _LRA_rcvStats::nRdErr, and _LRA_dataItem::value.
Referenced by updateStats().
void updateStats | ( | LRA_sregData * | data, | |
LRA_control * | ctrl, | |||
LRA_stats * | stats | |||
) | [static] |
Update statistics data.
The accumulated statistics data is updated using the newly read statistics register data.
data | The address of the read register data. | |
ctrl | The address of the LRA control block. | |
stats | The address of the statistics block to be updated. |
References _LRA_stats::aem, _LRA_sregData::aemCrStat, _LRA_sregData::aemFbStat, _LRA_ebmStats::aemR, _LRA_sregData::aemStatus, _LRA_sregData::aemTrgStat, _LRA_aemStats::arcErr, _LRA_gemStats::base, _LRA_temStReg::cableErr, _LRA_stats::ccc, _LRA_sregData::cccStatus, _LRA_temStats::cmd, _LRA_aemStats::cmd, _LRA_ebmStats::cmd, _LRA_pduStats::cmd, _LRA_cruStats::cmd, _LRA_gemStats::cmd, _LRA_tccStReg::cmdPerr, _LRA_cccStReg::cmdPerr, _LRA_ticStReg::cmdPerr, _LRA_temStReg::cmdPerr, _LRA_aemCstReg::cmdPerr, _LRA_temStReg::cmdPPerr, _LRA_aemCstReg::cmdPPerr, _LRA_stats::cru, _LRA_sregData::cruCrStat, _LRA_tccStats::data, _LRA_tccStReg::datPerr, _LRA_gemStats::dead, _LRA_tccStats::diag, _LRA_cccStats::diag, _LRA_gemStats::disc, _LRA_stats::ebm, _LRA_sregData::ebmAemER, _LRA_sregData::ebmCrStat, _LRA_sregData::ebmEpu0ER, _LRA_sregData::ebmEpu0ES, _LRA_sregData::ebmEpu1ER, _LRA_sregData::ebmEpu1ES, _LRA_sregData::ebmEpu2ER, _LRA_sregData::ebmEpu2ES, _LRA_sregData::ebmGemER, _LRA_sregData::ebmSiu0ER, _LRA_sregData::ebmSiu0ES, _LRA_sregData::ebmSiu1ER, _LRA_sregData::ebmSiu1ES, _LRA_sregData::ebmSiueER, _LRA_sregData::ebmSiueES, _LRA_sregData::ebmSsrES, _LRA_sregData::ebmTem0ER, _LRA_sregData::ebmTem1ER, _LRA_ebmStats::epu0R, _LRA_ebmStats::epu0S, _LRA_ebmStats::epu1R, _LRA_ebmStats::epu1S, _LRA_ebmStats::epu2R, _LRA_ebmStats::epu2S, _LRA_tccStats::error, _LRA_cccStats::error, _LRA_dataItem::error, _LRA_temStats::evt, _LRA_aemStats::evt, _LRA_gemStats::evt, _LRA_temStReg::evtErr, _LRA_cccStReg::evtPerr, _LRA_aemTstReg::fault, _LRA_tccStReg::fifoStat, _LRA_cccStReg::fifoStat, _LRA_tccStReg::fullErr, _LRA_stats::gem, _LRA_sregData::gemCrStat, _LRA_sregData::gemDeadZone, _LRA_sregData::gemDiscard, _LRA_sregData::gemEvStat, _LRA_sregData::gemLivetime, _LRA_sregData::gemPrescale, _LRA_ebmStats::gemR, _LRA_sregData::gemSent, _LRA_sregData::gemTimebase, _LRA_tccStReg::hdrPerr, _LRA_control::lastPrd, _LRA_control::lastTem0, _LRA_control::lastTem1, _LRA_gemStats::live, LRA_CTR_OFLOW, LRA_GCW_DEADZONE, LRA_GCW_DISCARD, LRA_GCW_LIVETIME, LRA_GCW_PRESCALE, LRA_GCW_SENT, LRA_GCW_TIMEBASE, LRA_N_ARC, LRA_N_CCC, LRA_N_TCC, LRA_N_TEM, _LRA_temStats::nCableErr, _LRA_tccStats::nCmdPerr, _LRA_cccStats::nCmdPerr, _LRA_ticStats::nCmdPerr, _LRA_temStats::nCmdPerr, _LRA_aemStats::nCmdPerr, _LRA_temStats::nCmdPPerr, _LRA_aemStats::nCmdPPerr, _LRA_cccStats::nData, _LRA_tccStats::nDatPerr, _LRA_temStats::nEvtErr, _LRA_cccStats::nEvtPerr, _LRA_aemTrgStats::nFault, _LRA_aemStats::nFreeErr, _LRA_tccStats::nFullErr, _LRA_tccStats::nHdrPerr, _LRA_arcErrStats::nNoSbit, _LRA_aemTrgStats::nOflow, _LRA_aemTrgStats::nOper, _LRA_arcErrStats::nParity, _LRA_temStats::nPrimPerr, _LRA_aemTstReg::nRcvd, _LRA_aemTrgStats::nRdErr, _LRA_temStats::nRdntPerr, _LRA_temStats::nRdntSel, _LRA_tccStats::nReadErr, _LRA_cccStats::nReadErr, _LRA_ticStats::nReadErr, _LRA_temStats::nTagErr, _LRA_tccStats::nTfeTerr, _LRA_tccStats::nTimeout, _LRA_cccStats::nTimeout, _LRA_temStats::nTimeout, _LRA_tccStats::nTrcSerr, _LRA_tccStats::nTrcTerr, _LRA_temStats::nTrgPerr, _LRA_aemStats::nTrgPerr, _LRA_tccStats::nWcntPerr, _LRA_cccStats::pData, _LRA_stats::pdu0, _LRA_sregData::pdu0CrStat, _LRA_stats::pdu1, _LRA_sregData::pdu1CrStat, _LRA_gemStats::pres, _LRA_temStReg::primPerr, _LRA_temStReg::rdntPerr, _LRA_temStReg::rdntSel, _LRA_temStats::rsp, _LRA_aemStats::rsp, _LRA_ebmStats::rsp, _LRA_pduStats::rsp, _LRA_cruStats::rsp, _LRA_gemStats::rsp, _LRA_gemStats::sent, _LRA_ebmStats::siu0R, _LRA_ebmStats::siu0S, _LRA_ebmStats::siu1R, _LRA_ebmStats::siu1S, _LRA_ebmStats::siueR, _LRA_ebmStats::siueS, _LRA_ebmStats::ssrS, _LRA_aemFstReg::status, _LRA_tccStats::summ, _LRA_cccStats::summ, _LRA_temStReg::tagErr, _LRA_stats::tcc, _LRA_sregData::tccStatus, _LRA_stats::tem, _LRA_sregData::temCrStat, _LRA_ebmStats::temR, _LRA_sregData::temStatus, _LRA_tccStReg::tfeTerr, _LRA_stats::tic, _LRA_sregData::ticStatus, _LRA_tccStReg::timeout, _LRA_cccStReg::timeout, _LRA_temStReg::timeout, _LRA_tccStats::tot, _LRA_tccStReg::trcSerr, _LRA_tccStReg::trcTerr, _LRA_aemStats::trg, _LRA_temStReg::trgPerr, _LRA_aemCstReg::trgPerr, updateCrStats(), updateCtrStats(), updateFifoStats(), updateRcvStats(), updateTrcvStats(), updateXmtStats(), _LRA_dataItem::value, and _LRA_tccStReg::wcntPerr.
Referenced by LRA_updateStats().
unsigned updateTrcvStats | ( | LRA_dataItem * | data, | |
unsigned int | period, | |||
LRA_trcvStats * | rStats | |||
) | [static] |
Update TEM receive statistics item.
A TEM receive statistics item is updated using the value from a receive statistics register.
data | The address of the data block from the receive statistics register | |
period | The update period (microseconds) | |
rStats | The address of the TEM receive statistics block |
0 | Success | |
1 | Error reading register |
References _LRA_rcvReg::datPerr, _LRA_dataItem::error, _LRA_rcvReg::fEmpty, _LRA_rcvReg::fFull, _LRA_rcvReg::hdrPerr, LRA_CTR_OFLOW, _LRA_trcvStats::nDatPerr, _LRA_trcvStats::nEmpty, _LRA_trcvStats::nFull, _LRA_trcvStats::nHdrPerr, _LRA_trcvStats::nOflow, _LRA_trcvStats::nOper, _LRA_rcvReg::nRcvd, _LRA_trcvStats::nRdErr, _LRA_trcvStats::period, and _LRA_dataItem::value.
Referenced by updateStats().
unsigned updateXmtStats | ( | LRA_dataItem * | data, | |
LRA_xmtStats * | tStats | |||
) | [static] |
Update transmit statistics item.
A transmit statistics item is updated using the value from a transmit statistics register.
data | The address of the data block from the transmit statistics register | |
tStats | The address of the transmit statistics block |
0 | Success | |
1 | Error reading register |
References _LRA_dataItem::error, LRA_CTR_OFLOW, _LRA_xmtStats::nOflow, _LRA_xmtStats::nOper, _LRA_xmtStats::nPause, _LRA_xmtStats::nRdErr, _LRA_xmtReg::nSent, _LRA_xmtReg::paused, and _LRA_dataItem::value.
Referenced by updateStats().