GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCBD / dev > lcbd / rad750
#include <LCBD/LCBD_clk.h>
#include <LCBD/LCBD_evt.h>
#include <LCBD/LCBD_nut.h>
#include <LCBD/LCBD_rst.h>
#include <LCBD/LCBD_stats.h>
#include <PBS/FORK.h>
#include <PBS/TASK.h>
#include <PBS/L.h>
#include <PBS/MTX.h>
#include <PBS/SEM.h>
#include <MSG/MSG_pubdefs.h>
#include <PBI/Endianness.h>
#include <PBI/Attribute.h>
#include <PBS/BSWP.ih>
#include <LCBD/LCBD_drv.h>
Classes | |
struct | _LCBD_clk_ucb |
Clock Unit Control Block. More... | |
struct | _LCBD_hcb |
Handler control block. More... | |
struct | _LCBD_rst_msg |
Result dispatch messsage. More... | |
struct | _LCBD_rst_flush_msg |
Result flush dispatch messsage. More... | |
struct | _LCBD_rst_ccb |
The Command Control Block, describes the control information for needed to control access to the LCB's command request queue. More... | |
struct | _LCBD_rst_ucb |
Result Unit Control Block. More... | |
struct | _LCBD_evt_msg |
Event dispatch messsage. More... | |
struct | _LCBD_evt_cbb |
Cached information about the circular buffer. More... | |
struct | _LCBD_evt_fcb |
Event Unit free control block. More... | |
struct | _LCBD_evt_ucb |
Event Unit control block. More... | |
struct | _LCBD_siv_bf |
The driver's State Informat Vector, bit field representation. More... | |
struct | _LCBD_siv_us |
The driver's State Informat Vector, unsigned shorts. More... | |
union | _LCBD_siv |
Union of the bit field representation of the state vector with an unsigned int. More... | |
struct | _LCBD_ucb |
Control block for the 3 units that comprise the LCB. More... | |
struct | _LCBD_scb |
Statistics control block. More... | |
struct | _LCBD_ncb_msg |
Format of the fork notification messsage. More... | |
struct | _LCBD_ncb |
Notification control block. More... | |
struct | _LCBD_icb |
Interrupt control block. More... | |
struct | _LCBD_aib |
Asycnchronous Initialization Block. More... | |
struct | _LCBD |
Struct containing fundamental parameters for the LCB. More... | |
Defines | |
#define | _DPRINTF(format, args...) |
expands to empty statement for production builds | |
#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 | LCBD_K_INTERNAL_OP_STALL 0 |
Used as the stall value for commands to the LCBD internal registers. | |
Typedefs | |
typedef enum _LCBD_DISPATCH_TYPE | LCBD_DISPATCH_TYPE |
Typedef for enum __LCBD_DISPATCH_TYPE. | |
typedef struct _LCBD_clk_ucb | LCBD_clk_ucb |
Typedef for struct _LCBD_clk_ucb. | |
typedef struct _LCBD_hcb | LCBD_hcb |
Typedef for struct _LCBD_hcb. | |
typedef struct _LCBD_rst_msg | LCBD_rst_msg |
Typedef for struct _LCBD_rst_msg. | |
typedef struct _LCBD_rst_flush_msg | LCBD_rst_flush_msg |
Typedef for struct _LCBD_rst_flush_msg. | |
typedef struct _LCBD_rst_ccb | LCBD_rst_ccb |
Typedef for struct _LCBD_rst_ccb. | |
typedef struct _LCBD_rst_ucb | LCBD_rst_ucb |
Typedef for struct _LCBD_rst_ucb. | |
typedef struct _LCBD_evt_msg | LCBD_evt_msg |
Typedef for struct _LCBD_evt_msg. | |
typedef struct _LCBD_evt_cbb | LCBD_evt_cbb |
Typedef for struct _LCBD_evt_cbb. | |
typedef struct _LCBD_evt_fcb | LCBD_evt_fcb |
Typedef for struct _LCBD_evt_fcb. | |
typedef struct _LCBD_evt_ucb | LCBD_evt_ucb |
Typedef for struct _LCBD_evt_ucb. | |
typedef enum _LCBD_SIV_V | LCBD_SIV_V |
Typedef for enum _LCBD_SIV_V. | |
typedef enum _LCBD_SIV_M | LCBD_SIV_M |
Typedef for enum _LCBD_SIV_M. | |
typedef struct _LCBD_siv_bf | LCBD_siv_bf |
Typedef for enum _LCBD_siv_bf. | |
typedef struct _LCBD_siv_us | LCBD_siv_us |
Typedef for enum _LCBD_siv_us. | |
typedef union _LCBD_siv | LCBD_siv |
Typedef for union _LCBD_siv. | |
typedef struct _LCBD_ucb | LCBD_ucb |
Typedef for struct _LCBD_ucb. | |
typedef struct _LCBD_scb | LCBD_scb |
Typedef for struct _LCBD_scb. | |
typedef struct _LCBD_ncb_msg | LCBD_ncb_msg |
Typedef for struct _LCBD_ncb_msg. | |
typedef struct _LCBD_ncb | LCBD_ncb |
Typedef for struct _LCBD_ncb. | |
typedef enum _LCBD_ICB_K_TYPE | LCBD_ICB_K_TYPE |
Typedef for enum _LCBD_ICB_K_TYPE. | |
typedef struct _LCBD_icb | LCBD_icb |
Typedef for struct _LCBD_icb. | |
typedef void(* | LCBD_acb )(void *prm, LCBD lcb) |
Callback for LCBD_load asynchronous completion. | |
typedef enum _LCBD_aib_action | LCBD_aib_action |
Typedef for enum _LCBD_aib_action. | |
typedef struct _LCBD_aib | LCBD_aib |
Typedef for struct _LCBD_aib. | |
Enumerations | |
enum | _LCBD_DISPATCH_TYPE { LCBD_DISPATCH_TYPE_ISR = 0, LCBD_DISPATCH_TYPE_USR = 1 } |
Enumeration of the different types of events that cause bottom half processing. More... | |
enum | _LCBD_SIV_V { LCBD_SIV_V_PCI_UNINITIALIZED = 0, LCBD_SIV_V_SW_UNINITIALIZED = 1, LCBD_SIV_V_LATP_UNINITIALIZED = 2, LCBD_SIV_V_NOCLOCK = 3, LCBD_SIV_V_DISCONNECTED = 4, LCBD_SIV_V_RESULT_DISABLED = 5, LCBD_SIV_V_CNT = 6, LCBD_SIV_V_STATE = 16 } |
Bit field offsets for the State Information Vector. More... | |
enum | _LCBD_SIV_M { LCBD_SIV_M_PCI_UNINITIALIZED = (1 << LCBD_SIV_V_PCI_UNINITIALIZED), LCBD_SIV_M_SW_UNINITIALIZED = (1 << LCBD_SIV_V_SW_UNINITIALIZED), LCBD_SIV_M_LATP_UNINITIALIZED = (1 << LCBD_SIV_V_LATP_UNINITIALIZED), LCBD_SIV_M_NOCLOCK = (1 << LCBD_SIV_V_NOCLOCK), LCBD_SIV_M_DISCONNECTED = (1 << LCBD_SIV_V_DISCONNECTED), LCBD_SIV_M_RESULT_DISABLED = (1 << LCBD_SIV_V_RESULT_DISABLED), LCBD_SIV_M_STATE = 0xFFFF0000, LCBD_SIV_M_VEC_INITIAL_VALUE = (1 << LCBD_SIV_V_CNT) - 1, LCBD_SIV_M_STATE_ONLINE = (LCBD_STATE_ONLINE << LCBD_SIV_V_STATE), LCBD_SIV_M_STATE_OFFLINE = (LCBD_STATE_OFFLINE << LCBD_SIV_V_STATE), LCBD_SIV_M_STATE_UNINITIALIZED, LCBD_SIV_M_STATE_UNLOADING = (LCBD_STATE_UNLOADING << LCBD_SIV_V_STATE), LCBD_SIV_M_INITIAL_VALUE } |
Bit field masks for the State Information Vector. More... | |
enum | _LCBD_ICB_K_TYPE { LCBD_ICB_K_TYPE_PCI = 0, LCBD_ICB_K_TYPE_PID = 1 } |
The interrupt source type. | |
enum | _LCBD_aib_action { LCBD_AIB_ACTION_AVAILABLE = -1, LCBD_AIB_ACTION_NO_ACCESS = 0, LCBD_AIB_ACTION_COMPLETE = 1, LCBD_AIB_ACTION_CANCEL = 2 } |
The action to perform. More... | |
Functions | |
static __inline unsigned int | LCBD__pciLoad32 (volatile unsigned int *src) ATTR_UNUSED_OK |
Read a 32-bit integer from PCI Memory. | |
static __inline void | LCBD__pciStore32 (volatile unsigned int *dest, unsigned int w) ATTR_UNUSED_OK |
Write a 32-bit integer to PCI Memory. | |
static __inline void | LCBD__pciSynchStore32 (volatile unsigned int *dest, unsigned int w) ATTR_UNUSED_OK |
Write a 32-bit integer to PCI Memory. | |
static __inline unsigned int | msr_get (void) |
Gets the value of the Power PC Machine Status Register. | |
static __inline unsigned int | msr_clr (unsigned int msr) |
Clears the interrupt enable bit in the specified msr. | |
static __inline void | msr_put (unsigned int msr) |
Puts/restores the specified msr back into the Machine Status Register. | |
unsigned int | LCBD_stats_init (LCBD_scb *scb) |
Initializes the statistics control block. | |
unsigned int | LCBD_stats_destroy (LCBD_scb *scb) |
Destroys the statistics control block. | |
unsigned int | lcbd_csr_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int timeout, 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 timeout, 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_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. | |
FORK_cb_status | lcbd_evt_handler (FORK_cb_prm parameter, FORK_msg_hdr *fork_msg) |
The main LCBD descriptor dispatching routine for event traffic. | |
FORK_cb_status | lcbd_rst_handler (FORK_cb_prm parameter, FORK_msg_hdr *fork_msg) |
The main LCBD descriptor dispatching routine. | |
FORK_cb_status | lcbd_rst_flush_handler (FORK_cb_prm parameter, FORK_msg_hdr *fork_msg) |
The main LCBD descriptor dispatching routine. | |
unsigned int | lcbd_nut_post (LCBD lcb) |
Posts a message to the notify service task. | |
unsigned int | lcbd_nut_handler_destroy (LCBD lcb, unsigned int *exit_status) |
Destroys the notification service task. |
#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.
n | Unique identifying string (helps isolate the error) | |
a | The value to check | |
b | The value to check |
Callback for LCBD_load asynchronous completion.
prm | A user specified parameter | |
lcb | The LCB handle |
Typedef for struct _LCBD_aib.
Typedef for struct _LCBD_evt_fcb.
Information for freeing events
Typedef for struct _LCBD_evt_msg.
Describes the FORK message passed to the event handler
Typedef for struct _LCBD_evt_ucb.
Combines an generic handler control block with a specific message
Typedef for struct _LCBD_hcb.
Describes the parameters of a LCBD handler (either event or result)
Typedef for struct _LCBD_ncb_msg.
Typedef for struct _LCBD_rst_ccb.
Typedef for struct _LCBD_rst_flush_msg.
Describes the FORK message passed to the result flush handler. This handler gets called back whenever the driver goes offline and there are messages on the pending que.
Typedef for struct _LCBD_rst_msg.
Describes the FORK message passed to the result handler
Typedef for struct _LCBD_rst_ucb.
Combines an generic handler control block with a specific message
Typedef for struct _LCBD_scb.
The block contains the context used by the LCBD statistics routines. These routines do not control the accumulation of the statistics, but manage the fetching and clearing of them.
Typedef for enum _LCBD_siv_bf.
Typedef for struct _LCBD_ucb.
The block contains the context used by the LCBD to control each of its three (nearly) distinct units. These units are
enum _LCBD_aib_action |
enum _LCBD_DISPATCH_TYPE |
enum _LCBD_SIV_M |
Bit field masks for the State Information Vector.
enum _LCBD_SIV_V |
Bit field offsets for the State Information Vector.
static __inline unsigned int LCBD__pciLoad32 | ( | volatile unsigned int * | src | ) | [static] |
Read a 32-bit integer from PCI Memory.
src | Pointer source memory location |
Referenced by drain_event(), init_latp(), LCBD_enable(), LCBD_evt_conds_set(), lcbd_evt_handler(), LCBD_evt_tickle(), LCBD_fabric_read(), LCBD_fabric_select(), lcbd_isr(), LCBD_pci_csr_read(), LCBD_pci_eventq_read(), LCBD_pci_events_base_read(), LCBD_pci_events_free_read(), LCBD_pci_fabric_select_read(), LCBD_pci_irq_read(), LCBD_pci_requestq_read(), LCBD_pci_resultq_read(), lcbd_rst_handler(), poll(), and submit().
static __inline void LCBD__pciStore32 | ( | volatile unsigned int * | dest, | |
unsigned int | w | |||
) | [static] |
Write a 32-bit integer to PCI Memory.
dest | Pointer destination memory | |
w | 32-bit value to store |
Referenced by init_circ(), init_latp(), init_pci(), LCBD_enable(), LCBD_evt_conds_set(), lcbd_evt_handler(), LCBD_evt_rng_free(), LCBD_evt_tickle(), lcbd_isr(), LCBD_pci_csr_write(), LCBD_pci_events_base_write(), LCBD_pci_events_free_write(), LCBD_pci_fabric_select_write(), LCBD_pci_irq_write(), lcbd_rst_handler(), and select_fabric().
static __inline void LCBD__pciSynchStore32 | ( | volatile unsigned int * | dest, | |
unsigned int | w | |||
) | [static] |
Write a 32-bit integer to PCI Memory.
dest | Pointer destination memory | |
w | 32-bit value to store |
Referenced by LCBD_pci_requestq_write(), and submit().
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.
hcb | The LCBD handler control block, upon success, this is filled in with information about the newly created FORK task. | |
name | The name of the FORK task | |
priority | The priority of the task | |
lcb | Used as the callback parameter to the handler | |
que_cnt | The number of queues to configure | |
que_cfg | The configuration of each que | |
que_id | The que id to use for the handler | |
failure | Status code to use in case of failure |
References _LCBD_hcb::fcb, LCBD_OK, and _LCBD_hcb::que.
Referenced by LCBD_evt_handler_create(), LCBD_nut_handler_create(), and LCBD_rst_handler_create().
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.
lcb | The LCB driver handle | |
value | The value to write. Only bits matching those in the field_select parameter will actually be written. | |
field_select | Pattern of those bits in value to write | |
stall | The stall period, in units of 20MHz clock ticks, for the LCB to wait for completion. | |
prv | Pointer to receive the value of the register before modification. This may be NULL. | |
cur | Pointer to receive the value of the register after modification. This may be NULL. |
References LCBC_csr_access(), LCBD_STATE_ONLINE, and poll_csr_access().
Referenced by LCBD_board_id_set(), LCBD_clk_edge_set(), LCBD_evt_enable(), and LCBD_width_set().
FORK_cb_status lcbd_evt_handler | ( | FORK_cb_prm | parameter, | |
FORK_msg_hdr * | fork_msg | |||
) |
The main LCBD descriptor dispatching routine for event traffic.
parameter | Pointer to private LCBD structure | |
fork_msg | FORK system message |
References _LATP_pckt_hdr::bf, _LCB_evt_dsc::bf, _LCB_evt_dsc::bfc, _LCBD_stats_evt::cnts, _LCBD_evt_hdr::dsc, _LCBD_evt_msg::ed, _LCBD_evt_ucb::err, _LCB_evt_dsc_bfe::error, _LCB_prb::event_queue, _LCBD_evt_hdr::fsw, _LATP_pckt_hdr_bf::hdr, _LCBD_evt::hdr, _LCB_prb::irq, _LCBD_evt::latp, LCB_EVENT_BUFFER_SIZE, LCB_EVT_ERR_RCV_PACKET_TRUNCATED, LCB_EVT_ERR_RCV_UNDEFINED_1, LCB_EVT_ERR_XFR_Q_EMPTY, LCB_PCI_IRQ_M_ENABLE_EVENT, LCBD__pciLoad32(), LCBD__pciStore32(), LCBD_EVT_FATE_M_NO_FREE, LCBD_EVT_FATE_M_NO_MORE, LCBD_EVT_FATE_M_NO_PROCESS, LCBD_EVT_FATE_M_NO_REARM, LCBD_evt_free(), LCBD_EVT_PROTO_UNDEFINED, lcbd_stats_evt_proto_xct_add(), _LCB_evt_dsc_bf::len, msr_clr(), msr_get(), msr_put(), _LCB_evt_dsc_bf::offset, _LCBD_evt_err_cbp::prm, _LCBD_stats_evt::proto, _LATP_cell_hdr_bf::proto, _LCBD_stats_evt_proto::rcv, _LCB_evt_dsc_bf::rstatus, _LCBD_evt_err_cbp::rtn, _LCB_evt_dsc::ui, and _LCB_evt_dsc_bf::xstatus.
Referenced by LCBD_evt_tickle(), and lcbd_isr().
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.
lcb | The LCB driver handle | |
value | The value to write. Only bits matching those in the field_select parameter will actually be written. | |
field_select | Pattern of those bits in value to write | |
stall | The stall time, in units of 20MHz clock ticks, for the LCB to wait for completion. | |
prv | Pointer to receive the value of the register before modification. This may be NULL. | |
cur | Pointer to receive the value of the register after modification. This may be NULL. |
References LCBC_faults_access(), LCBD_STATE_ONLINE, and poll_faults_access().
Referenced by LCBD_faults_read().
unsigned int lcbd_nut_handler_destroy | ( | LCBD | lcb, | |
unsigned int * | exit_status | |||
) |
Destroys the notification service task.
lcb | The LCB driver handle | |
exit_status | Pointer to receive the exit status of the notification routine. |
References lcbd_nut_post(), and LCBD_OK.
Referenced by destroy_sw().
unsigned int lcbd_nut_post | ( | LCBD | lcb | ) |
Posts a message to the notify service task.
lcb | The LCB driver handle |
References LCBD_OK, and notify().
Referenced by handle_clks(), lcbd_nut_handler_destroy(), and LCBD_nut_notify().
FORK_cb_status lcbd_rst_flush_handler | ( | FORK_cb_prm | parameter, | |
FORK_msg_hdr * | fork_msg | |||
) |
The main LCBD descriptor dispatching routine.
parameter | lcb Pointer to private LCBD structure | |
fork_msg | FORK system message |
References LCB_RST_ERR_XFR_IN_UNDEFINED_7, _LCBD_xcb_sys::prm, _LCBD_xcb_usr::rd, _LCBD_xcb_sys::rtn, _LCBD_xcb::sys, _LCB_rst_dsc::ui, and _LCBD_xcb::usr.
Referenced by handle_clks().
FORK_cb_status lcbd_rst_handler | ( | FORK_cb_prm | parameter, | |
FORK_msg_hdr * | fork_msg | |||
) |
The main LCBD descriptor dispatching routine.
parameter | lcb Pointer to private LCBD structure | |
fork_msg | FORK system message |
References _LCB_rst_dsc::bf, _LCB_rst_dsc::bfd, _LCBD_rst_ucb::ccb, _LCBD_stats_rst::cnts, _LCB_rst_dsc_bfd::dir, _LCB_prb::irq, LCB_PCI_IRQ_M_ENABLE_RESULT, LCB_RST_DSC_M_ADR, LCB_RST_ERR_XFR_OUT_Q_EMPTY, LCBD__pciLoad32(), LCBD__pciStore32(), LCBD_RST_FATE_M_NO_MORE, LCBD_RST_FATE_M_NO_REARM, locate(), msr_clr(), msr_get(), msr_put(), _LCBD_rst_ucb::null, _LCBD_stats_rst::null, _LCBD_xcb_sys::prm, _LCBD_rst_null_cbp::prm, _LCBD_xcb_usr::rd, _LCBD_rst_msg::rd, _LCB_prb::result_queue, retire(), _LCBD_xcb_sys::rtn, _LCBD_rst_null_cbp::rtn, _LCBD_stats_rst::seq, _LCBD_xcb::sys, _LCB_rst_dsc::ui, _LCBD_xcb::usr, and _LCB_rst_dsc_bf::xstatus.
Referenced by lcbd_isr().
unsigned int LCBD_stats_destroy | ( | LCBD_scb * | scb | ) |
Destroys the statistics control block.
LCBD_OK,on | success | |
Anything | else, failure |
scb | Pointer to the statistics control block to destroy |
References LCBD_OK, _LCBD_scb::ledgerValid, and _LCBD_scb::mutex.
Referenced by destroy_sw().
unsigned int LCBD_stats_init | ( | LCBD_scb * | scb | ) |
Initializes the statistics control block.
LCBD_OK,on | success | |
LCBD_STATSIFL,on | failure |
scb | Pointer to the statistics control block to initialize |
References _LCBD_scb::active, _LCBD_stats_tim::beg, _LCBD_scb::clear, LCBD_OK, _LCBD_scb::ledger, _LCBD_scb::ledgerValid, _LCBD_scb::mutex, _LCBD_scb::stats, and _LCBD_stats::tim.
Referenced by init_sw().
static __inline unsigned int msr_clr | ( | unsigned int | msr | ) | [static] |
Clears the interrupt enable bit in the specified msr.
msr | The value of the machine status register to clear the interrupt in. |
Referenced by lcbd_evt_handler(), LCBD_evt_rng_free(), and lcbd_rst_handler().
static __inline unsigned int msr_get | ( | void | ) | [static] |
Gets the value of the Power PC Machine Status Register.
Referenced by lcbd_evt_handler(), LCBD_evt_rng_free(), and lcbd_rst_handler().
static __inline void msr_put | ( | unsigned int | msr | ) | [static] |
Puts/restores the specified msr back into the Machine Status Register.
msr | The value of the machine status register to put |
Referenced by lcbd_evt_handler(), LCBD_evt_rng_free(), and lcbd_rst_handler().