GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCBD / V1-3-2
Constituent: lcbd     Tag: sun-gcc
#include <string.h>
#include "LCBD/LCBD_drv.h"
#include "LCBD/LCBD_pci.h"
#include "LCBD/LCBD_msgs.h"
#include "LCBD/LCB.h"
#include "LCBD/LCB_cr.h"
#include "LCBD/LCBC.h"
#include "LCBD_p.h"
#include "PBI/Attribute.h"
#include "PBS/L.ih"
#include "PBS/FORK.h"
#include "PBS/MBA.h"
#include "PBS/SPIN.h"
#include "PBS/RW.ih"
#include "PBS/RW_protos.h"
#include "PBS/INT.ih"
#include <stdio.h>
Include dependency graph for LCBD_drv.c:
Data Structures | |
struct | _FpgaList |
Structure defining the list of supported Fpgas. More... | |
Defines | |
#define | FABRIC_SELECT_TIMEOUT 10000 |
The timeout period, in nanoseconds, that one is willing to wait for the clock to show up after doing a fabric select. | |
Typedefs | |
typedef _FpgaList | FpgaList |
Typedef for struct _FpgaList. | |
Functions | |
unsigned int | connect (LCBD lcb, unsigned int options) |
Connects the LCBD to the interrupt source. | |
unsigned int | disconnect (LCBD lcb) |
Disconnects the LCBD from the interrupt source. | |
unsigned int | clk_handler (void *unused, LCBD lcb) |
Default clock off -> on and clock on -> off handler. | |
unsigned int | evt_def_handler (void *unused, unsigned int ed, LCBD_evt *evt) |
Default event handler. | |
unsigned int | init_pci (LCBD lcb) |
Initializes the LCBD structure -- probes the PCI bus. | |
unsigned int | init_latp (LCBD lcb, unsigned int options, unsigned int *event_base, LCBD_load_cb notify, void *prm) |
Laundry list of LCBD initializations to do on the LATp side. | |
unsigned int | init_latp_clk_on (LCBD lcb, unsigned int options, unsigned int *event_base) |
Complete LCBD initializations of LATp side. | |
unsigned int | init_latp_clk_on_isr (SEM semaphore, LCBD lcb) ATTR_UNUSED_OK |
Clock interrupt callback routine to complete LATp-side initialization. | |
unsigned int | init_latp_clk_on_entry (LCBD lcb) ATTR_UNUSED_OK |
The asynchronous LATp-side initialization call back handler. | |
unsigned int | init_circ (LCBD lcb, unsigned int *event_base, int fill) |
Allocates memory for and sets it up to be used as the circular buffer. | |
unsigned int | init_sw (LCBD lcb) |
Laundry list of LCBD initializations to do on the software side. | |
unsigned int | destroy_sw (LCBD lcb) |
Laundry list of LCBD shutdowns to do on the software side. | |
unsigned int | drain_result (LCBD lcb) |
Drains the result FIFOs. | |
unsigned int | drain_event (LCBD lcb) |
Drains the event FIFOs. | |
unsigned int | check (unsigned int rd, unsigned int error, const char *name) |
Checks for and reports both IO and ITEM errors. | |
unsigned int | poll (LCBD lcb, unsigned int nsecs, int iterations) |
Polls the RESULT FIFO every nsecs for @ iterations. | |
unsigned int | destroy_handler (LCBD_hcb *hcb, unsigned int failure) |
Destroys a FORK processing task, iff it was created by the LCBD driver. | |
void | select_fabric (unsigned int volatile *fabric, unsigned int select) |
Accesses the fabric select register, writing the fabric select bit and waits for either the clock to show up or a timeout period to expire. | |
unsigned int | submit (LCBD lcb, unsigned int request) |
Submits the specified request list to the LCB for execution. | |
unsigned int | poll_reg_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *prv, unsigned int *cur, unsigned int header) |
Performs an access to the LATP register. | |
unsigned int | poll_csr_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *prv, unsigned int *cur) |
Performs an access to the LATP CSR register. | |
unsigned int | poll_faults_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *prv, unsigned int *cur) |
Performs an access to the LATP FAULTS register. | |
unsigned int | clear_faults (LCBD lcb, unsigned short int stall) |
Clears the FIFO faults register. | |
void | lcbd_isr (LCBD lcb) |
Central ISR that dispatches LCB result descriptors. | |
unsigned int | lcbd_csr_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *prv, unsigned int *cur) |
Utility routine to compose and execute an access command to LCB's CSR register independent of whether the driver is offline or online. | |
unsigned int | lcbd_faults_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *prv, unsigned int *cur) |
Utility routine to compose and execute an access command to LCB's FAULTS register independent of whether the driver is offline or online. | |
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. | |
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 *org_options) |
Sets the clock options. | |
LCBD | LCBD_create (LCBD lcb) |
Preinitializes the LCBD device control block. | |
const LCBD_dib * | LCBD_dib_locate (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_drain (LCBD lcb, int which) |
Drains the specified ques. | |
unsigned int | LCBD_enable (LCBD lcb, unsigned int enables) |
Sets the enable/disable flags controlling the EVENT and RESULT interrupts. | |
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. | |
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_pci_cfg_status_clear (LCBD lcb) |
Clears the PCI configuration space status word. | |
LCBD_state | LCBD_state_get (LCBD lcb) |
Returns the current state of the driver. | |
unsigned int | LCBD_unload (LCBD lcb) |
Unloads the LCB driver. | |
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. | |
__inline unsigned int | init_dib (LCBD_dib *dib) |
Initializes the Device Information Block Status. | |
__inline unsigned int | check_pci_version (const FpgaList *fpga, unsigned char pci_version) |
Checks if the pci version is in the list of acceptable versions. | |
__inline unsigned int | check_fpgas_version (const FpgaList *fpga, unsigned char pci_version, unsigned char latp_version) |
Checks if the combined PCI/LATP versions is in the list of acceptable versions. | |
__inline void | init_evt_cbp (LCBD_evt_cbp evt[LCBD_EVT_PROTO_CNT], LCBD_evt_cb defaultHandler, void *defaultParameter) |
Initializes all event fabric protocol handlers to a default callback and parameter. | |
__inline unsigned int | init_evt_fcb (LCBD_evt_fcb *fcb, unsigned int *event_base) |
Initializes the event free control block. | |
__inline int | init_ucb (LCBD_ucb *ucb, LCBD lcb) |
Initializes the Unit Control block. | |
__inline int | destroy_ucb (LCBD_ucb *ucb, LCBD lcb) |
Shutsdown the Unit(s) Control block. | |
__inline unsigned int | destroy_result_handler (LCBD lcb) |
Destroys the result que service task, iff it was created by the LCBD driver. | |
__inline unsigned int | destroy_event_handler (LCBD lcb) |
Destroys the event que service task, iff it was created by the LCBD driver. | |
unsigned int | lcbd_create_handler (LCBD_hcb *hcb, const char *name, int priority, LCBD lcb, int que_cnt, const FORK_que_cfg *que_cfg, int que_id, unsigned int failure) |
Creates a FORK processing task. | |
__inline unsigned int | handle_clks (LCBD_clk_ucb *clk, LCBD_stats_isr *stats, LCBD lcb, unsigned int clock, unsigned int pending, unsigned int enabled) |
Handles the clock interrupts. | |
Variables | |
FpgaList | Fpga |
List of correlated PCI,LATP FPGA versions that this driver is compatiable with. | |
_LCBD | Lcb |
The actual storage for the driver control block. |
JJRussell -- russell@slac.stanford.edu
CVS $Id
The next step is to drain the FIFOs, but this depends on whether the LCB is a commander or a responder
Problems associated with the draining of each FIFOs must be considered separately.
If the LCB is being used as a responder, then it is very possible that one will find a result item sent by the commander (SIU) that contains the board address to assign to this LCB. This is also a signal that the LCB LATp side clock is now running, so one can now perform operations to the LATp side (ie proceed with the LATp side initialization phase.
|
The timeout period, in nanoseconds, that one is willing to wait for the clock to show up after doing a fabric select.
|
|
Checks for and reports both IO and ITEM errors.
|
Here is the call graph for this function:
|
Checks if the combined PCI/LATP versions is in the list of acceptable versions.
|
|
Checks if the pci version is in the list of acceptable versions.
|
|
Clears the FIFO faults register.
|
Here is the call graph for this function:
|
Default clock off -> on and clock on -> off handler.
|
|
Connects the LCBD to the interrupt source.
|
Here is the call graph for this function:
|
Destroys the event que service task, iff it was created by the LCBD driver.
|
Here is the call graph for this function:
|
Destroys a FORK processing task, iff it was created by the LCBD driver.
|
|
Destroys the result que service task, iff it was created by the LCBD driver.
|
Here is the call graph for this function:
|
Laundry list of LCBD shutdowns to do on the software side.
|
Here is the call graph for this function:
|
Shutsdown the Unit(s) Control block.
|
|
Disconnects the LCBD from the interrupt source.
|
Here is the call graph for this function:
|
Drains the event FIFOs.
|
Here is the call graph for this function:
|
Drains the result FIFOs.
In the last case, an attempt is made to clear an remaining transactions. Could one get into trouble here be taking too long. Don't think so. The request FIFO can only execute 2 commands at a time so the only way there could be a lot of transactions to dispose of is if they are already in the result que. The result FIFO is a maximum of 4Kbytes or 1K transactions in length, Therefore the maximum time will be something like 1K * 2 usecs (the 2 usecs being a generous estimate of the PCI read of the result FIFO.) + the time of complete of the sweeping transaction (something like 10usecs) for a total of about .2msecs.
|
Here is the call graph for this function:
|
Default event handler.
|
|
Handles the clock interrupts.
|
Here is the call graph for this function:
|
Allocates memory for and sets it up to be used as the circular buffer.
|
Here is the call graph for this function:
|
Initializes the Device Information Block Status.
|
|
Initializes all event fabric protocol handlers to a default callback and parameter.
|
|
Initializes the event free control block.
|
|
Laundry list of LCBD initializations to do on the LATp side.
|
Here is the call graph for this function:
|
Complete LCBD initializations of LATp side.
|
Here is the call graph for this function:
|
Initializes the LCBD structure -- probes the PCI bus.
|
Here is the call graph for this function:
|
Laundry list of LCBD initializations to do on the software side.
|
Here is the call graph for this function:
|
Initializes the Unit Control block.
|
Here is the call graph for this function:
|
Adds the specified PCI and LATP version number combination as being supported by this driver.
|
|
Sets the LATp board Id, returning the orginal board id.
|
Here is the call graph for this function:
|
Sets the clock options.
|
Here is the call graph for this function:
|
Preinitializes the LCBD device control block.
|
|
Creates a FORK processing task.
|
|
Utility routine to compose and execute an access command to LCB's CSR register independent of whether the driver is offline or online.
|
Here is the call graph for this function:
|
Returns a readonly pointer to the LCB's device information block.
|
|
Shows (prints to the terminal) the Device Information Block.
|
|
Drains the specified ques.
|
Here is the call graph for this function:
|
Sets the enable/disable flags controlling the EVENT and RESULT interrupts.
|
Here is the call graph for this function:
|
Reads the fabric select register.
|
Here is the call graph for this function:
|
Sets the fabric to specified value.
|
Here is the call graph for this function:
|
Utility routine to compose and execute an access command to LCB's FAULTS register independent of whether the driver is offline or online.
|
Here is the call graph for this function:
|
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);
|
Here is the call graph for this function:
|
Returns a pointer to the driver control structute.
|
|
Central ISR that dispatches LCB result descriptors.
|
Here is the call graph for this function:
|
Initializes the LCB hardware and LCBD software.
|
Here is the call graph for this function:
|
Cancels the Waiting for the LCBD_load_init completion.
|
|
Initializes the LCB hardware and LCBD software.
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; . |
Here is the call graph for this function:
|
Pre-canned LCBD load notification callback routine.
|
|
Waits for the LCBD_load_init completion.
|
|
Clears the PCI configuration space status word.
|
Here is the call graph for this function:
|
Returns the current state of the driver.
|
|
Unloads the LCB driver.
|
Here is the call graph for this function:
|
Sets the LATp event fabric data path width, returning the original data path width setting.
|
Here is the call graph for this function:
|
Polls the RESULT FIFO every nsecs for @ iterations.
|
Here is the call graph for this function:
|
Performs an access to the LATP CSR register.
|
Here is the call graph for this function:
|
Performs an access to the LATP FAULTS register.
|
Here is the call graph for this function:
|
Performs an access to the LATP register.
|
Here is the call graph for this function:
|
Accesses the fabric select register, writing the fabric select bit and waits for either the clock to show up or a timeout period to expire.
|
Here is the call graph for this function:
|
Submits the specified request list to the LCB for execution.
|
Here is the call graph for this function:
|
Initial value: { 9, 9, { FPGA (0x80, 0x80), FPGA (0x2c, 0x5e), FPGA (0x2c, 0x5d), FPGA (0x2c, 0x5c), FPGA (0x2b, 0x5c), FPGA (0x2a, 0x5c), FPGA (0x2c, 0x5b), FPGA (0x2b, 0x5b), FPGA (0x2a, 0x5b), 0,0, 0,0,0,0 } }
|
|
The actual storage for the driver control block.
|