libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
usart.h File Reference
Include dependency graph for usart.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define USART0   USART0_BASE
 
#define USART1   USART1_BASE
 
#define USART2   USART2_BASE
 
#define USART3   USART3_BASE
 
#define USART_CR(x)   MMIO32((x) + 0x0000)
 
#define USART_MR(x)   MMIO32((x) + 0x0004)
 
#define USART_IER(x)   MMIO32((x) + 0x0008)
 
#define USART_IDR(x)   MMIO32((x) + 0x000C)
 
#define USART_IMR(x)   MMIO32((x) + 0x0010)
 
#define USART_CSR(x)   MMIO32((x) + 0x0014)
 
#define USART_RHR(x)   MMIO32((x) + 0x0018)
 
#define USART_THR(x)   MMIO32((x) + 0x001C)
 
#define USART_BRGR(x)   MMIO32((x) + 0x0020)
 
#define USART_RTOR(x)   MMIO32((x) + 0x0024)
 
#define USART_TTGR(x)   MMIO32((x) + 0x0028)
 
#define USART_FIDI(x)   MMIO32((x) + 0x0040)
 
#define USART_NER(x)   MMIO32((x) + 0x0044)
 
#define USART_IF(x)   MMIO32((x) + 0x004C)
 
#define USART_MAN(x)   MMIO32((x) + 0x0050)
 
#define USART_LINMR(x)   MMIO32((x) + 0x0054)
 
#define USART_LINIR(x)   MMIO32((x) + 0x0058)
 
#define USART_WPMR(x)   MMIO32((x) + 0x00E4)
 
#define USART_WPSR(x)   MMIO32((x) + 0x00E8)
 
#define USART_VERSION(x)   MMIO32((x) + 0x00FC)
 
#define USART_CR_LINWKUP   (0x01 << 21)
 
#define USART_CR_LINABT   (0x01 << 20)
 
#define USART_CR_RTSDIS   (0x01 << 19)
 
#define USART_CR_RCS   (0x01 << 19)
 
#define USART_CR_RTSEN   (0x01 << 18)
 
#define USART_CR_FCS   (0x01 << 18)
 
#define USART_CR_RETTO   (0x01 << 15)
 
#define USART_CR_RSTNACK   (0x01 << 14)
 
#define USART_CR_RSTIT   (0x01 << 13)
 
#define USART_CR_SENDA   (0x01 << 12)
 
#define USART_CR_STTTO   (0x01 << 11)
 
#define USART_CR_STPBRK   (0x01 << 10)
 
#define USART_CR_STTBRK   (0x01 << 9)
 
#define USART_CR_RSTSTA   (0x01 << 8)
 
#define USART_CR_TXDIS   (0x01 << 7)
 
#define USART_CR_TXEN   (0x01 << 6)
 
#define USART_CR_RXDIS   (0x01 << 5)
 
#define USART_CR_RXEN   (0x01 << 4)
 
#define USART_CR_RSTTX   (0x01 << 3)
 
#define USART_CR_RSTRX   (0x01 << 2)
 
#define USART_MR_ONEBIT   (0x01 << 31)
 
#define USART_MR_MODSYNC   (0x01 << 30)
 
#define USART_MR_MAN   (0x01 << 29)
 
#define USART_MR_FILTER   (0x01 << 28)
 
#define USART_MR_MAX_ITERATION_MASK   (0x07 << 24)
 
#define USART_MR_INVDATA   (0x01 << 23)
 
#define USART_MR_VAR_SYNC   (0x01 << 22)
 
#define USART_MR_DSNACK   (0x01 << 21)
 
#define USART_MR_INACK   (0x01 << 20)
 
#define USART_MR_OVER   (0x01 << 19)
 
#define USART_MR_CLKO   (0x01 << 18)
 
#define USART_MR_MODE9   (0x01 << 17)
 
#define USART_MR_MSBF   (0x01 << 16)
 
#define USART_MR_CPOL   (0x01 << 16)
 
#define USART_MR_CHMODE_MASK   (0x03 << 14)
 
#define USART_MR_CHMODE_NORMAL   (0x00 << 14)
 
#define USART_MR_CHMODE_AUTOMATIC   (0x01 << 14)
 
#define USART_MR_CHMODE_LOCAL_LOOPBACK   (0x02 << 14)
 
#define USART_MR_CHMODE_REMOTE_LOOPBACK   (0x03 << 14)
 
