core/uart/uart.h File Reference

Go to the source code of this file.

Defines

#define IER_RBR   0x01
#define IER_THRE   0x02
#define IER_RLS   0x04
#define IIR_PEND   0x01
#define IIR_RLS   0x03
#define IIR_RDA   0x02
#define IIR_CTI   0x06
#define IIR_THRE   0x01
#define LSR_RDR   0x01
#define LSR_OE   0x02
#define LSR_PE   0x04
#define LSR_FE   0x08
#define LSR_BI   0x10
#define LSR_THRE   0x20
#define LSR_TEMT   0x40
#define LSR_RXFE   0x80

Typedefs

typedef bool_t(* uart_rx_hook_t )(uint32_t ch)
 If a hook returns true the character will be removed from stream.

Functions

bool_t uart0_init (uint32_t baudrate, uint8_t data_bits, char parity, uint8_t stop_bits)
uint32_t uart0_send (const uint8_t *p_data, uint32_t data_size, bool_t cr_to_crlf)
bool_t uart0_putc (uint32_t ch)
bool_t uart0_getc (uint32_t *p_ch, uint32_t timeout_in_ms)
void uart0_flush_buffers (void)
void uart0_set_rx_hook (uart_rx_hook_t f)
bool_t uart1_init (uint32_t baudrate, uint8_t data_bits, char parity, uint8_t stop_bits)
uint32_t uart1_send (const uint8_t *p_data, uint32_t data_size, bool_t cr_to_crlf)
bool_t uart1_putc (uint32_t ch, bool_t right_now)
bool_t uart1_getc (uint32_t *p_ch, uint32_t timeout_in_ms)
void uart1_flush_buffers (void)
void uart1_set_rx_hook (uart_rx_hook_t f)

Detailed Description

Definitions for UART0 & UART1.

Definition in file uart.h.


Function Documentation

void uart0_flush_buffers ( void   ) 

Clear the TX & RX data buffers of UART0.

Definition at line 358 of file uart.c.

bool_t uart0_getc ( uint32_t *  p_ch,
uint32_t  timeout_in_ms 
)

Get a character from UART0.

Parameters:
p_ch Pointer to variable where the received character will be stored.
timeout_in_ms Time (ms) to wait for a character to come in, 0 equals no wait.
Returns:
true on success, false otherwise.

Definition at line 345 of file uart.c.

bool_t uart0_init ( uint32_t  baudrate,
uint8_t  data_bits,
char  parity,
uint8_t  stop_bits 
)

Initialize UART0, setup pin select, clock, parity, stop bits, FIFO, etc.

Parameters:
baudrate Baudrate
data_bits Number of data bits [5,6,7,8]
parity Parity ['n','N,'o','O','e','E','1','0']
stop_bits Number of stop bits [1,2]
Returns:
false if the interrupt handler could not be installed in the VIC table, true otherwise.

Definition at line 239 of file uart.c.

bool_t uart0_putc ( uint32_t  ch  ) 

Send one character using UART0.

Parameters:
ch Character to send.
Returns:
true on success, false otherwise.

Definition at line 325 of file uart.c.

uint32_t uart0_send ( const uint8_t *  p_data,
uint32_t  data_size,
bool_t  cr_to_crlf 
)

Send a block of data using UART0.

Parameters:
p_data Pointer to data.
data_size Number of bytes to send.
cr_to_crlf Convert CR to CRLF or not.
Returns:
The number of characters sent.

Definition at line 301 of file uart.c.

void uart0_set_rx_hook ( uart_rx_hook_t  f  ) 

Set RX hook for UART1.

Parameters:
f Pointer to hook function.

Definition at line 370 of file uart.c.

void uart1_flush_buffers ( void   ) 

Clear the TX & RX data buffers of UART1.

Definition at line 586 of file uart.c.

bool_t uart1_getc ( uint32_t *  p_ch,
uint32_t  timeout_in_ms 
)

Get a character from UART1.

Parameters:
p_ch Pointer to variable where the received character will be stored.
timeout_in_ms Time (ms) to wait for a character to come in, 0 equals no wait.
Returns:
true on success, false otherwise.

Definition at line 573 of file uart.c.

bool_t uart1_init ( uint32_t  baudrate,
uint8_t  data_bits,
char  parity,
uint8_t  stop_bits 
)

Initialize UART1, setup pin select, clock, parity, stop bits, FIFO, etc.

Parameters:
baudrate Baudrate
data_bits Number of data bits [5,6,7,8]
parity Parity ['n','N,'o','O','e','E','1','0']
stop_bits Number of stop bits [1,2]
Returns:
false if the interrupt handler could not be installed in the VIC table, true otherwise.

Definition at line 467 of file uart.c.

bool_t uart1_putc ( uint32_t  ch,
bool_t  right_now 
)

Send one character using UART1.

Parameters:
ch Character to send.
right_now If true will send character immediately.
Returns:
true on success, false otherwise.

Definition at line 546 of file uart.c.

uint32_t uart1_send ( const uint8_t *  p_data,
uint32_t  data_size,
bool_t  cr_to_crlf 
)

Send a block of data using UART1.

Parameters:
p_data Pointer to data.
data_size Number of bytes to send.
cr_to_crlf Convert CR to CRLF or not.
Returns:
The number of characters sent.

Definition at line 521 of file uart.c.

void uart1_set_rx_hook ( uart_rx_hook_t  f  ) 

Set RX hook for UART1.

Parameters:
f Pointer to hook function.

Definition at line 598 of file uart.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Defines

Generated by  doxygen 1.6.2