FreeRTOS port on GAP8/RISC-V
|
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... | |
#define UART_DEFAULT_PRE_ALLOC_EVT |
#define UART_DRIVER_DATA_IMPLEM_SPECIFC |
#define UART_TX_BUFFER_SIZE |
void __pi_uart_close | ( | struct uart_itf_data_s * | device_data | ) |
This function closes an opened device.
driver_data | Pointer to driver info. |
References __pi_uart_rx_abort(), __pi_uart_tx_abort(), uart_itf_data_s::device_id, disable_irq(), hal_soc_eu_clear_fc_mask(), hal_uart_tx_status_get(), hal_udma_ctrl_cg_enable(), hal_udma_ctrl_reset_clear(), hal_udma_uart_irq_disable(), hal_udma_uart_rx_dest_set(), hal_udma_uart_tx_dest_set(), hal_udma_uart_tx_status_get(), uart_itf_data_s::nb_open, pi_fc_event_handler_clear(), pi_fc_l1_free(), pi_freq_callback_remove(), pi_l2_free(), pi_udma_core_lin_free(), restore_irq(), SOC_EVENT_UDMA_UART_RX, SOC_EVENT_UDMA_UART_TX, uart_itf_data_s::uart_freq_cb, UART_TRACE, uart_itf_data_s::udma_chan_id_rx, uart_itf_data_s::udma_chan_id_tx, and UDMA_UART_ID.
Referenced by pi_uart_close().
void __pi_uart_conf_init | ( | struct pi_uart_conf * | conf | ) |
This function initializes a config struct with default values.
conf | Pointer 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.
driver_data | Pointer to driver info. |
l2_buf | Address of data buffer. |
size | Size of data buffer. |
channel | Direction of transfer. |
task | Event task used to notify end of transfer. |
0 | If operation is successfull. |
-1 | Otherwise. |
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.
driver_data | Pointer to driver info. |
cmd | Ioctl command. |
arg | Ioctl command arg. |
-1 | If wrong ioctl command. |
Value | Value 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 | ||
) |
This function opens a device. A conf struct and a pointer to store UART driver info should be given.
conf | Pointer to struct pi_uart_conf. driver_data Pointer to store driver info. |
0 | If operation is successfull. |
ERRNO | An error code otherwise. |
References __pi_uart_conf_set(), __pi_uart_error_handler(), __pi_uart_freq_cb(), uart_itf_data_s::device_id, hal_soc_eu_set_fc_mask(), hal_udma_ctrl_cg_disable(), hal_udma_ctrl_reset_set(), hal_udma_uart_irq_enable(), uart_itf_data_s::nb_open, pi_fc_event_handler_set(), pi_fc_l1_malloc(), pi_freq_callback_add(), pi_freq_callback_init(), pi_udma_fifo_init(), RX_CHANNEL, SOC_EVENT_UDMA_CHAN_LIN, SOC_EVENT_UDMA_UART_ERR_EVT, TX_CHANNEL, uart_itf_data_s::uart_freq_cb, UART_TRACE, UART_TRACE_ERR, uart_itf_data_s::udma_chan, uart_itf_data_s::udma_chan_id_rx, udma_ctrl, uart_itf_data_s::udma_timer_id_rx, uart_itf_data_s::udma_timer_id_tx, udma_uart, and UDMA_UART_ID.
|
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.
driver_data | Pointer to driver info. |
buffer | Pointer to data buffer. |
size | Size of data buffer. |
task | Event task used to notify end of transfer. |
0 | If operation is successfull. |
-1 | Otherwise. |
References __pi_uart_copy(), and RX_CHANNEL.
|
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.
driver_data | Pointer to driver info. |
buffer | Pointer to data buffer. |
size | Size of data buffer. |
task | Event task used to notify end of transfer. |
0 | If operation is successfull. |
-1 | Otherwise. |
References __pi_uart_copy(), and TX_CHANNEL.