TI-RTOS for SimpleLink Wireless MCUs
2.14.01.20
|
UART driver implementation for a CC3200 UART controller.
============================================================================
The UARTCC3200 driver is (ring) buffered driver where it stores data it may already received in a user-supplied background buffer.
While permitted, it is STRONGLY suggested to avoid implementations where you call UART_read() within it own callback function (when in UART_MODE_CALLBACK).
Doing so, will require additional (task and system) stack for each nested UART_read() call.
Tool chain | Number of bytes per nested UART_read() call |
---|---|
GNU | 96 bytes + callback function stack requirements |
IAR | 40 bytes + callback function stack requirements |
TI | 80 bytes + callback function stack requirements |
It is important to note a potential worst case scenario: A full ring buffer with data; say 32 bytes The callback function calls UART_read() with a size of 1 (byte) No other variables are allocated in the callback function No other function calls are made in the callback function
As a result, you need an additional task and system stack of: 32 bytes * (80 bytes for TI + 0 bytes by the callback function) = 2.5kB
The UART header file should be included in an application as follows:
#include <stdint.h>
#include <stdbool.h>
#include <ti/drivers/ports/ClockP.h>
#include <ti/drivers/ports/HwiP.h>
#include <ti/drivers/ports/SemaphoreP.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/RingBuf.h>
Go to the source code of this file.
Data Structures | |
struct | UARTCC3200_FxnSet |
Complement set of read functions to be used by the UART ISR and UARTCC3200_read(). Internal use only. More... | |
struct | UARTCC3200_HWAttrs |
UARTCC3200 Hardware attributes. More... | |
struct | UARTCC3200_Object |
UARTCC3200 Object. More... | |
Typedefs | |
typedef struct UARTCC3200_FxnSet | UARTCC3200_FxnSet |
Complement set of read functions to be used by the UART ISR and UARTCC3200_read(). Internal use only. More... | |
typedef struct UARTCC3200_HWAttrs | UARTCC3200_HWAttrs |
UARTCC3200 Hardware attributes. More... | |
typedef struct UARTCC3200_Object | UARTCC3200_Object |
UARTCC3200 Object. More... | |
typedef struct UARTCC3200_Object * | UARTCC3200_Handle |
Variables | |
const UART_FxnTable | UARTCC3200_fxnTable |
typedef struct UARTCC3200_FxnSet UARTCC3200_FxnSet |
Complement set of read functions to be used by the UART ISR and UARTCC3200_read(). Internal use only.
These functions should not be used by the user and are solely intended for the UARTCC3200 driver. The UARTCC3200_FxnSet is a pair of complement functions that are design to operate with one another in a task context and in an ISR context. The readTaskFxn is called by UARTCC3200_read() to drain a circular buffer, whereas the readIsrFxn is used by the UARTCC3200_hwiIntFxn to fill up the circular buffer.
readTaskFxn: Function called by UART read These variables are set and avilalable for use to the readTaskFxn. object->readBuf = buffer; //Pointer to a user buffer object->readSize = size; //Desired no. of bytes to read object->readCount = size; //Remaining no. of bytes to read
readIsrFxn: The required ISR counterpart to readTaskFxn
typedef struct UARTCC3200_HWAttrs UARTCC3200_HWAttrs |
UARTCC3200 Hardware attributes.
These fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For CC3200Ware these definitions are found in:
A sample structure is shown below:
typedef struct UARTCC3200_Object UARTCC3200_Object |
UARTCC3200 Object.
The application must not access any member variables of this structure!
typedef struct UARTCC3200_Object * UARTCC3200_Handle |
const UART_FxnTable UARTCC3200_fxnTable |