GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCBD / V1-3-1
Constituent: lcbd     Tag: rad750
Functional Unit | What it does | Header Files | Source Files
|
Driver | Driver load/unload plus interrupt connection and enables | LCBD_drv.h | LCBD_drv.c
|
Clock | Signals transitions of the 20MHz LATp-side clock | LCBD_clk.h | LCBD_clk.c
|
Notification | Asynchronous notification of driver state transitions | LCBD_nut.h | LCBD_nut.c
|
Command/Response | Submits command lists and handles result lists | LCBD_rst.h | LCBD_rst.c
|
Event | Handles incoming traffic on the event fabric | LCBD_evt.h | LCBD_evt.c
|
Statistics | Fetching and displaying of driver statistics | LCBD_stats.h | LCBD_stats.c
|
Driver Command/Result Lists | Lays out LCBD structure for both command & result lists | LCBD_cr.h | - none -
|
Command Utilities | Simple filling, parsing and synchronous execution of command lists and items | LCBC.h | LCBC.c
|
Result Utilities | Parsing and traversing of result lists and items | LCBR.h | LCBR.c
|
MSG Codes | MSG message code definitions | LCBD_msgs.h | - none - |
Hardware Unit | What it does | Header Files
|
LCB Definitions | Defines global LCB hardware properties | LCB.h
|
LCB Command/Result List & Items | Defines command and result lists and items plus opcodes | LCB_cr.h
|
LATP | LAT protocal definitions | LATP.h |
Function | Description
|
LCBD_allow | Allows additional to accept additional PCI/LATp FPGA versions
|
LCBD_create | Creation and software pre-initialization of the drive handle, one-time only call
|
LCBD_get | Returns a pointer to the driver handle
|
LCBD_load | Loads the driver
|
LCBD_unload | Unloads the driver
|
LCBD_enable | Enables/Disables the various interrupt sources
|
LCBD_state_get | Gets the current state of the driver
|
LCBD_drain | Drains the result and/or event queues (non-interrupt mode)
|
LCBD_pci_cfg_status_clear | Clears the status bits in the PCI configuration status register
|
LCBD_dib_locate | Returns a pointer to the Device Information Block
|
LCBD_dib_show | Displays the contents of the Device Information Block |
Function | Description
|
LCBD_clk_off_cb_set | Seeds the clock off callback routine + parameter
|
LCBD_clk_off_cbp_get | Returns the clock off callback routine + parameter
|
LCBD_clk_on_cb_set | Seeds the clock on callback routine + parameter
|
LCBD_clk_off_cbp_get | Returns the clock on callback routine + parameter
|
Function | Description
|
LCBD_nut_handler_create | Convenience routine to create the NUT service task and set the FORK_que
|
LCBD_nut_que_install | Installs the NUT FORK que
|
LCBD__nut_fill | Convenience routine to fill a notification request
|
LCBD_nut_notify | Ques a notification request
|
LCBD_nut_cancel | Cancels a notification request |
Function | Description
|
LCBD_nut_notifyW | Ques a notification request and waits for till it is satisfied
|
LCBD_nut_head_create | Creates a pending list head to use with LCBD_nut_post and LCBD_nut_pendW
|
LCBD_nut_head_destroy | Destroys the specified nut post head created with LCBD_nut_head_create
|
LCBD_nut_post | Ques a notification request and ques the satisfied request to the specified posting head
|
LCBD_nut_pendW | Pends of a NUT post head for the next satisfied notification request
|
LCBD_nut_fork | Ques a notification request and ques the satisfied request to the specified FORK que
|
Function | Description
|
LCBD_rst_handler_create | Convenience routine to create the RST service task and set the FORK_que
|
LCBD_rst_que_install | Installs the RST FORK que
|
LCBD_rst_null_cb_set | Seeds the NULL result descriptor handler + parameter
|
LCBD_rst_null_cbp_get | Returns the NULL result descriptor handler + parameter
|
LCBD_bind | Binds the parameters of an LCBD_xcb to the XCB
|
LCBD_submit | Submits a bound LCBD_xcb to the LCB for execution |
Function | Description
|
LCBD_rst_rcv_err_map | Translates a result list receive error code to a standard MSG code
|
LCBD_rst_xfr_err_map | Translates a result list transfer error code to a standard MSG code
|
LCBD_cl_alloc | Command list allocator, by bytes
|
LCBD_rl_alloc | Result list allocator, by bytes
|
LCBD_cl_alloc8 | Command list allocator, by 8 byte cells
|
LCBD_rl_alloc8 | Result list allocator, by 8 byte cells
|
LCBD__cl_len | Converts a command list length in bytes to 8-byte cells, i.e. something suitable to passing to one of the LCBD_bind routines
|
LCBD__cl_dlen | Converts a command list specified by it's beginning and ending pointers to 8-byte cells, i.e. something suitable to passing to one of the LCBD_bind routines
|
LCBD__rl_len | Converts a result list length in bytes to 8-byte cells, i.e. something suitable to passing to one of the LCBD_bind routines
|
LCBD__rl_dlen | Converts a result list specified by it's beginning and ending pointers to 8-byte cells, i.e. something suitable to passing to one of the LCBD_bind routines |
Function | Description
|
LCBD_qioW | Convenience routine to que a command list to the LCB and wait for its completion, combines LCBD_bind and LCBD_submitW
|
LCBD_submitW | Submits a bound LCBD_xcb to the LCB and waits for its completed execution
|
LCBD_fork_bind | Binds the parameters to an LCBD_xcb using a dispatch to a FORK que as its synchronization method.
|
LCBD_post_create | Creates a posting list head that can be used by LCBD_post_bind and LCBD_post_pendW
|
LCBD_post_destroy | Destroys the posting list head created by LCBD_post_create
|
LCBD_post_bind | Binds the parameters of the LCBD_xcb to an XCB using a dispatch to a posting list head as its synchronization method.
|
LCBD_post_pendW | Waits for the next completed LCBD_xcb on the specified posting list head |
Macro | Description
|
LCBD_EXP_DSC_COMPOSE | Composes a command export descriptor |
Function | Description
|
LCBD_evt_handler_create | Convenience routine to create the EVT service task and set the FORK_que
|
LCBD_evt_que_install | Installs the EVT FORK que
|
LCBD_evt_cb_set | Seeds the event callback handler + parameter for a specified protocol
|
LCBD_evt_cbp_get | Returns the event callback handler + parameter for a specified protocol
|
LCBD_evt_err_cb_set | Seeds the event error handler + parameter for a specified
|
LCBD_evt_err_cbp_get | Returns the event error handler + parameter
|
LCBD_evt_conds_set | Sets the event que and event buffer interrupt conditions, returning the old ones, see LCBD_EVT_COND
|
LCBD_evt_enable | Enables the flow of events into the event circular buffer, returns the original flow state
|
LCBD_evt_tickle | Tickles the event handler to check if there are any events to be serviced.
|
LCBD_evt_free | Frees the specified event
|
LCBD_evt_rcv_err_map | Translates a event receive error code to a standard MSG code
|
LCBD_evt_xfr_err_map | Translates a event transfer error code to a standard MSG code |
Macro | Description
|
unsigned int startLcbd (unsigned int options, unsigned int *circularBuffer) { // Get pre-initialized driver handle lcb = LCBD_create (NULL); // Load the driver, // Options is used to select the path and the interrupt source // See LCBD_LOAD_OPTIONS_M for details status = LCBD_load (lcb, options, 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 25% on FIFO */ LCBD_evt_conds_set (lcb, LCBD_EVT_COND_25_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; }
unsigned int startLcbd (unsigned int options, unsigned int *circularBuffer, FORK_que *evt_que, FORK_que *nut_que, FORK_que *rst_que) { // Get pre-initialized driver handle lcb = LCBD_create (NULL); // Load the driver // Options is used to select the path and the interrupt source // See LCBD_LOAD_OPTIONS_M for details init_status = LCBD_load (lcb, options, circularBuffer); // Check for success errors if (_msg_error (init_status) return init_status; // Install the result, event and notification ques status = LCBD_rst_que_install (lcb, rst_que); status = LCBD_evt_que_install (lcb, evt_que); status = LCBD_nut_que_install (lcb, nut_que); // Enable the clock on interrupt // The only possible error is if one tries to simoultaneously set // both the ENABLE and DISABLEs, clearly not happening here LCBD_enable (lcb, LCBD_M_ENABLE_CLK_ON); // Check if possibly have no clock if (init_status == LCBD_NOCLK) { LCBD_state state; // Wait for the driver to come online // Once ONLINE the driver has been successfully initialized // Keep in mind it may on OFFLINE at any time in the future, // but in terms of initialization, it's done. state = LCBD_nut_notifyW (lcb, LCBD_STATE_M_ONLINE); } // Set the callback handler for the protocol #1 status = LCBD_evt_cb_set (lcb, 1, eventHander, eventParameter); // Set event interrupt conditions 25% on FIFO full LCBD_evt_conds_set (lcb, LCBD_EVT_COND_25_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); // Check driver state, not necessary, but just to illustrate return (LCBD_state_get (lcb) == LCBD_STATE_ONLINE) ? status : ERROR; }
@par Example @code // Define the command items typedef struct _MyCmdItems { LCB_ci_mark_time mark1; // Issue a mark time command LCB_ci_csr csr; // Read the LATp-side CSR LCB_ci_mark_time mark2; // Issue another mark time command LCB_ci_faults faults; // Read the LATp-side FAULTs register } MyCmdItems; // Assemble into a command list typedef struct _MyCmdList { unsigned int *result; // Reserved for the result list address MyCmdItems ci; // The command items } MyCmdList; // Define the corresponding result items typedef struct _MyRstItems { LCB_ri_mark_time mark1; // Result item for mark time command 1 LCB_ri_csr csr; // Result item for CSR access LCB_ci_mark_time mark2; // Result item for mark time command 2 LCB_ci_faults faults; // Result item for FAULTS register access } MyRstItems; // Assemble into a hardward result list typedef struct _LcbRstList { unsigned int *command; // Reserved for the command list address MyRstItems ri; // The result items } LcbRstList; // Tack on the XCB that the driver needs typedef struct MyRstList { LCBD_xcb xcb; // The XCB control structure LcbRstList rl; // The LCB result list } MyRstList; LCBD_post_head head; // Synchronizing que head LCBD_xcb *xcb; // Allocate these // This could also be done off the stack (obeying proper alignment) MyCmdList *cl = LCBD_cl_alloc (sizeof (MyCmdList); MyRstList *rl = LCBD_rl_alloc (sizeof (MyRstList); // Use the inlines to fill the commands although the structures of // each command are exposed, so you could 'do it yourself' LCBC__mark_time_fill (&cl.ci.mark1, 200); LCBC__csr_access_fill (&cl.ci.csr, val, select, timeout); LCBC__mark_time_fill (&cl.ci.mark2, 400); LCBC__faults_access_fill (&cl.ci.cfaults, 0, -1, timeout); LCBD_post_create (lcb, &head) // Bind these parameters to a posting que synchronization method xcb = LCBD_post_bind (lcb, LCBD__cl_len (sizeof (*cl)), cl, LCBD__rl_len (sizeof (&rl->rl)), rl, &head, 0, 0, 0, 0); // Submit the transaction LCBD_submit (lcb, &xcb); // Wait for completion... xcb = LCBD_post_pendW (lcb, &head);
Function | Description
|
LCBD_stats_clr | Clears the statistics counters
|
LCBD_stats_get | Gets a copy of the statistics counters
|
LCBD_stats_sub | Subtracts two sets of statistics counters
|
LCBD_stats_isr_show | Displays the ISR statistics counters
|
LCBD_stats_evt_show | Displays the EVENT statistics counters
|
LCBD_stats_rst_show | Displays the RESULT statistics counters
|
LCBD_stats_show | Displays the all the statistics counters |
Function | Description
|
LCBC_process | Convenience routine to execute a user callback routine for each command item
|
LCBC_show | Convenience routine to display each command item |
Function | Description
| |
LCBC_mark_time | Convenience routine to fill a mark time command item
| |
LCBC_cmd_xmit | Convenience routine to fill a LAT reset command item |
|
LCBC_lat_reset | Convenience routine to fill a command transmit with no response command item
| |
LCBC_cmdr_xmit | Convenience routine to fill a command transmit with response command item
| |
LCBC_csr_access | Convenience routine to fill a LATp-side CSR access command item
| |
LCBC_faults_access | Convenience routine to fill a LATp-side FAULTS register access command item |
Function | Description
|
LCBC_mark_time_fill | Convenience routine to fill a mark time command item
|
LCBC_event_fill | Convenience routine to fill a event transmit command item
|
LCBC_cmd_xmit_fill | Convenience routine to fill a LAT reset command item
|
LCBC_lat_reset_fill | Convenience routine to fill a command transmit with no response command item
|
LCBC_cmdr_xmit_fill | Convenience routine to fill a command transmit with response command item
|
LCBC_csr_access_fill | Convenience routine to fill a LATp-side CSR access command item
|
LCBC_faults_access_fill | Convenience routine to fill a LATp-side FAULTS register access command item |
Function | Description
|
LCBC__mark_time_fill | Convenience routine to fill a mark time command item
|
LCBC__event_fill | Convenience routine to fill a event transmit command item
|
LCBC__cmd_xmit_fill | Convenience routine to fill a LAT reset command item
|
LCBC__lat_reset_fill | Convenience routine to fill a command transmit with no response command item
|
LCBC__cmdr_xmit_fill | Convenience routine to fill a command transmit with response command item
|
LCBC__csr_access_fill | Convenience routine to fill a LATp-side CSR access command item
|
LCBC__faults_access_fill | Convenience routine to fill a LATp-side FAULTS register access command item |
Macro | Description
|
LCBC_TYPE_BY_OPCODE_FULL | Translates an opcode to a command item type, mapping word is specified
|
LCBC_TYPE_BY_OPCODE_FULL | Translates an opcode to a command item type, mapping word is implicit |
Function | Description
|
LCBR_check | Convenience routine to check each result item for errors
|
LCBR_error_get | Convenience routine to get the error word for a result item
|
LCBR_process | Convenience routine to execute a user callback routine for each result item
|
LCBR_show | Convenience routine to display each result item |
Macro | Description
|
LCBR_TYPE_BY_OPCODE_FULL | Translates an opcode to a command item type, mapping word specified
|
LCBR_TYPE_BY_OPCODE_FULL | Translates an opcode to a result item type, mapping word is implicit
|
LCBR_N8BYTES_BY_OPCODE_FULL | Translates an opcode to a result item length in 8-byte cells, mapping word is specified
|
LCBR_N8BYTES_BY_OPCODE | Translates an opcode to a result item length in 8-byte cells, mapping word is implicit |
Macros | Description
|
Macro | Description
|
LCB_CI_HDR | Composes the command item header word
|
LCB_CI_CMD | Composes the a transmit command item initializing data statement
|
LCB_CI_MARK_TIME | Composes the a mark command item initializing data statement
|
LCB_CI_LAT_RESET | Composes the a lat reset command item initializing data statement
|
LCB_CI_CSR | Composes the a csr access command item data statement
|
LCB_CI_FAULTS | Composes the a faults command item data statement
|
LCB_CI_EVENT_LEN_32 | Rounds a specified number of integers to the next highest LATP number of cells, returning the answer in integers. Useful for specifying the length to a Event Transfer Command
|