#define USART_MR_NBSTOP_MASK   (0x03 << 12)
 
#define USART_MR_NBSTOP_1_BIT   (0x00 << 12)
 
#define USART_MR_NBSTOP_1_5_BIT   (0x01 << 12)
 
#define USART_MR_NBSTOP_2_BIT   (0x02 << 12)
 
#define USART_MR_PAR_MASK   (0x07 << 9)
 
#define USART_MR_PAR_EVEN   (0x00 << 9)
 
#define USART_MR_PAR_ODD   (0x01 << 9)
 
#define USART_MR_PAR_SPACE   (0x02 << 9)
 
#define USART_MR_PAR_MARK   (0x03 << 9)
 
#define USART_MR_PAR_NO   (0x04 << 9)
 
#define USART_MR_SYNC   (0x01 << 8)
 
#define USART_MR_CPHA   (0x01 << 8)
 
#define USART_MR_CHRL_SHIFT   (6)
 
#define USART_MR_CHRL_MASK   (0x03 << USART_MR_CHRL_SHIFT)
 
#define USART_MR_CHRL_5BIT   (0x00 << USART_MR_CHRL_SHIFT)
 
#define USART_MR_CHRL_6BIT   (0x01 << USART_MR_CHRL_SHIFT)
 
#define USART_MR_CHRL_7BIT   (0x02 << USART_MR_CHRL_SHIFT)
 
#define USART_MR_CHRL_8BIT   (0x03 << USART_MR_CHRL_SHIFT)
 
#define USART_MR_USCLKS_SHIFT   (4)
 
#define USART_MR_USCLKS_MASK   (0x03 << USART_MR_USCLKS_SHIFT)
 
#define USART_MR_USCLKS_MCK   (0x00 << 4)
 
#define USART_MR_USCLKS_DIV   (0x01 << 4)
 
#define USART_MR_USCLKS_SCK   (0x03 << 4)
 
#define USART_MR_MODE_MASK   (0x0F << 0)
 
#define USART_MR_MODE_NORMAL   (0x00 << 0)
 
#define USART_MR_MODE_RS485   (0x01 << 0)
 
#define USART_MR_MODE_HW_HANDSHAKING   (0x02 << 0)
 
#define USART_MR_MODE_ISO7816_T_0   (0x03 << 0)
 
#define USART_MR_MODE_ISO7816_T_1   (0x04 << 0)
 
#define USART_MR_MODE_IRDA   (0x06 << 0)
 
#define USART_MR_MODE_LIN_MASTER   (0x0A << 0)
 
#define USART_MR_MODE_LIN_SLAVE   (0x0B << 0)
 
#define USART_MR_MODE_SPI_MASTER   (0x0E << 0)
 
#define USART_MR_MODE_SPI_SLAVE   (0x0F << 0)
 
#define USART_CSR_LINSNRE   (0x01 << 29)
 
#define USART_CSR_LINCE   (0x01 << 28)
 
#define USART_CSR_LINIPE   (0x01 << 27)
 
#define USART_CSR_LINSFE   (0x01 << 26)
 
#define USART_CSR_LINBE   (0x01 << 25)
 
#define USART_CSR_MANERR   (0x01 << 24)
 
#define USART_CSR_CTS   (0x01 << 23)
 
#define USART_CSR_LINBLS   (0x01 << 23)
 
#define USART_CSR_CTSIC   (0x01 << 19)
 
#define USART_CSR_LINTC   (0x01 << 15)
 
#define USART_CSR_LINID   (0x01 << 14)
 
#define USART_CSR_NACK   (0x01 << 13)
 
#define USART_CSR_LINBK   (0x01 << 13)
 
#define USART_CSR_RXBUFF   (0x01 << 12)
 
#define USART_CSR_TXBUFE   (0x01 << 11)
 
#define USART_CSR_TXEMPTY   (0x01 << 9)
 
#define USART_CSR_PARE   (0x01 << 7)
 
#define USART_CSR_FRAME   (0x01 << 6)
 
#define USART_CSR_OVRE   (0x01 << 5)
 
#define USART_CSR_ENDTX   (0x01 << 4)
 
#define USART_CSR_ENDRX   (0x01 << 3)
 
#define USART_CSR_TXRDY   (0x01 << 1)
 
#define USART_CSR_RXRDY   (0x01 << 0)
 
