Serial Driver
4.3.2
Global Instance Structure
Nearly all the functions in the mini-driver API take a pointer to a serial driver instance structure called
SDINFO. This structure is defined in LLSERIAL.H. The following are the base members. The structure can
be extended by the mini-driver.
//
// Serial device information
//
typedef struct _sdinfo {
uint
uint
HANDLE
STKEVENT_Handle hEvent;
UINT32
uint
uint
uint
uint
uint
PBMQ
PBMQ
PBM_Handle
UINT8
uint
UINT16
UINT8
PBM_Handle
UINT8
uint
UINT16
UINT8
UINT8
void (*cbRx)(char);
void (*cbTimer)(HANDLE h);
void (*cbInput)(PBM_Handle hPkt); // HDLC Input callback (when open)
uint
uint
uint
UINT8
} SDINFO;
Only some of these fields are used in a mini-driver. The structure entries as defined as follows:
Field
PhysIdx
Open
hHDLC
hEvent
22
TMS320C6000 Network Developer's Kit (NDK) Support Package for EVMDM642
PhysIdx;
// Physical index of device (0 to –1)
Open;
// Open counter used by llSerial
hHDLC;
// Handle to HDLC driver (NULL=closed)
// Handle to scheduler event object
PeerMap;
// 32 bit char escape map (for HDLC)
Ticks;
// Track timer ticks
Baud;
// Baud rate
Mode;
// Data bits, stop bits, parity
FlowCtrl;
// Flow Control Mode
TxFree;
// Transmitter "free" flag
PBMQ_tx;
// Tx queue (one for each SER device)
PBMQ_rx;
// Rx queue (one for each SER device)
hRxPend;
// Packet being rx'd
*pRxBuf;
// Pointer to write next char
RxCount;
// Number of bytes received
RxCRC;
// Receive CRC
RxFlag;
// Flag to "un-escape" character
hTxPend;
// Packet being tx'd
*pTxBuf;
// Pointer to next char to send
TxCount;
// Number of bytes left to send
TxCRC;
// Transmit CRC
TxFlag;
// Flag to insert character
TxChar;
// Insert character
// Charmode callback (when open)
// HDLC Timer callback (when open)
CharReadIdx;
// Charmode read index
CharWriteIdx;
// Charmode write index
CharCount;
// Number of charmode bytes waiting
CharBuf[CHAR_MAX];// Character mode recv data buffer
Table 2. Structure Entries
Description
Physical Index of this Device (0 to –1). The physical index of the device determines
how the device instance is represented to the outside world. The mini-driver is not
concerned about the physical index.
Open Flag. This flag is used by LLSERIAL.C to track whether the mini-driver has been
opened. It should not be modified by the mini-driver code.
Handle to HDLC Driver. The handle to the HDLC device is how the system tracks
where HDLC data should be sent. When this field is NULL, the driver is not open for
HDLC mode, and all data should be treated as character mode. When the field is not
NULL, any incoming serial data should be treated as potential HDLC data, and any
output packet is treated as an egress HDLC frame. HDLC packets received in HDLC
mode are tagged with this handle so that the upper layers can identify the packet's
source.
Handle to Scheduler Event Object. The handle hEvent is used with the STKEVENT
function STKEVENT_signal() to signal the system whenever new data is received. In
character mode, this event is fired for each character. In HDLC mode, the event is fired
when a good HDLC packet is received.
SPRUES5A – January 2007 – Revised June 2008
Submit Documentation Feedback
www.ti.com
Need help?
Do you have a question about the TMS320C6000 and is the answer not in the manual?