18#if VSF_HAL_USE_DAC == ENABLED
24#define vsf_real_dac_t VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_t)
25#define vsf_real_dac_capability VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_capability)
27#ifndef VSF_DAC_CFG_REIMPLEMENT_API_CAPABILITY
28# define VSF_DAC_CFG_REIMPLEMENT_API_CAPABILITY DISABLED
31#ifdef VSF_DAC_CFG_IMP_REMAP_PREFIX
32# undef VSF_DAC_CFG_REIMPLEMENT_API_CAPABILITY
33# define VSF_DAC_CFG_REIMPLEMENT_API_CAPABILITY ENABLED
36#if VSF_DAC_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
37# ifndef VSF_DAC_CFG_CAPABILITY_IRQ_MASK
38# define VSF_DAC_CFG_CAPABILITY_IRQ_MASK VSF_DAC_IRQ_ALL_BITS_MASK
40# ifndef VSF_DAC_CFG_CAPABILITY_MAX_RESOLUTION_BITS
41# define VSF_DAC_CFG_CAPABILITY_MAX_RESOLUTION_BITS 12
43# ifndef VSF_DAC_CFG_CAPABILITY_MIN_RESOLUTION_BITS
44# define VSF_DAC_CFG_CAPABILITY_MIN_RESOLUTION_BITS 8
46# ifndef VSF_DAC_CFG_CAPABILITY_CHANNEL_COUNT
47# define VSF_DAC_CFG_CAPABILITY_CHANNEL_COUNT 4
54#if VSF_DAC_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
58 .irq_mask = VSF_DAC_CFG_CAPABILITY_IRQ_MASK,
60 .min_resolution_bits = VSF_DAC_CFG_CAPABILITY_MIN_RESOLUTION_BITS,
61 .channel_count = VSF_DAC_CFG_CAPABILITY_CHANNEL_COUNT,
64 return dac_capability;
70#undef VSF_DAC_CFG_REIMPLEMENT_API_CAPABILITY
71#undef VSF_DAC_CFG_CAPABILITY_IRQ_MASK
72#undef VSF_DAC_CFG_CAPABILITY_MAX_RESOLUTION_BITS
73#undef VSF_DAC_CFG_CAPABILITY_MIN_RESOLUTION_BITS
74#undef VSF_DAC_CFG_CAPABILITY_CHANNEL_COUNT
77#undef vsf_real_dac_capability
81#ifdef VSF_DAC_CFG_IMP_REMAP_PREFIX
82# define vsf_imp_dac_t VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_t)
83# define vsf_imp_dac_init(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_init)
84# define vsf_imp_dac_fini(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_fini)
85# define vsf_imp_dac_enable(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_enable)
86# define vsf_imp_dac_disable(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_disable)
87# define vsf_imp_dac_status(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_status)
88# define vsf_imp_dac_capability(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_capability)
89# define vsf_imp_dac_irq_enable(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_irq_enable)
90# define vsf_imp_dac_irq_disable(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_irq_disable)
91# define vsf_imp_dac_channel_request_once(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_channel_request_once)
92# define vsf_imp_dac_channel_config(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_channel_config)
93# define vsf_imp_dac_channel_request(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_PREFIX, _dac_channel_request)
95# define vsf_remap_dac_t VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_t)
96# define vsf_remap_dac_init(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_init)
97# define vsf_remap_dac_fini(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_fini)
98# define vsf_remap_dac_enable(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_enable)
99# define vsf_remap_dac_disable(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_disable)
100# define vsf_remap_dac_status(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_status)
101# define vsf_remap_dac_capability(__DAC) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_capability)
102# define vsf_remap_dac_irq_enable(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_irq_enable)
103# define vsf_remap_dac_irq_disable(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_irq_disable)
104# define vsf_remap_dac_channel_request_once(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_channel_request_once)
105# define vsf_remap_dac_channel_config(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_channel_config)
106# define vsf_remap_dac_channel_request(__DAC, ...) VSF_MCONNECT(VSF_DAC_CFG_IMP_REMAP_PREFIX, _dac_channel_request)
108# define VSF_DAC_CFG_IMP_REMAP_FUNCTIONS \
109 vsf_err_t vsf_imp_dac_init(vsf_imp_dac_t *dac) \
111 VSF_HAL_ASSERT(dac != NULL); \
112 return vsf_remap_dac_init((vsf_remap_dac_t *)dac); \
115 void vsf_imp_dac_fini(vsf_imp_dac_t *dac) \
117 VSF_HAL_ASSERT(dac != NULL); \
118 vsf_remap_dac_fini((vsf_remap_dac_t *)dac); \
121 vsf_remap_dac_status_t vsf_imp_dac_status(vsf_imp_dac_t *dac) \
123 VSF_HAL_ASSERT(dac != NULL); \
124 return vsf_remap_dac_status((vsf_remap_dac_t *)dac); \
127 vsf_remap_dac_capability_t vsf_imp_dac_capability(vsf_imp_dac_t *dac) \
129 VSF_HAL_ASSERT(dac != NULL); \
130 return vsf_remap_dac_capability((vsf_remap_dac_t *)dac); \
133 fsm_rt_t vsf_imp_dac_enable(vsf_imp_dac_t *dac) \
135 VSF_HAL_ASSERT(dac != NULL); \
136 return vsf_remap_dac_enable((vsf_remap_dac_t *)dac); \
139 fsm_rt_t vsf_imp_dac_disable(vsf_imp_dac_t *dac) \
141 VSF_HAL_ASSERT(dac != NULL); \
142 return vsf_remap_dac_disable((vsf_remap_dac_t *)dac); \
145 void vsf_imp_dac_irq_enable(vsf_imp_dac_t *dac, vsf_remap_dac_irq_mask_t irq_mask) \
147 VSF_HAL_ASSERT(dac != NULL); \
148 vsf_remap_dac_irq_enable((vsf_remap_dac_t *)dac, irq_mask); \
151 void vsf_imp_dac_irq_disable(vsf_imp_dac_t *dac, vsf_remap_dac_irq_mask_t irq_mask) \
153 VSF_HAL_ASSERT(dac != NULL); \
154 vsf_remap_dac_irq_disable((vsf_remap_dac_t *)dac, irq_mask); \
157 vsf_err_t vsf_imp_dac_channel_request_once(vsf_imp_dac_t *dac, \
158 vsf_remap_dac_channel_cfg_t *channel_cfg, uint_fast16_t value) \
160 VSF_HAL_ASSERT(dac != NULL); \
161 return vsf_remap_dac_channel_request_once((vsf_remap_dac_t *)dac, channel_cfg, value); \
164 vsf_err_t vsf_imp_dac_channel_config(vsf_imp_dac_t *dac, \
165 vsf_remap_dac_channel_cfg_t *channel_cfgs, uint_fast8_t channel_cfgs_cnt) \
167 VSF_HAL_ASSERT(dac != NULL); \
168 return vsf_remap_dac_channel_config((vsf_remap_dac_t *)dac, channel_cfgs, channel_cfgs_cnt);\
171 vsf_err_t vsf_imp_dac_channel_request(vsf_imp_dac_t *dac, \
172 void *buffer, uint_fast32_t count) \
174 VSF_HAL_ASSERT(dac != NULL); \
175 return vsf_remap_dac_channel_request((vsf_remap_dac_t *)dac, buffer, count); \
184#define VSF_HAL_TEMPLATE_IMP_NAME _dac
185#define VSF_HAL_TEMPLATE_IMP_UPCASE_NAME _DAC
187#ifndef VSF_DAC_CFG_IMP_PREFIX
188# error "Please define VSF_DAC_CFG_IMP_PREFIX in dac driver"
191#ifndef VSF_DAC_CFG_IMP_UPCASE_PREFIX
192# error "Please define VSF_DAC_CFG_IMP_UPCASE_PREFIX in dac driver"
195#ifndef VSF_DAC_CFG_IMP_COUNT_MASK_PREFIX
196# define VSF_DAC_CFG_IMP_COUNT_MASK_PREFIX VSF_DAC_CFG_IMP_UPCASE_PREFIX
199#ifdef VSF_DAC_CFG_IMP_REMAP_FUNCTIONS
200# define VSF_HAL_CFG_IMP_REMAP_FUNCTIONS VSF_DAC_CFG_IMP_REMAP_FUNCTIONS
205#undef VSF_DAC_CFG_IMP_PREFIX
206#undef VSF_DAC_CFG_IMP_COUNT_MASK_PREFIX
207#undef VSF_DAC_CFG_IMP_UPCASE_PREFIX
208#undef VSF_DAC_CFG_IMP_LV0
209#undef VSF_DAC_CFG_IMP_REMAP_FUNCTIONS
210#undef VSF_DAC_CFG_IMP_HAS_OP
211#undef VSF_DAC_CFG_IMP_EXTERN_OP
214#undef vsf_imp_dac_init
215#undef vsf_imp_dac_fini
216#undef vsf_imp_dac_enable
217#undef vsf_imp_dac_disable
218#undef vsf_imp_dac_status
219#undef vsf_imp_dac_capability
220#undef vsf_imp_dac_irq_enable
221#undef vsf_imp_dac_irq_disable
222#undef vsf_imp_dac_channel_request_once
223#undef vsf_imp_dac_channel_config
224#undef vsf_imp_dac_channel_request
226#undef vsf_remap_dac_t
227#undef vsf_remap_dac_init
228#undef vsf_remap_dac_fini
229#undef vsf_remap_dac_enable
230#undef vsf_remap_dac_disable
231#undef vsf_remap_dac_status
232#undef vsf_remap_dac_capability
233#undef vsf_remap_dac_irq_enable
234#undef vsf_remap_dac_irq_disable
235#undef vsf_remap_dac_channel_request_once
236#undef vsf_remap_dac_channel_config
237#undef vsf_remap_dac_channel_request
Definition vsf_template_dac.h:154
uint8_t max_resolution_bits
Definition vsf_template_dac.h:160