#define USART_WPMR_KEY   (0x555341 << 8)
 
#define USART_WPMR_WPEN   (0x01 << 0)
 

Enumerations

enum  usart_stopbits { USART_STOPBITS_1 , USART_STOPBITS_1_5 , USART_STOPBITS_2 }
 
enum  usart_parity {
  USART_PARITY_EVEN , USART_PARITY_ODD , USART_PARITY_SPACE , USART_PARITY_MARK ,
  USART_PARITY_NONE , USART_PARITY_MULTIDROP
}
 
enum  usart_mode { USART_MODE_DISABLED , USART_MODE_RX , USART_MODE_TX , USART_MODE_TX_RX }
 
enum  usart_flowcontrol { USART_FLOWCONTROL_NONE , USART_FLOWCONTROL_RTS_CTS }
 
enum  usart_clock { USART_CLOCK_CLK_USART , USART_CLOCK_CLK_USART_DIV , USART_CLOCK_CLK = 3 }
 
enum  usart_chrl { USART_CHRL_5BIT , USART_CHRL_6BIT , USART_CHRL_7BIT , USART_CHRL_8BIT }
 

Functions

void usart_set_baudrate (uint32_t usart, uint32_t baud)
 
void usart_set_databits (uint32_t usart, int bits)
 
void usart_set_stopbits (uint32_t usart, enum usart_stopbits)
 
void usart_set_parity (uint32_t usart, enum usart_parity)
 
void usart_set_mode (uint32_t usart, enum usart_mode)
 
void usart_set_character_length (uint32_t usart, enum usart_chrl chrl)
 
void usart_set_flow_control (uint32_t usart, enum usart_flowcontrol)
 
void usart_enable (uint32_t usart)
 
void usart_disable (uint32_t usart)
 
void usart_send (uint32_t usart, uint16_t data)
 
uint16_t usart_recv (uint32_t usart)
 
void usart_wait_send_ready (uint32_t usart)
 
void usart_wait_recv_ready (uint32_t usart)
 
void usart_send_blocking (uint32_t usart, uint16_t data)
 
uint16_t usart_recv_blocking (uint32_t usart)
 
void usart_enable_rx_interrupt (uint32_t usart)
 
void usart_disable_rx_interrupt (uint32_t usart)
 
void usart_wp_disable (uint32_t usart)
 
void usart_wp_enable (uint32_t usart)
 
void usart_select_clock (uint32_t usart, enum usart_clock clk)
 

Macro Definition Documentation

◆ USART0

#define USART0   USART0_BASE

Definition at line 26 of file usart.h.

◆ USART1

#define USART1   USART1_BASE

Definition at line 27 of file usart.h.

◆ USART2

#define USART2   USART2_BASE

Definition at line 28 of file usart.h.

◆ USART3

#define USART3   USART3_BASE

Definition at line 29 of file usart.h.

◆ USART_BRGR

#define USART_BRGR (   x)    MMIO32((x) + 0x0020)

Definition at line 40 of file usart.h.

◆ USART_CR

#define USART_CR (   x)    MMIO32((x) + 0x0000)

Definition at line 32 of file usart.h.

◆ USART_CR_FCS

#define USART_CR_FCS   (0x01 << 18)

Definition at line 66 of file usart.h.

◆ USART_CR_LINABT

#define USART_CR_LINABT   (0x01 << 20)

Definition at line 62 of file usart.h.

◆ USART_CR_LINWKUP

#define USART_CR_LINWKUP   (0x01 << 21)

Definition at line 61 of file usart.h.

◆ USART_CR_RCS

#define USART_CR_RCS   (0x01 << 19)

Definition at line 64 of file usart.h.

◆ USART_CR_RETTO

#define USART_CR_RETTO   (0x01 << 15)

Definition at line 68 of file usart.h.

◆ USART_CR_RSTIT

#define USART_CR_RSTIT   (0x01 << 13)

Definition at line 70 of file usart.h.

◆ USART_CR_RSTNACK

#define USART_CR_RSTNACK   (0x01 << 14)

Definition at line 69 of file usart.h.

◆ USART_CR_RSTRX

#define USART_CR_RSTRX   (0x01 << 2)

Definition at line 81 of file usart.h.

◆ USART_CR_RSTSTA

#define USART_CR_RSTSTA   (0x01 << 8)

Definition at line 75 of file usart.h.

◆ USART_CR_RSTTX

