www.ti.com
4.2
Serial Port Driver
This section discusses the serial support source files, and the amount of required porting for each.
4.2.1
Important Note on Data Alignment
The NDK libraries have been built with the assumption that the IP header in a data packet is 16-bit
aligned. In other words, the first byte of the IP packet (the version/length field) must start on an even 16-bit
boundary. In any fixed length header protocol, this requirement can be met by backing off any odd byte
header size, and adding it to the header padding specified to the stack. For Ethernet and peer to peer
protocol (PPP), the only requirement is that the Ethernet or PPP packet not start on an odd byte
boundary.
In addition, all drivers in the NDK are set up to have a 22 byte header. This is the header size of a PPPoE
packet when sent using a 14 byte Ethernet header. When all arriving packets use the 22 byte header, it
guarantees that they can be routed to any egress device with a header requirement up to that size. For
serial operation, this requires that an HDLC packet has 18 bytes of pre-pad to make its total header size
22 bytes.
The value of this pre-pad is #defined as PKT_PREPAD in the file LLSERIAL.H.
4.2.2
Hardware Independent Low-Level Serial Driver: LLSERIAL.c
The low-level serial port driver API is discussed in the Hardware Adaptation Layer (HAL) section of the
TMS320C6000 Network Developer's Kit (NDK) Software Programmer's Reference Guide (SPRU524). It is
very similar to the low-level Ethernet driver and, like the Ethernet driver, it consists of two parts: a
hardware independent module and a hardware specific module. This makes the hardware specific portion
of the driver easier to port.
The standard API to access a serial port as defined in the Hardware Adaptation Layer (HAL) section of the
TMS320C6000 Network Developer's Kit (NDK) Software Programmer's Reference Guide (SPRU524) is
implemented by the LLSERIAL.C module. This module can also handle multiple device instances.
To implement the low-level serial API in a device independent manner, the LLSERIAL module calls down
to a hardware specific module. The interface functions to this module are defined in the LLSERIAL.H
include file. The API description of this hardware's specific mini-driver is documented in
4.2.3
Hardware Specific Low-Level Serial Driver
The TI752.C modules include a device driver specific to the TL16C752. These modules communicate with
the serial hardware.
In HDLC mode, they also must check the HDLC frame delimiters, add or remove escape sequences,
compute or validate the HDLC CRC, and indicate data to the upper layers as frames.
The calling interface to this mini-driver is described in the following section.
4.3
Serial Port Mini-Driver
4.3.1
Overview
As mentioned in the previous section, the low-level serial port driver is broken down into two distinct parts:
a hardware independent module (LLSERIAL.C) that implements the llSerial API, and a hardware specific
module that interfaces to the hardware independent module. The llSerial API is described in the Hardware
Adaptation Layer (HAL) section of the TMS320C6000 Network Developer's Kit (NDK) Software
Programmer's Reference Guide (SPRU524). This section describes this small hardware specific module,
or mini-driver.
Note that this module is purely optional. A valid serial port driver can be developed by directly
implementing the llSerial API described in the TMS320C6000 Network Developer's Kit (NDK) Software
Programmer's Reference Guide (SPRU524). Even if the mini-driver is used, you may change any of the
internal data structures as long as the llSerial interface remains unchanged.
SPRUES5A – January 2007 – Revised June 2008
Submit Documentation Feedback
TMS320C6000 Network Developer's Kit (NDK) Support Package for EVMDM642
Serial Driver
Section
4.3.4.
21
Need help?
Do you have a question about the TMS320C6000 and is the answer not in the manual?