GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LRA / V5-2-0 > lra / rad750
#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.11 2009/07/31 22:08:03 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 |
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 |
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 |
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. |
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 |
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_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_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 |
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 |
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 |
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 |
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 |
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 |
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 |
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. |
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 |
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 |