Data Structures

struct  KUARTConf
 Uart configuration structure. More...
 
struct  KUART
 Uart interface data structure. More...
 

Enumerations

enum  KUARTNum {
  K_UART1 = 0, K_UART2, K_UART3, K_UART4,
  K_UART5, K_UART6
}
 Available uart interfaces. More...
 
enum  KWordLen { K_WORD_LEN_7BIT = 0, K_WORD_LEN_8BIT, K_WORD_LEN_9BIT }
 Word length. More...
 
enum  KStopBits { K_STOP_BITS_1 = 0, K_STOP_BITS_2 }
 Number of stop bits. More...
 
enum  KParity { K_PARITY_NONE = 0, K_PARITY_EVEN, K_PARITY_ODD }
 Parity setting. More...
 

Functions

KUARTConf k_uart_conf_defaults (void)
 Generate KUARTConf with default uart values. More...
 
void k_uart_init (KUARTNum uart, KUARTConf *conf)
 Setup and enable uart interface. More...
 
void k_uart_console_init (void)
 Setup and enable console uart interface. More...
 
int k_uart_read (KUARTNum uart, char *ptr, int len)
 Interrupt driven function for reading data from a uart interface. More...
 
int k_uart_write (KUARTNum uart, char *ptr, int len)
 Interrupt driven function for writing data to a uart interface. More...
 
void k_uart_write_immediate (KUARTNum uart, char c)
 Write data directly to a uart interface. More...
 
int k_uart_rx_queue_len (KUARTNum uart)
 Returns the number of characters currently in the uart rx queue. More...
 
void k_uart_rx_queue_push (KUARTNum uart, char c, void *task_woken)
 Pushes a character into the uart rx queue. More...
 
int k_uart_rx_pin (KUARTNum uart)
 Returns rx pin for specified uart interface. More...
 
int k_uart_tx_pin (KUARTNum uart)
 Returns tx pin for specified uart interface. More...
 
KUARTkprv_uart_get (KUARTNum uart)
 Returns uart data structure for specified interface. More...
 
void kprv_uart_dev_init (KUARTNum uart)
 Performs low level uart hardware initialization. More...
 
void kprv_uart_enable_tx_int (KUARTNum uart)
 Enables uart transmit interrupt. More...
 

Enumeration Type Documentation

enum KParity

Parity setting.

Enumerator
K_PARITY_NONE 
K_PARITY_EVEN 
K_PARITY_ODD 
enum KStopBits

Number of stop bits.

Enumerator
K_STOP_BITS_1 
K_STOP_BITS_2 
enum KUARTNum

Available uart interfaces.

Enumerator
K_UART1 
K_UART2 
K_UART3 
K_UART4 
K_UART5 
K_UART6 
enum KWordLen

Word length.

Enumerator
K_WORD_LEN_7BIT 
K_WORD_LEN_8BIT 
K_WORD_LEN_9BIT 

Function Documentation

KUARTConf k_uart_conf_defaults ( void  )

Generate KUARTConf with default uart values.

Returns
KUARTConf
void k_uart_console_init ( void  )

Setup and enable console uart interface.

void k_uart_init ( KUARTNum  uart,
KUARTConf conf 
)

Setup and enable uart interface.

Parameters
uartuart interface to initialize
confconfig values to initialize with
int k_uart_read ( KUARTNum  uart,
char *  ptr,
int  len 
)

Interrupt driven function for reading data from a uart interface.

This function reads from a queue which is filled up via the uart interrupt handler.

Parameters
uartuart interface to read from
ptrbuffer to read data into
lenlength of data to read
Returns
int number of characters read
int k_uart_rx_pin ( KUARTNum  uart)
inline

Returns rx pin for specified uart interface.

Parameters
uartuart interface number
Returns
int rx pin
int k_uart_rx_queue_len ( KUARTNum  uart)

Returns the number of characters currently in the uart rx queue.

Parameters
uartuart interface number
void k_uart_rx_queue_push ( KUARTNum  uart,
char  c,
void *  task_woken 
)

Pushes a character into the uart rx queue.

Parameters
uartuart interface number
ccharacter to push
task_wokenused by FreeRTOS to determine task blocking
int k_uart_tx_pin ( KUARTNum  uart)
inline

Returns tx pin for specified uart interface.

Parameters
uartuart interface number
Returns
int tx pin
int k_uart_write ( KUARTNum  uart,
char *  ptr,
int  len 
)

Interrupt driven function for writing data to a uart interface.

This function writes data into a queue which is then written out in the interrupt handler.

Parameters
uartuart interface to write to
ptrbuffer to write data from
lenlength of data to write
Returns
int number of characters written
void k_uart_write_immediate ( KUARTNum  uart,
char  c 
)

Write data directly to a uart interface.

Parameters
uartuart interface to write to
ccharacter to write
void kprv_uart_dev_init ( KUARTNum  uart)

Performs low level uart hardware initialization.

Parameters
uartuart interface to initialize
void kprv_uart_enable_tx_int ( KUARTNum  uart)

Enables uart transmit interrupt.

Parameters
uartuart interface number
KUART* kprv_uart_get ( KUARTNum  uart)

Returns uart data structure for specified interface.

Parameters
uartuart interface number
Returns
KUART* pointer to uart data structure