36 #ifndef _UART_SERIAL_H_    37 #define _UART_SERIAL_H_    44 #if ((!SAM4L) && (!SAMG55))    90 #if ((!SAM4L) && (!SAMG55))   105         if (UART == (
Uart*)p_usart) {
   150         if (USART == p_usart) {
   172                 flexcom_enable(FLEXCOM0);
   173                 flexcom_set_opmode(FLEXCOM0, FLEXCOM_USART);
   196                 flexcom_enable(FLEXCOM1);
   197                 flexcom_set_opmode(FLEXCOM1, FLEXCOM_USART);
   220                 flexcom_enable(FLEXCOM2);
   221                 flexcom_set_opmode(FLEXCOM2, FLEXCOM_USART);
   241         if (USART3 == p_usart) {
   244                 flexcom_enable(FLEXCOM3);
   245                 flexcom_set_opmode(FLEXCOM3, FLEXCOM_USART);
   265         if (USART4 == p_usart) {
   268                 flexcom_enable(FLEXCOM4);
   269                 flexcom_set_opmode(FLEXCOM4, FLEXCOM_USART);
   289         if (USART5 == p_usart) {
   292                 flexcom_enable(FLEXCOM5);
   293                 flexcom_set_opmode(FLEXCOM5, FLEXCOM_USART);
   313         if (USART6 == p_usart) {
   316                 flexcom_enable(FLEXCOM6);
   317                 flexcom_set_opmode(FLEXCOM6, FLEXCOM_USART);
   337         if (USART7 == p_usart) {
   340                 flexcom_enable(FLEXCOM7);
   341                 flexcom_set_opmode(FLEXCOM7, FLEXCOM_USART);
   379         if (UART == (
Uart*)p_usart) {
   412         if (USART == p_usart) {
   436         if (USART3 == p_usart) {
   442         if (USART4 == p_usart) {
   448         if (USART5 == p_usart) {
   454         if (USART6 == p_usart) {
   460         if (USART7 == p_usart) {
   484         if (UART == (
Uart*)p_usart) {
   512         if (USART == p_usart) {
   514                 *data = (uint8_t)(val & 0xFF);
   520                 *data = (uint8_t)(val & 0xFF);
   526                 *data = (uint8_t)(val & 0xFF);
   532                 *data = (uint8_t)(val & 0xFF);
   536         if (USART3 == p_usart) {
   538                 *data = (uint8_t)(val & 0xFF);
   542         if (USART4 == p_usart) {
   544                 *data = (uint8_t)(val & 0xFF);
   548         if (USART5 == p_usart) {
   550                 *data = (uint8_t)(val & 0xFF);
   554         if (USART6 == p_usart) {
   556                 *data = (uint8_t)(val & 0xFF);
   560         if (USART7 == p_usart) {
   562                 *data = (uint8_t)(val & 0xFF);
   580         if (UART == (
Uart*)p_usart) {
   608         if (USART == p_usart) {
   628         if (USART3 == p_usart) {
   633         if (USART4 == p_usart) {
   638         if (USART5 == p_usart) {
   643         if (USART6 == p_usart) {
   648         if (USART7 == p_usart) {
 
void usart_enable_rx(Usart *p_usart)
Enable USART receiver. 
 
#define ID_USART1
USART 1 (USART1) 
 
#define UNUSED(v)
Marking v as a unused parameter or value. 
 
Usart hardware registers. 
 
#define UART3
(UART3 ) Base Address 
 
static int usart_serial_putchar(usart_if p_usart, const uint8_t c)
Sends a character with the USART. 
 
uint32_t uart_read(Uart *p_uart, uint8_t *puc_data)
Read from UART Receive Holding Register. Before reading user should check if rx is ready...
 
#define US_MR_CHMODE_NORMAL
(US_MR) Normal mode 
 
status_code_t usart_serial_write_packet(usart_if usart, const uint8_t *data, size_t len)
Send a sequence of bytes to a USART device. 
 
#define ID_UART3
UART 3 (UART3) 
 
struct uart_rs232_options usart_rs232_options_t
 
#define UART1
(UART1 ) Base Address 
 
#define USART0
(USART0) Base Address 
 
#define ID_UART0
UART 0 (UART0) 
 
#define USART1
(USART1) Base Address 
 
uint32_t uart_init(Uart *p_uart, const sam_uart_opt_t *p_uart_opt)
Configure UART with the specified parameters. 
 
Commonly used includes, types and macros. 
 
uint32_t usart_read(Usart *p_usart, uint32_t *c)
Read from USART Receive Holding Register. 
 
static uint32_t sysclk_get_peripheral_hz(void)
Retrieves the current rate in Hz of the peripheral clocks. 
 
uint32_t usart_is_rx_ready(Usart *p_usart)
Check if the received data are ready. Check if Data have been received and loaded into USART_RHR...
 
uint32_t usart_init_rs232(Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck)
Configure USART to work in RS232 mode. 
 
#define ID_UART1
UART 1 (UART1) 
 
#define ID_UART2
UART 2 (UART2) 
 
uint32_t uart_is_rx_ready(Uart *p_uart)
Check if Received data is ready. Check if data has been received and loaded in UART_RHR. 
 
static void usart_serial_getchar(usart_if p_usart, uint8_t *data)
Waits until a character is received, and returns it. 
 
USBInterfaceDescriptor data
 
Option list for UART peripheral initialization. 
 
#define ID_USART0
USART 0 (USART0) 
 
enum status_code status_code_t
 
static void usart_serial_init(usart_if p_usart, usart_serial_options_t *opt)
Initializes the Usart in master mode. 
 
uint32_t uart_write(Uart *p_uart, const uint8_t uc_data)
Write to UART Transmit Holding Register Before writing user should check if tx is ready (or empty)...
 
void usart_enable_tx(Usart *p_usart)
Enable USART transmitter. 
 
static void sysclk_enable_peripheral_clock(uint32_t ul_id)
Enable a peripheral's clock. 
 
#define UART0
(UART0 ) Base Address 
 
#define USART2
(USART2) Base Address 
 
#define UART4
(UART4 ) Base Address 
 
uint32_t usart_write(Usart *p_usart, uint32_t c)
Write to USART Transmit Holding Register. 
 
status_code_t usart_serial_read_packet(usart_if usart, uint8_t *data, size_t len)
Receive a sequence of bytes to a USART device. 
 
usart_rs232_options_t usart_serial_options_t
 
static uint32_t usart_serial_is_rx_ready(usart_if p_usart)
Check if Received data is ready. 
 
static uint32_t sysclk_get_peripheral_bus_hz(const volatile void *module)
Retrieves the current rate in Hz of the Peripheral Bus clock attached to the specified peripheral...
 
#define ID_USART2
USART 2 (USART2) 
 
#define UART2
(UART2 ) Base Address 
 
#define ID_UART4
UART 4 (UART4) 
 
USART Serial Configuration.