#define USART_CR_RSTTX   (0x01 << 3)

Definition at line 80 of file usart.h.

◆ USART_CR_RTSDIS

#define USART_CR_RTSDIS   (0x01 << 19)

Definition at line 63 of file usart.h.

◆ USART_CR_RTSEN

#define USART_CR_RTSEN   (0x01 << 18)

Definition at line 65 of file usart.h.

◆ USART_CR_RXDIS

#define USART_CR_RXDIS   (0x01 << 5)

Definition at line 78 of file usart.h.

◆ USART_CR_RXEN

#define USART_CR_RXEN   (0x01 << 4)

Definition at line 79 of file usart.h.

◆ USART_CR_SENDA

#define USART_CR_SENDA   (0x01 << 12)

Definition at line 71 of file usart.h.

◆ USART_CR_STPBRK

#define USART_CR_STPBRK   (0x01 << 10)

Definition at line 73 of file usart.h.

◆ USART_CR_STTBRK

#define USART_CR_STTBRK   (0x01 << 9)

Definition at line 74 of file usart.h.

◆ USART_CR_STTTO

#define USART_CR_STTTO   (0x01 << 11)

Definition at line 72 of file usart.h.

◆ USART_CR_TXDIS

#define USART_CR_TXDIS   (0x01 << 7)

Definition at line 76 of file usart.h.

◆ USART_CR_TXEN

#define USART_CR_TXEN   (0x01 << 6)

Definition at line 77 of file usart.h.

◆ USART_CSR

#define USART_CSR (   x)    MMIO32((x) + 0x0014)

Definition at line 37 of file usart.h.

◆ USART_CSR_CTS

#define USART_CSR_CTS   (0x01 << 23)

Definition at line 150 of file usart.h.

◆ USART_CSR_CTSIC

#define USART_CSR_CTSIC   (0x01 << 19)

Definition at line 153 of file usart.h.

◆ USART_CSR_ENDRX

#define USART_CSR_ENDRX   (0x01 << 3)

Definition at line 168 of file usart.h.

◆ USART_CSR_ENDTX

#define USART_CSR_ENDTX   (0x01 << 4)

Definition at line 167 of file usart.h.

◆ USART_CSR_FRAME

#define USART_CSR_FRAME   (0x01 << 6)

Definition at line 165 of file usart.h.

◆ USART_CSR_LINBE

#define USART_CSR_LINBE   (0x01 << 25)

Definition at line 148 of file usart.h.

◆ USART_CSR_LINBK

#define USART_CSR_LINBK   (0x01 << 13)

Definition at line 158 of file usart.h.

◆ USART_CSR_LINBLS

#define USART_CSR_LINBLS   (0x01 << 23)

Definition at line 151 of file usart.h.

◆ USART_CSR_LINCE

#define USART_CSR_LINCE   (0x01 << 28)

Definition at line 145 of file usart.h.

◆ USART_CSR_LINID

#define USART_CSR_LINID   (0x01 << 14)

Definition at line 156 of file usart.h.

◆ USART_CSR_LINIPE

#define USART_CSR_LINIPE   (0x01 << 27)

Definition at line 146 of file usart.h.

◆ USART_CSR_LINSFE

#define USART_CSR_LINSFE   (0x01 << 26)

Definition at line 147 of file usart.h.

◆ USART_CSR_LINSNRE

#define USART_CSR_LINSNRE   (0x01 << 29)

Definition at line 144 of file usart.h.

◆ USART_CSR_LINTC

#define USART_CSR_LINTC   (0x01 << 15)

Definition at line 155 of file usart.h.

◆ USART_CSR_MANERR

#define USART_CSR_MANERR   (0x01 << 24)

Definition at line 149 of file usart.h.

◆ USART_CSR_NACK

#define USART_CSR_NACK   (0x01 << 13)

Definition at line 157 of file usart.h.

◆ USART_CSR_OVRE

#define USART_CSR_OVRE   (0x01 << 5)

Definition at line 166 of file usart.h.

◆ USART_CSR_PARE

#define USART_CSR_PARE   (0x01 << 7)

Definition at line 164 of file usart.h.

◆ USART_CSR_RXBUFF

#define USART_CSR_RXBUFF   (0x01 << 12)

Definition at line 159 of file usart.h.

◆ USART_CSR_RXRDY

#define USART_CSR_RXRDY   (0x01 << 0)

