FreeRTOS port on GAP8/RISC-V
|
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_s * | g_uart_itf_data [UDMA_NB_UART] |
#define UDMA_DATA_MAX_SIZE |
Referenced by __pi_uart_copy_exec(), and __pi_uart_handler().
|
inlinestatic |
References pi_freq_get(), and UART_TRACE_ERR.
Referenced by __pi_uart_conf_set().
void __pi_uart_close | ( | struct uart_itf_data_s * | driver_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.
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.
|
static |
References __pi_uart_clk_div(), __pi_uart_rx_handler(), __pi_uart_tx_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(), hal_udma_core_lin_get(), hal_udma_core_lin_reset(), hal_udma_uart_rts_limit_get(), hal_udma_uart_rts_limit_set(), hal_udma_uart_rx_dest_set(), hal_udma_uart_setup_get(), hal_udma_uart_setup_mask_set(), hal_udma_uart_tx_dest_set(), pi_udma_core_lin_alloc(), pi_udma_core_lin_free(), SOC_EVENT_UDMA_CHAN_LIN, UART_TRACE, UART_TRACE_ERR, uart_itf_data_s::udma_chan_id_rx, uart_itf_data_s::udma_chan_id_tx, UDMA_CHAN_LIN_ID, UDMA_UART_SETUP_BIT_LENGTH, UDMA_UART_SETUP_CLKDIV, UDMA_UART_SETUP_CTS_EN, UDMA_UART_SETUP_PARITY_ENA, UDMA_UART_SETUP_RTS_EN, UDMA_UART_SETUP_RX_ENA, UDMA_UART_SETUP_STOP_BITS, UDMA_UART_SETUP_TX_CLK_EN, UDMA_UART_SETUP_TX_CLK_PHA, UDMA_UART_SETUP_TX_CLK_POL, UDMA_UART_SETUP_TX_ENA, and uart_itf_data_s::usart_mode.
Referenced by __pi_uart_ioctl(), and __pi_uart_open().
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.
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.
|
static |
References __pi_uart_rx_timeout_abort(), __pi_uart_tx_timeout_abort(), uart_itf_data_s::device_id, hal_udma_uart_enqueue(), max_size, pi_task_timeout_callback_set(), pi_udma_fifo_buffer_set(), pi_udma_fifo_hw_fifo_task_enqueue(), pi_udma_timeout_config_set(), RX_CHANNEL, UART_TRACE, uart_itf_data_s::udma_chan, uart_itf_data_s::udma_chan_id_rx, uart_itf_data_s::udma_chan_id_tx, UDMA_DATA_MAX_SIZE, uart_itf_data_s::udma_timer_id_rx, and uart_itf_data_s::udma_timer_id_tx.
Referenced by __pi_uart_copy(), and __pi_uart_handler().
|
static |
References uart_itf_data_s::device_id, hal_udma_uart_error_get(), printf, and UART_TRACE_ERR.
Referenced by __pi_uart_open().
|
static |
References uart_itf_data_s::device_id, uart_itf_data_s::flow_ctrl_ena, hal_udma_uart_flow_control_enable(), and UART_TRACE.
Referenced by __pi_uart_ioctl().
|
static |
Referenced by __pi_uart_open().
|
static |
References __pi_irq_handle_end_of_task(), __pi_uart_copy_exec(), uart_itf_data_s::device_id, hal_udma_uart_enqueue(), max_size, pi_udma_fifo_buffer_set(), pi_udma_fifo_hw_buffer_empty(), pi_udma_fifo_hw_fifo_current_task_get(), pi_udma_fifo_hw_fifo_task_enqueue(), pi_udma_fifo_hw_fifo_task_pop(), pi_udma_fifo_sw_fifo_task_pop(), UART_TRACE, uart_itf_data_s::udma_chan, and UDMA_DATA_MAX_SIZE.
Referenced by __pi_uart_rx_handler(), and __pi_uart_tx_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.
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.
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.
|
static |
References uart_itf_data_s::device_id, hal_udma_core_lin_get(), hal_udma_core_lin_reset(), hal_udma_uart_rx_disable(), pi_udma_fifo_hw_fifo_task_pop(), RX_CHANNEL, UART_TRACE, uart_itf_data_s::udma_chan, uart_itf_data_s::udma_chan_id_rx, and UDMA_CHAN_LIN_ID.
Referenced by __pi_uart_close(), and __pi_uart_ioctl().
|
inlinestatic |
References uart_itf_data_s::device_id, hal_udma_uart_rx_enable(), RX_CHANNEL, and UART_TRACE.
Referenced by __pi_uart_ioctl().
|
static |
References __pi_uart_handler(), and RX_CHANNEL.
Referenced by __pi_uart_conf_set().
|
static |
References uart_itf_data_s::device_id, hal_udma_core_lin_get(), hal_udma_core_lin_reset(), hal_udma_uart_rx_disable(), hal_udma_uart_rx_enable(), pi_udma_fifo_hw_fifo_task_pop(), RX_CHANNEL, UART_TRACE, uart_itf_data_s::udma_chan, uart_itf_data_s::udma_chan_id_rx, and UDMA_CHAN_LIN_ID.
Referenced by __pi_uart_copy_exec().
|
static |
References uart_itf_data_s::device_id, hal_udma_core_lin_get(), hal_udma_core_lin_reset(), hal_udma_uart_tx_disable(), pi_udma_fifo_hw_fifo_task_pop(), TX_CHANNEL, UART_TRACE, uart_itf_data_s::udma_chan, uart_itf_data_s::udma_chan_id_tx, and UDMA_CHAN_LIN_ID.
Referenced by __pi_uart_close(), and __pi_uart_ioctl().
|
inlinestatic |
References uart_itf_data_s::device_id, hal_udma_uart_tx_enable(), TX_CHANNEL, and UART_TRACE.
Referenced by __pi_uart_ioctl().
|
static |
References uart_itf_data_s::device_id, and hal_udma_uart_tx_status_get().
Referenced by __pi_uart_ioctl().
|
static |
References __pi_uart_handler(), and TX_CHANNEL.
Referenced by __pi_uart_conf_set().
|
static |
References uart_itf_data_s::device_id, hal_udma_core_lin_get(), hal_udma_core_lin_reset(), hal_udma_uart_tx_disable(), hal_udma_uart_tx_enable(), pi_udma_fifo_hw_fifo_task_pop(), TX_CHANNEL, UART_TRACE, uart_itf_data_s::udma_chan, uart_itf_data_s::udma_chan_id_tx, and UDMA_CHAN_LIN_ID.
Referenced by __pi_uart_copy_exec().
|
static |
References uart_itf_data_s::udma_timer_id_rx.
Referenced by __pi_uart_ioctl().
|
static |
References uart_itf_data_s::udma_timer_id_tx.
Referenced by __pi_uart_ioctl().
|
static |