|
Register Offsets | |
|
| |
| #define | USART_DATA 0x00 |
| TX/RX Data Register. | |
| #define | USART_STATUS 0x01 |
| Status Register. | |
| #define | USART_CTRLA 0x03 |
| Control Register A. | |
| #define | USART_CTRLB 0x04 |
| Control Register B. | |
| #define | USART_CTRLC 0x05 |
| Control Register C. | |
| #define | USART_BAUDCTRLA 0x06 |
| Baud Rate Register A. | |
| #define | USART_BAUDCTRLB 0x07 |
| Baud Rate Register B. | |
STATUS register bits | |
|
| |
| #define | USART_RXB8_BIT 0 |
| Receive Bit 8. | |
| #define | USART_PERR_BIT 2 |
| Parity Error. | |
| #define | USART_BUFOVF_BIT 3 |
| Buffer Overflow. | |
| #define | USART_FERR_BIT 4 |
| Frame Error. | |
| #define | USART_DREIF_BIT 5 |
| Data Register Empty. | |
| #define | USART_TXCIF_BIT 6 |
| Transmit Complete. | |
| #define | USART_RXCIF_BIT 7 |
| Receive Complete. | |
CTRLA register bits | |
|
| |
| #define | USART_DREINTLVL_START 0 |
| Data Reg Empty Interrupt Level. | |
| #define | USART_DREINTLVL_SIZE 2 |
| Data Reg Empty Interrupt Level. | |
| #define | USART_TXCINTLVL_START 2 |
| TX Complete Interrupt Level. | |
| #define | USART_TXCINTLVL_SIZE 2 |
| TX Complete Interrupt Level. | |
| #define | USART_RXCINTLVL_START 4 |
| RX Complete Interrupt Level. | |
| #define | USART_RXCINTLVL_SIZE 2 |
| RX Complete Interrupt Level. | |
CTRLB register bits | |
|
| |
| #define | USART_TXB8_BIT 0 |
| Transmit Bit 8. | |
| #define | USART_MPCM_BIT 1 |
| Multi-processor Communication Mode. | |
| #define | USART_CLK2X_BIT 2 |
| Double Transmission Speed. | |
| #define | USART_TXEN_BIT 3 |
| Transmitter Enable. | |
| #define | USART_RXEN_BIT 4 |
| Receiver Enable. | |
CTRLC register bits | |
|
| |
| #define | USART_CHSIZE_START 0 |
| Character Size. | |
| #define | USART_CHSIZE_SIZE 3 |
| Character Size. | |
| #define | USART_SBMODE_START 3 |
| Stop Bit Mode. | |
| #define | USART_SBMODE_SIZE 1 |
| Stop Bit Mode. | |
| #define | USART_PMODE_START 4 |
| Parity Mode. | |
| #define | USART_PMODE_SIZE 2 |
| Parity Mode. | |
| #define | USART_CMODE_START 6 |
| Communication Mode. | |
| #define | USART_CMODE_SIZE 2 |
| Communication Mode. | |
BAUDCTRLB register bits | |
|
| |
| #define | USART_BSELB_START 0 |
| Baud Rate bits 8..11. | |
| #define | USART_BSELB_SIZE 4 |
| Baud Rate bits 8..11. | |
| #define | USART_BSCALE_START 4 |
| Baud Rate Scale factor. | |
| #define | USART_BSCALE_SIZE 4 |
| Baud Rate Scale factor. | |
Bit manipulation macros | |
|
| |
| #define | USART_BIT(name) (1U << USART_##name##_BIT) |
| Create a mask with bit name set. | |
| #define | USART_BF(name, value) ((value) << USART_##name##_START) |
| Create a mask with bitfield name set to value. | |
| #define | USART_BFEXT(name, regval) |
| Extract the value of bitfield name from regval. | |
| #define | USART_BFINS(name, value, regval) |
| Return regval with bitfield name set to value. | |
Register access macros | |
|
| |
| #define | usart_read_reg(usart, reg) mmio_read8((void *)((uintptr_t)(usart) + USART_##reg)) |
| Read the value of reg on usart. | |
| #define | usart_write_reg(usart, reg, value) mmio_write8((void *)((uintptr_t)(usart) + USART_##reg), value) |
| Write value to reg on usart. | |
This is the register interface to the XMEGA USART. The registers are defined as offsets relative to the base address of the module, so they may be easily reused across several modules on the same chip, or across different types of chips.
| #define USART_BAUDCTRLA 0x06 |
Baud Rate Register A.
Definition at line 63 of file xmega_usart.h.
| #define USART_BAUDCTRLB 0x07 |
Baud Rate Register B.
Definition at line 64 of file xmega_usart.h.
| #define USART_BF | ( | name, | |||
| value | ) | ((value) << USART_##name##_START) |
Create a mask with bitfield name set to value.
Definition at line 123 of file xmega_usart.h.
| #define USART_BFEXT | ( | name, | |||
| regval | ) |
(((regval) >> USART_##name##_START) \
& ((1U << USART_##name##_SIZE) - 1))
Extract the value of bitfield name from regval.
Definition at line 126 of file xmega_usart.h.
| #define USART_BFINS | ( | name, | |||
| value, | |||||
| regval | ) |
(((regval) & ~(((1U << USART_##name##_SIZE) - 1) \
<< USART_##name##_START)) \
| USART_BF(name, value))
Return regval with bitfield name set to value.
Definition at line 130 of file xmega_usart.h.
| #define USART_BIT | ( | name | ) | (1U << USART_##name##_BIT) |
Create a mask with bit name set.
Definition at line 120 of file xmega_usart.h.
Referenced by uart_get_byte_priv(), uart_put_byte_priv(), uart_rx_buffer_is_full_priv(), uart_transmit_is_complete_priv(), and uart_tx_buffer_is_empty_priv().
| #define USART_BSCALE_SIZE 4 |
Baud Rate Scale factor.
Definition at line 114 of file xmega_usart.h.
| #define USART_BSCALE_START 4 |
Baud Rate Scale factor.
Definition at line 113 of file xmega_usart.h.
| #define USART_BSELB_SIZE 4 |
Baud Rate bits 8..11.
Definition at line 112 of file xmega_usart.h.
| #define USART_BSELB_START 0 |
Baud Rate bits 8..11.
Definition at line 111 of file xmega_usart.h.
| #define USART_BUFOVF_BIT 3 |
Buffer Overflow.
Definition at line 71 of file xmega_usart.h.
| #define USART_CHSIZE_SIZE 3 |
Character Size.
Definition at line 100 of file xmega_usart.h.
| #define USART_CHSIZE_START 0 |
Character Size.
Definition at line 99 of file xmega_usart.h.
| #define USART_CLK2X_BIT 2 |
Double Transmission Speed.
Definition at line 92 of file xmega_usart.h.
| #define USART_CMODE_SIZE 2 |
Communication Mode.
Definition at line 106 of file xmega_usart.h.
| #define USART_CMODE_START 6 |
Communication Mode.
Definition at line 105 of file xmega_usart.h.
| #define USART_CTRLA 0x03 |
Control Register A.
Definition at line 60 of file xmega_usart.h.
| #define USART_CTRLB 0x04 |
Control Register B.
Definition at line 61 of file xmega_usart.h.
| #define USART_CTRLC 0x05 |
Control Register C.
Definition at line 62 of file xmega_usart.h.
| #define USART_DATA 0x00 |
TX/RX Data Register.
Definition at line 58 of file xmega_usart.h.
| #define USART_DREIF_BIT 5 |
Data Register Empty.
Definition at line 73 of file xmega_usart.h.
| #define USART_DREINTLVL_SIZE 2 |
Data Reg Empty Interrupt Level.
Definition at line 81 of file xmega_usart.h.
| #define USART_DREINTLVL_START 0 |
Data Reg Empty Interrupt Level.
Definition at line 80 of file xmega_usart.h.
| #define USART_FERR_BIT 4 |
Frame Error.
Definition at line 72 of file xmega_usart.h.
| #define USART_MPCM_BIT 1 |
Multi-processor Communication Mode.
Definition at line 91 of file xmega_usart.h.
| #define USART_PERR_BIT 2 |
Parity Error.
Definition at line 70 of file xmega_usart.h.
| #define USART_PMODE_SIZE 2 |
Parity Mode.
Definition at line 104 of file xmega_usart.h.
| #define USART_PMODE_START 4 |
Parity Mode.
Definition at line 103 of file xmega_usart.h.
| #define usart_read_reg | ( | usart, | |||
| reg | ) | mmio_read8((void *)((uintptr_t)(usart) + USART_##reg)) |
Read the value of reg on usart.
Definition at line 140 of file xmega_usart.h.
Referenced by uart_get_byte_priv(), uart_put_byte_priv(), uart_rx_buffer_is_full_priv(), uart_transmit_is_complete_priv(), and uart_tx_buffer_is_empty_priv().
| #define USART_RXB8_BIT 0 |
Receive Bit 8.
Definition at line 69 of file xmega_usart.h.
| #define USART_RXCIF_BIT 7 |
Receive Complete.
Definition at line 75 of file xmega_usart.h.
| #define USART_RXCINTLVL_SIZE 2 |
RX Complete Interrupt Level.
Definition at line 85 of file xmega_usart.h.
| #define USART_RXCINTLVL_START 4 |
RX Complete Interrupt Level.
Definition at line 84 of file xmega_usart.h.
| #define USART_RXEN_BIT 4 |
Receiver Enable.
Definition at line 94 of file xmega_usart.h.
| #define USART_SBMODE_SIZE 1 |
Stop Bit Mode.
Definition at line 102 of file xmega_usart.h.
| #define USART_SBMODE_START 3 |
Stop Bit Mode.
Definition at line 101 of file xmega_usart.h.
| #define USART_STATUS 0x01 |
Status Register.
Definition at line 59 of file xmega_usart.h.
| #define USART_TXB8_BIT 0 |
Transmit Bit 8.
Definition at line 90 of file xmega_usart.h.
| #define USART_TXCIF_BIT 6 |
Transmit Complete.
Definition at line 74 of file xmega_usart.h.
| #define USART_TXCINTLVL_SIZE 2 |
TX Complete Interrupt Level.
Definition at line 83 of file xmega_usart.h.
| #define USART_TXCINTLVL_START 2 |
TX Complete Interrupt Level.
Definition at line 82 of file xmega_usart.h.
| #define USART_TXEN_BIT 3 |
Transmitter Enable.
Definition at line 93 of file xmega_usart.h.
| #define usart_write_reg | ( | usart, | |||
| reg, | |||||
| value | ) | mmio_write8((void *)((uintptr_t)(usart) + USART_##reg), value) |
Write value to reg on usart.
Definition at line 143 of file xmega_usart.h.
Referenced by uart_put_byte_priv(), and uart_send_byte_priv().
1.6.3