Definition at line 171 of file usart.h.

◆ USART_CSR_TXBUFE

#define USART_CSR_TXBUFE   (0x01 << 11)

Definition at line 160 of file usart.h.

◆ USART_CSR_TXEMPTY

#define USART_CSR_TXEMPTY   (0x01 << 9)

Definition at line 162 of file usart.h.

◆ USART_CSR_TXRDY

#define USART_CSR_TXRDY   (0x01 << 1)

Definition at line 170 of file usart.h.

◆ USART_FIDI

#define USART_FIDI (   x)    MMIO32((x) + 0x0040)

Definition at line 44 of file usart.h.

◆ USART_IDR

#define USART_IDR (   x)    MMIO32((x) + 0x000C)

Definition at line 35 of file usart.h.

◆ USART_IER

#define USART_IER (   x)    MMIO32((x) + 0x0008)

Definition at line 34 of file usart.h.

◆ USART_IF

#define USART_IF (   x)    MMIO32((x) + 0x004C)

Definition at line 47 of file usart.h.

◆ USART_IMR

#define USART_IMR (   x)    MMIO32((x) + 0x0010)

Definition at line 36 of file usart.h.

◆ USART_LINIR

#define USART_LINIR (   x)    MMIO32((x) + 0x0058)

Definition at line 50 of file usart.h.

◆ USART_LINMR

#define USART_LINMR (   x)    MMIO32((x) + 0x0054)

Definition at line 49 of file usart.h.

◆ USART_MAN

#define USART_MAN (   x)    MMIO32((x) + 0x0050)

Definition at line 48 of file usart.h.

◆ USART_MR

#define USART_MR (   x)    MMIO32((x) + 0x0004)

Definition at line 33 of file usart.h.

◆ USART_MR_CHMODE_AUTOMATIC

#define USART_MR_CHMODE_AUTOMATIC   (0x01 << 14)

Definition at line 102 of file usart.h.

◆ USART_MR_CHMODE_LOCAL_LOOPBACK

#define USART_MR_CHMODE_LOCAL_LOOPBACK   (0x02 << 14)

Definition at line 103 of file usart.h.

◆ USART_MR_CHMODE_MASK

#define USART_MR_CHMODE_MASK   (0x03 << 14)

Definition at line 100 of file usart.h.

◆ USART_MR_CHMODE_NORMAL

#define USART_MR_CHMODE_NORMAL   (0x00 << 14)

Definition at line 101 of file usart.h.

◆ USART_MR_CHMODE_REMOTE_LOOPBACK

#define USART_MR_CHMODE_REMOTE_LOOPBACK   (0x03 << 14)

Definition at line 104 of file usart.h.

◆ USART_MR_CHRL_5BIT

#define USART_MR_CHRL_5BIT   (0x00 << USART_MR_CHRL_SHIFT)

Definition at line 121 of file usart.h.

◆ USART_MR_CHRL_6BIT

#define USART_MR_CHRL_6BIT   (0x01 << USART_MR_CHRL_SHIFT)

Definition at line 122 of file usart.h.

◆ USART_MR_CHRL_7BIT

#define USART_MR_CHRL_7BIT   (0x02 << USART_MR_CHRL_SHIFT)

Definition at line 123 of file usart.h.

◆ USART_MR_CHRL_8BIT

#define USART_MR_CHRL_8BIT   (0x03 << USART_MR_CHRL_SHIFT)

Definition at line 124 of file usart.h.

◆ USART_MR_CHRL_MASK

#define USART_MR_CHRL_MASK   (0x03 << USART_MR_CHRL_SHIFT)

Definition at line 120 of file usart.h.

◆ USART_MR_CHRL_SHIFT

#define USART_MR_CHRL_SHIFT   (6)

Definition at line 119 of file usart.h.

◆ USART_MR_CLKO

#define USART_MR_CLKO   (0x01 << 18)

Definition at line 96 of file usart.h.

◆ USART_MR_CPHA

#define USART_MR_CPHA   (0x01 << 8)

Definition at line 118 of file usart.h.

◆ USART_MR_CPOL

#define USART_MR_CPOL   (0x01 << 16)

Definition at line 99 of file usart.h.

◆ USART_MR_DSNACK

#define USART_MR_DSNACK   (0x01 << 21)

Definition at line 93 of file usart.h.

◆ USART_MR_FILTER

