18#if VSF_HAL_USE_ADC == ENABLED
23#define vsf_real_adc_t VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_t)
24#define vsf_real_adc_capability VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_capability)
26#ifndef VSF_ADC_CFG_REIMPLEMENT_API_CAPABILITY
27# define VSF_ADC_CFG_REIMPLEMENT_API_CAPABILITY DISABLED
30#ifdef VSF_ADC_CFG_IMP_REMAP_PREFIX
31# undef VSF_ADC_CFG_REIMPLEMENT_API_CAPABILITY
32# define VSF_ADC_CFG_REIMPLEMENT_API_CAPABILITY ENABLED
35#if VSF_ADC_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
36# ifndef VSF_ADC_CFG_CAPABILITY_IRQ_MASK
37# define VSF_ADC_CFG_CAPABILITY_IRQ_MASK VSF_ADC_IRQ_ALL_BITS_MASK
39# ifndef VSF_ADC_CFG_CAPABILITY_MAX_DATA_BITS
40# define VSF_ADC_CFG_CAPABILITY_MAX_DATA_BITS 12
42# ifndef VSF_ADC_CFG_CAPABILITY_CHANNEL_COUNT
43# define VSF_ADC_CFG_CAPABILITY_CHANNEL_COUNT 4
50#if VSF_ADC_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
54 .irq_mask = VSF_ADC_CFG_CAPABILITY_IRQ_MASK,
56 .channel_count = VSF_ADC_CFG_CAPABILITY_CHANNEL_COUNT,
59 return adc_capability;
65#undef VSF_ADC_CFG_REIMPLEMENT_API_CAPABILITY
66#undef VSF_ADC_CFG_CAPABILITY_IRQ_MASK
67#undef VSF_ADC_CFG_CAPABILITY_MAX_DATA_BITS
68#undef VSF_ADC_CFG_CAPABILITY_CHANNEL_COUNT
71#undef vsf_real_adc_capability
77#ifdef VSF_ADC_CFG_IMP_REMAP_PREFIX
78# define vsf_imp_adc_t VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_t)
79# define vsf_imp_adc_init VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_init)
80# define vsf_imp_adc_fini VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_fini)
81# define vsf_imp_adc_enable VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_enable)
82# define vsf_imp_adc_disable VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_disable)
83# define vsf_imp_adc_status VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_status)
84# define vsf_imp_adc_capability VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_capability)
85# define vsf_imp_adc_irq_enable VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_irq_enable)
86# define vsf_imp_adc_irq_disable VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_irq_disable)
87# define vsf_imp_adc_channel_request_once VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_channel_request_once)
88# define vsf_imp_adc_channel_config VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_channel_config)
89# define vsf_imp_adc_channel_request VSF_MCONNECT(VSF_ADC_CFG_IMP_PREFIX, _adc_channel_request)
91# define vsf_remap_adc_t VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_t)
92# define vsf_remap_adc_init VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_init)
93# define vsf_remap_adc_fini VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_fini)
94# define vsf_remap_adc_enable VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_enable)
95# define vsf_remap_adc_disable VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_disable)
96# define vsf_remap_adc_status VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_status)
97# define vsf_remap_adc_capability VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_capability)
98# define vsf_remap_adc_irq_enable VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_irq_enable)
99# define vsf_remap_adc_irq_disable VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_irq_disable)
100# define vsf_remap_adc_channel_request_once VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_channel_request_once)
101# define vsf_remap_adc_channel_config VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_channel_config)
102# define vsf_remap_adc_channel_request VSF_MCONNECT(VSF_ADC_CFG_IMP_REMAP_PREFIX, _adc_channel_request)
104# define VSF_ADC_CFG_IMP_REMAP_FUNCTIONS \
105 vsf_err_t vsf_imp_adc_init(vsf_imp_adc_t *adc, vsf_adc_cfg_t *cfg) \
107 VSF_HAL_ASSERT(adc != NULL); \
108 return vsf_remap_adc_init((vsf_remap_adc_t *)adc, cfg); \
111 void vsf_imp_adc_fini(vsf_imp_adc_t *adc) \
113 VSF_HAL_ASSERT(adc != NULL); \
114 vsf_remap_adc_fini((vsf_remap_adc_t *)adc); \
117 vsf_adc_status_t vsf_imp_adc_status(vsf_imp_adc_t *adc) \
119 VSF_HAL_ASSERT(adc != NULL); \
120 return vsf_remap_adc_status((vsf_remap_adc_t *)adc); \
123 vsf_adc_capability_t vsf_imp_adc_capability(vsf_imp_adc_t *adc) \
125 VSF_HAL_ASSERT(adc != NULL); \
126 return vsf_remap_adc_capability((vsf_remap_adc_t *)adc); \
129 fsm_rt_t vsf_imp_adc_enable(vsf_imp_adc_t *adc) \
131 VSF_HAL_ASSERT(adc != NULL); \
132 return vsf_remap_adc_enable((vsf_remap_adc_t *)adc); \
135 fsm_rt_t vsf_imp_adc_disable(vsf_imp_adc_t *adc) \
137 VSF_HAL_ASSERT(adc != NULL); \
138 return vsf_remap_adc_disable((vsf_remap_adc_t *)adc); \
141 void vsf_imp_adc_irq_enable(vsf_imp_adc_t *adc, vsf_adc_irq_mask_t irq_mask) \
143 VSF_HAL_ASSERT(adc != NULL); \
144 vsf_remap_adc_irq_enable((vsf_remap_adc_t *)adc, irq_mask); \
147 void vsf_imp_adc_irq_disable(vsf_imp_adc_t *adc, vsf_adc_irq_mask_t irq_mask) \
149 VSF_HAL_ASSERT(adc != NULL); \
150 vsf_remap_adc_irq_disable((vsf_remap_adc_t *)adc, irq_mask); \
153 vsf_err_t vsf_imp_adc_channel_request_once(vsf_imp_adc_t *adc, \
154 vsf_adc_channel_cfg_t *channel_cfg, void *buffer) \
156 VSF_HAL_ASSERT(adc != NULL); \
157 return vsf_remap_adc_channel_request_once((vsf_remap_adc_t *)adc, \
158 channel_cfg, buffer); \
161 vsf_err_t vsf_imp_adc_channel_config(vsf_imp_adc_t *adc, \
162 vsf_adc_channel_cfg_t *channel_cfgs, uint32_t channel_cfgs_cnt) \
164 VSF_HAL_ASSERT(adc != NULL); \
165 return vsf_remap_adc_channel_config((vsf_remap_adc_t *)adc, \
166 channel_cfgs, channel_cfgs_cnt); \
169 vsf_err_t vsf_imp_adc_channel_request(vsf_imp_adc_t *adc, \
170 void *buffer, uint_fast32_t count) \
172 VSF_HAL_ASSERT(adc != NULL); \
173 return vsf_remap_adc_channel_request((vsf_remap_adc_t *)adc, buffer, count);\
179#define VSF_HAL_TEMPLATE_IMP_NAME _adc
180#define VSF_HAL_TEMPLATE_IMP_UPCASE_NAME _ADC
182#ifndef VSF_ADC_CFG_IMP_PREFIX
183# error "Please define VSF_ADC_CFG_IMP_PREFIX in adc driver"
186#ifndef VSF_ADC_CFG_IMP_UPCASE_PREFIX
187# error "Please define VSF_ADC_CFG_IMP_UPCASE_PREFIX in adc driver"
190#ifndef VSF_ADC_CFG_IMP_COUNT_MASK_PREFIX
191# define VSF_ADC_CFG_IMP_COUNT_MASK_PREFIX VSF_ADC_CFG_IMP_UPCASE_PREFIX
194#ifdef VSF_ADC_CFG_IMP_REMAP_FUNCTIONS
195# define VSF_HAL_CFG_IMP_REMAP_FUNCTIONS VSF_ADC_CFG_IMP_REMAP_FUNCTIONS
200#undef VSF_ADC_CFG_IMP_PREFIX
201#undef VSF_ADC_CFG_IMP_COUNT_MASK_PREFIX
202#undef VSF_ADC_CFG_IMP_UPCASE_PREFIX
203#undef VSF_ADC_CFG_IMP_REMAP_PREFIX
204#undef VSF_ADC_CFG_IMP_LV0
205#undef VSF_ADC_CFG_IMP_REMAP_FUNCTIONS
206#undef VSF_ADC_CFG_IMP_HAS_OP
207#undef VSF_ADC_CFG_IMP_EXTERN_OP
210#undef vsf_imp_adc_init
211#undef vsf_imp_adc_fini
212#undef vsf_imp_adc_enable
213#undef vsf_imp_adc_disable
214#undef vsf_imp_adc_status
215#undef vsf_imp_adc_capability
216#undef vsf_imp_adc_irq_enable
217#undef vsf_imp_adc_irq_disable
218#undef vsf_imp_adc_channel_request_once
219#undef vsf_imp_adc_channel_config
220#undef vsf_imp_adc_channel_request
222#undef vsf_remap_adc_t
223#undef vsf_remap_adc_init
224#undef vsf_remap_adc_fini
225#undef vsf_remap_adc_enable
226#undef vsf_remap_adc_disable
227#undef vsf_remap_adc_status
228#undef vsf_remap_adc_capability
229#undef vsf_remap_adc_irq_enable
230#undef vsf_remap_adc_irq_disable
231#undef vsf_remap_adc_channel_request_once
232#undef vsf_remap_adc_channel_config
233#undef vsf_remap_adc_channel_request
Definition vsf_template_adc.h:248
uint8_t max_data_bits
Definition vsf_template_adc.h:254