UARTCC32XXDMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2017, 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 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 #include <stdint.h>
68 #include <stdbool.h>
69 
70 #include <ti/drivers/dpl/ClockP.h>
71 #include <ti/drivers/dpl/HwiP.h>
72 
73 #include <ti/drivers/dpl/SemaphoreP.h>
74 #include <ti/drivers/Power.h>
76 #include <ti/drivers/UART.h>
78 
79 
86 #define UARTCC32XXDMA_PIN_UNASSIGNED 0xFFF
87 /*
88  * The bits in the pin mode macros are as follows:
89  * The lower 8 bits of the macro refer to the pin, offset by 1, to match
90  * driverlib pin defines. For example, UARTCC32XXDMA_PIN_01_UART1_TX & 0xff = 0,
91  * which equals PIN_01 in driverlib pin.h. By matching the PIN_xx defines in
92  * driverlib pin.h, we can pass the pin directly to the driverlib functions.
93  * The upper 8 bits of the macro correspond to the pin mux confg mode
94  * value for the pin to operate in the UART mode. For example, pin 1 is
95  * configured with mode 7 to operate as UART1 TX.
96  */
97 #define UARTCC32XXDMA_PIN_01_UART1_TX 0x700
98 #define UARTCC32XXDMA_PIN_02_UART1_RX 0x701
99 #define UARTCC32XXDMA_PIN_03_UART0_TX 0x702
100 #define UARTCC32XXDMA_PIN_04_UART0_RX 0x703
101 #define UARTCC32XXDMA_PIN_07_UART1_TX 0x506
102 #define UARTCC32XXDMA_PIN_08_UART1_RX 0x507
103 #define UARTCC32XXDMA_PIN_16_UART1_TX 0x20F
104 #define UARTCC32XXDMA_PIN_17_UART1_RX 0x210
105 #define UARTCC32XXDMA_PIN_45_UART0_RX 0x92C
106 #define UARTCC32XXDMA_PIN_45_UART1_RX 0x22C
107 #define UARTCC32XXDMA_PIN_53_UART0_TX 0x934
108 #define UARTCC32XXDMA_PIN_55_UART0_TX 0x336
109 #define UARTCC32XXDMA_PIN_55_UART1_TX 0x636
110 #define UARTCC32XXDMA_PIN_57_UART0_RX 0x338
111 #define UARTCC32XXDMA_PIN_57_UART1_RX 0x638
112 #define UARTCC32XXDMA_PIN_58_UART1_TX 0x639
113 #define UARTCC32XXDMA_PIN_59_UART1_RX 0x63A
114 #define UARTCC32XXDMA_PIN_62_UART0_TX 0xB3D
116 /*
117  * Flow control pins.
118  */
119 #define UARTCC32XXDMA_PIN_50_UART0_CTS 0xC31
120 #define UARTCC32XXDMA_PIN_50_UART0_RTS 0x331
121 #define UARTCC32XXDMA_PIN_50_UART1_RTS 0xA31
122 #define UARTCC32XXDMA_PIN_52_UART0_RTS 0x633
123 #define UARTCC32XXDMA_PIN_61_UART0_RTS 0x53C
124 #define UARTCC32XXDMA_PIN_61_UART0_CTS 0x63C
125 #define UARTCC32XXDMA_PIN_61_UART1_CTS 0x33C
126 #define UARTCC32XXDMA_PIN_62_UART0_RTS 0xA3D
127 #define UARTCC32XXDMA_PIN_62_UART1_RTS 0x33D
132 #define UARTCC32XXDMA_FLOWCTRL_NONE 0
133 
137 #define UARTCC32XXDMA_FLOWCTRL_HARDWARE 1
138 
149 /* Add UARTCC32XXDMA_STATUS_* macros here */
150 
171 #define UARTCC32XXDMA_CMD_IS_BUSY (UART_CMD_RESERVED + 0)
172 
173 
182 #define UARTCC32XXDMA_CMD_IS_RX_DATA_AVAILABLE (UART_CMD_RESERVED + 1)
183 
184 
193 #define UARTCC32XXDMA_CMD_IS_TX_SPACE_AVAILABLE (UART_CMD_RESERVED + 2)
194 
195 
198 /* UART function table pointer */
200 
213 typedef void (*UARTCC32XXDMA_ErrorCallback) (UART_Handle handle, uint32_t error);
214 
266 typedef struct UARTCC32XXDMA_HWAttrsV1 {
268  unsigned int baseAddr;
270  unsigned int intNum;
272  unsigned int intPriority;
274  uint32_t flowControl;
276  unsigned long rxChannelIndex;
278  unsigned long txChannelIndex;
280  uint16_t rxPin;
282  uint16_t txPin;
284  uint16_t ctsPin;
286  uint16_t rtsPin;
293 
299 typedef struct UARTCC32XXDMA_Object {
300  /* UART control variables */
301  bool opened; /* Has the obj been opened */
302  UART_Mode readMode; /* Mode for all read calls */
303  UART_Mode writeMode; /* Mode for all write calls */
304  unsigned int readTimeout; /* Timeout for read semaphore */
305  unsigned int writeTimeout; /* Timeout for write semaphore */
306  UART_Callback readCallback; /* Pointer to read callback */
307  UART_Callback writeCallback; /* Pointer to write callback */
308  UART_ReturnMode readReturnMode; /* Receive return mode */
309  UART_DataMode readDataMode; /* Type of data being read */
310  UART_DataMode writeDataMode; /* Type of data being written */
311  uint32_t baudRate; /* Baud rate for UART */
312  UART_LEN dataLength; /* Data length for UART */
313  UART_STOP stopBits; /* Stop bits for UART */
314  UART_PAR parityType; /* Parity bit type for UART */
315  UART_Echo readEcho; /* Echo received data back */
316 
317  /* UART write variables */
318  const void *writeBuf; /* Buffer data pointer */
319  size_t writeCount; /* Number of Chars sent */
320  size_t writeSize; /* Chars remaining in buffer */
321 
322  /* UART receive variables */
323  void *readBuf; /* Buffer data pointer */
324  size_t readCount; /* Number of Chars read */
325  size_t readSize; /* Chars remaining in buffer */
326 
327  /* Semaphores for blocking mode */
328  SemaphoreP_Handle writeSem; /* UART write semaphore */
329  SemaphoreP_Handle readSem; /* UART read semaphore */
330 
331  HwiP_Handle hwiHandle;
332 
333  /* For Power management */
334  ClockP_Handle txFifoEmptyClk; /* UART TX FIFO empty clock */
335  Power_NotifyObj postNotify; /* LPDS wake-up notify object */
336  unsigned int powerMgrId; /* Determined from base address */
337  PowerCC32XX_ParkState prevParkTX; /* Previous park state TX pin */
338  uint16_t txPin; /* TX pin ID */
339  PowerCC32XX_ParkState prevParkRTS; /* Previous park state of RTS pin */
340  uint16_t rtsPin; /* RTS pin ID */
341 
342  /* UDMA */
345 
346 #ifdef __cplusplus
347 }
348 #endif
349 
350 #endif /* ti_drivers_uart_UARTCC32XXDMA__include */
UARTCC32XXDMA Hardware attributes.
Definition: UARTCC32XXDMA.h:266
Power_NotifyObj postNotify
Definition: UARTCC32XXDMA.h:335
enum UART_Echo_ UART_Echo
UART echo settings.
uint32_t flowControl
Definition: UARTCC32XXDMA.h:274
uint16_t rxPin
Definition: UARTCC32XXDMA.h:280
PowerCC32XX_ParkState prevParkTX
Definition: UARTCC32XXDMA.h:337
size_t readSize
Definition: UARTCC32XXDMA.h:325
UARTCC32XXDMA Object.
Definition: UARTCC32XXDMA.h:299
UART_Callback writeCallback
Definition: UARTCC32XXDMA.h:307
enum UART_PAR_ UART_PAR
UART parity type settings.
unsigned int writeTimeout
Definition: UARTCC32XXDMA.h:305
Power Manager.
enum UART_LEN_ UART_LEN
UART data length settings.
UDMACC32XX_Handle dmaHandle
Definition: UARTCC32XXDMA.h:343
unsigned int baseAddr
Definition: UARTCC32XXDMA.h:268
const void * writeBuf
Definition: UARTCC32XXDMA.h:318
enum UART_Mode_ UART_Mode
UART mode settings.
UART_Echo readEcho
Definition: UARTCC32XXDMA.h:315
size_t readCount
Definition: UARTCC32XXDMA.h:324
struct UARTCC32XXDMA_HWAttrsV1 UARTCC32XXDMA_HWAttrsV1
UARTCC32XXDMA Hardware attributes.
SemaphoreP_Handle readSem
Definition: UARTCC32XXDMA.h:329
unsigned int powerMgrId
Definition: UARTCC32XXDMA.h:336
uDMA driver implementation for CC32XX.
unsigned int intNum
Definition: UARTCC32XXDMA.h:270
UART Global configuration.
Definition: UART.h:678
SemaphoreP_Handle writeSem
Definition: UARTCC32XXDMA.h:328
uint16_t txPin
Definition: UARTCC32XXDMA.h:282
void * readBuf
Definition: UARTCC32XXDMA.h:323
UDMACC32XX Global configuration.
Definition: UDMACC32XX.h:125
uint16_t ctsPin
Definition: UARTCC32XXDMA.h:284
Power manager interface for the CC32XX.
ClockP_Handle txFifoEmptyClk
Definition: UARTCC32XXDMA.h:334
uint32_t baudRate
Definition: UARTCC32XXDMA.h:311
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:635
Power notify object structure.
Definition: Power.h:443
UART_PAR parityType
Definition: UARTCC32XXDMA.h:314
Universal Asynchronous Receiver-Transmitter (UART) Driver.
bool opened
Definition: UARTCC32XXDMA.h:301
UART_STOP stopBits
Definition: UARTCC32XXDMA.h:313
UART_LEN dataLength
Definition: UARTCC32XXDMA.h:312
UART_DataMode readDataMode
Definition: UARTCC32XXDMA.h:309
uint16_t rtsPin
Definition: UARTCC32XXDMA.h:340
uint16_t rtsPin
Definition: UARTCC32XXDMA.h:286
unsigned int readTimeout
Definition: UARTCC32XXDMA.h:304
size_t writeCount
Definition: UARTCC32XXDMA.h:319
enum UART_STOP_ UART_STOP
UART stop bit settings.
enum UART_ReturnMode_ UART_ReturnMode
UART return mode settings.
size_t writeSize
Definition: UARTCC32XXDMA.h:320
UARTCC32XXDMA_ErrorCallback errorFxn
Definition: UARTCC32XXDMA.h:291
HwiP_Handle hwiHandle
Definition: UARTCC32XXDMA.h:331
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:213
unsigned long rxChannelIndex
Definition: UARTCC32XXDMA.h:276
PowerCC32XX_ParkState prevParkRTS
Definition: UARTCC32XXDMA.h:339
uint16_t txPin
Definition: UARTCC32XXDMA.h:338
UART_Mode writeMode
Definition: UARTCC32XXDMA.h:303
UART_DataMode writeDataMode
Definition: UARTCC32XXDMA.h:310
struct UARTCC32XXDMA_Object UARTCC32XXDMA_Object
UARTCC32XXDMA Object.
UART_Mode readMode
Definition: UARTCC32XXDMA.h:302
unsigned long txChannelIndex
Definition: UARTCC32XXDMA.h:278
unsigned int intPriority
Definition: UARTCC32XXDMA.h:272
UART_Callback readCallback
Definition: UARTCC32XXDMA.h:306
const UART_FxnTable UARTCC32XXDMA_fxnTable
struct UARTCC32XXDMA_Object * UARTCC32XXDMA_Handle
UART_ReturnMode readReturnMode
Definition: UARTCC32XXDMA.h:308
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
enum UART_DataMode_ UART_DataMode
UART data mode settings.
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