18#ifndef __VSF_TEMPLATE_DAC_H__
19#define __VSF_TEMPLATE_DAC_H__
33#ifndef VSF_DAC_CFG_MULTI_CLASS
34# define VSF_DAC_CFG_MULTI_CLASS ENABLED
37#if defined(VSF_HW_DAC_COUNT) && !defined(VSF_HW_DAC_MASK)
38# define VSF_HW_DAC_MASK VSF_HAL_COUNT_TO_MASK(VSF_HW_DAC_COUNT)
41#if defined(VSF_HW_DAC_MASK) && !defined(VSF_HW_DAC_COUNT)
42# define VSF_HW_DAC_COUNT VSF_HAL_MASK_TO_COUNT(VSF_HW_DAC_MASK)
46#ifndef VSF_DAC_CFG_PREFIX
47# if VSF_DAC_CFG_MULTI_CLASS == ENABLED
48# define VSF_DAC_CFG_PREFIX vsf
49# elif defined(VSF_HW_DAC_COUNT) && (VSF_HW_DAC_COUNT != 0)
50# define VSF_DAC_CFG_PREFIX vsf_hw
52# define VSF_DAC_CFG_PREFIX vsf
56#ifndef VSF_DAC_CFG_FUNCTION_RENAME
57# define VSF_DAC_CFG_FUNCTION_RENAME ENABLED
60#ifndef VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK
61# define VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED
67#if VSF_DAC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG == DISABLED
68# define VSF_DAC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG DISABLED
74#if VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
75# define VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG DISABLED
81#if VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
82# define VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED
85#ifndef VSF_DAC_CFG_INHERT_HAL_CAPABILITY
86# define VSF_DAC_CFG_INHERT_HAL_CAPABILITY ENABLED
91#define VSF_DAC_APIS(__prefix_name) \
92 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, init, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_cfg_t *cfg_ptr) \
93 __VSF_HAL_TEMPLATE_API(__prefix_name, void, dac, fini, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
94 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, dac, enable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
95 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, dac, disable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
96 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_dac_status_t, dac, status, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
97 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_dac_capability_t, dac, capability, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr) \
98 __VSF_HAL_TEMPLATE_API(__prefix_name, void, dac, irq_enable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_irq_mask_t irq_mask) \
99 __VSF_HAL_TEMPLATE_API(__prefix_name, void, dac, irq_disable, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_irq_mask_t irq_mask) \
100 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, channel_request_once, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_channel_cfg_t *cfg, uint_fast16_t value) \
101 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, channel_config, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, vsf_dac_channel_cfg_t *cfgs_ptr, uint_fast8_t cnt) \
102 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, dac, channel_request, VSF_MCONNECT(__prefix_name, _dac_t) *dac_ptr, void *values_ptr, uint_fast32_t cnt)
106#if VSF_DAC_CFG_REIMPLEMENT_TYPE_IRQ_MASK == DISABLED
119#if VSF_ADC_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG == DISABLED
126#if VSF_DAC_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
142#if VSF_DAC_CFG_REIMPLEMENT_TYPE_STATUS == DISABLED
153#if VSF_DAC_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
155#if VSF_DAC_CFG_INHERT_HAL_CAPABILITY == ENABLED
167#undef __VSF_HAL_TEMPLATE_API
168#define __VSF_HAL_TEMPLATE_API VSF_HAL_TEMPLATE_API_FP
173#if VSF_DAC_CFG_MULTI_CLASS == ENABLED
364#if VSF_DAC_CFG_FUNCTION_RENAME == ENABLED
365# define __vsf_dac_t VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_t)
366# define vsf_dac_init(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_init) ((__vsf_dac_t *)(__DAC), ##__VA_ARGS__)
367# define vsf_dac_fini(__DAC) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_fini) ((__vsf_dac_t *)(__DAC))
368# define vsf_dac_enable(__DAC) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_enable) ((__vsf_dac_t *)(__DAC))
369# define vsf_dac_disable(__DAC) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_disable) ((__vsf_dac_t *)(__DAC))
370# define vsf_dac_status(__DAC) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_status) ((__vsf_dac_t *)(__DAC))
371# define vsf_dac_capability(__DAC) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_capability) ((__vsf_dac_t *)(__DAC))
372# define vsf_dac_irq_enable(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_irq_enable) ((__vsf_dac_t *)(__DAC), ##__VA_ARGS__)
373# define vsf_dac_irq_disable(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_irq_disable) ((__vsf_dac_t *)(__DAC), ##__VA_ARGS__)
374# define vsf_dac_channel_request_once(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_channel_request_once) ((__vsf_dac_t *)(__DAC), ##__VA_ARGS__)
375# define vsf_dac_channel_config(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_channel_config) ((__vsf_dac_t *)(__DAC), ##__VA_ARGS__)
376# define vsf_dac_channel_request(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_PREFIX, _dac_channel_request) ((__vsf_dac_t *)(__DAC), ##__VA_ARGS__)
vsf_err_t
Definition __type.h:42
vsf_arch_prio_t
Definition cortex_a_generic.h:88
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
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned int uint_fast32_t
Definition stdint.h:27
unsigned short uint_fast16_t
Definition stdint.h:25
Definition vsf_template_dac.h:154
uint8_t min_resolution_bits
Definition vsf_template_dac.h:161
inherit(vsf_peripheral_capability_t) vsf_dac_irq_mask_t irq_mask
uint8_t channel_count
Definition vsf_template_dac.h:162
uint8_t max_resolution_bits
Definition vsf_template_dac.h:160
dac configuration
Definition vsf_template_dac.h:137
vsf_dac_isr_t isr
Definition vsf_template_dac.h:138
dac channel configuration
Definition vsf_template_dac.h:120
uint8_t channel
Definition vsf_template_dac.h:121
uint8_t resolution
Definition vsf_template_dac.h:122
Definition vsf_template_dac.h:130
vsf_arch_prio_t prio
Definition vsf_template_dac.h:133
vsf_dac_isr_handler_t * handler_fn
Definition vsf_template_dac.h:131
void * target_ptr
Definition vsf_template_dac.h:132
Definition vsf_template_dac.h:166
Definition vsf_template_dac.h:143
Definition vsf_template_dac.h:174
const vsf_dac_op_t * op
Definition vsf_template_dac.h:175
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_dac_channel_config(__DAC,...)
Definition vsf_template_dac.h:375
void vsf_dac_isr_handler_t(void *target_ptr, vsf_dac_t *dac_ptr, vsf_dac_irq_mask_t irq_mask)
Definition vsf_template_dac.h:128
#define vsf_dac_fini(__DAC)
Definition vsf_template_dac.h:367
#define vsf_dac_irq_enable(__DAC,...)
Definition vsf_template_dac.h:372
#define vsf_dac_channel_request(__DAC,...)
Definition vsf_template_dac.h:376
vsf_dac_irq_mask_t
Definition vsf_template_dac.h:107
@ VSF_DAC_IRQ_MASK_IDLE
Definition vsf_template_dac.h:108
@ VSF_DAC_IRQ_MASK_CPL
Definition vsf_template_dac.h:109
#define vsf_dac_disable(__DAC)
Definition vsf_template_dac.h:369
#define vsf_dac_init(__DAC,...)
Definition vsf_template_dac.h:366
#define vsf_dac_status(__DAC)
Definition vsf_template_dac.h:370
#define VSF_DAC_APIS(__prefix_name)
Definition vsf_template_dac.h:91
@ VSF_DAC_IRQ_ALL_BITS_MASK
Definition vsf_template_dac.h:115
@ VSF_DAC_IRQ_COUNT
Definition vsf_template_dac.h:114
#define vsf_dac_irq_disable(__DAC,...)
Definition vsf_template_dac.h:373
#define vsf_dac_enable(__DAC)
Definition vsf_template_dac.h:368
#define vsf_dac_channel_request_once(__DAC,...)
Definition vsf_template_dac.h:374
#define vsf_dac_capability(__DAC)
Definition vsf_template_dac.h:371