Data Structures | |
struct | usart_iso7816_options_t |
Input parameters when initializing ISO7816 mode. More... | |
struct | usart_options_t |
Input parameters when initializing RS232 and similar modes. More... | |
Macros | |
#define | USART_DEFAULT_TIMEOUT 10000 |
Default time-out value (number of attempts). More... | |
Return Values | |
#define | USART_SUCCESS 0 |
Successful completion. More... | |
#define | USART_FAILURE -1 |
Failure because of some unspecified reason. More... | |
#define | USART_INVALID_INPUT 1 |
Input value out of range. More... | |
#define | USART_INVALID_ARGUMENT -1 |
Argument value out of range. More... | |
#define | USART_TX_BUSY 2 |
Transmitter was busy. More... | |
#define | USART_RX_EMPTY 3 |
Nothing was received. More... | |
#define | USART_RX_ERROR 4 |
Transmission error occurred. More... | |
#define | USART_MODE_FAULT 5 |
USART not in the appropriate mode. More... | |
Parity Settings | |
#define | USART_EVEN_PARITY AVR32_USART_MR_PAR_EVEN |
Use even parity on character transmission. More... | |
#define | USART_ODD_PARITY AVR32_USART_MR_PAR_ODD |
Use odd parity on character transmission. More... | |
#define | USART_SPACE_PARITY AVR32_USART_MR_PAR_SPACE |
Use a space as parity bit. More... | |
#define | USART_MARK_PARITY AVR32_USART_MR_PAR_MARK |
Use a mark as parity bit. More... | |
#define | USART_NO_PARITY AVR32_USART_MR_PAR_NONE |
Don't use a parity bit. More... | |
#define | USART_MULTIDROP_PARITY AVR32_USART_MR_PAR_MULTI |
Parity bit is used to flag address characters. More... | |
Stop Bits Settings | |
#define | USART_1_STOPBIT AVR32_USART_MR_NBSTOP_1 |
Use 1 stop bit. More... | |
#define | USART_1_5_STOPBITS AVR32_USART_MR_NBSTOP_1_5 |
Use 1.5 stop bits. More... | |
#define | USART_2_STOPBITS AVR32_USART_MR_NBSTOP_2 |
Use 2 stop bits (for more, just give the number of bits). More... | |
Channel Modes | |
#define | USART_NORMAL_CHMODE AVR32_USART_MR_CHMODE_NORMAL |
Normal communication. More... | |
#define | USART_AUTO_ECHO AVR32_USART_MR_CHMODE_ECHO |
Echo data. More... | |
#define | USART_LOCAL_LOOPBACK AVR32_USART_MR_CHMODE_LOCAL_LOOP |
Local loopback. More... | |
#define | USART_REMOTE_LOOPBACK AVR32_USART_MR_CHMODE_REMOTE_LOOP |
Remote loopback. More... | |
Functions | |
Initialization Functions | |
void | usart_reset (volatile avr32_usart_t *usart) |
Resets the USART and disables TX and RX. More... | |
int | usart_init_rs232 (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz) |
Sets up the USART to use the standard RS232 protocol. More... | |
int | usart_init_rs232_tx_only (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz) |
Sets up the USART to use the standard RS232 protocol in TX-only mode. More... | |
int | usart_init_hw_handshaking (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz) |
Sets up the USART to use hardware handshaking. More... | |
int | usart_init_modem (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz) |
Sets up the USART to use the modem protocol, activating dedicated inputs/outputs. More... | |
int | usart_init_sync_master (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz) |
Sets up the USART to use a synchronous RS232-like protocol in master mode. More... | |
int | usart_init_sync_slave (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz) |
Sets up the USART to use a synchronous RS232-like protocol in slave mode. More... | |
int | usart_init_rs485 (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz) |
Sets up the USART to use the RS485 protocol. More... | |
int | usart_init_IrDA (volatile avr32_usart_t *usart, const usart_options_t *opt, long pba_hz, unsigned char irda_filter) |
Sets up the USART to use the IrDA protocol. More... | |
int | usart_init_iso7816 (volatile avr32_usart_t *usart, const usart_iso7816_options_t *opt, int t, long pba_hz) |
Sets up the USART to use the ISO7816 T=0 or T=1 smartcard protocols. More... | |
Read and Reset Error Status Bits | |
static __always_inline void | usart_reset_status (volatile avr32_usart_t *usart) |
Resets the error status. More... | |
static __always_inline int | usart_parity_error (volatile avr32_usart_t *usart) |
Checks if a parity error has occurred since last status reset. More... | |
static __always_inline int | usart_framing_error (volatile avr32_usart_t *usart) |
Checks if a framing error has occurred since last status reset. More... | |
static __always_inline int | usart_overrun_error (volatile avr32_usart_t *usart) |
Checks if an overrun error has occurred since last status reset. More... | |
ISO7816 Control Functions | |
static __always_inline void | usart_iso7816_enable_receiver (volatile avr32_usart_t *usart) |
Enables the ISO7816 receiver. More... | |
static __always_inline void | usart_iso7816_enable_transmitter (volatile avr32_usart_t *usart) |
Enables the ISO7816 transmitter. More... | |
Transmit/Receive Functions | |
int | usart_send_address (volatile avr32_usart_t *usart, int address) |
Addresses a receiver. More... | |
static __always_inline int | usart_tx_ready (volatile avr32_usart_t *usart) |
Tests if the USART is ready to transmit a character. More... | |
int | usart_write_char (volatile avr32_usart_t *usart, int c) |
Writes the given character to the TX buffer if the transmitter is ready. More... | |
static __always_inline void | usart_bw_write_char (volatile avr32_usart_t *usart, int c) |
An active wait writing a character to the USART. More... | |
int | usart_putchar (volatile avr32_usart_t *usart, int c) |
Sends a character with the USART. More... | |
static __always_inline int | usart_tx_empty (volatile avr32_usart_t *usart) |
Tests if all requested USART transmissions are over. More... | |
static __always_inline int | usart_test_hit (volatile avr32_usart_t *usart) |
Tests if the USART contains a received character. More... | |
int | usart_read_char (volatile avr32_usart_t *usart, int *c) |
Checks the RX buffer for a received character, and stores it at the given memory location. More... | |
int | usart_getchar (volatile avr32_usart_t *usart) |
Waits until a character is received, and returns it. More... | |
void | usart_write_line (volatile avr32_usart_t *usart, const char *string) |
Writes one character string to the USART. More... | |
int | usart_get_echo_line (volatile avr32_usart_t *usart) |
Gets and echoes characters until end of line (detected by a CR character). More... | |