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

Functions

static void __pi_uart_handle_end_of_task (struct pi_task *task)
 
static void __pi_uart_handler (void *arg)
 
static uint32_t __pi_uart_task_fifo_enqueue (struct uart_itf_data_s *data, struct pi_task *task, udma_channel_e channel)
 
static struct pi_task * __pi_uart_task_fifo_pop (struct uart_itf_data_s *data, udma_channel_e channel)
 
static void __pi_uart_copy_exec (struct uart_itf_data_s *data, struct pi_task *task)
 
static void __pi_uart_conf_set (struct uart_itf_data_s *data, struct pi_uart_conf *conf)
 
static void __pi_uart_channel_enable (struct uart_itf_data_s *data, udma_channel_e channel)
 
static void __pi_uart_rx_abort (struct uart_itf_data_s *data)
 
static void __pi_uart_tx_abort (struct uart_itf_data_s *data)
 
static int32_t __pi_uart_flow_control_enable (struct uart_itf_data_s *data)
 
static void __pi_uart_copy_exec_flow_control (struct uart_itf_data_s *data, struct pi_task *task)
 
static void __pi_uart_freq_cb (void *args)
 
static uint16_t __pi_uart_clk_div (uint32_t baudrate)
 
void __pi_uart_conf_init (struct pi_uart_conf *conf)
 Initialize conf struct. More...
 
int32_t __pi_uart_open (struct uart_itf_data_s **device_data, struct pi_uart_conf *conf)
 Open a device. More...
 
void __pi_uart_close (struct uart_itf_data_s *data)
 Close a device. More...
 
int32_t __pi_uart_ioctl (struct uart_itf_data_s *data, uint32_t cmd, void *arg)
 Ioctl commands. More...
 
int32_t __pi_uart_copy (struct uart_itf_data_s *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]
 

Function Documentation

static void __pi_uart_channel_enable ( struct uart_itf_data_s data,
udma_channel_e  channel 
)
inlinestatic
static uint16_t __pi_uart_clk_div ( uint32_t  baudrate)
inlinestatic

References pi_freq_get().

Referenced by __pi_uart_conf_set(), and __pi_uart_freq_cb().

void __pi_uart_close ( struct uart_itf_data_s driver_data)

This function closes an opened device.

Parameters
driver_dataPointer to driver info.

Referenced by pi_uart_close().

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.

Referenced by pi_uart_conf_init().

static void __pi_uart_conf_set ( struct uart_itf_data_s data,
struct pi_uart_conf *  conf 
)
inlinestatic
int32_t __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.

Referenced by __pi_uart_read(), __pi_uart_write(), pi_uart_read_async(), and pi_uart_write_async().

static void __pi_uart_copy_exec ( struct uart_itf_data_s data,
struct pi_task *  task 
)
static
static void __pi_uart_copy_exec_flow_control ( struct uart_itf_data_s data,
struct pi_task *  task 
)
static
static int32_t __pi_uart_flow_control_enable ( struct uart_itf_data_s data)
static

Referenced by __pi_uart_ioctl(), and __pi_uart_open().

static void __pi_uart_handle_end_of_task ( struct pi_task *  task)
static

References pi_task_push(), and pi_task_release().

Referenced by __pi_uart_handler().

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.

Referenced by pi_uart_ioctl().

int32_t __pi_uart_open ( struct uart_itf_data_s **  driver_data,
struct pi_uart_conf *  conf 
)

This function opens a device. A conf struct and a pointer to store UART driver info should be given.

driver_data Pointer to store driver info.

Parameters
confPointer to struct pi_uart_conf.
Return values
0If operation is successfull.
ERRNOAn error code otherwise.

References __pi_uart_conf_set(), __pi_uart_flow_control_enable(), __pi_uart_freq_cb(), __pi_uart_handler(), uart_itf_data_s::baudrate_bps, uart_itf_data_s::device_id, uart_itf_data_s::flow_ctrl_ena, hal_soc_eu_set_fc_mask(), memset(), uart_itf_data_s::nb_open, pi_fc_event_handler_set(), pi_freq_callback_add(), pi_freq_callback_init(), pi_l2_malloc(), SOC_EVENT_UDMA_UART_RX, SOC_EVENT_UDMA_UART_TX, uart, uart_itf_data_s::uart_freq_cb, UART_TRACE, UART_TRACE_ERR, udma_ctrl_cg_disable(), UDMA_GC, and UDMA_UART_ID.

Referenced by pi_uart_open().

static uint32_t __pi_uart_task_fifo_enqueue ( struct uart_itf_data_s data,
struct pi_task *  task,
udma_channel_e  channel 
)
inlinestatic
static struct pi_task * __pi_uart_task_fifo_pop ( struct uart_itf_data_s data,
udma_channel_e  channel 
)
static

Variable Documentation

struct uart_itf_data_s* g_uart_itf_data[UDMA_NB_UART]
static