18#ifndef __VSF_TEMPLATE_I2S_H__
19#define __VSF_TEMPLATE_I2S_H__
33#ifndef VSF_I2S_CFG_MULTI_CLASS
34# define VSF_I2S_CFG_MULTI_CLASS ENABLED
37#if defined(VSF_HW_I2S_COUNT) && !defined(VSF_HW_I2S_MASK)
38# define VSF_HW_I2S_MASK VSF_HAL_COUNT_TO_MASK(VSF_HW_I2S_COUNT)
41#if defined(VSF_HW_I2S_MASK) && !defined(VSF_HW_I2S_COUNT)
42# define VSF_HW_I2S_COUNT VSF_HAL_MASK_TO_COUNT(VSF_HW_I2S_MASK)
46#ifndef VSF_I2S_CFG_PREFIX
47# if VSF_I2S_CFG_MULTI_CLASS == ENABLED
48# define VSF_I2S_CFG_PREFIX vsf
49# elif defined(VSF_HW_I2S_COUNT) && (VSF_HW_I2S_COUNT != 0)
50# define VSF_I2S_CFG_PREFIX vsf_hw
52# define VSF_I2S_CFG_PREFIX vsf
56#ifndef VSF_I2S_CFG_FUNCTION_RENAME
57# define VSF_I2S_CFG_FUNCTION_RENAME ENABLED
60#ifndef VSF_I2S_CFG_REIMPLEMENT_TYPE_MODE
61# define VSF_I2S_CFG_REIMPLEMENT_TYPE_MODE DISABLED
64#ifndef VSF_I2S_CFG_REIMPLEMENT_TYPE_IRQ_MASK
65# define VSF_I2S_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED
68#ifndef VSF_I2S_CFG_REIMPLEMENT_TYPE_STATUS
69# define VSF_I2S_CFG_REIMPLEMENT_TYPE_STATUS DISABLED
75#if VSF_I2S_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
76# define VSF_I2S_CFG_REIMPLEMENT_TYPE_CFG DISABLED
82#if VSF_I2S_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
83# define VSF_I2S_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED
86#ifndef VSF_I2S_CFG_INHERT_HAL_CAPABILITY
87# define VSF_I2S_CFG_INHERT_HAL_CAPABILITY ENABLED
92#define VSF_I2S_APIS(__prefix_name) \
93 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, i2s, init, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr, vsf_i2s_cfg_t *cfg_ptr) \
94 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, i2s, tx_init, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr, vsf_i2s_cfg_t *cfg_ptr) \
95 __VSF_HAL_TEMPLATE_API(__prefix_name, void, i2s, tx_fini, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr) \
96 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, i2s, tx_start, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr) \
97 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, i2s, rx_init, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr, vsf_i2s_cfg_t *cfg_ptr) \
98 __VSF_HAL_TEMPLATE_API(__prefix_name, void, i2s, rx_fini, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr) \
99 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, i2s, rx_start, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr) \
100 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, i2s, enable, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr) \
101 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, i2s, disable, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr) \
102 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_i2s_status_t, i2s, status, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr) \
103 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_i2s_capability_t, i2s, capability, VSF_MCONNECT(__prefix_name, _i2s_t) *i2s_ptr)
107#if VSF_I2S_CFG_REIMPLEMENT_TYPE_MODE == DISABLED
159#if VSF_I2S_CFG_REIMPLEMENT_TYPE_IRQ_MASK == DISABLED
171#if VSF_I2S_CFG_REIMPLEMENT_TYPE_STATUS == DISABLED
180#if VSF_I2S_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
182#if VSF_I2S_CFG_INHERT_HAL_CAPABILITY == ENABLED
187 bool is_src_supported;
189 bool is_dbuffer_supported;
194#if VSF_I2S_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
276#undef __VSF_HAL_TEMPLATE_API
277#define __VSF_HAL_TEMPLATE_API VSF_HAL_TEMPLATE_API_FP
282#if VSF_I2S_CFG_MULTI_CLASS == ENABLED
461#if VSF_I2S_CFG_FUNCTION_RENAME == ENABLED
462# define __vsf_i2s_t VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_t)
463# define vsf_i2s_init(__i2s, ...) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_init) ((__vsf_i2s_t *)(__i2s), ##__VA_ARGS__)
464# define vsf_i2s_enable(__i2s) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_enable) ((__vsf_i2s_t *)(__i2s))
465# define vsf_i2s_disable(__i2s) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_disable) ((__vsf_i2s_t *)(__i2s))
466# define vsf_i2s_status(__i2s) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_status) ((__vsf_i2s_t *)(__i2s))
467# define vsf_i2s_capability(__i2s) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_capability) ((__vsf_i2s_t *)(__i2s))
469# define vsf_i2s_tx_init(__i2s, ...) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_tx_init) ((__vsf_i2s_t *)(__i2s), ##__VA_ARGS__)
470# define vsf_i2s_tx_fini(__i2s, ...) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_tx_fini) ((__vsf_i2s_t *)(__i2s), ##__VA_ARGS__)
471# define vsf_i2s_tx_start(__i2s) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_tx_start) ((__vsf_i2s_t *)(__i2s))
473# define vsf_i2s_rx_init(__i2s, ...) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_rx_init) ((__vsf_i2s_t *)(__i2s), ##__VA_ARGS__)
474# define vsf_i2s_rx_fini(__i2s, ...) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_rx_fini) ((__vsf_i2s_t *)(__i2s), ##__VA_ARGS__)
475# define vsf_i2s_rx_start(__i2s) VSF_MCONNECT(VSF_I2S_CFG_PREFIX, _i2s_rx_start) ((__vsf_i2s_t *)(__i2s))
vsf_err_t
Definition __type.h:42
vsf_i2s_mode_t
Definition i2s.h:37
vsf_i2s_irq_mask_t
Definition i2s.h:32
vsf_arch_prio_t
Definition cortex_a_generic.h:88
unsigned short uint16_t
Definition lvgl.h:41
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
Definition vsf_template_i2s.h:181
inherit(vsf_peripheral_capability_t) struct
Definition vsf_template_i2s.h:183
i2s_capability
Definition vsf_template_i2s.h:190
i2s configuration
Definition vsf_template_i2s.h:257
vsf_i2s_mode_t mode
Definition vsf_template_i2s.h:258
uint16_t buffer_size
Definition vsf_template_i2s.h:266
vsf_i2s_isr_t isr
Definition vsf_template_i2s.h:270
uint8_t channel_num
Definition vsf_template_i2s.h:268
uint32_t hw_sample_rate
Definition vsf_template_i2s.h:262
uint8_t * buffer
Definition vsf_template_i2s.h:264
uint32_t data_sample_rate
Definition vsf_template_i2s.h:260
i2s interrupt configuration
Definition vsf_template_i2s.h:241
vsf_arch_prio_t prio
Definition vsf_template_i2s.h:246
vsf_i2s_isr_handler_t * handler_fn
Definition vsf_template_i2s.h:242
void * target_ptr
Definition vsf_template_i2s.h:244
Definition vsf_template_i2s.h:275
Definition vsf_template_i2s.h:172
Definition vsf_template_i2s.h:283
const vsf_i2s_op_t * op
Definition vsf_template_i2s.h:284
Definition vsf_template_hal_driver.h:203
Definition vsf_template_hal_driver.h:196
vk_av_control_value_t value
Definition vsf_audio.h:171
fsm_rt_t
Definition vsf_fsm.h:315
#define vsf_i2s_capability(__i2s)
Definition vsf_template_i2s.h:467
#define vsf_i2s_init(__i2s,...)
Definition vsf_template_i2s.h:463
#define vsf_i2s_enable(__i2s)
Definition vsf_template_i2s.h:464
void vsf_i2s_fini(vsf_i2s_t *i2s_ptr)
finalize a i2s instance.
#define vsf_i2s_disable(__i2s)
Definition vsf_template_i2s.h:465
#define vsf_i2s_status(__i2s)
Definition vsf_template_i2s.h:466
void vsf_i2s_isr_handler_t(void *target_ptr, vsf_i2s_t *i2s_ptr, vsf_i2s_irq_mask_t irq_mask)
i2s interrupt callback function prototype.
Definition vsf_template_i2s.h:230
@ VSF_I2S_IRQ_ALL_BITS_MASK
Definition vsf_template_i2s.h:167
#define vsf_i2s_rx_fini(__i2s,...)
Definition vsf_template_i2s.h:474
#define VSF_I2S_APIS(__prefix_name)
Definition vsf_template_i2s.h:92
#define vsf_i2s_rx_init(__i2s,...)
Definition vsf_template_i2s.h:473
@ VSF_I2S_FRAME_BITLEN_COUNT
Definition vsf_template_i2s.h:140
@ VSF_I2S_DATA_BITLEN_MASK
Definition vsf_template_i2s.h:136
@ VSF_I2S_STANDARD_COUNT
Definition vsf_template_i2s.h:145
@ VSF_I2S_FRAME_BITLEN_MASK
Definition vsf_template_i2s.h:141
@ VSF_I2S_MODE_COUNT
Definition vsf_template_i2s.h:131
@ VSF_I2S_MODE_MASK
Definition vsf_template_i2s.h:132
@ VSF_I2S_MODE_ALL_BITS_MASK
Definition vsf_template_i2s.h:150
@ VSF_I2S_DATA_BITLEN_COUNT
Definition vsf_template_i2s.h:135
@ VSF_I2S_STANDARD_MASK
Definition vsf_template_i2s.h:146
#define vsf_i2s_tx_start(__i2s)
Definition vsf_template_i2s.h:471
#define vsf_i2s_rx_start(__i2s)
Definition vsf_template_i2s.h:475
vsf_i2s_mode_t
Definition vsf_template_i2s.h:108
@ VSF_I2S_MCLK_OUTPUT
Definition vsf_template_i2s.h:126
@ VSF_I2S_STANDARD_LSB
Definition vsf_template_i2s.h:122
@ VSF_I2S_DATA_BITLEN_16
Definition vsf_template_i2s.h:112
@ VSF_I2S_FRAME_BITLEN_32
Definition vsf_template_i2s.h:118
@ VSF_I2S_FRAME_BITLEN_16
Definition vsf_template_i2s.h:116
@ VSF_I2S_STANDARD_MSB
Definition vsf_template_i2s.h:121
@ VSF_I2S_MODE_MASTER
Definition vsf_template_i2s.h:109
@ VSF_I2S_LRCK_POL
Definition vsf_template_i2s.h:124
@ VSF_I2S_DATA_BITLEN_32
Definition vsf_template_i2s.h:114
@ VSF_I2S_STANDARD_PHILIPS
Definition vsf_template_i2s.h:120
@ VSF_I2S_DATA_BITLEN_24
Definition vsf_template_i2s.h:113
@ VSF_I2S_FRAME_BITLEN_24
Definition vsf_template_i2s.h:117
@ VSF_I2S_MODE_SLAVE
Definition vsf_template_i2s.h:110
@ VSF_I2S_BCK_POL
Definition vsf_template_i2s.h:125
#define vsf_i2s_tx_fini(__i2s,...)
Definition vsf_template_i2s.h:470
#define vsf_i2s_tx_init(__i2s,...)
Definition vsf_template_i2s.h:469
vsf_i2s_irq_mask_t
Definition vsf_template_i2s.h:160
@ VSF_I2S_IRQ_MASK_RX_TGL_BUFFER
Definition vsf_template_i2s.h:162
@ VSF_I2S_IRQ_MASK_TX_TGL_BUFFER
Definition vsf_template_i2s.h:161