FD32M0P Microcontroller SDK
Loading...
Searching...
No Matches
uart.h File Reference
#include "UART_REGS.h"
#include "UART_RW_API.h"
#include <stdbool.h>
Include dependency graph for uart.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  uart_cfg_s
 UART Configuration Struct. More...
struct  uart_fifo_cfg_s
 UART Fifo Configuration Struct. More...

Macros

#define UART_CFG_DEFAULT
 Default Initializer for UART Configuration Struct.
#define UART_FIFO_CFG_DEFAULT
 Default Initializer for UART Fifo Configuration Struct.

Functions

void uart_init (UART_REGS_s *regs)
 This function initalizes the UART, enables power, resets the peripheral, and does reset status clear, blocks asynchronous fast clock requests.
void uart_cfg (UART_REGS_s *regs, const uart_cfg_s *cfg)
 This function configures the UART, data frame, clock, baud rate configurations, transmission and reception enables.
void uart_baud_cfg (UART_REGS_s *regs, uint32_t baud_rate, uint32_t clk_freq, uint32_t oversampling)
 This function calculates the UART baud rate, based on the inputs provided.
void uart_clk_en (UART_REGS_s *regs)
 This function enables the UART clk.
void uart_clk_dis (UART_REGS_s *regs)
 This function disables the UART clk.
void uart_en (UART_REGS_s *regs)
 This function enables the UART clock and UART peripheral.
void uart_dis (UART_REGS_s *regs)
 This function disables the UART peripheral.
void uart_fifo_cfg (UART_REGS_s *regs, const uart_fifo_cfg_s *fifo_cfg)
 This function configures the UART transmit and receive fifos, does fifo enable or disable.
uint32_t uart_txfifo_fill_nonblocking (UART_REGS_s *regs, const uint8_t *buffer, uint32_t num_bytes)
 This non blocking function fills the UART transmit fifo, user needs to update the buffer pointer and number of data bytes to be written, returns number of data bytes written.
bool uart_txfifo_fill_static_nonblocking (UART_REGS_s *regs, const uint8_t *buffer, uint32_t num_bytes, uint32_t rst_int_ctr)
 This non blocking static function fills the UART transmit fifo, auto updates the buffer pointer and number of bytes to be written, returns a boolean for transaction done.
void uart_txfifo_fill_blocking (UART_REGS_s *regs, const uint8_t *buffer, uint32_t num_bytes)
 This blocking function fills the UART transmit fifo.
void uart_puts (UART_REGS_s *regs, const char *data_char_arr)
 This blocking function puts a string in the UART transmit fifo.
static uint8_t uart_putc (UART_REGS_s *regs, const unsigned char data_char)
 This static inline function puts a charcter in UART transmit fifo, returns the character written.
uint32_t uart_rxfifo_drain_nonblocking (UART_REGS_s *regs, uint8_t *buffer, uint32_t num_bytes)
 This non blocking function drains the UART receive fifo, user needs to update the buffer pointer and number of data bytes to be read, returns number of data bytes read.
bool uart_rxfifo_drain_static_nonblocking (UART_REGS_s *regs, uint8_t *buffer, uint32_t num_bytes, uint32_t rst_int_ctr)
 This non blocking static function drains the UART receive fifo, auto updates the buffer pointer and number of data bytes to be read returns a boolean for transaction done.
void uart_rxfifo_drain_blocking (UART_REGS_s *regs, uint8_t *buffer, uint32_t num_bytes)
 This blocking function drains the UART receive fifo.
static uint8_t uart_getc (UART_REGS_s *regs)
 This static inline function returns a charcter from the UART receive fifo.
void uart_read_cfg (UART_REGS_s *regs, uart_cfg_s *rd_cfg)
 This function reads the UART configurations from the register space, puts them in the configuration struct provided in the input.