FreeRTOS port on GAP8/RISC-V
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gap9/pmsis/drivers/udma/uart/uart_internal.c File Reference

Macros

#define UDMA_DATA_MAX_SIZE
 

Functions

static void __pi_uart_error_handler (void *arg)
 
static void __pi_uart_rx_handler (void *arg)
 
static void __pi_uart_tx_handler (void *arg)
 
static void __pi_uart_handler (struct uart_itf_data_s *driver_data, udma_channel_e channel)
 
static void __pi_uart_copy_exec (struct uart_itf_data_s *driver_data, struct pi_task *task, uint8_t hw_buff_idx)
 
static int32_t __pi_uart_conf_set (struct uart_itf_data_s *driver_data, struct pi_uart_conf *conf)
 
static void __pi_uart_rx_enable (struct uart_itf_data_s *driver_data)
 
static void __pi_uart_tx_enable (struct uart_itf_data_s *driver_data)
 
static void __pi_uart_tx_flush (struct uart_itf_data_s *driver_data)
 
static void __pi_uart_rx_abort (struct uart_itf_data_s *driver_data)
 
static void __pi_uart_tx_abort (struct uart_itf_data_s *driver_data)
 
static void __pi_uart_rx_timeout_abort (struct uart_itf_data_s *driver_data)
 
static void __pi_uart_tx_timeout_abort (struct uart_itf_data_s *driver_data)
 
static int32_t __pi_uart_flow_control_enable (struct uart_itf_data_s *driver_data)
 
static void __pi_uart_freq_cb (void *args)
 
static uint32_t __pi_uart_clk_div (uint32_t baudrate)
 
static void __pi_uart_udma_timeout_rx_set (struct uart_itf_data_s *driver_data, uint8_t timeout_id)
 
static void __pi_uart_udma_timeout_tx_set (struct uart_itf_data_s *driver_data, uint8_t timeout_id)
 
void __pi_uart_conf_init (struct pi_uart_conf *conf)
 Initialize conf struct. More...
 
int32_t __pi_uart_open (struct pi_uart_conf *conf, struct uart_itf_data_s **device_data)
 Open a device. More...
 
void __pi_uart_close (struct uart_itf_data_s *device_data)
 Close a device. More...
 
int32_t __pi_uart_ioctl (struct uart_itf_data_s *data, uint32_t cmd, void *arg)
 Ioctl commands. More...
 
void __pi_uart_copy (struct uart_itf_data_s *device_data, uint32_t l2_buf, uint32_t size, udma_channel_e channel, struct pi_task *task)
 Transfer data. More...
 

Variables

static struct uart_itf_data_sg_uart_itf_data [UDMA_NB_UART]
 

Macro Definition Documentation

#define UDMA_DATA_MAX_SIZE

Function Documentation

static uint32_t __pi_uart_clk_div ( uint32_t  baudrate)
inlinestatic

References pi_freq_get(), and UART_TRACE_ERR.

Referenced by __pi_uart_conf_set().

void __pi_uart_conf_init ( struct pi_uart_conf *  conf)

This function initializes a config struct with default values.

Parameters
confPointer to struct pi_uart_conf.

References UART_CTRL_FLOW_DIS, and UART_USART_DIS.

void __pi_uart_copy ( struct uart_itf_data_s driver_data,
uint32_t  l2_buf,
uint32_t  size,
udma_channel_e  channel,
struct pi_task *  task 
)

This function allows to send/receive data using the periph. The transfer is executed immediately if there is no current transfer or no pending transfer. Otherwise, the transfer is enqueued in a fifo.

Parameters
driver_dataPointer to driver info.
l2_bufAddress of data buffer.
sizeSize of data buffer.
channelDirection of transfer.
taskEvent task used to notify end of transfer.
Return values
0If operation is successfull.
-1Otherwise.

References __pi_uart_copy_exec(), __pi_uart_copy_exec_flow_control(), __pi_uart_task_fifo_enqueue(), uart_itf_data_s::device_id, disable_irq(), uart_itf_data_s::flow_ctrl_ena, pi_udma_fifo_hw_buffer_empty(), pi_udma_fifo_sw_fifo_task_enqueue(), restore_irq(), RX_CHANNEL, UART_TRACE, UART_TRACE_ERR, and uart_itf_data_s::udma_chan.

static void __pi_uart_error_handler ( void *  arg)
static
static int32_t __pi_uart_flow_control_enable ( struct uart_itf_data_s driver_data)
static
static void __pi_uart_freq_cb ( void *  args)
static

Referenced by __pi_uart_open().

int32_t __pi_uart_ioctl ( struct uart_itf_data_s driver_data,
uint32_t  cmd,
void *  arg 
)

This function allows to configure a device using ioctl commands.

Parameters
driver_dataPointer to driver info.
cmdIoctl command.
argIoctl command arg.
Return values
-1If wrong ioctl command.
ValueValue depending on ioctl command.

References __pi_uart_channel_enable(), __pi_uart_conf_set(), __pi_uart_flow_control_enable(), __pi_uart_rx_abort(), __pi_uart_rx_enable(), __pi_uart_tx_abort(), __pi_uart_tx_enable(), __pi_uart_tx_flush(), __pi_uart_udma_timeout_rx_set(), __pi_uart_udma_timeout_tx_set(), disable_irq(), restore_irq(), RX_CHANNEL, and TX_CHANNEL.

int32_t __pi_uart_open ( struct pi_uart_conf *  conf,
struct uart_itf_data_s **  device_data 
)
static void __pi_uart_rx_enable ( struct uart_itf_data_s driver_data)
inlinestatic
static void __pi_uart_rx_handler ( void *  arg)
static

References __pi_uart_handler(), and RX_CHANNEL.

Referenced by __pi_uart_conf_set().

static void __pi_uart_tx_enable ( struct uart_itf_data_s driver_data)
inlinestatic
static void __pi_uart_tx_flush ( struct uart_itf_data_s driver_data)
static
static void __pi_uart_tx_handler ( void *  arg)
static

References __pi_uart_handler(), and TX_CHANNEL.

Referenced by __pi_uart_conf_set().

static void __pi_uart_udma_timeout_rx_set ( struct uart_itf_data_s driver_data,
uint8_t  timeout_id 
)
static
static void __pi_uart_udma_timeout_tx_set ( struct uart_itf_data_s driver_data,
uint8_t  timeout_id 
)
static

Variable Documentation

struct uart_itf_data_s* g_uart_itf_data[UDMA_NB_UART]
static