#define USART_MR_FILTER   (0x01 << 28)

Definition at line 88 of file usart.h.

◆ USART_MR_INACK

#define USART_MR_INACK   (0x01 << 20)

Definition at line 94 of file usart.h.

◆ USART_MR_INVDATA

#define USART_MR_INVDATA   (0x01 << 23)

Definition at line 91 of file usart.h.

◆ USART_MR_MAN

#define USART_MR_MAN   (0x01 << 29)

Definition at line 87 of file usart.h.

◆ USART_MR_MAX_ITERATION_MASK

#define USART_MR_MAX_ITERATION_MASK   (0x07 << 24)

Definition at line 90 of file usart.h.

◆ USART_MR_MODE9

#define USART_MR_MODE9   (0x01 << 17)

Definition at line 97 of file usart.h.

◆ USART_MR_MODE_HW_HANDSHAKING

#define USART_MR_MODE_HW_HANDSHAKING   (0x02 << 0)

Definition at line 133 of file usart.h.

◆ USART_MR_MODE_IRDA

#define USART_MR_MODE_IRDA   (0x06 << 0)

Definition at line 136 of file usart.h.

◆ USART_MR_MODE_ISO7816_T_0

#define USART_MR_MODE_ISO7816_T_0   (0x03 << 0)

Definition at line 134 of file usart.h.

◆ USART_MR_MODE_ISO7816_T_1

#define USART_MR_MODE_ISO7816_T_1   (0x04 << 0)

Definition at line 135 of file usart.h.

◆ USART_MR_MODE_LIN_MASTER

#define USART_MR_MODE_LIN_MASTER   (0x0A << 0)

Definition at line 137 of file usart.h.

◆ USART_MR_MODE_LIN_SLAVE

#define USART_MR_MODE_LIN_SLAVE   (0x0B << 0)

Definition at line 138 of file usart.h.

◆ USART_MR_MODE_MASK

#define USART_MR_MODE_MASK   (0x0F << 0)

Definition at line 130 of file usart.h.

◆ USART_MR_MODE_NORMAL

#define USART_MR_MODE_NORMAL   (0x00 << 0)

Definition at line 131 of file usart.h.

◆ USART_MR_MODE_RS485

#define USART_MR_MODE_RS485   (0x01 << 0)

Definition at line 132 of file usart.h.

◆ USART_MR_MODE_SPI_MASTER

#define USART_MR_MODE_SPI_MASTER   (0x0E << 0)

Definition at line 139 of file usart.h.

◆ USART_MR_MODE_SPI_SLAVE

#define USART_MR_MODE_SPI_SLAVE   (0x0F << 0)

Definition at line 140 of file usart.h.

◆ USART_MR_MODSYNC

#define USART_MR_MODSYNC   (0x01 << 30)

Definition at line 86 of file usart.h.

◆ USART_MR_MSBF

#define USART_MR_MSBF   (0x01 << 16)

Definition at line 98 of file usart.h.

◆ USART_MR_NBSTOP_1_5_BIT

#define USART_MR_NBSTOP_1_5_BIT   (0x01 << 12)

Definition at line 107 of file usart.h.

◆ USART_MR_NBSTOP_1_BIT

#define USART_MR_NBSTOP_1_BIT   (0x00 << 12)

Definition at line 106 of file usart.h.

◆ USART_MR_NBSTOP_2_BIT

#define USART_MR_NBSTOP_2_BIT   (0x02 << 12)

Definition at line 108 of file usart.h.

◆ USART_MR_NBSTOP_MASK

#define USART_MR_NBSTOP_MASK   (0x03 << 12)

Definition at line 105 of file usart.h.

◆ USART_MR_ONEBIT

#define USART_MR_ONEBIT   (0x01 << 31)

Definition at line 85 of file usart.h.

◆ USART_MR_OVER

#define USART_MR_OVER   (0x01 << 19)

Definition at line 95 of file usart.h.

◆ USART_MR_PAR_EVEN

#define USART_MR_PAR_EVEN   (0x00 << 9)

Definition at line 111 of file usart.h.

◆ USART_MR_PAR_MARK

#define USART_MR_PAR_MARK   (0x03 << 9)

Definition at line 114 of file usart.h.

◆ USART_MR_PAR_MASK

#define USART_MR_PAR_MASK   (0x07 << 9)

Definition at line 110 of file usart.h.

◆ USART_MR_PAR_NO

