]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/ti/devices/cc32xx/driverlib/uart.h
Add SimpleLink CC3220SF demo.
[freertos] / FreeRTOS / Demo / CORTEX_M4_SimpleLink_CC3220SF_CCS / ti / devices / cc32xx / driverlib / uart.h
1 /*
2  * -------------------------------------------
3  *    CC3220 SDK - v0.10.00.00 
4  * -------------------------------------------
5  *
6  *  Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ 
7  *  
8  *  Redistribution and use in source and binary forms, with or without 
9  *  modification, are permitted provided that the following conditions 
10  *  are met:
11  *
12  *    Redistributions of source code must retain the above copyright 
13  *    notice, this list of conditions and the following disclaimer.
14  *
15  *    Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the 
17  *    documentation and/or other materials provided with the   
18  *    distribution.
19  *
20  *    Neither the name of Texas Instruments Incorporated nor the names of
21  *    its contributors may be used to endorse or promote products derived
22  *    from this software without specific prior written permission.
23  *
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
25  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
26  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
28  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
29  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
30  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
33  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
34  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *  
36  */
37 //*****************************************************************************
38 //
39 //  uart.h
40 //
41 //  Defines and Macros for the UART.
42 //
43 //*****************************************************************************
44
45 #ifndef __UART_H__
46 #define __UART_H__
47
48 //*****************************************************************************
49 //
50 // If building with a C++ compiler, make all of the definitions in this header
51 // have a C binding.
52 //
53 //*****************************************************************************
54 #ifdef __cplusplus
55 extern "C"
56 {
57 #endif
58
59 //*****************************************************************************
60 //
61 // Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear
62 // as the ulIntFlags parameter, and returned from UARTIntStatus.
63 //
64 //*****************************************************************************
65 #define UART_INT_DMATX          0x20000     // DMA Tx Done interrupt Mask
66 #define UART_INT_DMARX          0x10000     // DMA Rx Done interrupt Mask
67 #define UART_INT_EOT            0x800       // End of transfer interrupt Mask
68 #define UART_INT_OE             0x400       // Overrun Error Interrupt Mask
69 #define UART_INT_BE             0x200       // Break Error Interrupt Mask
70 #define UART_INT_PE             0x100       // Parity Error Interrupt Mask
71 #define UART_INT_FE             0x080       // Framing Error Interrupt Mask
72 #define UART_INT_RT             0x040       // Receive Timeout Interrupt Mask
73 #define UART_INT_TX             0x020       // Transmit Interrupt Mask
74 #define UART_INT_RX             0x010       // Receive Interrupt Mask
75 #define UART_INT_CTS            0x002       // CTS Modem Interrupt Mask
76
77
78 //*****************************************************************************
79 //
80 // Values that can be passed to UARTConfigSetExpClk as the ulConfig parameter
81 // and returned by UARTConfigGetExpClk in the pulConfig parameter.
82 // Additionally, the UART_CONFIG_PAR_* subset can be passed to
83 // UARTParityModeSet as the ulParity parameter, and are returned by
84 // UARTParityModeGet.
85 //
86 //*****************************************************************************
87 #define UART_CONFIG_WLEN_MASK   0x00000060  // Mask for extracting word length
88 #define UART_CONFIG_WLEN_8      0x00000060  // 8 bit data
89 #define UART_CONFIG_WLEN_7      0x00000040  // 7 bit data
90 #define UART_CONFIG_WLEN_6      0x00000020  // 6 bit data
91 #define UART_CONFIG_WLEN_5      0x00000000  // 5 bit data
92 #define UART_CONFIG_STOP_MASK   0x00000008  // Mask for extracting stop bits
93 #define UART_CONFIG_STOP_ONE    0x00000000  // One stop bit
94 #define UART_CONFIG_STOP_TWO    0x00000008  // Two stop bits
95 #define UART_CONFIG_PAR_MASK    0x00000086  // Mask for extracting parity
96 #define UART_CONFIG_PAR_NONE    0x00000000  // No parity
97 #define UART_CONFIG_PAR_EVEN    0x00000006  // Even parity
98 #define UART_CONFIG_PAR_ODD     0x00000002  // Odd parity
99 #define UART_CONFIG_PAR_ONE     0x00000082  // Parity bit is one
100 #define UART_CONFIG_PAR_ZERO    0x00000086  // Parity bit is zero
101
102 //*****************************************************************************
103 //
104 // Values that can be passed to UARTFIFOLevelSet as the ulTxLevel parameter and
105 // returned by UARTFIFOLevelGet in the pulTxLevel.
106 //
107 //*****************************************************************************
108 #define UART_FIFO_TX1_8         0x00000000  // Transmit interrupt at 1/8 Full
109 #define UART_FIFO_TX2_8         0x00000001  // Transmit interrupt at 1/4 Full
110 #define UART_FIFO_TX4_8         0x00000002  // Transmit interrupt at 1/2 Full
111 #define UART_FIFO_TX6_8         0x00000003  // Transmit interrupt at 3/4 Full
112 #define UART_FIFO_TX7_8         0x00000004  // Transmit interrupt at 7/8 Full
113
114 //*****************************************************************************
115 //
116 // Values that can be passed to UARTFIFOLevelSet as the ulRxLevel parameter and
117 // returned by UARTFIFOLevelGet in the pulRxLevel.
118 //
119 //*****************************************************************************
120 #define UART_FIFO_RX1_8         0x00000000  // Receive interrupt at 1/8 Full
121 #define UART_FIFO_RX2_8         0x00000008  // Receive interrupt at 1/4 Full
122 #define UART_FIFO_RX4_8         0x00000010  // Receive interrupt at 1/2 Full
123 #define UART_FIFO_RX6_8         0x00000018  // Receive interrupt at 3/4 Full
124 #define UART_FIFO_RX7_8         0x00000020  // Receive interrupt at 7/8 Full
125
126 //*****************************************************************************
127 //
128 // Values that can be passed to UARTDMAEnable() and UARTDMADisable().
129 //
130 //*****************************************************************************
131 #define UART_DMA_ERR_RXSTOP     0x00000004  // Stop DMA receive if UART error
132 #define UART_DMA_TX             0x00000002  // Enable DMA for transmit
133 #define UART_DMA_RX             0x00000001  // Enable DMA for receive
134
135 //*****************************************************************************
136 //
137 // Values returned from UARTRxErrorGet().
138 //
139 //*****************************************************************************
140 #define UART_RXERROR_OVERRUN    0x00000008
141 #define UART_RXERROR_BREAK      0x00000004
142 #define UART_RXERROR_PARITY     0x00000002
143 #define UART_RXERROR_FRAMING    0x00000001
144
145 //*****************************************************************************
146 //
147 // Values that can be passed to UARTModemControlSet()and UARTModemControlClear()
148 // or returned from UARTModemControlGet().
149 //
150 //*****************************************************************************
151 #define UART_OUTPUT_RTS         0x00000800
152
153 //*****************************************************************************
154 //
155 // Values that can be returned from UARTModemStatusGet().
156 //
157 //*****************************************************************************
158 #define UART_INPUT_CTS          0x00000001
159
160 //*****************************************************************************
161 //
162 // Values that can be passed to UARTFlowControl() or returned from
163 // UARTFlowControlGet().
164 //
165 //*****************************************************************************
166 #define UART_FLOWCONTROL_TX     0x00008000
167 #define UART_FLOWCONTROL_RX     0x00004000
168 #define UART_FLOWCONTROL_NONE   0x00000000
169
170 //*****************************************************************************
171 //
172 // Values that can be passed to UARTTxIntModeSet() or returned from
173 // UARTTxIntModeGet().
174 //
175 //*****************************************************************************
176 #define UART_TXINT_MODE_FIFO    0x00000000
177 #define UART_TXINT_MODE_EOT     0x00000010
178
179
180 //*****************************************************************************
181 //
182 // API Function prototypes
183 //
184 //*****************************************************************************
185 extern void UARTParityModeSet(unsigned long ulBase, unsigned long ulParity);
186 extern unsigned long UARTParityModeGet(unsigned long ulBase);
187 extern void UARTFIFOLevelSet(unsigned long ulBase, unsigned long ulTxLevel,
188                              unsigned long ulRxLevel);
189 extern void UARTFIFOLevelGet(unsigned long ulBase, unsigned long *pulTxLevel,
190                              unsigned long *pulRxLevel);
191 extern void UARTConfigSetExpClk(unsigned long ulBase, unsigned long ulUARTClk,
192                                 unsigned long ulBaud, unsigned long ulConfig);
193 extern void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk,
194                                 unsigned long *pulBaud,
195                                 unsigned long *pulConfig);
196 extern void UARTEnable(unsigned long ulBase);
197 extern void UARTDisable(unsigned long ulBase);
198 extern void UARTFIFOEnable(unsigned long ulBase);
199 extern void UARTFIFODisable(unsigned long ulBase);
200 extern tBoolean UARTCharsAvail(unsigned long ulBase);
201 extern tBoolean UARTSpaceAvail(unsigned long ulBase);
202 extern long UARTCharGetNonBlocking(unsigned long ulBase);
203 extern long UARTCharGet(unsigned long ulBase);
204 extern tBoolean UARTCharPutNonBlocking(unsigned long ulBase,
205                                        unsigned char ucData);
206 extern void UARTCharPut(unsigned long ulBase, unsigned char ucData);
207 extern void UARTBreakCtl(unsigned long ulBase, tBoolean bBreakState);
208 extern tBoolean UARTBusy(unsigned long ulBase);
209 extern void UARTIntRegister(unsigned long ulBase, void(*pfnHandler)(void));
210 extern void UARTIntUnregister(unsigned long ulBase);
211 extern void UARTIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
212 extern void UARTIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
213 extern unsigned long UARTIntStatus(unsigned long ulBase, tBoolean bMasked);
214 extern void UARTIntClear(unsigned long ulBase, unsigned long ulIntFlags);
215 extern void UARTDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags);
216 extern void UARTDMADisable(unsigned long ulBase, unsigned long ulDMAFlags);
217 extern unsigned long UARTRxErrorGet(unsigned long ulBase);
218 extern void UARTRxErrorClear(unsigned long ulBase);
219 extern void UARTModemControlSet(unsigned long ulBase,
220                                 unsigned long ulControl);
221 extern void UARTModemControlClear(unsigned long ulBase,
222                                   unsigned long ulControl);
223 extern unsigned long UARTModemControlGet(unsigned long ulBase);
224 extern unsigned long UARTModemStatusGet(unsigned long ulBase);
225 extern void UARTFlowControlSet(unsigned long ulBase, unsigned long ulMode);
226 extern unsigned long UARTFlowControlGet(unsigned long ulBase);
227 extern void UARTTxIntModeSet(unsigned long ulBase, unsigned long ulMode);
228 extern unsigned long UARTTxIntModeGet(unsigned long ulBase);
229
230 //*****************************************************************************
231 //
232 // Mark the end of the C bindings section for C++ compilers.
233 //
234 //*****************************************************************************
235 #ifdef __cplusplus
236 }
237 #endif
238
239 #endif //  __UART_H__