API description

The UART API contains functions to send and receive characters via any of the USART blocks.

Table 1. UART API UART API calls
API call Description Reference
uint32_t ramsize_in_bytes uart_get_mem_size( void) ; UART get memory size UART API uart_get_mem_size
UART_HANDLE_T* uart_setup(uint32_t base_addr, uint8_t *ram) ; UART set-up UART API uart_setup
uint32_t uart_init(UART_HANDLE_T* handle, UART_CONFIG set); UART init UART API uart_init
uint8_t uart_get_char(UART_HANDLE_T* handle); UART get character UART API uart_get_char
void uart_put_char(UART_HANDLE_T* handle, uint8_t data); UART put character UART API uart_put_char
uint32_t uart_get_line(UART_HANDLE_T* handle, UART_PARAM_T param); UART get line UART API uart_get_line
uint32_t uart_put_line(UART_HANDLE_T* handle, UART_PARAM_T param); UART put line UART API uart_put_line
void uart_isr(UART_HANDLE_T* handle); UART interrupt service routine UART API uart_isr

The following structure has to be defined to use the UART API:

typedef struct  UARTD_API {         // indexof all the uart driver functions-->
                uint32_t (*uart_get_mem_size)(void);-->
                UART_HANDLE_T (*uart_setup)(uint32_t base_addr,uint8_t *ram);-->
                uint32_t (*uart_init)(UART_HANDLE_T handle,UART_CONFIG_T *set);-->
                //--polling functions--//-->
                uint8_t (*uart_get_char)(UART_HANDLE_T handle);-->
                void (*uart_put_char)(UART_HANDLE_T handle,uint8_t data);-->
                uint32_t (*uart_get_line)(UART_HANDLE_T handle,UART_PARAM_T * param);-->
                uint32_t (*uart_put_line)(UART_HANDLE_T handle,UART_PARAM_T * param);-->
                //--interrupt functions--//-->
                void (*uart_isr)(UART_HANDLE_T handle);-->
} UARTD_API_T  ;             // end of structure -->
-->
#define ROM_DRIVER_BASE (0x1FFF1FF8UL)-->
#define LPC_UART_API    ((UARTD_API_T *) ((*(ROM_API_T * *)(ROM_DRIVER_BASE))->pUARTD))-->

See Boot ROM General description for how to include the ROM driver structure.


-->