#define USART_MR_PAR_NO   (0x04 << 9)

Definition at line 115 of file usart.h.

◆ USART_MR_PAR_ODD

#define USART_MR_PAR_ODD   (0x01 << 9)

Definition at line 112 of file usart.h.

◆ USART_MR_PAR_SPACE

#define USART_MR_PAR_SPACE   (0x02 << 9)

Definition at line 113 of file usart.h.

◆ USART_MR_SYNC

#define USART_MR_SYNC   (0x01 << 8)

Definition at line 117 of file usart.h.

◆ USART_MR_USCLKS_DIV

#define USART_MR_USCLKS_DIV   (0x01 << 4)

Definition at line 128 of file usart.h.

◆ USART_MR_USCLKS_MASK

#define USART_MR_USCLKS_MASK   (0x03 << USART_MR_USCLKS_SHIFT)

Definition at line 126 of file usart.h.

◆ USART_MR_USCLKS_MCK

#define USART_MR_USCLKS_MCK   (0x00 << 4)

Definition at line 127 of file usart.h.

◆ USART_MR_USCLKS_SCK

#define USART_MR_USCLKS_SCK   (0x03 << 4)

Definition at line 129 of file usart.h.

◆ USART_MR_USCLKS_SHIFT

#define USART_MR_USCLKS_SHIFT   (4)

Definition at line 125 of file usart.h.

◆ USART_MR_VAR_SYNC

#define USART_MR_VAR_SYNC   (0x01 << 22)

Definition at line 92 of file usart.h.

◆ USART_NER

#define USART_NER (   x)    MMIO32((x) + 0x0044)

Definition at line 45 of file usart.h.

◆ USART_RHR

#define USART_RHR (   x)    MMIO32((x) + 0x0018)

Definition at line 38 of file usart.h.

◆ USART_RTOR

#define USART_RTOR (   x)    MMIO32((x) + 0x0024)

Definition at line 41 of file usart.h.

◆ USART_THR

#define USART_THR (   x)    MMIO32((x) + 0x001C)

Definition at line 39 of file usart.h.

◆ USART_TTGR

#define USART_TTGR (   x)    MMIO32((x) + 0x0028)

Definition at line 42 of file usart.h.

◆ USART_VERSION

#define USART_VERSION (   x)    MMIO32((x) + 0x00FC)

Definition at line 55 of file usart.h.

◆ USART_WPMR

#define USART_WPMR (   x)    MMIO32((x) + 0x00E4)

Definition at line 52 of file usart.h.

◆ USART_WPMR_KEY

#define USART_WPMR_KEY   (0x555341 << 8)

Definition at line 173 of file usart.h.

◆ USART_WPMR_WPEN

#define USART_WPMR_WPEN   (0x01 << 0)

Definition at line 174 of file usart.h.

◆ USART_WPSR

#define USART_WPSR (   x)    MMIO32((x) + 0x00E8)

Definition at line 53 of file usart.h.

Enumeration Type Documentation

◆ usart_chrl

enum usart_chrl
Enumerator
USART_CHRL_5BIT 
USART_CHRL_6BIT 
USART_CHRL_7BIT 
USART_CHRL_8BIT 

Definition at line 209 of file usart.h.

◆ usart_clock

Enumerator
USART_CLOCK_CLK_USART 
USART_CLOCK_CLK_USART_DIV 
USART_CLOCK_CLK 

Definition at line 203 of file usart.h.

◆ usart_flowcontrol

Enumerator
USART_FLOWCONTROL_NONE 
USART_FLOWCONTROL_RTS_CTS 

Definition at line 198 of file usart.h.

◆ usart_mode

enum usart_mode
Enumerator
USART_MODE_DISABLED 
USART_MODE_RX 
USART_MODE_TX 
USART_MODE_TX_RX 

Definition at line 191 of file usart.h.

◆ usart_parity

Enumerator
USART_PARITY_EVEN 
USART_PARITY_ODD 
USART_PARITY_SPACE 
USART_PARITY_MARK 
USART_PARITY_NONE 
USART_PARITY_MULTIDROP 

Definition at line 182 of file usart.h.

◆ usart_stopbits

Enumerator
USART_STOPBITS_1 
USART_STOPBITS_1_5 
USART_STOPBITS_2 

Definition at line 176 of file usart.h.

Function Documentation

◆ usart_disable()

