libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
usart_common_fifos.c
Go to the documentation of this file.
1/*
2 * This file is part of the libopencm3 project.
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
19
20void usart_enable_fifos(uint32_t usart) {
22}
23
24void usart_disable_fifos(uint32_t usart) {
25 USART_CR1(usart) &= ~USART_CR1_FIFOEN;
26}
27
30}
31
33 USART_CR1(usart) &= ~USART_CR1_TXFEIE;
34}
35
38}
39
41 USART_CR3(usart) &= ~USART_CR3_TXFTIE;
42}
43
44void usart_set_tx_fifo_threshold(uint32_t usart,
45 usart_fifo_threshold_t threshold) {
46 uint32_t cr3 = USART_CR3(usart) &
48 USART_CR3(usart) = cr3 | (threshold << USART_CR3_TXFTCFG_SHIFT);
49}
50
53}
54
56 USART_CR1(usart) &= ~USART_CR1_RXFFIE;
57}
58
61}
62
64 USART_CR3(usart) &= ~USART_CR3_RXFTIE;
65}
66
67void usart_set_rx_fifo_threshold(uint32_t usart,
68 usart_fifo_threshold_t threshold) {
69 uint32_t cr3 = USART_CR3(usart) &
71 USART_CR3(usart) = cr3 | (threshold << USART_CR3_RXFTCFG_SHIFT);
72}
#define USART_CR1_RXFFIE
RX FIFO Full Interrupt Enable.
#define USART_CR1_TXFEIE
TX FIFO Empty Interrupt Enable.
#define USART_CR1_FIFOEN
FIFO Enable bit.
#define USART_CR3_RXFTIE
RX FIFO THreshold Interrupt Enable.
#define USART_CR3_TXFTIE
TX FIFO THreshold Interrupt Enable.
#define USART_CR3_RXFTCFG_SHIFT
RX FIFO Threshold Configuration bits.
#define USART_CR3_TXFTCFG_SHIFT
TX FIFO Threshold Configuration bits.
usart_fifo_threshold_t
FIFO Threshold definitions.
@ USART_FIFO_THRESH_MASK
void usart_disable_tx_fifo_empty_interrupt(uint32_t usart)
Disable TX FIFO empty interrupt on the specified USART.
void usart_enable_rx_fifo_full_interrupt(uint32_t usart)
Enable RX FIFO full interrupt on the specified USART.
void usart_disable_rx_fifo_threshold_interrupt(uint32_t usart)
Disable RX FIFO threshold interrupt on the specified USART.
void usart_set_tx_fifo_threshold(uint32_t usart, usart_fifo_threshold_t threshold)
Configure TX FIFO threshold on specified UART.
void usart_enable_fifos(uint32_t usart)
Enable FIFOs on the specified USART.
void usart_enable_tx_fifo_empty_interrupt(uint32_t usart)
Enable TX FIFO empty interrupt on the specified USART.
void usart_disable_fifos(uint32_t usart)
Disable FIFOs on the specified USART.
void usart_disable_tx_fifo_threshold_interrupt(uint32_t usart)
Disable TX FIFO empty interrupt on the specified USART.
void usart_disable_rx_fifo_full_interrupt(uint32_t usart)
Disable RX FIFO full interrupt on the specified USART.
void usart_set_rx_fifo_threshold(uint32_t usart, usart_fifo_threshold_t threshold)
Configure RX FIFO threshold on specified UART.
void usart_enable_tx_fifo_threshold_interrupt(uint32_t usart)
Enable TX FIFO empty interrupt on the specified USART.
void usart_enable_rx_fifo_threshold_interrupt(uint32_t usart)
Enable RX FIFO threshold interrupt on the specified USART.
#define USART_CR3(usart_base)
Control register 3 (USARTx_CR3)
#define USART_CR1(usart_base)
Control register 1 (USARTx_CR1)