libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
uart.c
Go to the documentation of this file.
1/*
2 * This file is part of the libopencm3 project.
3 *
4 * Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
5 *
6 * This library is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/**
21 * @defgroup uart_file UART
22 *
23 * @ingroup LM4Fxx
24 *
25 * @author @htmlonly &copy; @endhtmlonly 2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
26 *
27 * \brief <b>libopencm3 LM4F Universal Asynchronous Receiver Transmitter</b>
28 *
29 * The LM4F UART API provides functionality for accessing the UART hardware of
30 * the LM4F.
31 *
32 * Please see the individual UART modules for more details. To use the UART, the
33 * uart.h header needs to be included:
34 * @code{.c}
35 * #include <libopencm3/lm4f/uart.h>
36 * @endcode
37 *
38 * @{
39 */
40
43#include <libopencm3/lm4f/rcc.h>
44
45/** @defgroup uart_config UART configuration
46 * @ingroup uart_file
47 *
48 * \brief <b>Enabling and configuring the UART</b>
49 *
50 * Enabling the UART is a two step process. The GPIO on which the UART resides
51 * must be enabled, and the UART pins must be configured as alternate function,
52 * digital pins. Pins must also be muxed to the appropriate alternate function.
53 * This is done with the GPIO API.
54 *
55 * The second step involves enabling and the UART itself. The UART should be
56 * disabled while it is being configured.
57 * -# The UART clock must be enabled with @ref periph_clock_enable().
58 * -# The UART must be disabled with @ref uart_disable().
59 * -# The UART clock source should be chosen before setting the baudrate.
60 * -# Baudrate, data bits, stop bit length, and parity can be configured.
61 * -# If needed, enable CTS or RTS lines via the @ref uart_set_flow_control().
62 * -# The UART can now be enabled with @ref uart_enable().
63 *
64 * For example, to enable UART1 at 115200 8n1 with hardware flow control:
65 * @code{.c}
66 * // Enable the UART clock
67 * periph_clock_enable(RCC_UART1);
68 * // We need a brief delay before we can access UART config registers
69 * __asm__("nop"); __asm__("nop"); __asm__("nop");
70 * // Disable the UART while we mess with its settings
71 * uart_disable(UART1);
72 * // Configure the UART clock source as precision internal oscillator
73 * uart_clock_from_piosc();
74 * // Set communication parameters
75 * uart_set_baudrate(UART1, 115200);
76 * uart_set_databits(UART1, 8);
77 * uart_set_parity(UART1, UART_PARITY_NONE);
78 * uart_set_stopbits(UART1, 1);
79 * // Enable RTC and CTS lines
80 * uart_set_flow_control(UART1, UART_FLOWCTL_HARD_RTS_CTS);
81 * // Now that we're done messing with the settings, enable the UART
82 * uart_enable(UART1);
83 * @endcode
84 */
85/**@{*/
86/**
87 * \brief Enable the UART
88 *
89 * Enable the UART. The Rx and Tx lines are also enabled.
90 *
91 * @param[in] uart UART block register address base @ref uart_reg_base
92 */
93void uart_enable(uint32_t uart)
94{
96}
97
98/**
99 * \brief Disable the UART
100 *
101 * @param[in] uart UART block register address base @ref uart_reg_base
102 */
103void uart_disable(uint32_t uart)
104{
105 UART_CTL(uart) &= ~UART_CTL_UARTEN;
106}
107
108/**
109 * \brief Set UART baudrate
110 *
111 * @param[in] uart UART block register address base @ref uart_reg_base
112 * @param[in] baud Baud rate in bits per second (bps).*
113 */
114void uart_set_baudrate(uint32_t uart, uint32_t baud)
115{
116 uint32_t clock;
117
118 /* Are we running off the internal clock or system clock? */
119 if (UART_CC(uart) == UART_CC_CS_PIOSC) {
120 clock = 16000000;
121 } else {
123 }
124
125 /* Find the baudrate divisor */
126 uint32_t div = (((clock * 8) / baud) + 1) / 2;
127
128 /* Set the baudrate divisors */
129 UART_IBRD(uart) = div / 64;
130 UART_FBRD(uart) = div % 64;
131}
132
133/**
134 * \brief Set UART databits
135 *
136 * @param[in] uart UART block register address base @ref uart_reg_base
137 * @param[in] databits number of data bits per transmission.
138 */
139void uart_set_databits(uint32_t uart, uint8_t databits)
140{
141 uint32_t reg32, bitint32_t;
142
143 /* This has the same effect as using UART_LCRH_WLEN_5/6/7/8 directly */
144 bitint32_t = (databits - 5) << 5;
145
146 /* TODO: What about 9 data bits? */
147
148 reg32 = UART_LCRH(uart);
149 reg32 &= ~UART_LCRH_WLEN_MASK;
150 reg32 |= bitint32_t;
151 UART_LCRH(uart) = reg32;
152}
153
154/**
155 * \brief Set UART stopbits
156 *
157 * @param[in] uart UART block register address base @ref uart_reg_base
158 * @param[in] bits the requested number of stopbits, either 1 or 2.
159 */
160void uart_set_stopbits(uint32_t uart, uint8_t stopbits)
161{
162 if (stopbits == 2) {
163 UART_LCRH(uart) |= UART_LCRH_STP2;
164 } else {
165 UART_LCRH(uart) &= ~UART_LCRH_STP2;
166 }
167}
168
169/**
170 * \brief Set UART parity
171 *
172 * @param[in] uart UART block register address base @ref uart_reg_base
173 * @param[in] bits the requested parity scheme.
174 */
175void uart_set_parity(uint32_t uart, enum uart_parity parity)
176{
177 uint32_t reg32;
178
179 reg32 = UART_LCRH(uart);
180 reg32 |= UART_LCRH_PEN;
181 reg32 &= ~(UART_LCRH_SPS | UART_LCRH_EPS);
182
183 switch (parity) {
184 case UART_PARITY_NONE:
185 /* Once we disable parity the other bits are meaningless */
186 UART_LCRH(uart) &= ~UART_LCRH_PEN;
187 return;
188 case UART_PARITY_ODD:
189 break;
190 case UART_PARITY_EVEN:
191 reg32 |= UART_LCRH_EPS;
192 break;
194 reg32 |= (UART_LCRH_SPS | UART_LCRH_EPS);
195 break;
197 reg32 |= UART_LCRH_SPS;
198 break;
199 }
200
201 UART_LCRH(uart) = reg32;
202}
203
204/**
205 * \brief Set the flow control scheme
206 *
207 * Set the flow control scheme by enabling or disabling RTS and CTS lines. This
208 * will only have effect if the given UART supports the RTS and CTS lines.
209 *
210 * @param[in] uart UART block register address base @ref uart_reg_base
211 * @param[in] flow The flow control scheme to use (none, RTS, CTS or both) \n
212 * UART_FLOWCTL_RTS -- enable the RTS line \n
213 * UART_FLOWCTL_CTS -- enable the CTS line \n
214 * UART_FLOWCTL_RTS_CTS -- enable both RTS and CTS lines
215 */
216void uart_set_flow_control(uint32_t uart, enum uart_flowctl flow)
217{
218 uint32_t reg32 = UART_CTL(uart);
219
220 reg32 &= ~(UART_CTL_RTSEN | UART_CTL_CTSEN);
221
222 if (flow == UART_FLOWCTL_RTS) {
223 reg32 |= UART_CTL_RTSEN;
224 } else if (flow == UART_FLOWCTL_CTS) {
225 reg32 |= UART_CTL_CTSEN;
226 } else if (flow == UART_FLOWCTL_RTS_CTS) {
227 reg32 |= (UART_CTL_RTSEN | UART_CTL_CTSEN);
228 }
229
230 UART_CTL(uart) = reg32;
231}
232
233/**
234 * \brief Clock the UART module from the internal oscillator
235 *
236 * @param[in] uart UART block register address base @ref uart_reg_base
237 */
238void uart_clock_from_piosc(uint32_t uart)
239{
241}
242
243/**
244 * \brief Clock the UART module from the system clock
245 *
246 * @param[in] uart UART block register address base @ref uart_reg_base
247 */
248void uart_clock_from_sysclk(uint32_t uart)
249{
251}
252/**@}*/
253
254/** @defgroup uart_send_recv UART transmission and reception
255 * @ingroup uart_file
256 *
257 * \brief <b>Sending and receiving data through the UART</b>
258 *
259 * Primitives for sending and receiving data are provided, @ref uart_send() and
260 * @ref uart_recv(). These primitives do not check if data can be transmitted
261 * or wait for data. If waiting until data is available or can be transmitted is
262 * desired, blocking primitives are also available, @ref uart_send_blocking()
263 * and @ref uart_recv_blocking().
264 *
265 * These primitives only handle one byte at at time, and thus may be unsuited
266 * for some applications. You may also consider using @ref uart_dma.
267 */
268/**@{*/
269/**
270 * \brief UART Send a Data Word.
271 *
272 * @param[in] uart UART block register address base @ref uart_reg_base
273 * @param[in] data data to send.
274 */
275void uart_send(uint32_t uart, uint16_t data)
276{
277 data &= 0xFF;
278 UART_DR(uart) = data;
279}
280
281/**
282 * \brief UART Read a Received Data Word.
283 *
284 * @param[in] uart UART block register address base @ref uart_reg_base
285 * @return data from the Rx FIFO.
286 */
287uint16_t uart_recv(uint32_t uart)
288{
289 return UART_DR(uart) & UART_DR_DATA_MASK;
290}
291
292/**
293 * \brief UART Wait for Transmit Data Buffer Not Full
294 *
295 * Blocks until the transmit data FIFO is not empty and can accept the next data
296 * word.
297 * \n
298 * Even if the FIFO is not empty, this function will return as long as there is
299 * room for at least one more word.
300 *
301 * @param[in] uart UART block register address base @ref uart_reg_base
302 */
303void uart_wait_send_ready(uint32_t uart)
304{
305 /* Wait until the Tx FIFO is no longer full */
306 while (UART_FR(uart) & UART_FR_TXFF);
307}
308
309/**
310 * \brief UART Wait for Received Data Available
311 *
312 * Blocks until the receive data FIFO holds a at least valid received data word.
313 *
314 * @param[in] uart UART block register address base @ref uart_reg_base
315 */
316void uart_wait_recv_ready(uint32_t uart)
317{
318 /* Wait until the Tx FIFO is no longer empty */
319 while (UART_FR(uart) & UART_FR_RXFE);
320}
321
322/**
323 * \brief UART Send Data Word with Blocking
324 *
325 * Blocks until the transmit data FIFO can accept the next data word for
326 * transmission.
327 *
328 * @param[in] uart UART block register address base @ref uart_reg_base
329 */
330void uart_send_blocking(uint32_t uart, uint16_t data)
331{
333 uart_send(uart, data);
334}
335
336/**
337 * \brief UART Read a Received Data Word with Blocking.
338 *
339 * Wait until a data word has been received then return the word.
340 *
341 * @param[in] uart UART block register address base @ref uart_reg_base
342 * @return data from the Rx FIFO.
343 */
344uint16_t uart_recv_blocking(uint32_t uart)
345{
347 return uart_recv(uart);
348}
349/**@}*/
350
351/** @defgroup uart_irq UART Interrupt control
352 * @ingroup uart_file
353 *
354 * \brief <b>Configuring interrupts from the UART</b>
355 *
356 * To have an event generate an interrupt, its interrupt source must be
357 * unmasked. This can be achieved with @ref uart_enable_interrupts(). Interrupts
358 * which are no longer needed can be disabled through
359 * @ref uart_disable_interrupts().
360 *
361 * In order for the interrupt to generate an IRQ and a call to the interrupt
362 * service routine, the interrupt for the target UART must be routed through the
363 * NVIC with @ref nvic_enable_irq(). For this last step, the nvic.h header is
364 * needed:
365 * @code{.c}
366 * #include <libopencm3/lm4f/nvic.h>
367 * @endcode
368 *
369 * Enabling an interrupt is as simple as unmasking the desired interrupt, and
370 * routing the desired UART's interrupt through the NVIC.
371 * @code{.c}
372 * // Unmask receive interrupt
373 * uart_enable_rx_interrupt(UART0);
374 * // Make sure the interrupt is routed through the NVIC
375 * nvic_enable_irq(NVIC_UART0_IRQ);
376 * @endcode
377 *
378 * If a more than one interrupt is to be enabled at one time, the interrupts
379 * can be enabled by a single call to @ref uart_enable_interrupts().
380 * For example:
381 * @code{.c}
382 * // Unmask receive, CTS, and RI, interrupts
383 * uart_enable_interrupts(UART0, UART_INT_RX | UART_INT_RI | UART_INT_CTS);
384 * @endcode
385 *
386 * After interrupts are properly enabled and routed through the NVIC, when an
387 * event occurs, the appropriate IRQ flag is set by hardware, and execution
388 * jumps to the UART ISR. The ISR should query the IRQ flags to determine which
389 * event caused the interrupt. For this, use @ref uart_is_interrupt_source(),
390 * with the desired UART_INT flag. After one or more interrupt sources are
391 * serviced, the IRQ flags must be cleared by the ISR. This can be done with
392 * @ref uart_clear_interrupt_flag().
393 *
394 * A typical UART ISR may look like the following:
395 * @code{.c}
396 * void uart0_isr(void)
397 * {
398 * uint32_t serviced_irqs = 0;
399 *
400 * // Process individual IRQs
401 * if (uart_is_interrupt_source(UART0, UART_INT_RX)) {
402 * process_rx_event();
403 * serviced_irq |= UART_INT_RX;
404 * }
405 * if (uart_is_interrupt_source(UART0, UART_INT_CTS)) {
406 * process_cts_event();
407 * serviced_irq |= UART_INT_CTS;
408 * }
409 *
410 * // Clear the interrupt flag for the processed IRQs
411 * uart_clear_interrupt_flag(UART0, serviced_irqs);
412 * }
413 * @endcode
414 */
415/**@{*/
416/**
417 * \brief Enable Specific UART Interrupts
418 *
419 * Enable any combination of interrupts. Interrupts may be OR'ed together to
420 * enable them with one call. For example, to enable both the RX and CTS
421 * interrupts, pass (UART_INT_RX | UART_INT_CTS)
422 *
423 * Note that the NVIC must be enabled and properly configured for the interrupt
424 * to be routed to the CPU.
425 *
426 * @param[in] uart UART block register address base @ref uart_reg_base
427 * @param[in] ints Interrupts which to enable. Any combination of interrupts may
428 * be specified by OR'ing then together
429 */
430void uart_enable_interrupts(uint32_t uart, enum uart_interrupt_flag ints)
431{
432 UART_IM(uart) |= ints;
433}
434
435/**
436 * \brief Enable Specific UART Interrupts
437 *
438 * Disabe any combination of interrupts. Interrupts may be OR'ed together to
439 * disable them with one call. For example, to disable both the RX and CTS
440 * interrupts, pass (UART_INT_RX | UART_INT_CTS)
441 *
442 * @param[in] uart UART block register address base @ref uart_reg_base
443 * @param[in] ints Interrupts which to disable. Any combination of interrupts
444 * may be specified by OR'ing then together
445 */
446void uart_disable_interrupts(uint32_t uart, enum uart_interrupt_flag ints)
447{
448 UART_IM(uart) &= ~ints;
449}
450
451/**
452 * \brief Enable the UART Receive Interrupt.
453 *
454 * Note that the NVIC must be enabled and properly configured for the interrupt
455 * to be routed to the CPU.
456 *
457 * @param[in] uart UART block register address base @ref uart_reg_base
458 */
459void uart_enable_rx_interrupt(uint32_t uart)
460{
462}
463
464/**
465 * \brief Disable the UART Receive Interrupt.
466 *
467 * @param[in] uart UART block register address base @ref uart_reg_base
468 */
469void uart_disable_rx_interrupt(uint32_t uart)
470{
472}
473
474/**
475 * \brief Enable the UART Transmit Interrupt.
476 *
477 * Note that the NVIC must be enabled and properly configured for the interrupt
478 * to be routed to the CPU.
479 *
480 * @param[in] uart UART block register address base @ref uart_reg_base
481 */
482void uart_enable_tx_interrupt(uint32_t uart)
483{
485}
486
487/**
488 * \brief Disable the UART Transmit Interrupt.
489 *
490 * @param[in] uart UART block register address base @ref uart_reg_base
491 */
492void uart_disable_tx_interrupt(uint32_t uart)
493{
495}
496
497/**
498 * \brief Mark interrupt as serviced
499 *
500 * After an interrupt is services, its flag must be cleared. If the flag is not
501 * cleared, then execution will jump back to the start of the ISR after the ISR
502 * returns.
503 *
504 * @param[in] uart UART block register address base @ref uart_reg_base
505 * @param[in] ints Interrupts which to clear. Any combination of interrupts may
506 * be specified by OR'ing then together
507 */
508void uart_clear_interrupt_flag(uint32_t uart, enum uart_interrupt_flag ints)
509{
510 UART_ICR(uart) |= ints;
511}
512/**@}*/
513
514/** @defgroup uart_dma UART DMA control
515 * @ingroup uart_file
516 *
517 * \brief <b>Enabling Direct Memory Access transfers for the UART</b>
518 *
519 */
520/**@{*/
521
522/**
523 * \brief Enable the UART Receive DMA.
524 *
525 * @param[in] uart UART block register address base @ref uart_reg_base
526 */
527void uart_enable_rx_dma(uint32_t uart)
528{
530}
531
532/**
533 * \brief Disable the UART Receive DMA.
534 *
535 * @param[in] uart UART block register address base @ref uart_reg_base
536 */
537void uart_disable_rx_dma(uint32_t uart)
538{
539 UART_DMACTL(uart) &= ~UART_DMACTL_RXDMAE;
540}
541
542/**
543 * \brief Enable the UART Transmit DMA.
544 *
545 * @param[in] uart UART block register address base @ref uart_reg_base
546 */
547void uart_enable_tx_dma(uint32_t uart)
548{
550}
551
552/**
553 * \brief Disable the UART Transmit DMA.
554 *
555 * @param[in] uart UART block register address base @ref uart_reg_base
556 */
557void uart_disable_tx_dma(uint32_t uart)
558{
559 UART_DMACTL(uart) &= ~UART_DMACTL_TXDMAE;
560}
561/**@}*/
562
563/** @defgroup uart_fifo UART FIFO control
564 * @ingroup uart_file
565 *
566 * \brief <b>Enabling and controlling UART FIFO</b>
567 *
568 * The UART on the LM4F can either be used with a single character TX and RX
569 * buffer, or with a 8 character TX and RX FIFO. In order to use the FIFO it
570 * must be enabled, this is done with uart_enable_fifo() and can be disabled
571 * again with uart_disable_fifo(). On reset the FIFO is disabled, and it must
572 * be explicitly be enabled.
573 *
574 * When enabling the UART FIFOs, RX and TX interrupts are triggered according
575 * to the amount of data in the FIFOs. For the RX FIFO the trigger level is
576 * defined by how full the FIFO is. The TX FIFO trigger level is defined by
577 * how empty the FIFO is instead.
578 *
579 * For example, to enable the FIFOs and trigger interrupts for a single
580 * received and single transmitted character:
581 * @code{.c}
582 * uart_enable_fifo(UART0);
583 * uart_set_fifo_trigger_levels(UART0, UART_FIFO_RX_TRIG_1_8,
584 * UART_FIFO_TX_TRIG_7_8);
585 * @endcode
586 */
587/**@{*/
588
589/**
590 * \brief Enable FIFO for the UART.
591 *
592 * @param[in] uart UART block register address base @ref uart_reg_base
593 */
594void uart_enable_fifo(uint32_t uart)
595{
596 UART_LCRH(uart) |= UART_LCRH_FEN;
597}
598
599/**
600 * \brief Disable FIFO for the UART.
601 *
602 * @param[in] uart UART block register address base @ref uart_reg_base
603 */
604void uart_disable_fifo(uint32_t uart)
605{
606 UART_LCRH(uart) &= ~UART_LCRH_FEN;
607}
608
609/**
610 * \brief Set the FIFO trigger levels.
611 *
612 * @param[in] uart UART block register address base @ref uart_reg_base
613 * @param[in] rx_level Trigger level for RX FIFO
614 * @param[in] tx_level Trigger level for TX FIFO
615 */
617 enum uart_fifo_rx_trigger_level rx_level,
618 enum uart_fifo_tx_trigger_level tx_level)
619{
620 UART_IFLS(uart) = rx_level | tx_level;
621}
622/**@}*/
623
624
625/**
626 * @}
627 */
uint32_t rcc_get_system_clock_frequency(void)
Get the system clock frequency.
Definition: rcc.c:383
void uart_disable(uint32_t uart)
Disable the UART.
Definition: uart.c:103
void uart_set_baudrate(uint32_t uart, uint32_t baud)
Set UART baudrate.
Definition: uart.c:114
void uart_set_parity(uint32_t uart, enum uart_parity parity)
Set UART parity.
Definition: uart.c:175
void uart_clock_from_sysclk(uint32_t uart)
Clock the UART module from the system clock.
Definition: uart.c:248
void uart_clock_from_piosc(uint32_t uart)
Clock the UART module from the internal oscillator.
Definition: uart.c:238
void uart_set_flow_control(uint32_t uart, enum uart_flowctl flow)
Set the flow control scheme.
Definition: uart.c:216
void uart_enable(uint32_t uart)
Enable the UART.
Definition: uart.c:93
void uart_set_databits(uint32_t uart, uint8_t databits)
Set UART databits.
Definition: uart.c:139
void uart_set_stopbits(uint32_t uart, uint8_t stopbits)
Set UART stopbits.
Definition: uart.c:160
#define UART_DR(uart_base)
Definition: uart.h:64
#define UART_DMACTL_TXDMAE
Transmit DMA enable.
Definition: uart.h:321
#define UART_CTL_CTSEN
Enable Clear To Send.
Definition: uart.h:232
#define UART_DMACTL(uart_base)
Definition: uart.h:104
#define UART_FR_TXFF
Tx FIFO full.
Definition: uart.h:198
#define UART_ICR(uart_base)
Definition: uart.h:101
#define UART_LCRH_STP2
Two stop bits select.
Definition: uart.h:220
#define UART_CTL_UARTEN
UART enable.
Definition: uart.h:258
#define UART_LCRH_SPS
Stick parity select.
Definition: uart.h:210
#define UART_CTL(uart_base)
Definition: uart.h:86
#define UART_CTL_RXE
Rx Enable.
Definition: uart.h:240
uart_flowctl
Definition: uart.h:372
#define UART_IBRD(uart_base)
Definition: uart.h:77
#define UART_CC(uart_base)
Definition: uart.h:125
#define UART_DR_DATA_MASK
Data transmitted or received.
Definition: uart.h:176
#define UART_CTL_RTSEN
Enable Request To Send.
Definition: uart.h:234
#define UART_FR_RXFE
Rx FIFO empty.
Definition: uart.h:200
#define UART_CC_CS_PIOSC
Definition: uart.h:359
#define UART_IFLS(uart_base)
Definition: uart.h:89
uart_fifo_rx_trigger_level
UART RX FIFO interrupt trigger levels.
Definition: uart.h:412
#define UART_FBRD(uart_base)
Definition: uart.h:80
#define UART_LCRH_FEN
Enable FIFOs.
Definition: uart.h:218
#define UART_CTL_TXE
Tx Enable.
Definition: uart.h:242
#define UART_DMACTL_RXDMAE
Receive DMA enable.
Definition: uart.h:323
uart_interrupt_flag
UART interrupt masks.
Definition: uart.h:385
uart_parity
Definition: uart.h:364
#define UART_LCRH_PEN
Parity enable.
Definition: uart.h:224
#define UART_IM(uart_base)
Definition: uart.h:92
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_LCRH(uart_base)
Definition: uart.h:83
#define UART_CC_CS_SYSCLK
Definition: uart.h:358
#define UART_LCRH_EPS
Even parity select.
Definition: uart.h:222
@ UART_FLOWCTL_CTS
Definition: uart.h:375
@ UART_FLOWCTL_RTS
Definition: uart.h:374
@ UART_FLOWCTL_RTS_CTS
Definition: uart.h:376
@ UART_INT_TX
Definition: uart.h:396
@ UART_INT_RX
Definition: uart.h:397
@ 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
void uart_disable_rx_dma(uint32_t uart)
Disable the UART Receive DMA.
Definition: uart.c:537
void uart_enable_rx_dma(uint32_t uart)
Enable the UART Receive DMA.
Definition: uart.c:527
void uart_enable_tx_dma(uint32_t uart)
Enable the UART Transmit DMA.
Definition: uart.c:547
void uart_disable_tx_dma(uint32_t uart)
Disable the UART Transmit DMA.
Definition: uart.c:557
void uart_enable_fifo(uint32_t uart)
Enable FIFO for the UART.
Definition: uart.c:594
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
void uart_disable_fifo(uint32_t uart)
Disable FIFO for the UART.
Definition: uart.c:604
void uart_enable_interrupts(uint32_t uart, enum uart_interrupt_flag ints)
Enable Specific UART Interrupts.
Definition: uart.c:430
void uart_disable_tx_interrupt(uint32_t uart)
Disable the UART Transmit Interrupt.
Definition: uart.c:492
void uart_disable_interrupts(uint32_t uart, enum uart_interrupt_flag ints)
Enable Specific UART Interrupts.
Definition: uart.c:446
void uart_disable_rx_interrupt(uint32_t uart)
Disable the UART Receive Interrupt.
Definition: uart.c:469
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_enable_rx_interrupt(uint32_t uart)
Enable the UART Receive Interrupt.
Definition: uart.c:459
void uart_send(uint32_t uart, uint16_t data)
UART Send a Data Word.
Definition: uart.c:275
void uart_send_blocking(uint32_t uart, uint16_t data)
UART Send Data Word with Blocking.
Definition: uart.c:330
void uart_wait_recv_ready(uint32_t uart)
UART Wait for Received Data Available.
Definition: uart.c:316
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
void uart_wait_send_ready(uint32_t uart)
UART Wait for Transmit Data Buffer Not Full.
Definition: uart.c:303