void usart_disable ( uint32_t  usart)

Definition at line 58 of file usart_common_all.c.

References USART_CR, USART_CR_RXDIS, and USART_CR_TXDIS.

◆ usart_disable_rx_interrupt()

void usart_disable_rx_interrupt ( uint32_t  usart)

Definition at line 101 of file usart_common_all.c.

References USART_CSR_RXRDY, and USART_IDR.

◆ usart_enable()

void usart_enable ( uint32_t  usart)

Definition at line 53 of file usart_common_all.c.

References USART_CR, USART_CR_RXEN, and USART_CR_TXEN.

◆ usart_enable_rx_interrupt()

void usart_enable_rx_interrupt ( uint32_t  usart)

Definition at line 96 of file usart_common_all.c.

References USART_CSR_RXRDY, and USART_IER.

◆ usart_recv()

uint16_t usart_recv ( uint32_t  usart)

Definition at line 68 of file usart_common_all.c.

References USART_RHR.

Referenced by usart_recv_blocking().

Here is the caller graph for this function:

◆ usart_recv_blocking()

uint16_t usart_recv_blocking ( uint32_t  usart)

Definition at line 89 of file usart_common_all.c.

References usart_recv(), and usart_wait_recv_ready().

Here is the call graph for this function:

◆ usart_select_clock()

void usart_select_clock ( uint32_t  usart,
enum usart_clock  clk 
)

Definition at line 116 of file usart_common_all.c.

References USART_MR, USART_MR_USCLKS_MASK, and USART_MR_USCLKS_SHIFT.

◆ usart_send()

void usart_send ( uint32_t  usart,
uint16_t  data 
)

Definition at line 63 of file usart_common_all.c.

References USART_THR.

Referenced by usart_send_blocking().

Here is the caller graph for this function:

◆ usart_send_blocking()

void usart_send_blocking ( uint32_t  usart,
uint16_t  data 
)

Definition at line 83 of file usart_common_all.c.

References usart_send(), and usart_wait_send_ready().

Here is the call graph for this function:

◆ usart_set_baudrate()

void usart_set_baudrate ( uint32_t  usart,
uint32_t  baud 
)

Definition at line 24 of file usart_common_3.c.

References pmc_mck_frequency, and USART_BRGR.

◆ usart_set_character_length()

void usart_set_character_length ( uint32_t  usart,
enum usart_chrl  chrl 
)

Definition at line 122 of file usart_common_all.c.

References USART_MR, and USART_MR_CHRL_SHIFT.

◆ usart_set_databits()

void usart_set_databits ( uint32_t  usart,
int  bits 
)

Definition at line 22 of file usart_common_all.c.

References USART_MR.

◆ usart_set_flow_control()

void usart_set_flow_control ( uint32_t  usart,
enum  usart_flowcontrol 
)

Definition at line 47 of file usart_common_all.c.

References USART_MR, and USART_MR_MODE_HW_HANDSHAKING.

◆ usart_set_mode()

void usart_set_mode ( uint32_t  usart,
enum  usart_mode 
)

◆ usart_set_parity()

void usart_set_parity ( uint32_t  usart,
enum  usart_parity 
)

Definition at line 34 of file usart_common_all.c.

References USART_MR.

◆ usart_set_stopbits()

void usart_set_stopbits ( uint32_t  usart,
enum  usart_stopbits 
)

Definition at line 28 of file usart_common_all.c.

References USART_MR.

◆ usart_wait_recv_ready()

void usart_wait_recv_ready ( uint32_t  usart)

Definition at line 78 of file usart_common_all.c.

References USART_CSR, and USART_CSR_RXRDY.

Referenced by usart_recv_blocking().

Here is the caller graph for this function:

◆ usart_wait_send_ready()

void usart_wait_send_ready ( uint32_t  usart)

Definition at line 73 of file usart_common_all.c.

References USART_CSR, and USART_CSR_TXRDY.

Referenced by usart_send_blocking().

Here is the caller graph for this function:

◆ usart_wp_disable()

void usart_wp_disable ( uint32_t  usart)

Definition at line 111 of file usart_common_all.c.

References USART_WPMR, and USART_WPMR_KEY.

◆ usart_wp_enable()

void usart_wp_enable ( uint32_t  usart)

Definition at line 106 of file usart_common_all.c.

References USART_WPMR, USART_WPMR_KEY, and USART_WPMR_WPEN.