18#if VSF_HAL_USE_PWM == ENABLED
24#ifndef VSF_PWM_CFG_REIMPLEMENT_API_CAPABILITY
25# define VSF_PWM_CFG_REIMPLEMENT_API_CAPABILITY DISABLED
28#ifdef VSF_PWM_CFG_IMP_REMAP_PREFIX
29# undef VSF_PWM_CFG_REIMPLEMENT_API_CAPABILITY
30# define VSF_PWM_CFG_REIMPLEMENT_API_CAPABILITY ENABLED
33#if VSF_PWM_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
34# ifndef VSF_PWM_CFG_CAPABILITY_MIN_FREQ
35# define VSF_PWM_CFG_CAPABILITY_MIN_FREQ (1ul * 1000)
37# ifndef VSF_PWM_CFG_CAPABILITY_MAX_FREQ
38# define VSF_PWM_CFG_CAPABILITY_MAX_FREQ (10ul * 1000 * 1000)
42#define vsf_real_pwm_t VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_t)
43#define vsf_real_pwm_set VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_set)
44#define vsf_real_pwm_get_freq VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_get_freq)
45#define vsf_real_pwm_capability VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_capability)
54#if VSF_PWM_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
62 return pwm_capability;
68#undef VSF_PWM_CFG_REIMPLEMENT_API_CAPABILITY
69#undef VSF_PWM_CFG_CAPABILITY_MAX_FREQ
70#undef VSF_PWM_CFG_CAPABILITY_MIN_FREQ
72#undef vsf_real_pwm_capability
76#ifdef VSF_PWM_CFG_IMP_REMAP_PREFIX
78# define vsf_imp_pwm_t VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_t)
79# define vsf_imp_pwm_init VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_init)
80# define vsf_imp_pwm_fini VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_fini)
81# define vsf_imp_pwm_enable VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_enable)
82# define vsf_imp_pwm_disable VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_disable)
83# define vsf_imp_pwm_capability VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_capability)
84# define vsf_imp_pwm_set VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_set)
85# define vsf_imp_pwm_get_freq VSF_MCONNECT(VSF_PWM_CFG_IMP_PREFIX, _pwm_get_freq)
87# define vsf_remap_pwm_t VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_t)
88# define vsf_remap_pwm_init VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_init)
89# define vsf_remap_pwm_fini VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_fini)
90# define vsf_remap_pwm_enable VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_enable)
91# define vsf_remap_pwm_disable VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_disable)
92# define vsf_remap_pwm_capability VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_capability)
93# define vsf_remap_pwm_set VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_set)
94# define vsf_remap_pwm_get_freq VSF_MCONNECT(VSF_PWM_CFG_IMP_REMAP_PREFIX, _pwm_get_freq)
96# define VSF_PWM_CFG_IMP_REMAP_FUNCTIONS \
97 vsf_err_t vsf_imp_pwm_init(vsf_imp_pwm_t *pwm_ptr, vsf_pwm_cfg_t *cfg_ptr) \
99 VSF_HAL_ASSERT(pwm_ptr != NULL); \
100 return vsf_remap_pwm_init(pwm_ptr, cfg_ptr); \
102 void vsf_imp_pwm_fini(vsf_imp_pwm_t *pwm_ptr) \
104 VSF_HAL_ASSERT(pwm_ptr != NULL); \
105 vsf_remap_pwm_fini(pwm_ptr); \
107 fsm_rt_t vsf_imp_pwm_enable(vsf_imp_pwm_t *pwm_ptr) \
109 VSF_HAL_ASSERT(pwm_ptr != NULL); \
110 return vsf_remap_pwm_enable(pwm_ptr); \
112 fsm_rt_t vsf_imp_pwm_disable(vsf_imp_pwm_t *pwm_ptr) \
114 VSF_HAL_ASSERT(pwm_ptr != NULL); \
115 return vsf_remap_pwm_disable(pwm_ptr); \
117 vsf_pwm_capability_t vsf_imp_pwm_capability(vsf_imp_pwm_t *pwm_ptr) \
119 VSF_HAL_ASSERT(pwm_ptr != NULL); \
120 return vsf_remap_pwm_capability(pwm_ptr); \
122 vsf_err_t vsf_imp_pwm_set(vsf_imp_pwm_t *pwm_ptr, uint8_t channel, \
123 uint32_t period, uint32_t pulse) \
125 VSF_HAL_ASSERT(pwm_ptr != NULL); \
126 return vsf_remap_pwm_set(pwm_ptr, channel, period, pulse); \
128 uint32_t vsf_imp_pwm_get_freq(vsf_imp_pwm_t *pwm_ptr) \
130 VSF_HAL_ASSERT(pwm_ptr != NULL); \
131 return vsf_remap_pwm_get_freq(pwm_ptr); \
138#define VSF_HAL_TEMPLATE_IMP_NAME _pwm
139#define VSF_HAL_TEMPLATE_IMP_UPCASE_NAME _PWM
141#ifndef VSF_PWM_CFG_IMP_PREFIX
142# error "Please define VSF_PWM_CFG_IMP_PREFIX in pwm driver"
145#ifndef VSF_PWM_CFG_IMP_UPCASE_PREFIX
146# error "Please define VSF_PWM_CFG_IMP_UPCASE_PREFIX in pwm driver"
149#ifndef VSF_PWM_CFG_IMP_COUNT_MASK_PREFIX
150# define VSF_PWM_CFG_IMP_COUNT_MASK_PREFIX VSF_PWM_CFG_IMP_UPCASE_PREFIX
153#ifdef VSF_PWM_CFG_IMP_REMAP_FUNCTIONS
154# define VSF_HAL_CFG_IMP_REMAP_FUNCTIONS VSF_PWM_CFG_IMP_REMAP_FUNCTIONS
159#undef VSF_PWM_CFG_IMP_PREFIX
160#undef VSF_PWM_CFG_IMP_COUNT_MASK_PREFIX
161#undef VSF_PWM_CFG_IMP_UPCASE_PREFIX
162#undef VSF_PWM_CFG_IMP_LV0
163#undef VSF_PWM_CFG_IMP_REMAP_FUNCTIONS
164#undef VSF_PWM_CFG_IMP_HAS_OP
165#undef VSF_PWM_CFG_IMP_EXTERN_OP
168#undef vsf_imp_pwm_init
169#undef vsf_imp_pwm_fini
170#undef vsf_imp_pwm_enable
171#undef vsf_imp_pwm_disable
172#undef vsf_imp_pwm_capability
173#undef vsf_imp_pwm_set
174#undef vsf_imp_pwm_get_freq
176#undef vsf_remap_pwm_t
177#undef vsf_remap_pwm_init
178#undef vsf_remap_pwm_fini
179#undef vsf_remap_pwm_enable
180#undef vsf_remap_pwm_disable
181#undef vsf_remap_pwm_capability
182#undef vsf_remap_pwm_set
183#undef vsf_remap_pwm_get_freq
#define VSF_PWM_CFG_CAPABILITY_MIN_FREQ
Definition aic_pwm.c:139
#define VSF_PWM_CFG_CAPABILITY_MAX_FREQ
Definition aic_pwm.c:138
Definition vsf_template_pwm.h:101
uint32_t min_freq
Definition vsf_template_pwm.h:107