3.2. Driver Interface

The polled mode LCBD provides the following services:

3.2.1. Driver Initialization

Before beginning operation the polled mode LCBD requires several chunks of "scratch pad" memory, which must be provided by the boot application. The required memory sizes and characteristics are shown below:

Memory SpaceLCB DMASizeAlignment
LCBD HandleN/A< 100 Bytes, fixed.None
Command ListReadUp to 4092 Bytes512 Byte
Result ListWriteUp to 4084 Bytes8 Byte
Circular BufferWrite512KB up to 4MB1MB

Table 3-1. polled mode LCBD Memory Attributes

The LCBD handle is used to manage the LCB.

A single command list is required to send LCB-to-LCB data on the event fabric.

A single result list is required because the LCB will generate a simple response to the bulk data transfer request.

The circular buffer is required to receive unsolicited data on the event fabric.

The function prototype for initializing the polled mode LCBD is shown below.

int LCB_PollInit(LCB *lcb, unsigned int *cmdList, unsigned int *rstList, unsigned int *baseAddr);

This call returns an initialized LCB handle. The cmdList parameter is a pointer to a memory 4KB memory chunk to use for the command list. The rstList parameter is a pointer to a memory 4KB memory chunk to use for the result list. The baseAddr parameter is the base memory address to use for the circular buffer.

At this point the LCB is completely configured. The reception of unsolicited data is enabled by calling LCB_PollStart() shown below.

int LCB_PollStart(LCB *lcb);

3.2.2. Dispatching Results

This section leverages much of the machinery described previously for unsolicited data handling, see Section 2.5. The major difference is that the interrupt handler and callback routines are replaced with a simple polling loop.

The LAT boot application will poll the LCBD looking for new unsolicited data by calling the LCB_PollQuery() function.

LCB_msg * LCB_PollQuery(LCB *lcb);

When new LCB-to-LCB data is available this function returns a non-NULL LCB_msg pointer. When no data is available LCB_PollQuery() returns NULL.

Decoding the LCB_msg pointer proceeds as previously described in sections Section 2.5.2, Section 2.5.3 and Section 2.5.4. The big difference is that the decoding occurs within the polling loop, not in a user callback routine. See Section 3.3 for an example of the polled mode interface.

3.2.3. Sending Bulk Data

Sending bulk data on the event fabric is very straight forward. The maximum length of a bulk data item is 4080 bytes. Most of the discussion on sending bulk data using the ISR driver applies to the polled mode driver as well (see Section 2.4.1.2.4). The major difference is that the polled mode LCBD can only queue a single bulk transfer at a time.

The LCB_PollSend() function is used to send bulk data.

int LCB_PollSend(LCB *lcb, unsigned short nodeId, unsigned short proto, unsigned int nBytes, unsigned int *data);