Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
UART2CC26X2.h File Reference

Detailed Description

UART driver implementation for a CC26X2 UART controller.

============================================================================

The UART header file should be included in an application as follows:

Refer to UART2.h for a complete description of APIs and examples of use.


#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <ti/devices/DeviceFamily.h>
#include <DeviceFamily_constructPath(inc/hw_types.h)>
#include <DeviceFamily_constructPath(driverlib/udma.h)>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SemaphoreP.h>
#include <ti/drivers/UART2.h>
#include <ti/drivers/pin/PINCC26XX.h>
#include <ti/drivers/dma/UDMACC26XX.h>
Include dependency graph for UART2CC26X2.h:

Go to the source code of this file.

Data Structures

struct  UART2CC26X2_HWAttrs
 UART2CC26X2 Hardware attributes. More...
 
struct  UART2CC26X2_Object
 UART2CC26X2 Object. More...
 

Macros

#define UART2CC26X2_FLOWCTRL_NONE   0
 No hardware flow control. More...
 
#define UART2CC26X2_FLOWCTRL_HARDWARE   1
 Hardware flow control. More...
 
#define UART2CC26X2_FIFO_SIZE   32
 

Typedefs

typedef enum UART2CC26X2_FifoThreshold UART2CC26X2_FifoThreshold
 UART TX/RX interrupt FIFO threshold select. More...
 
typedef struct UART2CC26X2_HWAttrs UART2CC26X2_HWAttrs
 UART2CC26X2 Hardware attributes. More...
 
typedef struct UART2CC26X2_Object UART2CC26X2_Object
 UART2CC26X2 Object. More...
 
typedef struct UART2CC26X2_ObjectUART2CC26X2_Handle
 

Enumerations

enum  UART2CC26X2_FifoThreshold {
  UART2CC26X2_FIFO_THRESHOLD_1_8 = 0, UART2CC26X2_FIFO_THRESHOLD_2_8 = 1, UART2CC26X2_FIFO_THRESHOLD_4_8 = 2, UART2CC26X2_FIFO_THRESHOLD_6_8 = 3,
  UART2CC26X2_FIFO_THRESHOLD_7_8 = 4
}
 UART TX/RX interrupt FIFO threshold select. More...
 

Functions

void UART2CC26X2_close (UART2_Handle handle)
 
void UART2CC26X2_disableRx (UART2_Handle handle)
 
UART2_Handle UART2CC26X2_open (uint_least8_t, UART2_Params *params)
 
int_fast16_t UART2CC26X2_read (UART2_Handle handle, void *buffer, size_t size, size_t *bytesRead)
 
void UART2CC26X2_readCancel (UART2_Handle handle)
 
int_fast16_t UART2CC26X2_write (UART2_Handle handle, const void *buffer, size_t size, size_t *bytesWritten)
 
void UART2CC26X2_writeCancel (UART2_Handle handle)
 
void UART2CC26X2_flushRx (UART2_Handle handle)
 
void UART2CC26X2_getParams (UART2_Handle handle, UART2_Params *params)
 
void UART2CC26X2_setParams (UART2_Handle handle, UART2_Params *params)
 

Variables

const UART2_FxnTable UART2CC26X2_fxnTable
 

Macro Definition Documentation

§ UART2CC26X2_FLOWCTRL_NONE

#define UART2CC26X2_FLOWCTRL_NONE   0

No hardware flow control.

§ UART2CC26X2_FLOWCTRL_HARDWARE

#define UART2CC26X2_FLOWCTRL_HARDWARE   1

Hardware flow control.

§ UART2CC26X2_FIFO_SIZE

#define UART2CC26X2_FIFO_SIZE   32

Size of the TX and RX FIFOs is 32 items

Typedef Documentation

§ UART2CC26X2_FifoThreshold

UART TX/RX interrupt FIFO threshold select.

Defined FIFO thresholds for generation of both TX interrupt and RX interrupt. If the RX and TX FIFO and thresholds are not set in the HwAttrs, the RX interrupt FIFO threshold is set to 1/8 full, and the TX interrupt FIFO threshold is set to 1/8 full.

§ UART2CC26X2_HWAttrs

UART2CC26X2 Hardware attributes.

The fields, baseAddr and intNum are used by driverlib APIs and therefore must be populated by driverlib macro definitions. These definitions are found under the device family in:

  • inc/hw_memmap.h
  • inc/hw_ints.h
  • driverlib/uart.h

