GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCBD / dev > lcbd / linux-gcc
Classes | |
struct | _LCBD_load_cbp |
Callback routine and parameter for LCBD_load asychronous completion. More... | |
struct | _LCBD_dib |
LCBD Device information block. More... | |
Defines | |
#define | LCBD_OK 0 |
Success return code, note that this is not an LCBD message code, but may be used as one. | |
#define | LCBD_K_EVENT_BASE_IGNORE (unsigned int *)(-1) |
Instructs LCBD_load to ignore setting the event base address. | |
#define | LCBD_K_EVENT_BASE_ALLOCATE (unsigned int *)( 0) |
Instructs LCBD_load to automatically allocate an event buffer and assign the starting address as the event base. | |
Typedefs | |
typedef enum _LCBD_LOAD_OPTIONS_M | LCBD_LOAD_OPTIONS_M |
Typedef for enum _LCBD_LOAD_OPTIONS_M. | |
typedef void(* | LCBD_load_cb )(void *prm, LCBD lcb, unsigned int status) |
Callback for LCBD_load asynchronous completion. | |
typedef struct _LCBD_load_cbp | LCBD_load_cbp |
Typedef for struct _LCBD_load_cbp. | |
typedef enum _LCBD_CLK_EDGE_OPTIONS_M | LCBD_CLK_EDGE_OPTIONS_M |
Typedef for enum _LCBD_CLK_EDGE_OPTIONS_M. | |
typedef enum _LCBD_STATE | LCBD_STATE |
Typedef for enum LCBD_STATE. | |
typedef enum _LCBD_STATE | LCBD_state |
Typedef for enum LCBD_state. | |
typedef enum _LCBD_STATE_M | LCBD_STATE_M |
Typedef for enum LCBD_STATE_M. | |
typedef enum _LCBD_QUES_M | LCBD_QUES_M |
Typedef for enum _LCBD_QUES_M. | |
typedef enum _LCBD_FPGA_SUP_K | LCBD_FPGA_SUP_K |
Typedef for enum _LCBD_FPGA_SUP_K. | |
typedef struct _LCBD_dib | LCBD_dib |
Typedef for struct _LCBD_dib. | |
typedef enum _LCBD_M_ENABLE_DISABLE | LCBD_M_ENABLE_DISABLE |
Typedef for enum _LCBD_M_ENABLE_DISABLE. | |
typedef enum _LCBD_WIDTH_K | LCBD_WIDTH_K |
Typedef for enum _LCBD_WIDTH_K. | |
typedef enum _LCBD_FABRIC_K | LCBD_FABRIC_K |
Typedef for enum _LCBD_fabric_select. | |
Enumerations | |
enum | _LCBD_LOAD_OPTIONS_M { LCBD_LOAD_OPTIONS_M_FABRIC_ASIS = 0, LCBD_LOAD_OPTIONS_M_FABRIC_PRIMARY = COMPOSE(FABRIC, 0), LCBD_LOAD_OPTIONS_M_FABRIC_REDUNDANT = COMPOSE(FABRIC, 1), LCBD_LOAD_OPTIONS_M_INTERRUPT_DEFAULT = 0, LCBD_LOAD_OPTIONS_M_INTERRUPT_PCI = COMPOSE (INTERRUPT,0), LCBD_LOAD_OPTIONS_M_INTERRUPT_PID = COMPOSE (INTERRUPT,1), LCBD_LOAD_OPTIONS_M_ICLK_ASIS = 0, LCBD_LOAD_OPTIONS_M_ICLK_LEADING_EDGE = COMPOSE(ICLK, 0), LCBD_LOAD_OPTIONS_M_ICLK_TRAILING_EDGE = COMPOSE(ICLK, 1), LCBD_LOAD_OPTIONS_M_OCLK_ASIS = 0, LCBD_LOAD_OPTIONS_M_OCLK_LEADING_EDGE = COMPOSE(OCLK, 0), LCBD_LOAD_OPTIONS_M_OCLK_TRAILING_EDGE = COMPOSE(OCLK, 1), LCBD_LOAD_OPTIONS_M_BOARD_ID_ASIS = 0, LCBD_LOAD_OPTIONS_M_LATP8_ASIS = 0, LCBD_LOAD_OPTIONS_M_LATP8_BIT = COMPOSE(LATP8, 0), LCBD_LOAD_OPTIONS_M_LATP8_BYTE = COMPOSE(LATP8, 1), LCBD_LOAD_OPTIONS_M_CSR } |
Defines the load options word. More... | |
enum | _LCBD_CLK_EDGE_OPTIONS_M { LCBD_CLK_EDGE_OPTIONS_M_ICLK_IGNORE = 0x0, LCBD_CLK_EDGE_OPTIONS_M_ICLK_LEADING = COMPOSE (ICLK, 0), LCBD_CLK_EDGE_OPTIONS_M_ICLK_TRAILING = COMPOSE (ICLK, 1), LCBD_CLK_EDGE_OPTIONS_M_OCLK_IGNORE = 0x0, LCBD_CLK_EDGE_OPTIONS_M_OCLK_LEADING = COMPOSE (OCLK, 0), LCBD_CLK_EDGE_OPTIONS_M_OCLK_TRAILING = COMPOSE (OCLK, 1) } |
Defines the options word of LCBD_clk_edge_set. More... | |
enum | _LCBD_STATE { LCBD_STATE_ERROR = -1, LCBD_STATE_ONLINE = 0, LCBD_STATE_OFFLINE = 1, LCBD_STATE_UNINITIALIZED = 2, LCBD_STATE_UNLOADING = 3 } |
The state of the LCB driver. More... | |
enum | _LCBD_STATE_M { LCBD_STATE_M_ONLINE = (1 << LCBD_STATE_ONLINE), LCBD_STATE_M_OFFLINE = (1 << LCBD_STATE_OFFLINE), LCBD_STATE_M_UNINITIALIZED = (1 << LCBD_STATE_UNINITIALIZED), LCBD_STATE_M_UNLOADING = (1 << LCBD_STATE_UNLOADING) } |
The state of the LCB driver as a bit value. More... | |
enum | _LCBD_QUES_M { LCBD_QUES_M_RESULT = 1, LCBD_QUES_M_EVENT = 2, LCBD_QUES_M_BOTH = (LCBD_QUES_M_RESULT | LCBD_QUES_M_EVENT) } |
Enumerates the LCBD ques as a bit mask selection. More... | |
enum | _LCBD_FPGA_SUP_K { LCBD_FPGA_SUP_K_MIN = -1, LCBD_FPGA_SUP_K_NOT = -1, LCBD_FPGA_SUP_K_GOLDEN = 0, LCBD_FPGA_SUP_K_BACKWARD = 1, LCBD_FPGA_SUP_K_USER = 2, LCBD_FPGA_SUP_K_CNT = 4 } |
Enumerates the possible driver FPGA support levels. More... | |
enum | _LCBD_M_ENABLE_DISABLE { LCBD_M_ENABLE_RESULT = (1 << 0), LCBD_M_ENABLE_EVENT = (1 << 1), LCBD_M_ENABLE_CLK_ON = (1 << 2), LCBD_M_ENABLE_CLK_OFF = (1 << 3), LCBD_M_ENABLE_CLKS = (LCBD_M_ENABLE_CLK_ON | LCBD_M_ENABLE_CLK_OFF), LCBD_M_ENABLE_ALL, LCBD_M_DISABLE_RESULT = (1 << (0+4)), LCBD_M_DISABLE_EVENT = (1 << (1+4)), LCBD_M_DISABLE_CLK_ON = (1 << (2+4)), LCBD_M_DISABLE_CLK_OFF = (1 << (3+4)), LCBD_M_DISABLE_CLKS, LCBD_M_DISABLE_ALL, LCBD_M_ENABLE_CBUF = (1 << 12), LCBD_M_DISABLE_CBUF = (1 << 13) } |
Enumerates the IRQ enable/disable/pending bits. More... | |
enum | _LCBD_WIDTH_K { LCBD_WIDTH_K_BIT = 0, LCBD_WIDTH_K_BYTE = 1 } |
Enumeration of the two possible values of the event fabric data width, either bit-wide or byte-wide. More... | |
enum | _LCBD_FABRIC_K { LCBD_FABRIC_K_PRIMARY = 0, LCBD_FABRIC_K_REDUNDANT = 1 } |
Value of the parameter to LCBD_fabric_select routine. More... | |
Functions | |
unsigned int | LCBD_allow (unsigned char pci_version, unsigned char latp_version) |
Adds the specified PCI and LATP version number combination as being supported by this driver. | |
LCBD | LCBD_create (LCBD lcb) |
Preinitializes the LCBD device control block. | |
LCBD | LCBD_get (void) |
Returns a pointer to the driver control structute. | |
unsigned int | LCBD_load (LCBD lcb, unsigned int options, unsigned int *event_base) |
Initializes the LCB hardware and LCBD software. | |
unsigned int | LCBD_load_cancel (LCBD lcb) |
Cancels the Waiting for the LCBD_load_init completion. | |
unsigned int | LCBD_load_init (LCBD lcb, unsigned int options, unsigned int *event_base, LCBD_load_cb notify, void *prm) |
Initializes the LCB hardware and LCBD software. | |
void | LCBD_load_notify (void *semaphore, LCBD lcb, unsigned int status) |
Pre-canned LCBD load notification callback routine. | |
unsigned int | LCBD_load_wait (LCBD lcb) |
Waits for the LCBD_load_init completion. | |
unsigned int | LCBD_unload (LCBD lcb) |
Unloads the LCB driver. | |
unsigned int | LCBD_board_id_set (LCBD lcb, int new_board_id, int *org_board_id) |
Sets the LATp board Id, returning the orginal board id. | |
unsigned int | LCBD_clk_edge_set (LCBD lcb, unsigned int new_options, unsigned int *old_options) |
Sets the clock options. | |
unsigned int | LCBD_width_set (LCBD lcb, int new_width, int *org_width) |
Sets the LATp event fabric data path width, returning the original data path width setting. | |
unsigned int | LCBD_fabric_read (LCBD lcb) |
Reads the fabric select register. | |
unsigned int | LCBD_fabric_select (LCBD lcb, unsigned int fabric) |
Sets the fabric to specified value. | |
unsigned int | LCBD_faults_read (LCBD lcb, unsigned int clear, unsigned int *prv, unsigned int *cur) |
Reads the LATp faults register and, optionally, clears the specified bits. | |
unsigned int | LCBD_drain (LCBD lcb, int which) |
Drains the specified ques. | |
unsigned int | LCBD_pci_cfg_status_clear (LCBD lcb) |
Clears the PCI configuration space status word. | |
const LCBD_dib * | LCBD_dib_locate (const LCBD lcb) |
Returns a readonly pointer to the LCB's device information block. | |
void | LCBD_dib_show (const LCBD_dib *dib) |
Shows (prints to the terminal) the Device Information Block. | |
unsigned int | LCBD_enable (LCBD lcb, unsigned int enables) |
Sets the enable/disable flags controlling the EVENT and RESULT interrupts. | |
LCBD_state | LCBD_state_get (LCBD lcb) |
Returns the current state of the driver. |
CVS $Id
unsigned int loadLcbd (unsigned int *circularBuffer) { // Get pre-initialized driver handle lcb = LCBD_create (); // Load the driver status = LCBD_load (lcb, LCBD_LOAD_OPTIONS_M_FABRIC_PRIMARY | LCBD_LOAD_OPTIONS_M_SET_INTERRUPT_DEFAULT circularBuffer); // Install the result, event and notification service tasks // using the default priorities status = LCBD_rst_handler_create (lcb, LCBD_RST_K_DEFAULT_PRIORITY); status = LCBD_evt_handler_create (lcb, LCBD_EVT_K_DEFAULT_PRIORITY); status = LCBD_nut_handler_create (lcb, LCBD_NUT_K_DEFAULT_PRIORITY); // Set the callback handler for the protocol #1 status = LCBD_evt_cb_set (lcb, 1, eventHander, eventParameter); // Set event interrupt conditions 50% on FIFO LCBD_evt_conds_set (lcb, LCBD_EVT_COND_50_FULL); // Enable the result and event interrupts status = LCBD_enable (lcb, LCBD_M_ENABLE_EVENT | LCBD_M_ENABLE_RESULT)); // Enable the event flow into the LCB's circular buffer status = LCBD_evt_enable (lcb, 1); return status; }
Typedef for enum _LCBD_CLK_EDGE_OPTIONS_M.
Typedef for struct _LCBD_dib.
Typedef for enum _LCBD_FPGA_SUP_K.
Callback for LCBD_load asynchronous completion.
prm | A user specified parameter | |
lcb | The LCB handle | |
status | The initialization completion status |
Typedef for enum _LCBD_LOAD_OPTIONS_M.
status = LCBD_load (lcb, LCBD_LOAD_OPTIONS_M_FABRIC_REDUNDANT | LCBD_LOAD_OPTIONS_M_INTERRUPT_PID | LCBD_LOAD_OPTIONS_M_ICLK_ASIS | LCBD_LOAD_OPTIONS_M_OCLK_ASIS | LCBD_LOAD_OPTIONS_M_BOARD_ID_N(23) | LCBD_LAOD_OPTIONS_M_LATP8_BYTE eventBase);
Typedef for enum _LCBD_M_ENABLE_DISABLE.
Typedef for enum _LCBD_WIDTH_K.
Defines the options word of LCBD_clk_edge_set.
enum _LCBD_FABRIC_K |
enum _LCBD_FPGA_SUP_K |
Enumerates the possible driver FPGA support levels.
enum _LCBD_LOAD_OPTIONS_M |
Defines the load options word.
Enumerates the IRQ enable/disable/pending bits.
enum _LCBD_QUES_M |
enum _LCBD_STATE |
enum _LCBD_STATE_M |
enum _LCBD_WIDTH_K |
unsigned int LCBD_allow | ( | unsigned char | pci_version, | |
unsigned char | latp_version | |||
) |
Adds the specified PCI and LATP version number combination as being supported by this driver.
LCBD_OK,if | successfully added | |
LCBD_NOROOM,if | there is no room to add this version combination |
pci_version | The PCI FPGA version to allow | |
latp_version | The LATp FPGA version to allow |
References LCBD_OK, _FpgaList::pairs, and _FpgaList::tcnt.
unsigned int LCBD_board_id_set | ( | LCBD | lcb, | |
int | new_board_id, | |||
int * | org_board_id | |||
) |
Sets the LATp board Id, returning the orginal board id.
Status |
lcb | The LCB driver handle | |
new_board_id | The new board id | |
org_board_id | Returned as the value of the board id before it was changed. May be specified as NULL. |
References _LCB_csr::bf, _LCB_csr_bf::boardID, LCB_CSR_M_BOARD_ID, LCB_CSR_V_BOARD_ID, lcbd_csr_access(), LCBD_K_INTERNAL_OP_STALL, and _LCB_csr::ui.
unsigned int LCBD_clk_edge_set | ( | LCBD | lcb, | |
unsigned int | new_options, | |||
unsigned int * | org_options | |||
) |
Sets the clock options.
Status |
lcb | The LCB driver handle | |
new_options | The new options | |
org_options | Returned as the value of the options before they were changed. May be specified as NULL. |
References _LCB_csr::bf, _LCB_csr_bf::iclkTrailing, LCB_CSR_V_ICLK_TRAILING, lcbd_csr_access(), LCBD_K_INTERNAL_OP_STALL, _LCB_csr_bf::oclkTrailing, and _LCB_csr::ui.
LCBD LCBD_create | ( | LCBD | lcb | ) |
Preinitializes the LCBD device control block.
lcb | Pointer to the LCBD device control block to preinitialize. If this is NULL, then the block is located using LCBD_get () |
References Lcb.
const LCBD_dib* LCBD_dib_locate | ( | LCBD | lcb | ) |
Returns a readonly pointer to the LCB's device information block.
lcb | Pointer to private LCBD structure |
void LCBD_dib_show | ( | const LCBD_dib * | dib | ) |
Shows (prints to the terminal) the Device Information Block.
dib | The Device Information Block to show |
References _LCBD_dib::fpga_sup, _LCBD_dib::irq, _LCBD_dib::latp_rev, LCBD_FPGA_SUP_K_MIN, _LCBD_dib::lcl2pci, _LCBD_dib::pci2lcl, _LCBD_dib::pci_bus, _LCBD_dib::pci_dev, _LCBD_dib::pci_func, _LCBD_dib::pci_rev, and _LCBD_dib::reg.
unsigned int LCBD_drain | ( | LCBD | lcb, | |
int | which | |||
) |
Drains the specified ques.
lcb | The LCBD driver handle | |
which | Which ques to drain, a bit mask of LCBD_QUES_M_RESULT and LCBD_QUES_M_EVENT |
References drain_event(), drain_result(), LCBD_OK, LCBD_QUES_M_EVENT, and LCBD_QUES_M_RESULT.
Referenced by LCBD_unload().
unsigned int LCBD_enable | ( | LCBD | lcb, | |
unsigned int | enables | |||
) |
Sets the enable/disable flags controlling the EVENT and RESULT interrupts.
LCBD_OK,on | success | |
LCBD_ISRQUEUE,if | one or both of the result/event being enabled does not have a service FORK task/que associated with it. |
lcb | Pointer to private LCBD structure | |
enables | A bit mask of
|
Unless explicitly stated, when enabling or disabling the event interrupt, the sub-interrupt condition of the circular buffer full will also be enabled or disabled. To explicitly prohibit this action, specify LCBD_M_CBUF_ENABLE or LCBD_M_CBUF_DISABLE.
References _LCB_prb::csr, _LCB_prb::irq, LCB_IRQ_K_SRC_CNT, LCB_PCI_CSR_M_CLK, LCBD__pciLoad32(), LCBD__pciStore32(), LCBD_M_DISABLE_CBUF, LCBD_M_DISABLE_EVENT, LCBD_M_DISABLE_RESULT, LCBD_M_ENABLE_CBUF, LCBD_M_ENABLE_EVENT, LCBD_M_ENABLE_RESULT, LCBD_OK, LCBD_STATE_OFFLINE, and LCBD_STATE_ONLINE.
Referenced by LCBD_unload().
unsigned int LCBD_fabric_read | ( | LCBD | lcb | ) |
Reads the fabric select register.
lcb | Pointer to private LCBD structure |
References LCBD__pciLoad32().
unsigned int LCBD_fabric_select | ( | LCBD | lcb, | |
unsigned int | fabric | |||
) |
Sets the fabric to specified value.
lcb | Pointer to private LCBD structure | |
fabric | The value to set the fabric to, i.e. one of LCBD_FABRIC_PRIMARY or LCBD_FABRIC_REDUNDANT. |
References LCBD__pciLoad32(), and select_fabric().
unsigned int LCBD_faults_read | ( | LCBD | lcb, | |
unsigned int | clear, | |||
unsigned int * | prv, | |||
unsigned int * | cur | |||
) |
Reads the LATp faults register and, optionally, clears the specified bits.
// Just read the faults register status = LCBD_faults_read (lcb, 0, &faults, NULL); // Read and clear the faults register status = LCBD_faults_read (lcb, -1, &faults, NULL);
References lcbd_faults_access(), and LCBD_K_INTERNAL_OP_STALL.
LCBD LCBD_get | ( | void | ) |
Returns a pointer to the driver control structute.
References Lcb.
unsigned int LCBD_load | ( | LCBD | lcb, | |
unsigned int | options, | |||
unsigned int * | event_base | |||
) |
Initializes the LCB hardware and LCBD software.
lcb | The LCB device handle | |
options | Selects various options. This is done as a select/value field. This are enumerated in LCBD_LOAD_OPTIONS_M. | |
event_base | The base address of the event buffer. Two special values can be used here
|
References LCBD_load_init().
unsigned int LCBD_load_cancel | ( | LCBD | lcb | ) |
Cancels the Waiting for the LCBD_load_init completion.
LCBD_OK,operation | was cancelled | |
LCBD_AIBCOM,operation | was not cancelled because initialization is already completed. |
lcb | The LCB driver handle |
References LCBD_AIB_ACTION_AVAILABLE, LCBD_AIB_ACTION_CANCEL, and LCBD_OK.
unsigned int LCBD_load_init | ( | LCBD | lcb, | |
unsigned int | options, | |||
unsigned int * | event_base, | |||
LCBD_load_cb | notify, | |||
void * | prm | |||
) |
Initializes the LCB hardware and LCBD software.
lcb | The LCB device handle | |
options | Selects various options. This is done as a select/value field. This are enumerated in LCBD_LOAD_OPTIONS_M. | |
event_base | The base address of the event buffer. Two special values can be used here
| |
notify | A routine to be called back when the driver is fully initialized. The call signature is void notify (void *prm, LCBD lcb, unsigned int status) | |
prm | An arbitrary user parameter passed to the notify routine. |
status = LCBD_load_init (lcb, options, event_base, LBCD_load_notify, NULL); // The only errors are catastophic if (status != LCBD_OK) return status; // Now do a bunch of other stuff.... call_a_bunch_of_other_stuff (lots_of_parameters); // Done doing other stuff, now wait till the driver is fully initialized status = LCBD_load_wait (lcb); if (status != LCBD_OK) return status; .
References connect(), init_latp(), init_pci(), and init_sw().
Referenced by LCBD_load().
void LCBD_load_notify | ( | void * | semaphore, | |
LCBD | lcb, | |||
unsigned int | status | |||
) |
Pre-canned LCBD load notification callback routine.
semaphore | The synchronizing semaphore | |
lcb | The LCB driver handle | |
status | The completion status |
Referenced by init_latp().
unsigned int LCBD_load_wait | ( | LCBD | lcb | ) |
Waits for the LCBD_load_init completion.
lcb | The LCB driver handle |
Referenced by init_latp().
unsigned int LCBD_pci_cfg_status_clear | ( | LCBD | lcb | ) |
Clears the PCI configuration space status word.
status |
lcb | Pointer to private LCBD structure |
References LCBD_pci_cfg_outWord().
LCBD_state LCBD_state_get | ( | LCBD | lcb | ) |
Returns the current state of the driver.
lcb | The LCB driver handle |
unsigned int LCBD_unload | ( | LCBD | lcb | ) |
Unloads the LCB driver.
References _LCBD_siv::bf, destroy_sw(), disconnect(), LCBD_drain(), LCBD_enable(), LCBD_OK, LCBD_QUES_M_BOTH, LCBD_STATE_UNLOADING, and _LCBD_siv::ui.
unsigned int LCBD_width_set | ( | LCBD | lcb, | |
int | new_width, | |||
int * | org_width | |||
) |
Sets the LATp event fabric data path width, returning the original data path width setting.
Status. |
lcb | The LCB driver handle | |
new_width | The new data width, this should be specified as either
| |
org_width | Returned as the value of the data path width before it was changed. May be specified as NULL. The returned value will be either |
References _LCB_csr::bf, _LCB_csr_bf::latp8, LCB_CSR_M_LATP8, LCB_CSR_V_LATP8, lcbd_csr_access(), LCBD_K_INTERNAL_OP_STALL, and _LCB_csr::ui.