GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCBD / V1-4-2
Constituent: lcbb     Tag: mv2304
#include <string.h>
#include "PBS/SPIN.h"
#include "PBS/SPIN.ih"
#include "PBS/BSWP.ih"
#include "LCBD/LCBB.h"
#include "LCBD/LATP.h"
#include "LCBD/LCBB_msgs.h"
#include "LCBD/LCB_cr.h"
Include dependency graph for LCBB.c:
Data Structures | |
struct | _LCBB_err_rst_maps |
Maps to take a result transfer/receive error/status value, into a standard message code. More... | |
struct | _LCBB_err_evt_maps |
Maps to take an event transfer/receive error/status value, into a standard message code. More... | |
struct | _LCBB_err_maps |
Provides mapping arrays to take an LCB hardware error code into a LCB message code. More... | |
Defines | |
#define | CHECK_EQ(n, a, b) struct Check_ ## n { int x[1 / (a == b) ]; } |
Checks is a = b, and if not the compiler will issue an error. | |
#define | LCBB_XTIME_REGISTER 10000 |
Estimate of a register access time, in nanoseconds. | |
#define | LCBB_XTIME_FUNCTION 10000 |
Estimate of a function execution time, in nanoseconds. | |
#define | LCBB_XTIME_EVENT_TRANSFER 10000 |
Estimate of a event transfer overhead, in nanoseconds. | |
#define | LCBB_XTIME_TIMEOUT 60000000 |
Estimate of LCB event transfer timeout period. | |
#define | LCBB_CLK_FREQ 20000000 |
The default LCB LATp clock frequency (nominally 20MHz). | |
#define | LCBB_NSECS_PER_TICK 50 |
The default LCB LATp clock speed (nominally 20MHz = 50nsec/tick). | |
#define | LCBB_BITS_PER_TICK 1 |
The default LCB DMA output transfer speed. This is always 1 bit/tick (20Mbits/sec) independent of the bit/byte of the input interface. | |
#define | LCBB_RST_DRAIN_TIMEOUT ((unsigned int)(3 * LCBB_CLK_FREQ)) |
The result drain timeout period, in units of LCBB clock ticks. This is the maximum time that the function will wait for the sweeping transaction to be returned. | |
#define | LCBB_XTIME_EVENT_TRANSFER_BY_INTS(_nints) |
Estimates the time to get submit and get the result descriptor back for an event transfer of _nints. | |
Typedefs | |
typedef _LCBB_err_rst_maps | LCBB_err_rst_maps |
Typedef for struct _LCBB_err_rst_maps. | |
typedef _LCBB_err_evt_maps | LCBB_err_evt_maps |
Typedef for struct _LCBB_err_evt_maps. | |
typedef _LCBB_err_maps | LCBB_err_maps |
Typedef for struct _LCBB_err_maps. | |
Functions | |
static __inline void | pciStore32 (volatile unsigned int *dst, unsigned int w) |
Write a 32-bit integer to PCI Memory. | |
static __inline unsigned int | pciLoad32 (volatile unsigned int *src) |
Read a 32-bit integer from PCI Memory. | |
static __inline unsigned int | clear_faults (LCBB lcb, unsigned short timeout) |
Clears the FIFO faults register. | |
static unsigned int | access_function (LCBB lcb, unsigned short stall, unsigned int header, unsigned int poll_timeout) |
Performs an access to the specified LCB slave-side LATP function. | |
static unsigned int | access_reg (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *prv, unsigned int *cur, unsigned int header, unsigned int poll_timeout) |
Performs an access to the specified LCB slave-side LATP register. | |
static unsigned int | poll (LCBB lcb, unsigned int poll_period, unsigned int timeout, unsigned short int op_len, const void *result, const LCB_ri_err *ri_err) |
Polls the RESULT FIFO every nsecs for @ iterations. | |
static __inline unsigned int | submit (LCBB lcb, unsigned int request) |
Submits the specified request list to the LCB for execution. | |
static unsigned int | execute (LCBB lcb, unsigned int request, unsigned int xtime, unsigned int timeout, unsigned short int op_len, void *result, LCB_ri_err *ri_err) |
Has the LCB's command execution routine execute the specified single item request. The result list and result item is checked for successful completion. | |
static unsigned int | init_pci (LCBB lcb) |
Initializes the LCB structure -- probes the PCI bus. | |
static unsigned int | init_latp (LCBB lcb) |
Laundry list of LCB initializations to do on the LATp side. | |
static void | init_circ (LCBB lcb) |
Allocates memory for and sets it up to be used as the circular buffer. | |
static unsigned int | drain_result (LCBB lcb) |
Drains the result FIFOs. | |
static unsigned int | drain_event (LCBB lcb) |
Drains the event FIFOs. | |
static __inline unsigned int | mapXfrErr (const LCBB_err_rst_maps *maps, unsigned int err) |
Maps a result descriptor status into an error code. | |
static __inline unsigned int | mapRcvErr (const LCBB_err_rst_maps *maps, unsigned int err) |
Maps a result item status into an error code. | |
LCBB | LCBB_configure (unsigned int latp, void *requestList, void *resultList, void *circBuffer) |
Returns a pointer to the LCB control structure, with the specified configuration parameters. | |
unsigned int | LCBB_init (LCBB lcb) |
Initializes the LCB structure for polled mode. | |
unsigned int | LCBB_check (LCBB lcb, LCBB_msg *msg) |
Maps the LCB error codes to a LCB message code. | |
unsigned int | LCBB_free (LCBB lcb, LCBB_msg *msg) |
unsigned char * | LCBB_locate (LCBB lcb) |
Returns a pointer to payload. | |
LCBB_msg * | LCBB_receive (LCBB lcb) |
Reads the event FIFO for descriptors. | |
unsigned int | LCBB_send (LCBB lcb, unsigned int dst, unsigned int proto, int nbytes) |
Sends the data. | |
unsigned int | LCBB_start (LCBB lcb) |
Enables the LCB for taking event data. | |
unsigned int | LCBB_mark_time (LCBB lcb, unsigned short int stall) |
Issues a Mark Time command to the LCB. | |
unsigned int | LCBB_lat_reset (LCBB lcb, unsigned short int stall) |
Issues a LAT reset. | |
unsigned int | LCBB_csr_access (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int timeout, unsigned int *prv, unsigned int *cur) |
Does an access of the LATp CSR register. | |
unsigned int | LCBB_faults_access (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int timeout, unsigned int *prv, unsigned int *cur) |
Does an access of the LATp CSR register. | |
unsigned int | LCBB_rxstats_access (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int timeout, unsigned int *prv, unsigned int *cur) |
Does an access of the LATp Receive Statistics/Status register. | |
Variables | |
static const LCBB_err_maps | LcbbErrMaps |
Realization of the LCB error to message code mapping arrays. | |
_LCBB | Lcbb |
The LCB driver control block. |
JJRussell -- russell@slac.stanford.edu
CVS $Id
|
Checks is a = b, and if not the compiler will issue an error.
|
|
Value: (LCBB_XTIME_EVENT_TRANSFER \ + (((_nints) * 32) * LCBB_NSECS_PER_TICK) / LCBB_BITS_PER_TICK);
|
|
Typedef for struct _LCBB_err_maps. Combines the Result and Event mapping data structures |
|
Performs an access to the specified LCB slave-side LATP function.
|
|
Performs an access to the specified LCB slave-side LATP register.
|
|
Clears the FIFO faults register.
|
|
Drains the event FIFOs.
|
|
Drains the result FIFOs.
|
|
Has the LCB's command execution routine execute the specified single item request. The result list and result item is checked for successful completion.
|
|
Allocates memory for and sets it up to be used as the circular buffer.
|
|
Laundry list of LCB initializations to do on the LATp side.
|
|
Initializes the LCB structure -- probes the PCI bus.
|
|
Maps the LCB error codes to a LCB message code.
|
|
Returns a pointer to the LCB control structure, with the specified configuration parameters.
SIU EPU commander 1 - evt_path - - cmd_path - - hdr_parity - - payload_parity - - pause_test - - pause_stick - - board_id v - byte_wide v -
LCBB_latp_cfg latp; latp.ui = 0; latp.sv.value.command = 1; latp.sv.value.board_id = board_id; latp.sv.value.byte_wide = 1; latp.sv.select.command = LCBB_LATP_SELECT; latp.sv.select.board_id = LCBB_LATP_SELECT; latp.sv.select.byte_wide = LCBB_LATP_SELECT; LCBB_configure (latp.ui, requestList, resultList, circBuffer);
|
|
Does an access of the LATp CSR register.
|
|
Does an access of the LATp CSR register.
|
|
|
|
Initializes the LCB structure for polled mode.
|
|
Issues a LAT reset.
|
|
Returns a pointer to payload.
|
|
Issues a Mark Time command to the LCB.
|
|
Reads the event FIFO for descriptors.
|
|
Does an access of the LATp Receive Statistics/Status register.
|
|
Sends the data.
|
|
Enables the LCB for taking event data.
|
|
Maps a result item status into an error code.
|
|
Maps a result descriptor status into an error code.
|
|
Read a 32-bit integer from PCI Memory.
|
|
Write a 32-bit integer to PCI Memory.
|
|
Polls the RESULT FIFO every nsecs for @ iterations.
Even a list of up to 3 seconds is possible (pretty bizarre), can be covered by the range of the SPIN counter. The smallest range is MV2304, MCP750: 2**32 * 60 nsecs ~= 240 seconds RAD750 : 2**32 * 120 nsecs ~= 480 seconds |
|
Submits the specified request list to the LCB for execution.
|