intPriority is the UART peripheral's interrupt priority, as defined by the underlying OS. It is passed unmodified to the underlying OS's interrupt handler creation code, so you need to refer to the OS documentation for usage. For example, for SYS/BIOS applications, refer to the ti.sysbios.family.arm.m3.Hwi documentation for SYS/BIOS usage of interrupt priorities. If the driver uses the ti.dpl interface instead of making OS calls directly, then the HwiP port handles the interrupt priority in an OS specific way. In the case of the SYS/BIOS port, intPriority is passed unmodified to Hwi_create(). The CC26x2 uses three of the priority bits, meaning ~0 has the same effect as (7 << 5).

  (7 << 5) will apply the lowest priority.
  (1 << 5) will apply the highest priority.

Setting the priority to 0 is not supported by this driver. HWI's with priority 0 ignore the HWI dispatcher to support zero-latency interrupts, thus invalidating the critical sections in this driver.

A sample structure is shown below:

const UART2CC26X2_HWAttrs uartCC26X2HWAttrs[] = {
{
.baseAddr = UARTA0_BASE,
.intNum = INT_UART0_COMB,
.intPriority = (~0),
.swiPriority = 0,
.flowControl = UART2CC26X2_FLOWCTRL_NONE,
.rxPin = IOID_2,
.txPin = IOID_3,
.ctsPin = PIN_UNASSIGNED,
.rtsPin = PIN_UNASSIGNED,
},
{
.baseAddr = UART1_BASE,
.intNum = INT_UART1_COMB,
.intPriority = (~0),
.swiPriority = 0,
.flowControl = UART2CC26X2_FLOWCTRL_NONE,
.rxPin = PIN_UNASSIGNED,
.txPin = PIN_UNASSIGNED,
.ctsPin = PIN_UNASSIGNED,
.rtsPin = PIN_UNASSIGNED,
},
};

The .ctsPin and .rtsPin must be assigned to enable flow control.

§ UART2CC26X2_Object

UART2CC26X2 Object.

The application must not access any member variables of this structure!

§ UART2CC26X2_Handle

Enumeration Type Documentation

§ UART2CC26X2_FifoThreshold

UART TX/RX interrupt FIFO threshold select.

Defined FIFO thresholds for generation of both TX interrupt and RX interrupt. If the RX and TX FIFO and thresholds are not set in the HwAttrs, the RX interrupt FIFO threshold is set to 1/8 full, and the TX interrupt FIFO threshold is set to 1/8 full.

Enumerator
UART2CC26X2_FIFO_THRESHOLD_1_8 

FIFO threshold of 1/8 full

UART2CC26X2_FIFO_THRESHOLD_2_8 

FIFO threshold of 2/8 full

UART2CC26X2_FIFO_THRESHOLD_4_8 

FIFO threshold of 4/8 full

UART2CC26X2_FIFO_THRESHOLD_6_8 

FIFO threshold of 6/8 full

UART2CC26X2_FIFO_THRESHOLD_7_8 

FIFO threshold of 7/8 full

Function Documentation

§ UART2CC26X2_close()

void UART2CC26X2_close ( UART2_Handle  handle)

§ UART2CC26X2_disableRx()

void UART2CC26X2_disableRx ( UART2_Handle  handle)

§ UART2CC26X2_open()

UART2_Handle UART2CC26X2_open ( uint_least8_t  ,
UART2_Params params 
)

§ UART2CC26X2_read()

int_fast16_t UART2CC26X2_read ( UART2_Handle  handle,
void *  buffer,
size_t  size,
size_t *  bytesRead 
)

§ UART2CC26X2_readCancel()

void UART2CC26X2_readCancel ( UART2_Handle  handle)

§ UART2CC26X2_write()

int_fast16_t UART2CC26X2_write ( UART2_Handle  handle,
const void *  buffer,
size_t  size,
size_t *  bytesWritten 
)

§ UART2CC26X2_writeCancel()

void UART2CC26X2_writeCancel ( UART2_Handle  handle)

§ UART2CC26X2_flushRx()

void UART2CC26X2_flushRx ( UART2_Handle  handle)

§ UART2CC26X2_getParams()

void UART2CC26X2_getParams ( UART2_Handle  handle,
UART2_Params params 
)

§ UART2CC26X2_setParams()

void UART2CC26X2_setParams ( UART2_Handle  handle,
UART2_Params params 
)

Variable Documentation

§ UART2CC26X2_fxnTable

const UART2_FxnTable UART2CC26X2_fxnTable
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale