FreeRTOS port on GAP8/RISC-V
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gap9/pmsis/drivers/udma/i2s/i2s_internal.c File Reference

Macros

#define I2S_ASRC_CHANNEL_OFFSET
 

Functions

static void __pi_i2s_rx_handler (struct i2s_itf_slot_s *slot)
 
static uint32_t __pi_i2s_clk_div (uint32_t i2s_freq)
 
static void __pi_i2s_slot_conf_init (struct pi_i2s_conf *conf)
 
static int32_t __pi_i2s_slot_conf_apply (struct i2s_itf_slot_s *slot, uint8_t is_rx)
 
static int32_t __pi_i2s_slot_conf_set (struct i2s_itf_data_s *fifo, struct pi_i2s_conf *conf)
 
static void __pi_i2s_slot_conf_get (struct i2s_itf_data_s *fifo, struct pi_i2s_conf *conf)
 
static void __pi_i2s_resume (struct i2s_itf_data_s *fifo)
 
static void __pi_i2s_suspend (struct i2s_itf_data_s *fifo)
 
static uint8_t __pi_i2s_enqueue (struct i2s_itf_slot_s *slot)
 
static void * __pi_i2s_pop (struct i2s_itf_slot_s *slot)
 
static void __pi_i2s_tx_handler (struct i2s_itf_slot_s *slot)
 
static void __pi_i2s_timestamp_enable (struct i2s_itf_data_s *itf_data, pi_udma_timestamp_t *timestamp)
 
void __pi_i2s_conf_init (struct pi_i2s_conf *conf)
 Init i2s configuration structure. More...
 
int32_t __pi_i2s_open (struct pi_i2s_conf *conf, struct i2s_itf_data_s **device_data)
 Open i2s device. More...
 
void __pi_i2s_close (struct i2s_itf_data_s *itf_data)
 Close i2s device. More...
 
int32_t __pi_i2s_ioctl (struct i2s_itf_data_s *itf_data, uint32_t cmd, void *arg)
 Ioctl function. More...
 
int32_t __pi_i2s_channel_read_async (struct i2s_itf_data_s *itf_data, uint32_t channel, pi_task_t *task)
 Load data from micro. More...
 
int32_t __pi_i2s_read_status (pi_task_t *task, void **mem_block, size_t *size)
 Return status. More...
 
int32_t __pi_i2s_channel_write_async (struct i2s_itf_data_s *itf_data, uint32_t channel, void *mem_block, size_t size, pi_task_t *task)
 Send data to speakers. More...
 
int32_t __pi_i2s_write_status (pi_task_t *task)
 Return status. More...
 

Variables

struct i2s_itf_data_sg_i2s_itf_data [UDMA_NB_I2S]
 

Macro Definition Documentation

#define I2S_ASRC_CHANNEL_OFFSET

Function Documentation

int32_t __pi_i2s_channel_read_async ( struct i2s_itf_data_s itf_data,
uint32_t  channel,
pi_task_t task 
)
int32_t __pi_i2s_channel_write_async ( struct i2s_itf_data_s itf_data,
uint32_t  channel,
void *  mem_block,
size_t  size,
pi_task_t task 
)
Parameters
itf_dataPointer to driver data.
channelID of the channel to use.
mem_blockPointer to data buffer.
sizeSize of data to send.
taskPointer to struct pi_task.

References __pi_irq_handle_end_of_task(), pi_task_t::data, disable_irq(), i2s_itf_slot_s::fifo_head, i2s_itf_slot_s::fifo_tail, i2s_itf_slot_s::nb_ready_buffer, pi_task_t::next, restore_irq(), i2s_itf_data_s::slots, TX_CHANNEL, and i2s_itf_slot_s::tx_conf.

Referenced by pi_i2s_channel_write_async().

static uint32_t __pi_i2s_clk_div ( uint32_t  i2s_freq)
inlinestatic

References I2S_TRACE, and pi_freq_get().

Referenced by __pi_i2s_resume().

void __pi_i2s_conf_init ( struct pi_i2s_conf *  conf)
Parameters
confPointer to i2s conf.
static uint8_t __pi_i2s_enqueue ( struct i2s_itf_slot_s slot)
static
int32_t __pi_i2s_ioctl ( struct i2s_itf_data_s itf_data,
uint32_t  cmd,
void *  arg 
)
int32_t __pi_i2s_open ( struct pi_i2s_conf *  conf,
struct i2s_itf_data_s **  device_data 
)
Parameters
confPointer to i2s conf.
device_dataPointer to device data.
Return values
0Operation is successful.
ERRNOError code.

References __pi_i2s_conf_apply(), __pi_i2s_conf_init(), __pi_i2s_handler(), __pi_i2s_slot_conf_set(), i2s_itf_data_s::block_size, i2s_itf_data_s::channels, i2s_itf_data_s::clk, i2s_itf_data_s::clkcfg, i2s_itf_data_s::cur_buffer, i2s_itf_data_s::cur_read_buffer, i2s_itf_data_s::device_id, i2s_itf_slot_s::device_id, i2s_itf_data_s::fifo_head, i2s_itf_slot_s::fifo_head, i2s_itf_data_s::fifo_tail, i2s_itf_slot_s::fifo_tail, i2s_itf_data_s::format, i2s_itf_data_s::frame_clk_freq, i2s_itf_data_s::frequency, i2s_itf_data_s::glb_setup, hal_soc_eu_set_fc_mask(), hal_udma_ctrl_cg_disable(), hal_udma_ctrl_reset_set(), I2S_CLK_EDGE_RISE, I2S_CLK_EXT_SRC_PAD, I2S_GLB_PDM_2CH_DIS, i2s_itf_data_s::i2s_id, I2S_TRACE, I2S_TRACE_ERR, I2S_WS_EDGE_RISE, I2S_WS_EXT_SRC_PAD, I2S_WS_TYPE_PULSE, i2s_itf_data_s::mem_slab, i2s_itf_data_s::nb_open, i2s_itf_data_s::nb_ready_buffer, i2s_itf_data_s::options, i2s_itf_data_s::pdm_decimation, i2s_itf_data_s::pdm_filter_ena, i2s_itf_data_s::pdm_shift, i2s_itf_data_s::pending_size, pi_fc_event_handler_set(), pi_fc_l1_free(), pi_fc_l1_malloc(), pi_l2_malloc(), i2s_itf_data_s::pingpong_buffers, i2s_itf_data_s::reenqueue, RX_CHANNEL, i2s_itf_slot_s::rx_conf, i2s_itf_slot_s::slot_cfg, i2s_itf_slot_s::slot_id, i2s_itf_data_s::slots, SOC_EVENT_UDMA_I2S_RX, SOC_EVENT_UDMA_I2S_TX, TX_CHANNEL, i2s_itf_slot_s::tx_conf, i2s_itf_data_s::udma_cfg, i2s_itf_slot_s::udma_chan_id_rx, i2s_itf_slot_s::udma_chan_id_tx, UDMA_CORE_RX_CFG_DATASIZE, UDMA_CORE_RX_CFG_EN, udma_ctrl, udma_i2s, UDMA_I2S_CLKCFG_SETUP_CLK_EDGE, UDMA_I2S_CLKCFG_SETUP_CLK_EXT_SRC, UDMA_I2S_CLKCFG_SETUP_CLK_SRC, UDMA_I2S_CLKCFG_SETUP_WS_EDGE, UDMA_I2S_CLKCFG_SETUP_WS_EXT_SRC, UDMA_I2S_CLKCFG_SETUP_WS_SRC, UDMA_I2S_CLKCFG_SETUP_WS_TYPE, UDMA_I2S_GLB_SETUP_FRAME_LENGTH, UDMA_I2S_GLB_SETUP_FULL_DUPLEX_EN, UDMA_I2S_GLB_SETUP_PDM_2CH, UDMA_I2S_GLB_SETUP_PDM_EN, UDMA_I2S_GLB_SETUP_SLOT_WIDTH, UDMA_I2S_GLB_SETUP_WS_DELAY, UDMA_I2S_ID, udma_init_device(), and i2s_itf_data_s::word_size.

static void* __pi_i2s_pop ( struct i2s_itf_slot_s slot)
static
int32_t __pi_i2s_read_status ( pi_task_t task,
void **  mem_block,
size_t *  size 
)
Parameters
taskPointer to struct pi_task.
mem_blockPointer to data buffer.
sizePointer to size.

References pi_task_t::data.

static void __pi_i2s_slot_conf_get ( struct i2s_itf_data_s fifo,
struct pi_i2s_conf *  conf 
)
static
static void __pi_i2s_slot_conf_init ( struct pi_i2s_conf *  conf)
static
static int32_t __pi_i2s_slot_conf_set ( struct i2s_itf_data_s fifo,
struct pi_i2s_conf *  conf 
)
static
static void __pi_i2s_timestamp_enable ( struct i2s_itf_data_s itf_data,
pi_udma_timestamp_t *  timestamp 
)
static
int32_t __pi_i2s_write_status ( pi_task_t task)
Parameters
taskPointer to struct pi_task.

References pi_task_t::data.

Referenced by pi_i2s_write_status().

Variable Documentation

struct i2s_itf_data_s* g_i2s_itf_data[UDMA_NB_I2S]