FreeRTOS port on GAP8/RISC-V
|
Data Structures | |
struct | spim_drv_fifo |
struct | spim_cs_data |
struct | spim_driver_data |
struct | spim_transfer |
Macros | |
#define | SPIM_CS_DATA_GET_DRV_DATA(cs_data) |
#define | SPIM_TMP_RD_SIZE |
#define | SPIM_TMP_WR_SIZE |
#define | RD_TMP_BUF_F |
#define | WR_TMP_BUF_F |
#define | RD_TMP_BUF_L |
#define | WR_TMP_BUF_L |
#define | SPIM_TMP_BUF_SIZE |
Functions | |
void | __spim_execute_callback (void *arg) |
void | spim_eot_handler (void *arg) |
void | spim_tx_handler (void *arg) |
void | spim_rx_handler (void *arg) |
int | __pi_spi_open (struct spim_cs_data **cs_data, struct pi_spi_conf *conf) |
int | __pi_spi_close (struct spim_cs_data *cs_data) |
static int32_t | __pi_spim_drv_fifo_enqueue (struct spim_cs_data *data, struct spim_transfer *transfer, pi_task_t *end_task) |
static pi_task_t * | __pi_spim_drv_fifo_pop (struct spim_driver_data *data) |
static void | __pi_spim_exec_transfer (pi_task_t *task) |
void | __pi_spi_send_ucode_set_addr_info (struct spim_cs_data *cs_data, void *addr, size_t size) |
uint8_t * | __pi_spi_send_ucode_set (struct spim_cs_data *cs_data, uint8_t *ucode, size_t size) |
void | __pi_spi_receive_ucode_set_addr_info (struct spim_cs_data *cs_data, void *addr, size_t size) |
uint8_t * | __pi_spi_receive_ucode_set (struct spim_cs_data *cs_data, uint8_t *ucode, size_t size) |
void | __pi_spi_send_async (struct spim_cs_data *cs_data, void *data, size_t len, pi_spi_flags_e flags, pi_task_t *task) |
void | __pi_spi_receive_async (struct spim_cs_data *cs_data, void *data, size_t len, pi_spi_flags_e flags, pi_task_t *task) |
void | __pi_spi_receive_async_with_ucode (struct spim_cs_data *cs_data, void *data, size_t len, pi_spi_flags_e flags, int ucode_size, void *ucode, pi_task_t *task) |
void | __pi_spi_send_async_with_ucode (struct spim_cs_data *cs_data, void *data, size_t len, pi_spi_flags_e flags, int ucode_size, void *ucode, pi_task_t *task) |
void | __pi_spi_xfer_async (struct spim_cs_data *cs_data, void *tx_data, void *rx_data, size_t len, pi_spi_flags_e flags, pi_task_t *task) |
void | __pi_spi_copy_async (struct spim_cs_data *cs_data, uint32_t addr, void *data, size_t len, pi_spi_flags_e flags, pi_task_t *task) |
void | __pi_spi_copy_async_2d (struct spim_cs_data *cs_data, uint32_t addr, void *data, size_t len, size_t stride, size_t length, pi_spi_flags_e flags, pi_task_t *task) |
static uint32_t | __pi_spi_get_config (struct spim_cs_data *cs_data) |
static void | __pi_spim_drv_fifo_enqueue_task (struct spim_cs_data *cs_data, pi_task_t *end_task) |
static struct spim_cs_data * | __pi_spim_get_cs_data (struct spim_driver_data *drv_data, int cs) |
static void | __pi_spim_cs_data_del (struct spim_driver_data *drv_data, int cs) |
static void | __pi_spim_cs_data_add (struct spim_driver_data *drv_data, struct spim_cs_data *cs_data) |
void | __pi_spi_freq_cb (void *args) |
#define RD_TMP_BUF_F |
Referenced by __spi_cpy_read_misaligned(), and __spim_handle_first_byte_copy().
#define RD_TMP_BUF_L |
Referenced by __spi_cpy_read_misaligned(), and __spim_handle_last_byte_copy().
#define SPIM_CS_DATA_GET_DRV_DATA | ( | cs_data | ) |
#define SPIM_TMP_BUF_SIZE |
#define SPIM_TMP_RD_SIZE |
#define SPIM_TMP_WR_SIZE |
#define WR_TMP_BUF_F |
Referenced by __spi_cpy_send_misaligned().
#define WR_TMP_BUF_L |
int __pi_spi_close | ( | struct spim_cs_data * | cs_data | ) |
References __pi_spim_cs_data_del(), spim_cs_data::cs, spim_driver_data::device_id, spim_cs_data::drv_data, spim_driver_data::drv_fifo, hal_soc_eu_clear_fc_mask(), spim_driver_data::nb_open, pi_data_free, pi_default_free, pi_fc_event_handler_clear(), pi_freq_callback_remove(), SOC_EVENT_UDMA_SPIM_EOT, spim_driver_data::spi_freq_cb, udma_ctrl_cg_enable(), and UDMA_SPIM_ID.
Referenced by pi_spi_close().
void __pi_spi_copy_async | ( | struct spim_cs_data * | cs_data, |
uint32_t | addr, | ||
void * | data, | ||
size_t | len, | ||
pi_spi_flags_e | flags, | ||
pi_task_t * | task | ||
) |
void __pi_spi_copy_async_2d | ( | struct spim_cs_data * | cs_data, |
uint32_t | addr, | ||
void * | data, | ||
size_t | len, | ||
size_t | stride, | ||
size_t | length, | ||
pi_spi_flags_e | flags, | ||
pi_task_t * | task | ||
) |
References __pi_spi_copy_async(), __pi_spim_drv_fifo_enqueue_task(), pi_task_t::data, disable_irq(), spim_driver_data::end_of_transfer, pi_task_t::next, PRINTF, restore_irq(), SPI_TRANSFER_TYPE_COPY_2D, SPIM_CS_DATA_GET_DRV_DATA, SPIM_DEV_ADDR_ID, SPIM_GAP_ADDR_ID, SPIM_LENGTH_ID, SPIM_STRIDE_ID, TR_TYPE_ID, and spim_driver_data::transfer_2d.
Referenced by __pi_spim_exec_next_transfer(), pi_spi_copy_2d(), and pi_spi_copy_2d_async().
void __pi_spi_freq_cb | ( | void * | args | ) |
References __pi_spi_clk_div_get(), spim_cs_data::cfg, spim_driver_data::cs_list, spim_driver_data::device_id, spim_cs_data::max_baudrate, spim_cs_data::next, spim_cs_data::phase, spim_cs_data::polarity, RX_CHANNEL, SPI_CMD_CFG, SPIM, TX_CHANNEL, and udma_channel_busy_get().
Referenced by __pi_spi_open().
|
inlinestatic |
References spim_cs_data::cfg.
Referenced by pi_spi_get_config().
int __pi_spi_open | ( | struct spim_cs_data ** | cs_data, |
struct pi_spi_conf * | conf | ||
) |
References __pi_spi_clk_div_get(), __pi_spi_freq_cb(), __pi_spim_cs_data_add(), __pi_spim_get_cs_data(), spim_cs_data::big_endian, spim_cs_data::cfg, spim_cs_data::chunk_size_rx, spim_cs_data::chunk_size_tx, spim_cs_data::cs, spim_driver_data::device_id, spim_driver_data::drv_fifo, hal_soc_eu_clear_fc_mask(), hal_soc_eu_set_fc_mask(), spim_cs_data::max_baudrate, memset(), spim_driver_data::nb_open, spim_cs_data::phase, pi_data_malloc, pi_default_malloc, pi_fc_event_handler_set(), pi_freq_callback_add(), pi_freq_callback_init(), spim_cs_data::polarity, PRINTF, printf, SOC_EVENT_UDMA_SPIM_EOT, SOC_EVENT_UDMA_SPIM_RX, SOC_EVENT_UDMA_SPIM_TX, SPI_CMD_CFG, spim_driver_data::spi_freq_cb, spim_eot_handler(), spim_rx_handler(), spim_tx_handler(), system_core_clock_get(), udma_ctrl_cg_disable(), UDMA_SPIM_ID, and spim_cs_data::wordsize.
Referenced by pi_spi_open().
void __pi_spi_receive_async | ( | struct spim_cs_data * | cs_data, |
void * | data, | ||
size_t | len, | ||
pi_spi_flags_e | flags, | ||
pi_task_t * | task | ||
) |
References __pi_spim_drv_fifo_enqueue(), spim_cs_data::big_endian, spim_transfer::byte_align, spim_cs_data::cfg, spim_transfer::cfg_cmd, spim_cs_data::cs, spim_transfer::data, spim_driver_data::device_id, spim_driver_data::end_of_transfer, spim_transfer::flags, hal_soc_eu_set_fc_mask(), spim_transfer::is_send, spim_transfer::len, spim_cs_data::max_baudrate, PRINTF, restore_irq(), RX_CHANNEL, SOC_EVENT_UDMA_SPIM_RX, SPI_CMD_EOT, SPI_CMD_RX_DATA, SPI_CMD_SOT, SPIM, SPIM_CS_DATA_GET_DRV_DATA, spim_enqueue_channel(), system_core_clock_get(), TX_CHANNEL, spim_cs_data::udma_cmd, UDMA_CORE_RX_CFG_EN, UDMA_CORE_TX_CFG_EN, and spim_cs_data::wordsize.
Referenced by __pi_spim_exec_next_transfer(), and pi_spi_receive_async().
void __pi_spi_receive_async_with_ucode | ( | struct spim_cs_data * | cs_data, |
void * | data, | ||
size_t | len, | ||
pi_spi_flags_e | flags, | ||
int | ucode_size, | ||
void * | ucode, | ||
pi_task_t * | task | ||
) |
References __pi_spim_drv_fifo_enqueue(), spim_transfer::byte_align, spim_transfer::cfg_cmd, spim_transfer::data, spim_driver_data::device_id, spim_driver_data::end_of_transfer, spim_transfer::flags, hal_soc_eu_set_fc_mask(), spim_transfer::is_send, spim_transfer::len, memcpy(), restore_irq(), RX_CHANNEL, SOC_EVENT_UDMA_SPIM_RX, SPIM, SPIM_CS_DATA_GET_DRV_DATA, spim_enqueue_channel(), TX_CHANNEL, spim_cs_data::udma_cmd, UDMA_CORE_RX_CFG_EN, and UDMA_CORE_TX_CFG_EN.
Referenced by pi_spi_receive_with_ucode().
uint8_t* __pi_spi_receive_ucode_set | ( | struct spim_cs_data * | cs_data, |
uint8_t * | ucode, | ||
size_t | size | ||
) |
References spim_cs_data::cfg, spim_cs_data::cs, memcpy(), SPI_CMD_SOT, spim_cs_data::ucode_rx, and spim_cs_data::ucode_rx_pos.
Referenced by pi_spi_receive_ucode_set().
void __pi_spi_receive_ucode_set_addr_info | ( | struct spim_cs_data * | cs_data, |
void * | addr, | ||
size_t | size | ||
) |
References spim_cs_data::ucode_rx_addr, and spim_cs_data::ucode_rx_addr_size.
Referenced by pi_spi_receive_ucode_set_addr_info().
void __pi_spi_send_async | ( | struct spim_cs_data * | cs_data, |
void * | data, | ||
size_t | len, | ||
pi_spi_flags_e | flags, | ||
pi_task_t * | task | ||
) |
References __pi_spim_drv_fifo_enqueue(), spim_cs_data::big_endian, spim_transfer::byte_align, spim_cs_data::cfg, spim_transfer::cfg_cmd, spim_cs_data::cs, spim_transfer::data, spim_driver_data::device_id, disable_irq(), spim_driver_data::end_of_transfer, spim_transfer::flags, hal_read32(), hal_soc_eu_set_fc_mask(), spim_transfer::is_send, spim_transfer::len, spim_cs_data::max_baudrate, PRINTF, SOC_EVENT_UDMA_SPIM_TX, SPI_CMD_EOT, SPI_CMD_SOT, SPI_CMD_TX_DATA, SPIM, SPIM_CS_DATA_GET_DRV_DATA, spim_enqueue_channel(), system_core_clock_get(), TX_CHANNEL, spim_cs_data::udma_cmd, UDMA_CORE_TX_CFG_EN, and spim_cs_data::wordsize.
Referenced by __pi_spim_exec_next_transfer(), and pi_spi_send_async().
void __pi_spi_send_async_with_ucode | ( | struct spim_cs_data * | cs_data, |
void * | data, | ||
size_t | len, | ||
pi_spi_flags_e | flags, | ||
int | ucode_size, | ||
void * | ucode, | ||
pi_task_t * | task | ||
) |
References __pi_spim_drv_fifo_enqueue(), spim_transfer::byte_align, spim_transfer::cfg_cmd, spim_transfer::data, spim_driver_data::device_id, spim_driver_data::end_of_transfer, spim_transfer::flags, hal_read32(), hal_soc_eu_set_fc_mask(), spim_transfer::is_send, spim_transfer::len, pi_time_wait_us(), PRINTF, restore_irq(), SOC_EVENT_UDMA_SPIM_TX, SPI_CMD_EOT, SPIM, SPIM_CS_DATA_GET_DRV_DATA, spim_enqueue_channel(), TX_CHANNEL, spim_cs_data::udma_cmd, and UDMA_CORE_TX_CFG_EN.
Referenced by pi_spi_send_with_ucode().
uint8_t* __pi_spi_send_ucode_set | ( | struct spim_cs_data * | cs_data, |
uint8_t * | ucode, | ||
size_t | size | ||
) |
References spim_cs_data::cfg, spim_cs_data::cs, memcpy(), SPI_CMD_SOT, spim_cs_data::ucode_tx, and spim_cs_data::ucode_tx_pos.
Referenced by pi_spi_send_ucode_set().
void __pi_spi_send_ucode_set_addr_info | ( | struct spim_cs_data * | cs_data, |
void * | addr, | ||
size_t | size | ||
) |
References spim_cs_data::ucode_tx_addr, and spim_cs_data::ucode_tx_addr_size.
Referenced by pi_spi_send_ucode_set_addr_info().
void __pi_spi_xfer_async | ( | struct spim_cs_data * | cs_data, |
void * | tx_data, | ||
void * | rx_data, | ||
size_t | len, | ||
pi_spi_flags_e | flags, | ||
pi_task_t * | task | ||
) |
References __pi_spim_drv_fifo_enqueue(), spim_cs_data::big_endian, spim_transfer::byte_align, spim_cs_data::cfg, spim_transfer::cfg_cmd, spim_cs_data::cs, spim_transfer::data, spim_driver_data::device_id, spim_driver_data::end_of_transfer, spim_transfer::flags, hal_read32(), hal_soc_eu_set_fc_mask(), spim_transfer::is_send, spim_transfer::len, spim_cs_data::max_baudrate, PRINTF, restore_irq(), RX_CHANNEL, SOC_EVENT_UDMA_SPIM_RX, SPI_CMD_EOT, SPI_CMD_FULL_DUPL, SPI_CMD_SOT, SPIM, SPIM_CS_DATA_GET_DRV_DATA, spim_enqueue_channel(), system_core_clock_get(), TX_CHANNEL, spim_cs_data::udma_cmd, UDMA_CORE_RX_CFG_EN, UDMA_CORE_TX_CFG_EN, and spim_cs_data::wordsize.
Referenced by __pi_spim_exec_next_transfer(), and pi_spi_transfer_async().
|
inlinestatic |
References spim_driver_data::cs_list, spim_cs_data::drv_data, and spim_cs_data::next.
Referenced by __pi_spi_open().
|
inlinestatic |
References spim_cs_data::cs, spim_driver_data::cs_list, and spim_cs_data::next.
Referenced by __pi_spi_close().
|
inlinestatic |
References pi_task_t::data, spim_transfer::data, spim_cs_data::drv_data, spim_driver_data::drv_fifo, spim_drv_fifo::fifo_head, spim_drv_fifo::fifo_tail, spim_transfer::flags, hal_compiler_barrier(), spim_transfer::is_send, spim_transfer::len, and pi_task_t::next.
Referenced by __pi_spi_receive_async(), __pi_spi_receive_async_with_ucode(), __pi_spi_send_async(), __pi_spi_send_async_with_ucode(), and __pi_spi_xfer_async().
|
inlinestatic |
|
inlinestatic |
References spim_driver_data::drv_fifo, spim_drv_fifo::fifo_head, spim_drv_fifo::fifo_tail, and pi_task_t::next.
Referenced by spim_eot_handler().
|
inlinestatic |
|
static |
References spim_cs_data::cs, spim_driver_data::cs_list, and spim_cs_data::next.
Referenced by __pi_spi_open().
void __spim_execute_callback | ( | void * | arg | ) |
void spim_eot_handler | ( | void * | arg | ) |
References __pi_spim_drv_fifo_pop(), __pi_spim_exec_next_transfer(), __pi_spim_exec_post_transfer(), __spim_exec_2d_transfer(), __spim_handle_end_of_transfer(), __spim_handle_first_byte_copy(), __spim_handle_last_byte_copy(), pi_task_t::data, spim_driver_data::end_of_transfer, spim_driver_data::first_byte_addr, spim_driver_data::last_byte_addr, spim_driver_data::last_byte_mask, spim_driver_data::post_transfer_task, PREALLOC_TASK_VALID_ID, PRINTF, spim_driver_data::repeat_transfer, SOC_EVENT_UDMA_SPIM_EOT, and spim_driver_data::transfer_2d.
Referenced by __pi_spi_open(), spim_rx_handler(), and spim_tx_handler().
void spim_rx_handler | ( | void * | arg | ) |
References hal_soc_eu_clear_fc_mask(), PRINTF, SOC_EVENT_UDMA_SPIM_EOT, SOC_EVENT_UDMA_SPIM_RX, spim_eot_handler(), UDMA_CHANNEL_NB_EVENTS_LOG2, and UDMA_SPIM_ID.
Referenced by __pi_spi_open().
void spim_tx_handler | ( | void * | arg | ) |
References hal_soc_eu_clear_fc_mask(), PRINTF, SOC_EVENT_UDMA_SPIM_EOT, SOC_EVENT_UDMA_SPIM_TX, spim_eot_handler(), UDMA_CHANNEL_NB_EVENTS_LOG2, and UDMA_SPIM_ID.
Referenced by __pi_spi_open().