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

Data Structures

struct  uart_itf_data_s
 

Macros

#define UART_TX_BUFFER_SIZE
 
#define UART_DEFAULT_PRE_ALLOC_EVT
 
#define UART_DRIVER_DATA_IMPLEM_SPECIFC
 

Functions

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 *device_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...
 
static int __pi_uart_write (struct uart_itf_data_s *device_data, void *buffer, uint32_t size, pi_task_t *callback)
 Transfer data. More...
 
static int __pi_uart_read (struct uart_itf_data_s *device_data, void *buffer, uint32_t size, pi_task_t *callback)
 Transfer data. More...
 

Macro Definition Documentation

#define UART_DEFAULT_PRE_ALLOC_EVT
#define UART_DRIVER_DATA_IMPLEM_SPECIFC
#define UART_TX_BUFFER_SIZE

Function Documentation

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.

Referenced by pi_uart_conf_init().

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 
)

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.

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

int32_t __pi_uart_ioctl ( struct uart_itf_data_s device_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.

Referenced by pi_uart_ioctl().

int32_t __pi_uart_open ( struct pi_uart_conf *  conf,
struct uart_itf_data_s **  device_data 
)
static int __pi_uart_read ( struct uart_itf_data_s device_data,
void *  buffer,
uint32_t  size,
pi_task_t callback 
)
inlinestatic

This function allows to 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.
bufferPointer to data buffer.
sizeSize of data buffer.
taskEvent task used to notify end of transfer.
Return values
0If operation is successfull.
-1Otherwise.

References __pi_uart_copy(), and RX_CHANNEL.

static int __pi_uart_write ( struct uart_itf_data_s device_data,
void *  buffer,
uint32_t  size,
pi_task_t callback 
)
inlinestatic

This function allows to send 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.
bufferPointer to data buffer.
sizeSize of data buffer.
taskEvent task used to notify end of transfer.
Return values
0If operation is successfull.
-1Otherwise.

References __pi_uart_copy(), and TX_CHANNEL.