libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
uart.h
Go to the documentation of this file.
1/** @defgroup uart_defines UART Control
2 *
3 * @brief <b>Defined Constants and Types for the LM4F UART Control</b>
4 *
5 * @ingroup LM4Fxx_defines
6 *
7 * @version 1.0.0
8 *
9 * @author @htmlonly &copy; @endhtmlonly 2013
10 * Alexandru Gagniuc <mr.nuke.me@gmail.com>
11 *
12 * @date 07 May 2013
13 *
14 * LGPL License Terms @ref lgpl_license
15 */
16
17/*
18 * This file is part of the libopencm3 project.
19 *
20 * Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
21 *
22 * This library is free software: you can redistribute it and/or modify
23 * it under the terms of the GNU Lesser General Public License as published by
24 * the Free Software Foundation, either version 3 of the License, or
25 * (at your option) any later version.
26 *
27 * This library is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 *
32 * You should have received a copy of the GNU Lesser General Public License
33 * along with this library. If not, see <http://www.gnu.org/licenses/>.
34 */
35
36#ifndef LIBOPENCM3_LM4F_UART_H
37#define LIBOPENCM3_LM4F_UART_H
38
39/**@{*/
40
43
44/* =============================================================================
45 * Convenience macros
46 * ---------------------------------------------------------------------------*/
47/** @defgroup uart_reg_base UART register base addresses
48 * @{*/
49#define UART0 UART0_BASE
50#define UART1 UART1_BASE
51#define UART2 UART2_BASE
52#define UART3 UART3_BASE
53#define UART4 UART4_BASE
54#define UART5 UART5_BASE
55#define UART6 UART6_BASE
56#define UART7 UART7_BASE
57/** @} */
58
59/* =============================================================================
60 * UART registers
61 * ---------------------------------------------------------------------------*/
62
63/* UART data register */
64#define UART_DR(uart_base) MMIO32((uart_base) + 0x00)
65
66/* UART Receive Status/Error Clear register */
67#define UART_RSR(uart_base) MMIO32((uart_base) + 0x04)
68#define UART_ECR(uart_base) MMIO32((uart_base) + 0x04)
69
70/* UART Flag register */
71#define UART_FR(uart_base) MMIO32((uart_base) + 0x18)
72
73/* UART IrDA Low-Power register */
74#define UART_ILPR(uart_base) MMIO32((uart_base) + 0x20)
75
76/* UART Integer baudrate divisor */
77#define UART_IBRD(uart_base) MMIO32((uart_base) + 0x24)
78
79/* UART Fractional baudrate divisor */
80#define UART_FBRD(uart_base) MMIO32((uart_base) + 0x28)
81
82/* UART Line control */
83#define UART_LCRH(uart_base) MMIO32((uart_base) + 0x2C)
84
85/* UART Control */
86#define UART_CTL(uart_base) MMIO32((uart_base) + 0x30)
87
88/* UART Interrupt FIFO level select */
89#define UART_IFLS(uart_base) MMIO32((uart_base) + 0x34)
90
91/* UART Interrupt mask */
92#define UART_IM(uart_base) MMIO32((uart_base) + 0x38)
93
94/* UART Raw interrupt status */
95#define UART_RIS(uart_base) MMIO32((uart_base) + 0x3C)
96
97/* UART Masked Interrupt status */
98#define UART_MIS(uart_base) MMIO32((uart_base) + 0x40)
99
100/* UART Interrupt Clear */
101#define UART_ICR(uart_base) MMIO32((uart_base) + 0x44)
102
103/* UART DMA control */
104#define UART_DMACTL(uart_base) MMIO32((uart_base) + 0x48)
105
106/* UART LIN control */
107#define UART_LCTL(uart_base) MMIO32((uart_base) + 0x90)
108
109/* UART LIN snap shot */
110#define UART_LSS(uart_base) MMIO32((uart_base) + 0x94)
111
112/* UART LIN timer */
113#define UART_LTIM(uart_base) MMIO32((uart_base) + 0x98)
114
115/* UART 9-Bit self address */
116#define UART_9BITADDR(uart_base) MMIO32((uart_base) + 0xA4)
117
118/* UART 9-Bit self address mask */
119#define UART_9BITAMASK(uart_base) MMIO32((uart_base) + 0xA8)
120
121/* UART Peripheral properties */
122#define UART_PP(uart_base) MMIO32((uart_base) + 0xFC0)
123
124/* UART Clock configuration */
125#define UART_CC(uart_base) MMIO32((uart_base) + 0xFC8)
126
127/* UART Peripheral Identification 4 */
128#define UART_PERIPH_ID4(uart_base) MMIO32((uart_base) + 0xFD0)
129
130/* UART Peripheral Identification 5 */
131#define UART_PERIPH_ID5(uart_base) MMIO32((uart_base) + 0xFD4)
132
133/* UART Peripheral Identification 6 */
134#define UART_PERIPH_ID6(uart_base) MMIO32((uart_base) + 0xFD8)
135
136/* UART Peripheral Identification 7 */
137#define UART_PERIPH_ID7(uart_base) MMIO32((uart_base) + 0xFDC)
138
139/* UART Peripheral Identification 0 */
140#define UART_PERIPH_ID0(uart_base) MMIO32((uart_base) + 0xFE0)
141
142/* UART Peripheral Identification 1 */
143#define UART_PERIPH_ID1(uart_base) MMIO32((uart_base) + 0xFE4)
144
145/* UART Peripheral Identification 2 */
146#define UART_PERIPH_ID2(uart_base) MMIO32((uart_base) + 0xFE8)
147
148/* UART Peripheral Identification 3 */
149#define UART_PERIPH_ID3(uart_base) MMIO32((uart_base) + 0xFEC)
150
151/* UART PrimeCell Identification 0 */
152#define UART_PCELL_ID0(uart_base) MMIO32((uart_base) + 0xFF0)
153
154/* UART PrimeCell Identification 1 */
155#define UART_PCELL_ID1(uart_base) MMIO32((uart_base) + 0xFF4)
156
157/* UART PrimeCell Identification 2 */
158#define UART_PCELL_ID2(uart_base) MMIO32((uart_base) + 0xFF8)
159
160/* UART PrimeCell Identification 3 */
161#define UART_PCELL_ID3(uart_base) MMIO32((uart_base) + 0xFFC)
162
163
164/* =============================================================================
165 * UART_DR values
166 * ---------------------------------------------------------------------------*/
167/** Overrun Error */
168#define UART_DR_OE (1 << 11)
169/** Break Error */
170#define UART_DR_BE (1 << 10)
171/** Parity Error */
172#define UART_DR_PE (1 << 9)
173/** Framing Error */
174#define UART_DR_FE (1 << 8)
175/** Data transmitted or received */
176#define UART_DR_DATA_MASK (0xFF << 0)
177
178/* =============================================================================
179 * Readonly UART_RSR values
180 * ---------------------------------------------------------------------------*/
181/** Overrun Error */
182#define UART_RSR_OE (1 << 3)
183/** Break Error */
184#define UART_RSR_BE (1 << 2)
185/** Parity Error */
186#define UART_RSR_PE (1 << 1)
187/** Framing Error */
188#define UART_RSR_FE (1 << 0)
189
190/* =============================================================================
191 * UART_FR values
192 * ---------------------------------------------------------------------------*/
193/** Tx FIFO empty */
194#define UART_FR_TXFE (1 << 7)
195/** Rx FIFO full */
196#define UART_FR_RXFF (1 << 6)
197/** Tx FIFO full */
198#define UART_FR_TXFF (1 << 5)
199/** Rx FIFO empty */
200#define UART_FR_RXFE (1 << 4)
201/** UART Busy */
202#define UART_FR_BUSY (1 << 3)
203/** Clear To Send */
204#define UART_FR_CTS (1 << 0)
205
206/* =============================================================================
207 * UART_LCRH values
208 * ---------------------------------------------------------------------------*/
209/** Stick parity select */
210#define UART_LCRH_SPS (1 << 7)
211/** Word length */
212#define UART_LCRH_WLEN_MASK (3 << 5)
213#define UART_LCRH_WLEN_5 (0 << 5)
214#define UART_LCRH_WLEN_6 (1 << 5)
215#define UART_LCRH_WLEN_7 (2 << 5)
216#define UART_LCRH_WLEN_8 (3 << 5)
217/** Enable FIFOs */
218#define UART_LCRH_FEN (1 << 4)
219/** Two stop bits select */
220#define UART_LCRH_STP2 (1 << 3)
221/** Even parity select */
222#define UART_LCRH_EPS (1 << 2)
223/** Parity enable */
224#define UART_LCRH_PEN (1 << 1)
225/** Send break */
226#define UART_LCRH_BRK (1 << 0)
227
228/* =============================================================================
229 * UART_CTL values
230 * ---------------------------------------------------------------------------*/
231/** Enable Clear To Send */
232#define UART_CTL_CTSEN (1 << 15)
233/** Enable Request To Send */
234#define UART_CTL_RTSEN (1 << 14)
235/** Request To Send */
236#define UART_CTL_RTS (1 << 11)
237/** Data terminal ready */
238#define UART_CTL_DTR (1 << 10)
239/** Rx Enable */
240#define UART_CTL_RXE (1 << 9)
241/** Tx Enable */
242#define UART_CTL_TXE (1 << 8)
243/** Loop back enable */
244#define UART_CTL_LBE (1 << 7)
245/** LIN mode enable */
246#define UART_CTL_LIN (1 << 6)
247/** High speed Enable */
248#define UART_CTL_HSE (1 << 5)
249/** End of transmission */
250#define UART_CTL_EOT (1 << 4)
251/** ISO 7816 Smart Card support */
252#define UART_CTL_SMART (1 << 3)
253/** SIR low-power mode */
254#define UART_CTL_SIRLIP (1 << 2)
255/** SIR enable */
256#define UART_CTL_SIREN (1 << 1)
257/** UART enable */
258#define UART_CTL_UARTEN (1 << 0)
259
260/* =============================================================================
261 * UART_IFLS values
262 * ---------------------------------------------------------------------------*/
263/** UART Rx interrupt FIFO level select */
264#define UART_IFLS_RXIFLSEL_MASK (7 << 3)
265#define UART_IFLS_RXIFLSEL_1_8 (0 << 3)
266#define UART_IFLS_RXIFLSEL_1_4 (1 << 3)
267#define UART_IFLS_RXIFLSEL_1_2 (2 << 3)
268#define UART_IFLS_RXIFLSEL_3_4 (3 << 3)
269#define UART_IFLS_RXIFLSEL_7_8 (4 << 3)
270/** UART Tx interrupt FIFO level select */
271#define UART_IFLS_TXIFLSEL_MASK (7 << 0)
272#define UART_IFLS_TXIFLSEL_7_8 (0 << 0)
273#define UART_IFLS_TXIFLSEL_3_4 (1 << 0)
274#define UART_IFLS_TXIFLSEL_1_2 (2 << 0)
275#define UART_IFLS_TXIFLSEL_1_4 (3 << 0)
276#define UART_IFLS_TXIFLSEL_1_8 (4 << 0)
277
278/* =============================================================================
279 * UART interrupt mask values
280 *
281 * These are interchangeable across UART_IM, UART_RIS, UART_MIS, and UART_ICR
282 * registers.
283 * ---------------------------------------------------------------------------*/
284/** LIN mode edge 5 interrupt mask */
285#define UART_IM_LME5IM (1 << 15)
286/** LIN mode edge 1 interrupt mask */
287#define UART_IM_LME1IM (1 << 14)
288/** LIN mode sync break interrupt mask */
289#define UART_IM_LMSBIM (1 << 13)
290/** 9-bit mode interrupt mask */
291#define UART_IM_9BITIM (1 << 12)
292/** Overrun error interrupt mask */
293#define UART_IM_OEIM (1 << 10)
294/** Break error interrupt mask */
295#define UART_IM_BEIM (1 << 9)
296/** Parity error interrupt mask */
297#define UART_IM_PEIM (1 << 8)
298/** Framing error interrupt mask */
299#define UART_IM_FEIM (1 << 7)
300/** Receive time-out interrupt mask */
301#define UART_IM_RTIM (1 << 6)
302/** Transmit interrupt mask */
303#define UART_IM_TXIM (1 << 5)
304/** Receive interrupt mask */
305#define UART_IM_RXIM (1 << 4)
306/** Data Set Ready modem interrupt mask */
307#define UART_IM_DSRIM (1 << 3)
308/** Data Carrier Detect modem interrupt mask */
309#define UART_IM_DCDIM (1 << 2)
310/** Clear To Send modem interrupt mask */
311#define UART_IM_CTSIM (1 << 1)
312/** Ring Indicator modem interrupt mask */
313#define UART_IM_RIIM (1 << 0)
314
315/* =============================================================================
316 * UART_DMACTL values
317 * ---------------------------------------------------------------------------*/
318/** DMA on error */
319#define UART_DMACTL_DMAERR (1 << 2)
320/** Transmit DMA enable */
321#define UART_DMACTL_TXDMAE (1 << 1)
322/** Receive DMA enable */
323#define UART_DMACTL_RXDMAE (1 << 0)
324
325/* =============================================================================
326 * UART_LCTL values
327 * ---------------------------------------------------------------------------*/
328/** Sync break length */
329#define UART_LCTL_BLEN_MASK (3 << 4)
330#define UART_LCTL_BLEN_16T (3 << 4)
331#define UART_LCTL_BLEN_15T (2 << 4)
332#define UART_LCTL_BLEN_14T (1 << 4)
333#define UART_LCTL_BLEN_13T (0 << 4)
334/** LIN master enable */
335#define UART_LCTL_MASTER (1 << 0)
336
337/* =============================================================================
338 * UART_9BITADDR values
339 * ---------------------------------------------------------------------------*/
340/** Enable 9-bit mode */
341#define UART_UART_9BITADDR_9BITEN (1 << 15)
342/** Self-address for 9-bit mode */
343#define UART_UART_9BITADDR_ADDR_MASK (0xFF << 0)
344
345/* =============================================================================
346 * UART_PP values
347 * ---------------------------------------------------------------------------*/
348/** 9-bit support */
349#define UART_UART_PP_NB (1 << 1)
350/** Smart Card support */
351#define UART_UART_PP_SC (1 << 0)
352
353/* =============================================================================
354 * UART_CC values
355 * ---------------------------------------------------------------------------*/
356/** UART baud clock source */
357#define UART_CC_CS_MASK (0xF << 0)
358#define UART_CC_CS_SYSCLK (0x0 << 0)
359#define UART_CC_CS_PIOSC (0x5 << 0)
360
361/* =============================================================================
362 * Convenience enums
363 * ---------------------------------------------------------------------------*/
370};
371
377};
378
379/**
380 * \brief UART interrupt masks
381 *
382 * These masks can be OR'ed together to specify more than one interrupt. For
383 * example, (UART_INT_TXIM | UART_INT_TXIM) specifies both Rx and Tx Interrupt.
384 */
386
402};
403
404/**
405 * \brief UART RX FIFO interrupt trigger levels
406 *
407 * The levels indicate how full the FIFO should be before an interrupt is
408 * generated. UART_FIFO_RX_TRIG_3_4 means that an interrupt is triggered when
409 * the FIFO is 3/4 full. As the FIFO is 8 elements deep, 1/8 is equal to being
410 * triggered by a single character.
411 */
419
420/**
421 * \brief UART TX FIFO interrupt trigger levels
422 *
423 * The levels indicate how empty the FIFO should be before an interrupt is
424 * generated. Note that this indicates the emptiness of the FIFO and not the
425 * fullness. This is somewhat confusing, but it follows the wording of the
426 * LM4F120H5QR datasheet.
427 *
428 * UART_FIFO_TX_TRIG_3_4 means that an interrupt is triggered when the FIFO is
429 * 3/4 empty. As the FIFO is 8 elements deep, 7/8 is equal to being triggered
430 * by a single character.
431 */
439
440/* =============================================================================
441 * Function prototypes
442 * ---------------------------------------------------------------------------*/
444
445void uart_set_baudrate(uint32_t uart, uint32_t baud);
446void uart_set_databits(uint32_t uart, uint8_t databits);
447void uart_set_stopbits(uint32_t uart, uint8_t stopbits);
448void uart_set_parity(uint32_t uart, enum uart_parity parity);
449void uart_set_mode(uint32_t uart, uint32_t mode);
450void uart_set_flow_control(uint32_t uart, enum uart_flowctl flow);
451void uart_enable(uint32_t uart);
452void uart_disable(uint32_t uart);
453void uart_clock_from_piosc(uint32_t uart);
454void uart_clock_from_sysclk(uint32_t uart);
455
456void uart_send(uint32_t uart, uint16_t data);
457uint16_t uart_recv(uint32_t uart);
458void uart_wait_send_ready(uint32_t uart);
459void uart_wait_recv_ready(uint32_t uart);
460void uart_send_blocking(uint32_t uart, uint16_t data);
461uint16_t uart_recv_blocking(uint32_t uart);
462
463void uart_enable_rx_dma(uint32_t uart);
464void uart_disable_rx_dma(uint32_t uart);
465void uart_enable_tx_dma(uint32_t uart);
466void uart_disable_tx_dma(uint32_t uart);
467
468void uart_enable_fifo(uint32_t uart);
469void uart_disable_fifo(uint32_t uart);
470void uart_set_fifo_trigger_levels(uint32_t uart,
471 enum uart_fifo_rx_trigger_level rx_level,
472 enum uart_fifo_tx_trigger_level tx_level);
473
474/* We inline FIFO full/empty checks as they are intended to be called from ISRs
475 * */
476/** @ingroup uart_fifo
477 * @{
478 * \brief Determine if the TX fifo is full
479 *
480 * @param[in] uart UART block register address base @ref uart_reg_base
481 */
482static inline
483bool uart_is_tx_fifo_full(uint32_t uart)
484{
485 return UART_FR(uart) & UART_FR_TXFF;
486}
487
488
489/**
490 * \brief Determine if the TX fifo is empty
491 *
492 * @param[in] uart UART block register address base @ref uart_reg_base
493 */
494static inline
495bool uart_is_tx_fifo_empty(uint32_t uart)
496{
497 return UART_FR(uart) & UART_FR_TXFE;
498}
499
500/**
501 * \brief Determine if the RX fifo is full
502 *
503 * @param[in] uart UART block register address base @ref uart_reg_base
504 */
505static inline
506bool uart_is_rx_fifo_full(uint32_t uart)
507{
508 return UART_FR(uart) & UART_FR_RXFF;
509}
510
511/**
512 * \brief Determine if the RX fifo is empty
513 *
514 * @param[in] uart UART block register address base @ref uart_reg_base
515 */
516static inline
517bool uart_is_rx_fifo_empty(uint32_t uart)
518{
519 return UART_FR(uart) & UART_FR_RXFE;
520}
521/**@}*/
522
523void uart_enable_interrupts(uint32_t uart, enum uart_interrupt_flag ints);
524void uart_disable_interrupts(uint32_t uart, enum uart_interrupt_flag ints);
525void uart_enable_rx_interrupt(uint32_t uart);
526void uart_disable_rx_interrupt(uint32_t uart);
527void uart_enable_tx_interrupt(uint32_t uart);
528void uart_disable_tx_interrupt(uint32_t uart);
529void uart_clear_interrupt_flag(uint32_t uart, enum uart_interrupt_flag ints);
530
531/* Let's keep this one inlined. It's designed to be used in ISRs */
532/** @ingroup uart_irq
533 * @{
534 * \brief Determine if interrupt is generated by the given source
535 *
536 * @param[in] uart UART block register address base @ref uart_reg_base
537 * @param[in] source source to check.
538 */
539static inline
540bool uart_is_interrupt_source(uint32_t uart, enum uart_interrupt_flag source)
541{
542 return UART_MIS(uart) & source;
543}
544/**@}*/
545
547
548/**@}*/
549
550#endif /* LIBOPENCM3_LM4F_UART_H */
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void uart_enable_fifo(uint32_t uart)
Enable FIFO for the UART.
Definition: uart.c:594
void uart_disable(uint32_t uart)
Disable the UART.
Definition: uart.c:103
void uart_disable_rx_dma(uint32_t uart)
Disable the UART Receive DMA.
Definition: uart.c:537
void uart_set_baudrate(uint32_t uart, uint32_t baud)
Set UART baudrate.
Definition: uart.c:114
#define UART_FR_TXFE
Tx FIFO empty.
Definition: uart.h:194
void uart_enable_rx_dma(uint32_t uart)
Enable the UART Receive DMA.
Definition: uart.c:527
void uart_enable_interrupts(uint32_t uart, enum uart_interrupt_flag ints)
Enable Specific UART Interrupts.
Definition: uart.c:430
void uart_send(uint32_t uart, uint16_t data)
UART Send a Data Word.
Definition: uart.c:275
#define UART_IM_TXIM
Transmit interrupt mask.
Definition: uart.h:303
void uart_send_blocking(uint32_t uart, uint16_t data)
UART Send Data Word with Blocking.
Definition: uart.c:330
void uart_disable_tx_interrupt(uint32_t uart)
Disable the UART Transmit Interrupt.
Definition: uart.c:492
#define UART_FR_TXFF
Tx FIFO full.
Definition: uart.h:198
void uart_disable_interrupts(uint32_t uart, enum uart_interrupt_flag ints)
Enable Specific UART Interrupts.
Definition: uart.c:446
#define UART_IM_OEIM
Overrun error interrupt mask.
Definition: uart.h:293
void uart_set_mode(uint32_t uart, uint32_t mode)
void uart_set_fifo_trigger_levels(uint32_t uart, enum uart_fifo_rx_trigger_level rx_level, enum uart_fifo_tx_trigger_level tx_level)
Set the FIFO trigger levels.
Definition: uart.c:616
#define UART_IM_LME5IM
LIN mode edge 5 interrupt mask.
Definition: uart.h:285
#define UART_IM_DCDIM
Data Carrier Detect modem interrupt mask.
Definition: uart.h:309
void uart_wait_recv_ready(uint32_t uart)
UART Wait for Received Data Available.
Definition: uart.c:316
#define UART_IM_BEIM
Break error interrupt mask.
Definition: uart.h:295
#define UART_IM_DSRIM
Data Set Ready modem interrupt mask.
Definition: uart.h:307
#define UART_IFLS_TXIFLSEL_1_2
Definition: uart.h:274
uart_flowctl
Definition: uart.h:372
#define UART_IM_RTIM
Receive time-out interrupt mask.
Definition: uart.h:301
uint16_t uart_recv(uint32_t uart)
UART Read a Received Data Word.
Definition: uart.c:287
uint16_t uart_recv_blocking(uint32_t uart)
UART Read a Received Data Word with Blocking.
Definition: uart.c:344
#define UART_IFLS_RXIFLSEL_3_4
Definition: uart.h:268
void uart_disable_rx_interrupt(uint32_t uart)
Disable the UART Receive Interrupt.
Definition: uart.c:469
#define UART_IFLS_TXIFLSEL_3_4
Definition: uart.h:273
void uart_set_parity(uint32_t uart, enum uart_parity parity)
Set UART parity.
Definition: uart.c:175
#define UART_IFLS_TXIFLSEL_1_8
Definition: uart.h:276
#define UART_IM_PEIM
Parity error interrupt mask.
Definition: uart.h:297
#define UART_FR_RXFF
Rx FIFO full.
Definition: uart.h:196
#define UART_IFLS_RXIFLSEL_1_4
Definition: uart.h:266
#define UART_IFLS_RXIFLSEL_1_2
Definition: uart.h:267
#define UART_IFLS_TXIFLSEL_1_4
Definition: uart.h:275
void uart_enable_tx_dma(uint32_t uart)
Enable the UART Transmit DMA.
Definition: uart.c:547
void uart_clock_from_sysclk(uint32_t uart)
Clock the UART module from the system clock.
Definition: uart.c:248
void uart_disable_tx_dma(uint32_t uart)
Disable the UART Transmit DMA.
Definition: uart.c:557
void uart_wait_send_ready(uint32_t uart)
UART Wait for Transmit Data Buffer Not Full.
Definition: uart.c:303
#define UART_FR_RXFE
Rx FIFO empty.
Definition: uart.h:200
#define UART_IM_FEIM
Framing error interrupt mask.
Definition: uart.h:299
void uart_enable_tx_interrupt(uint32_t uart)
Enable the UART Transmit Interrupt.
Definition: uart.c:482
void uart_clear_interrupt_flag(uint32_t uart, enum uart_interrupt_flag ints)
Mark interrupt as serviced.
Definition: uart.c:508
void uart_clock_from_piosc(uint32_t uart)
Clock the UART module from the internal oscillator.
Definition: uart.c:238
#define UART_IM_RXIM
Receive interrupt mask.
Definition: uart.h:305
uart_fifo_rx_trigger_level
UART RX FIFO interrupt trigger levels.
Definition: uart.h:412
void uart_set_flow_control(uint32_t uart, enum uart_flowctl flow)
Set the flow control scheme.
Definition: uart.c:216
#define UART_IM_LME1IM
LIN mode edge 1 interrupt mask.
Definition: uart.h:287
void uart_enable_rx_interrupt(uint32_t uart)
Enable the UART Receive Interrupt.
Definition: uart.c:459
#define UART_IFLS_RXIFLSEL_7_8
Definition: uart.h:269
#define UART_IM_RIIM
Ring Indicator modem interrupt mask.
Definition: uart.h:313
void uart_enable(uint32_t uart)
Enable the UART.
Definition: uart.c:93
#define UART_IFLS_TXIFLSEL_7_8
Definition: uart.h:272
uart_interrupt_flag
UART interrupt masks.
Definition: uart.h:385
void uart_disable_fifo(uint32_t uart)
Disable FIFO for the UART.
Definition: uart.c:604
#define UART_IFLS_RXIFLSEL_1_8
Definition: uart.h:265
void uart_set_databits(uint32_t uart, uint8_t databits)
Set UART databits.
Definition: uart.c:139
#define UART_IM_9BITIM
9-bit mode interrupt mask
Definition: uart.h:291
#define UART_MIS(uart_base)
Definition: uart.h:98
#define UART_IM_LMSBIM
LIN mode sync break interrupt mask.
Definition: uart.h:289
uart_parity
Definition: uart.h:364
void uart_set_stopbits(uint32_t uart, uint8_t stopbits)
Set UART stopbits.
Definition: uart.c:160
uart_fifo_tx_trigger_level
UART TX FIFO interrupt trigger levels.
Definition: uart.h:432
#define UART_FR(uart_base)
Definition: uart.h:71
#define UART_IM_CTSIM
Clear To Send modem interrupt mask.
Definition: uart.h:311
@ UART_FLOWCTL_NONE
Definition: uart.h:373
@ UART_FLOWCTL_CTS
Definition: uart.h:375
@ UART_FLOWCTL_RTS
Definition: uart.h:374
@ UART_FLOWCTL_RTS_CTS
Definition: uart.h:376
@ UART_FIFO_RX_TRIG_1_2
Definition: uart.h:415
@ UART_FIFO_RX_TRIG_3_4
Definition: uart.h:416
@ UART_FIFO_RX_TRIG_1_4
Definition: uart.h:414
@ UART_FIFO_RX_TRIG_7_8
Definition: uart.h:417
@ UART_FIFO_RX_TRIG_1_8
Definition: uart.h:413
@ UART_INT_BE
Definition: uart.h:392
@ UART_INT_RI
Definition: uart.h:401
@ UART_INT_LMSB
Definition: uart.h:389
@ UART_INT_LME5
Definition: uart.h:387
@ UART_INT_DCD
Definition: uart.h:399
@ UART_INT_TX
Definition: uart.h:396
@ UART_INT_RX
Definition: uart.h:397
@ UART_INT_9BIT
Definition: uart.h:390
@ UART_INT_OE
Definition: uart.h:391
@ UART_INT_DSR
Definition: uart.h:398
@ UART_INT_RT
Definition: uart.h:395
@ UART_INT_LME1
Definition: uart.h:388
@ UART_INT_CTS
Definition: uart.h:400
@ UART_INT_FE
Definition: uart.h:394
@ UART_INT_PE
Definition: uart.h:393
@ UART_PARITY_STICK_0
Definition: uart.h:368
@ UART_PARITY_NONE
Definition: uart.h:365
@ UART_PARITY_EVEN
Definition: uart.h:367
@ UART_PARITY_ODD
Definition: uart.h:366
@ UART_PARITY_STICK_1
Definition: uart.h:369
@ UART_FIFO_TX_TRIG_3_4
Definition: uart.h:434
@ UART_FIFO_TX_TRIG_1_8
Definition: uart.h:437
@ UART_FIFO_TX_TRIG_1_4
Definition: uart.h:436
@ UART_FIFO_TX_TRIG_1_2
Definition: uart.h:435
@ UART_FIFO_TX_TRIG_7_8
Definition: uart.h:433
static bool uart_is_tx_fifo_full(uint32_t uart)
Determine if the TX fifo is full.
Definition: uart.h:483
static bool uart_is_rx_fifo_full(uint32_t uart)
Determine if the RX fifo is full.
Definition: uart.h:506
static bool uart_is_rx_fifo_empty(uint32_t uart)
Determine if the RX fifo is empty.
Definition: uart.h:517
static bool uart_is_tx_fifo_empty(uint32_t uart)
Determine if the TX fifo is empty.
Definition: uart.h:495
static bool uart_is_interrupt_source(uint32_t uart, enum uart_interrupt_flag source)
Determine if interrupt is generated by the given source.
Definition: uart.h:540