FreeRTOS port on GAP8/RISC-V
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gap8/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 NB_UART
 
#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 uart_itf_data_s **driver_data, struct pi_uart_conf *conf)
 Open a device. More...
 
void __pi_uart_close (struct uart_itf_data_s *driver_data)
 Close a device. More...
 
int32_t __pi_uart_ioctl (struct uart_itf_data_s *driver_data, uint32_t cmd, void *arg)
 Ioctl commands. More...
 
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)
 Transfer data. More...
 
static int __pi_uart_write (struct uart_itf_data_s *data, void *buffer, uint32_t size, pi_task_t *callback)
 Transfer data. More...
 
static int __pi_uart_read (struct uart_itf_data_s *data, void *buffer, uint32_t size, pi_task_t *callback)
 Transfer data. More...
 

Macro Definition Documentation

#define NB_UART
#define UART_DEFAULT_PRE_ALLOC_EVT
#define UART_DRIVER_DATA_IMPLEM_SPECIFC
#define UART_TX_BUFFER_SIZE

Function Documentation

void __pi_uart_close ( struct uart_itf_data_s driver_data)

This function closes an opened device.

Parameters
driver_dataPointer to driver info.
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.
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.
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.
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 int __pi_uart_read ( struct uart_itf_data_s 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 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.

Referenced by __pi_cl_delegate_uart_write_req_callback().