GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCBD / V1-5-0 > lcbd / rad750
#include "LCBD/LCB.h"
#include "LCBD/LATP.h"
Classes | |
struct | _LCBD_evt_hdr |
Layout of 8 padding words that precede an unsolicited event. More... | |
struct | _LCBD_evt |
Layout of an unsolicited data received on the event fabric. More... | |
struct | _LCBD_evt_cbp |
Binds an event call back routine with its parameter. More... | |
struct | _LCBD_evt_err_cbp |
Binds an event error handler call back routine with its parameter. 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_EVT_K_DEFAULT_PRIORITY -1 |
Instructs the event service task creation routine LCBD_evt_handler_create to use a system defined default priority. | |
#define | LCBD_EVT_PROTO_CNT ( LCB_EVT_PROTO_CNT + 1) |
The LCBD driver keeps track of the known LCB protocols + reserves one spot for unknown protocols. | |
#define | LCBD_EVT_PROTO_UNDEFINED (LCBD_EVT_PROTO_CNT - 1) |
Defines the 'undefined protocol. | |
Typedefs | |
typedef enum _LCBD_EVT_COND | LCBD_EVT_COND |
Typedef for enum _LCB_EVT_COND. | |
typedef enum _LCBD_EVT_QUE_STATE | LCBD_EVT_QUE_STATE |
Typedef for enum _LCBD_EVT_QUE_STATE. | |
typedef enum _LCBD_EVT_QUE_STATE | LCBD_evt_que_state |
Typedef for enum _LCBD_EVT_QUE_STATE. | |
typedef struct _LCBD_evt_hdr | LCBD_evt_hdr |
typedef for struct _LCBD_evt_hdr | |
typedef struct _LCBD_evt | LCBD_evt |
typedef for struct _LCBD_evt | |
typedef enum _LCBD_EVT_FATE_M | LCBD_EVT_FATE_M |
Typedef for enum _LCBD_EVT_FATE_M. | |
typedef unsigned int(* | LCBD_evt_cb )(void *prm, unsigned int dsc, LCBD_evt *evt) |
Typedef for LCBD event handling callback routine. | |
typedef struct _LCBD_evt_cbp | LCBD_evt_cbp |
Typedef for struct _LCBD_evt_cbp. | |
typedef unsigned int(* | LCBD_evt_err_cb )(void *prm, unsigned int ed, LCBD_evt *evt) |
Typedef for LCBD event error handling callback routine. | |
typedef struct _LCBD_evt_err_cbp | LCBD_evt_err_cbp |
Typedef for struct _LCBD_evt_err_cbp. | |
Enumerations | |
enum | _LCBD_EVT_COND { LCBD_EVT_COND_75_FULL = 0x0, LCBD_EVT_COND_50_FULL = 0x1, LCBD_EVT_COND_25_FULL = 0x2, LCBD_EVT_COND_NOT_EMPTY = 0x3 } |
Enumerates the Interrupt Request conditions of both the event queue. More... | |
enum | _LCBD_EVT_QUE_STATE { LCBD_EVT_QUE_STATE_EMPTY = -1, LCBD_EVT_QUE_STATE_POSTED = 0, LCBD_EVT_QUE_STATE_BUSY = 1 } |
Describes the current state of event queue. More... | |
enum | _LCBD_EVT_FATE_M { LCBD_EVT_FATE_M_NO_MORE = (1 << 0), LCBD_EVT_FATE_M_NO_REARM = (1 << 1), LCBD_EVT_FATE_M_NO_FREE = (1 << 2), LCBD_EVT_FATE_M_NO_PROCESS = (1 << 3), LCBD_EVT_FATE_M_ABORT } |
Bit masks defining the options available on the return values of the event callback routine. More... | |
Functions | |
unsigned int | LCBD_evt_cb_set (LCBD lcb, unsigned int proto, LCBD_evt_cb cb, void *prm) |
Sets the event data callback routine and parameter for the specified LATp protocol. | |
LCBD_evt_cbp | LCBD_evt_cbp_get (LCBD lcb, unsigned int proto) |
Retrieves the event data callback routine and parameter for the specified LATp protocol. | |
unsigned int | LCBD_evt_conds_set (LCBD lcb, unsigned int conditions) |
Sets the interrupt conditions for the EVENT FIFO and EVENT ring buffer. | |
unsigned int | LCBD_evt_err_cb_set (LCBD lcb, LCBD_evt_err_cb cb, void *prm) |
Establish callback for event transport errors. | |
LCBD_evt_err_cbp | LCBD_evt_err_cbp_get (LCBD lcb) |
Returns the callback routine for the event transport error handler plus its parameter. | |
unsigned int | LCBD_evt_enable (LCBD lcb, int enable) |
Enables/Disables the flow of events into the LCB. | |
unsigned int | LCBD_evt_handler_create (LCBD lcb, int priority) |
Creates the event que handler service task. | |
unsigned int | LCBD_evt_que_install (LCBD lcb, FORK_que *que) |
Installs queue from fcb as the ISR -> task message queue for event traffic. | |
FORK_que * | LCBD_evt_que_get (LCBD lcb, int que_id) |
Returns a pointer to the event FORK que. This allows outside code to schedule work that is serialized with the event taking. | |
LCBD_evt_que_state | LCBD_evt_tickle (LCBD lcb) |
Callable version of the LCBD ISR. | |
unsigned int | LCBD_evt_rcv_err_map (unsigned int err) |
Maps a receive error to a standard LCB message code. | |
unsigned int | LCBD_evt_xfr_err_map (unsigned int err) |
Maps a event transfer error code to a standard LCB message code. | |
unsigned int | LCBD_evt_free (LCBD lcb, LCBD_evt *evt) |
Frees the a LCBD_evt. | |
unsigned int | LCBD_evt_rng_free (LCBD lcb, LCBD_evt *from, LCBD_evt *to) |
Frees the LCBD_evts from to to exclusively, i.e. excludes the memory associated with to. |
CVS $Id
#define LCBD_EVT_K_DEFAULT_PRIORITY -1 |
Instructs the event service task creation routine LCBD_evt_handler_create to use a system defined default priority.
unsigned int(* LCBD_evt_cb)(void *prm, unsigned int dsc.LCBD_evt *evt) |
Typedef for LCBD event handling callback routine.
prm | User provided parameter | |
dsc | The event descriptor as an uninterpreted unsigned int. Likely the only thing valuable in here is the status. | |
evt | Pointer to the event data. This contains the length of the event as well as the data itself |
Typedef for enum _LCB_EVT_COND.
unsigned int(* LCBD_evt_err_cb)(void *prm, int unsigned int ed, LCBD_evt *evt) |
Typedef for LCBD event error handling callback routine.
prm | User provided parameter | |
ed | The event descriptor | |
evt | The event. |
The PACKET TRUNCATED events are passed to the normal user callback handlers where the user is expected to handle packet reassembly in a manner appropriate to his processing needs.
Any other errors are really serious hardware errors. Continued use of the LCB device is at the user's peril. However, rather than simply bugchecking the system, a callback routine is provided to allow the user to handle this error condition. The recommended action is to put your house in order with a minimum of fuss (naturally this means no LCB accesses) and shut the system down as gracefully as possible.
LCBD_EVT_FATE_M_NO_FREE | // Don't free this event descriptor LCBD_EVT_FATE_M_NO_MORE | // Don't process anymore event descriptors LCBD_EVT_FATE_M_NO_REARM | // Don't rearm the event interrupt LCBD_EVT_FATE_M_NO_PROCESS // Don't process the event with the normal user callback routine.
Typedef for struct _LCBD_evt_err_cbp.
All event descriptors with fatal hardware receive/transmit errors are funneled through this callback for user action. Naturally, these events are not expected to occur, but this a clean mechanism for moving the error handling outside the context of the driver.
Typedef for enum _LCBD_EVT_FATE_M.
typedef for struct _LCBD_evt_hdr
Typedef for enum _LCBD_EVT_QUE_STATE.
This value is returned by LCBD_evt_tickle.
enum _LCBD_EVT_COND |
enum _LCBD_EVT_FATE_M |
Bit masks defining the options available on the return values of the event callback routine.
enum _LCBD_EVT_QUE_STATE |
Describes the current state of event queue.
unsigned int LCBD_evt_cb_set | ( | LCBD | lcb, | |
unsigned int | proto, | |||
LCBD_evt_cb | cb, | |||
void * | prm | |||
) |
Sets the event data callback routine and parameter for the specified LATp protocol.
LCBD_OK,on | success | |
LCBD_INVPROTO,invalid | protocol, if proto is greater than the maximum |
lcb | Pointer to private LCBD structure | |
proto | LATp protocol to associate queue with. | |
cb | Event data callback routine (event handler) | |
prm | Evevt data callback routine parameter protocol number. |
LCBD_evt_cbp LCBD_evt_cbp_get | ( | LCBD | lcb, | |
unsigned int | proto | |||
) |
Retrieves the event data callback routine and parameter for the specified LATp protocol.
lcb | Pointer to private LCBD structure | |
proto | LATp protocol to associate queue with. |
unsigned int LCBD_evt_conds_set | ( | LCBD | lcb, | |
unsigned int | conditions | |||
) |
Sets the interrupt conditions for the EVENT FIFO and EVENT ring buffer.
The | interrupt conditions before modification |
lcb | Pointer to private LCBD structure | |
conditions | A word reflecting the desired interrupt conditions |
new = LCBD_EVT_CONDS_COMPOSE (LCBD_M_EVT_COND_50_FULL, LCBD_M_EVT_COND_25_FULL); prv = LCBD_evt_cond_set (lcb, new); // Do somethings, then restore prv = LCBD_evt_cond_set (lcb, prv);
unsigned int LCBD_evt_enable | ( | LCBD | lcb, | |
int | enable | |||
) |
Enables/Disables the flow of events into the LCB.
0,Event | enable was not set before this call | |
1,Event | enable was set before this call | |
Anything | else, an LCBD error |
lcb | The LCB driver handle | |
enable | Enable (1) / Disable (0) flag |
unsigned int LCBD_evt_err_cb_set | ( | LCBD | lcb, | |
LCBD_evt_err_cb | cb, | |||
void * | prm | |||
) |
Establish callback for event transport errors.
LCBD_OK |
lcb | The LCB driver handle | |
cb | The LCB event error handler | |
prm | The LCB event error parameter |
LCBD_evt_err_cbp LCBD_evt_err_cbp_get | ( | LCBD | lcb | ) |
Returns the callback routine for the event transport error handler plus its parameter.
lcb | The LCB driver handle |
unsigned int LCBD_evt_free | ( | LCBD | lcb, | |
LCBD_evt * | evt | |||
) |
Frees the a LCBD_evt.
lcb | Pointer to private LCBD structure | |
evt | pointer to LCBD_evt to free |
unsigned int LCBD_evt_handler_create | ( | LCBD | lcb, | |
int | priority | |||
) |
Creates the event que handler service task.
lcb | The LCBD driver handle | |
priority | The priority of the task. If specified as 0, then a default value is assigned. |
FORK_que* LCBD_evt_que_get | ( | LCBD | lcb, | |
int | que_id | |||
) |
Returns a pointer to the event FORK que. This allows outside code to schedule work that is serialized with the event taking.
lcb | Pointer to private LCBD structure | |
que_id | The ID of the que to get. Currently LCBD is configured with only one que (que_id = 0), but a future enhancement will allow LCBD to be configured with a priority que. |
unsigned int LCBD_evt_que_install | ( | LCBD | lcb, | |
FORK_que * | que | |||
) |
Installs queue from fcb as the ISR -> task message queue for event traffic.
lcb | Pointer to private LCBD structure | |
que | The FORK que to use |
LCBD_OK,on | success; currently there is no failure mode |
TASK_attr attributes; int que_cnt = 3; static const FORK_que_cfg QueCfg[3] = {{ NULL, NULL, NULL, 0}, { NULL, NULL, NULL, 0}, { NULL, NULL, NULL, 0} }; // Fill out the task attribute information attributes.options = 0; attributes.stack_addr = 0; attributes.stack_size = 0; attributes.name = "tLCBDevent"; attributes.priority = 61; // Allocate enough memory to support the FORK task fcb = (FORK_fcb *)MBA_alloc(FORK_fcb_sizeof(que_cnt)); // Create FORK queue status = FORK_create(fcb, // fork control block &attributes, // use task attributes NULL, // default callback lcb, // callback parm NULL, // timeout callback parm TOC_FOREVER, // timeout 3, // define a priority list with 3 queues QueCfg, // Queue configuration 0, // No system messages NULL, // No system messages 0); // No system messages // Locate the que to use and install it que = FORK_que_get (1); status = LCBD_evt_que_install (lcb, que);
unsigned int LCBD_evt_rcv_err_map | ( | unsigned int | err | ) |
Maps a receive error to a standard LCB message code.
err | The receive error to map |
Frees the LCBD_evts from to to exclusively, i.e. excludes the memory associated with to.
lcb | Pointer to private LCBD structure | |
from | The pointer to where the freeing should begin | |
to | The pointer to the next free location |
LCBD_evt_que_state LCBD_evt_tickle | ( | LCBD | lcb | ) |
Callable version of the LCBD ISR.
lcb | Pointer to private LCBD structure |
LCBD_EVT_QUE_STATE_BUSY | ||
LCBD_EVT_QUE_STATE_POSTED | ||
LCBD_EVT_QUE_STATE_EMPTY |
unsigned int LCBD_evt_xfr_err_map | ( | unsigned int | err | ) |
Maps a event transfer error code to a standard LCB message code.
err | The transfer error code to map |