UARTCC32XXDMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2019, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
60 #ifndef ti_drivers_uart_UARTCC32XXDMA__include
61 #define ti_drivers_uart_UARTCC32XXDMA__include
62 
63 #include <stdint.h>
64 #include <stdbool.h>
65 
66 #include <ti/drivers/dpl/ClockP.h>
67 #include <ti/drivers/dpl/HwiP.h>
68 
69 #include <ti/drivers/dpl/SemaphoreP.h>
70 #include <ti/drivers/Power.h>
72 #include <ti/drivers/UART.h>
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
85 #define UARTCC32XXDMA_PIN_UNASSIGNED 0xFFF
86 /*
87  * The bits in the pin mode macros are as follows:
88  * The lower 8 bits of the macro refer to the pin, offset by 1, to match
89  * driverlib pin defines. For example, UARTCC32XXDMA_PIN_01_UART1_TX & 0xff = 0,
90  * which equals PIN_01 in driverlib pin.h. By matching the PIN_xx defines in
91  * driverlib pin.h, we can pass the pin directly to the driverlib functions.
92  * The upper 8 bits of the macro correspond to the pin mux confg mode
93  * value for the pin to operate in the UART mode. For example, pin 1 is
94  * configured with mode 7 to operate as UART1 TX.
95  */
96 #define UARTCC32XXDMA_PIN_01_UART1_TX 0x700
97 #define UARTCC32XXDMA_PIN_02_UART1_RX 0x701
98 #define UARTCC32XXDMA_PIN_03_UART0_TX 0x702
99 #define UARTCC32XXDMA_PIN_04_UART0_RX 0x703
100 #define UARTCC32XXDMA_PIN_07_UART1_TX 0x506
101 #define UARTCC32XXDMA_PIN_08_UART1_RX 0x507
102 #define UARTCC32XXDMA_PIN_16_UART1_TX 0x20F
103 #define UARTCC32XXDMA_PIN_17_UART1_RX 0x210
104 #define UARTCC32XXDMA_PIN_45_UART0_RX 0x92C
105 #define UARTCC32XXDMA_PIN_45_UART1_RX 0x22C
106 #define UARTCC32XXDMA_PIN_53_UART0_TX 0x934
107 #define UARTCC32XXDMA_PIN_55_UART0_TX 0x336
108 #define UARTCC32XXDMA_PIN_55_UART1_TX 0x636
109 #define UARTCC32XXDMA_PIN_57_UART0_RX 0x338
110 #define UARTCC32XXDMA_PIN_57_UART1_RX 0x638
111 #define UARTCC32XXDMA_PIN_58_UART1_TX 0x639
112 #define UARTCC32XXDMA_PIN_59_UART1_RX 0x63A
113 #define UARTCC32XXDMA_PIN_62_UART0_TX 0xB3D
115 /*
116  * Flow control pins.
117  */
118 #define UARTCC32XXDMA_PIN_50_UART0_CTS 0xC31
119 #define UARTCC32XXDMA_PIN_50_UART0_RTS 0x331
120 #define UARTCC32XXDMA_PIN_50_UART1_RTS 0xA31
121 #define UARTCC32XXDMA_PIN_52_UART0_RTS 0x633
122 #define UARTCC32XXDMA_PIN_61_UART0_RTS 0x53C
123 #define UARTCC32XXDMA_PIN_61_UART0_CTS 0x63C
124 #define UARTCC32XXDMA_PIN_61_UART1_CTS 0x33C
125 #define UARTCC32XXDMA_PIN_62_UART0_RTS 0xA3D
126 #define UARTCC32XXDMA_PIN_62_UART1_RTS 0x33D
131 #define UARTCC32XXDMA_FLOWCTRL_NONE 0
132 
136 #define UARTCC32XXDMA_FLOWCTRL_HARDWARE 1
137 
148 /* Add UARTCC32XXDMA_STATUS_* macros here */
149 
170 #define UARTCC32XXDMA_CMD_IS_BUSY (UART_CMD_RESERVED + 0)
171 
172 
181 #define UARTCC32XXDMA_CMD_IS_RX_DATA_AVAILABLE (UART_CMD_RESERVED + 1)
182 
183 
192 #define UARTCC32XXDMA_CMD_IS_TX_SPACE_AVAILABLE (UART_CMD_RESERVED + 2)
193 
194 
197 /* UART function table pointer */
199 
212 typedef void (*UARTCC32XXDMA_ErrorCallback) (UART_Handle handle, uint32_t error);
213 
265 typedef struct {
267  unsigned int baseAddr;
269  unsigned int intNum;
271  unsigned int intPriority;
273  uint32_t flowControl;
275  unsigned long rxChannelIndex;
277  unsigned long txChannelIndex;
279  uint16_t rxPin;
281  uint16_t txPin;
283  uint16_t ctsPin;
285  uint16_t rtsPin;
292 
298 typedef struct {
299  /* UART control variables */
300  bool opened; /* Has the obj been opened */
301  UART_Mode readMode; /* Mode for all read calls */
302  UART_Mode writeMode; /* Mode for all write calls */
303  unsigned int readTimeout; /* Timeout for read semaphore */
304  unsigned int writeTimeout; /* Timeout for write semaphore */
305  UART_Callback readCallback; /* Pointer to read callback */
306  UART_Callback writeCallback; /* Pointer to write callback */
307  UART_ReturnMode readReturnMode; /* Receive return mode */
308  UART_DataMode readDataMode; /* Type of data being read */
309  UART_DataMode writeDataMode; /* Type of data being written */
310  uint32_t baudRate; /* Baud rate for UART */
311  UART_LEN dataLength; /* Data length for UART */
312  UART_STOP stopBits; /* Stop bits for UART */
313  UART_PAR parityType; /* Parity bit type for UART */
314  UART_Echo readEcho; /* Echo received data back */
315 
316  /* UART write variables */
317  const void *writeBuf; /* Buffer data pointer */
318  size_t writeCount; /* Number of Chars sent */
319  size_t writeSize; /* Chars remaining in buffer */
320 
321  /* UART receive variables */
322  void *readBuf; /* Buffer data pointer */
323  size_t readCount; /* Number of Chars read */
324  size_t readSize; /* Chars remaining in buffer */
325 
326  /* Semaphores for blocking mode */
327  SemaphoreP_Handle writeSem; /* UART write semaphore */
328  SemaphoreP_Handle readSem; /* UART read semaphore */
329 
330  HwiP_Handle hwiHandle;
331 
332  /* For Power management */
333  ClockP_Handle txFifoEmptyClk; /* UART TX FIFO empty clock */
334  Power_NotifyObj postNotify; /* LPDS wake-up notify object */
335  unsigned int powerMgrId; /* Determined from base address */
336  PowerCC32XX_ParkState prevParkTX; /* Previous park state TX pin */
337  uint16_t txPin; /* TX pin ID */
338  PowerCC32XX_ParkState prevParkRTS; /* Previous park state of RTS pin */
339  uint16_t rtsPin; /* RTS pin ID */
340 
341  /* UDMA */
344 
345 #ifdef __cplusplus
346 }
347 #endif
348 
349 #endif /* ti_drivers_uart_UARTCC32XXDMA__include */
UARTCC32XXDMA Hardware attributes.
Definition: UARTCC32XXDMA.h:265
UART_STOP
UART stop bit settings.
Definition: UART.h:523
Power_NotifyObj postNotify
Definition: UARTCC32XXDMA.h:334
uint32_t flowControl
Definition: UARTCC32XXDMA.h:273
uint16_t rxPin
Definition: UARTCC32XXDMA.h:279
PowerCC32XX_ParkState prevParkTX
Definition: UARTCC32XXDMA.h:336
size_t readSize
Definition: UARTCC32XXDMA.h:324
UARTCC32XXDMA Object.
Definition: UARTCC32XXDMA.h:298
UART_Callback writeCallback
Definition: UARTCC32XXDMA.h:306
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:635
unsigned int writeTimeout
Definition: UARTCC32XXDMA.h:304
Power Manager.
UART_PAR
UART parity type settings.
Definition: UART.h:533
UDMACC32XX_Handle dmaHandle
Definition: UARTCC32XXDMA.h:342
unsigned int baseAddr
Definition: UARTCC32XXDMA.h:267
const void * writeBuf
Definition: UARTCC32XXDMA.h:317
UART_Mode
UART mode settings.
Definition: UART.h:428
UART_Echo readEcho
Definition: UARTCC32XXDMA.h:314
UART_DataMode
UART data mode settings.
Definition: UART.h:483
size_t readCount
Definition: UARTCC32XXDMA.h:323
UART_ReturnMode
UART return mode settings.
Definition: UART.h:461
SemaphoreP_Handle readSem
Definition: UARTCC32XXDMA.h:328
unsigned int powerMgrId
Definition: UARTCC32XXDMA.h:335
UART_Echo
UART echo settings.
Definition: UART.h:501
uDMA driver implementation for CC32XX.
unsigned int intNum
Definition: UARTCC32XXDMA.h:269
UART Global configuration.
Definition: UART.h:678
SemaphoreP_Handle writeSem
Definition: UARTCC32XXDMA.h:327
uint16_t txPin
Definition: UARTCC32XXDMA.h:281
void * readBuf
Definition: UARTCC32XXDMA.h:322
UDMACC32XX Global configuration.
Definition: UDMACC32XX.h:125
uint16_t ctsPin
Definition: UARTCC32XXDMA.h:283
Power manager interface for the CC32XX.
ClockP_Handle txFifoEmptyClk
Definition: UARTCC32XXDMA.h:333
uint32_t baudRate
Definition: UARTCC32XXDMA.h:310
Power notify object structure.
Definition: Power.h:443
UART_PAR parityType
Definition: UARTCC32XXDMA.h:313
Universal Asynchronous Receiver-Transmitter (UART) Driver.
bool opened
Definition: UARTCC32XXDMA.h:300
UART_STOP stopBits
Definition: UARTCC32XXDMA.h:312
UART_LEN dataLength
Definition: UARTCC32XXDMA.h:311
UART_DataMode readDataMode
Definition: UARTCC32XXDMA.h:308
uint16_t rtsPin
Definition: UARTCC32XXDMA.h:339
uint16_t rtsPin
Definition: UARTCC32XXDMA.h:285
unsigned int readTimeout
Definition: UARTCC32XXDMA.h:303
size_t writeCount
Definition: UARTCC32XXDMA.h:318
size_t writeSize
Definition: UARTCC32XXDMA.h:319
UARTCC32XXDMA_ErrorCallback errorFxn
Definition: UARTCC32XXDMA.h:290
HwiP_Handle hwiHandle
Definition: UARTCC32XXDMA.h:330
void(* UARTCC32XXDMA_ErrorCallback)(UART_Handle handle, uint32_t error)
The definition of an optional callback function used by the UART driver to notify the application whe...
Definition: UARTCC32XXDMA.h:212
UART_LEN
UART data length settings.
Definition: UART.h:511
unsigned long rxChannelIndex
Definition: UARTCC32XXDMA.h:275
PowerCC32XX_ParkState prevParkRTS
Definition: UARTCC32XXDMA.h:338
uint16_t txPin
Definition: UARTCC32XXDMA.h:337
UART_Mode writeMode
Definition: UARTCC32XXDMA.h:302
UART_DataMode writeDataMode
Definition: UARTCC32XXDMA.h:309
struct UARTCC32XXDMA_Object * UARTCC32XXDMA_Handle
UART_Mode readMode
Definition: UARTCC32XXDMA.h:301
unsigned long txChannelIndex
Definition: UARTCC32XXDMA.h:277
unsigned int intPriority
Definition: UARTCC32XXDMA.h:271
UART_Callback readCallback
Definition: UARTCC32XXDMA.h:305
const UART_FxnTable UARTCC32XXDMA_fxnTable
UART_ReturnMode readReturnMode
Definition: UARTCC32XXDMA.h:307
void(* UART_Callback)(UART_Handle handle, void *buf, size_t count)
The definition of a callback function used by the UART driver when used in UART_MODE_CALLBACK The cal...
Definition: UART.h:421
PowerCC32XX_ParkState
Enumeration of states a pin can be parked in.
Definition: PowerCC32XX.h:385
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale