18#if VSF_HAL_USE_TIMER == ENABLED
23#ifndef VSF_TIMER_CFG_REIMPLEMENT_API_CAPABILITY
24# define VSF_TIMER_CFG_REIMPLEMENT_API_CAPABILITY DISABLED
27#ifndef VSF_TIMER_CFG_REIMPLEMENT_API_PWM_SET
28# define VSF_TIMER_CFG_REIMPLEMENT_API_PWM_SET DISABLED
31#ifdef VSF_TIMER_CFG_IMP_REMAP_PREFIX
32# undef VSF_TIMER_CFG_REIMPLEMENT_API_CAPABILITY
33# undef VSF_TIMER_CFG_REIMPLEMENT_API_PWM_SET
34# define VSF_TIMER_CFG_REIMPLEMENT_API_CAPABILITY ENABLED
35# define VSF_TIMER_CFG_REIMPLEMENT_API_PWM_SET ENABLED
38#if VSF_TIMER_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
39# ifndef VSF_TIMER_CFG_CAPABILITY_IRQ_MASK
40# define VSF_TIMER_CFG_CAPABILITY_IRQ_MASK VSF_TIMER_IRQ_ALL_BITS_MASK
42# ifndef VSF_TIMER_CFG_CAPABILITY_TIMER_BITLEN
43# define VSF_TIMER_CFG_CAPABILITY_TIMER_BITLEN 32
45# ifndef VSF_TIMER_CFG_CAPABILITY_SUPPORT_PWM
46# define VSF_TIMER_CFG_CAPABILITY_SUPPORT_PWM 1
48# ifndef VSF_TIMER_CFG_CAPABILITY_PWM_CHANNEL_CNT
49# define VSF_TIMER_CFG_CAPABILITY_PWM_CHANNEL_CNT 32
58#define vsf_real_timer_t VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_t)
59#define vsf_real_timer_capability VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_capability)
60#define vsf_real_timer_pwm_set VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_pwm_set)
65#if VSF_TIMER_CFG_REIMPLEMENT_API_PWM_SET == DISABLED
75#if VSF_TIMER_CFG_REIMPLEMENT_API_CAPABILITY == DISABLED
85 return timer_capability;
91#undef VSF_TIMER_CFG_REIMPLEMENT_API_CAPABILITY
92#undef VSF_TIMER_CFG_CAPABILITY_IRQ_MASK
93#undef VSF_TIMER_CFG_CAPABILITY_TIMER_BITLEN
94#undef VSF_TIMER_CFG_CAPABILITY_SUPPORT_PWM
95#undef VSF_TIMER_CFG_CAPABILITY_PWM_CHANNEL_CNT
96#undef vsf_real_timer_t
97#undef vsf_real_timer_capability
98#undef vsf_real_timer_pwm_set
102#ifdef VSF_TIMER_CFG_IMP_REMAP_PREFIX
104# define vsf_imp_timer_t VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_t)
105# define vsf_imp_timer_init VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_init)
106# define vsf_imp_timer_fini VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_fini)
107# define vsf_imp_timer_enable VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_enable)
108# define vsf_imp_timer_disable VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_disable)
109# define vsf_imp_timer_capability VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_capability)
110# define vsf_imp_timer_irq_enable VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_irq_enable)
111# define vsf_imp_timer_irq_disable VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_irq_disable)
112# define vsf_imp_timer_pwm_set VSF_MCONNECT(VSF_TIMER_CFG_IMP_PREFIX, _timer_pwm_set)
114# define vsf_remap_timer_t VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_t)
115# define vsf_remap_timer_init VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_init)
116# define vsf_remap_timer_fini VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_fini)
117# define vsf_remap_timer_enable VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_enable)
118# define vsf_remap_timer_disable VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_disable)
119# define vsf_remap_timer_capability VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_capability)
120# define vsf_remap_timer_irq_enable VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_irq_enable)
121# define vsf_remap_timer_irq_disable VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_irq_disable)
122# define vsf_remap_timer_pwm_set VSF_MCONNECT(VSF_TIMER_CFG_IMP_REMAP_PREFIX, _timer_pwm_set)
124# define VSF_TIMER_CFG_IMP_REMAP_FUNCTIONS \
125 vsf_err_t vsf_imp_timer_init(vsf_imp_timer_t *timer_ptr, vsf_timer_cfg_t *cfg_ptr) \
127 VSF_HAL_ASSERT(timer_ptr != NULL); \
128 return vsf_remap_timer_init(timer_ptr, cfg_ptr); \
130 void vsf_imp_timer_fini(vsf_imp_timer_t *timer_ptr) \
132 VSF_HAL_ASSERT(timer_ptr != NULL); \
133 vsf_remap_timer_fini(timer_ptr); \
135 fsm_rt_t vsf_imp_timer_enable(vsf_imp_timer_t *timer_ptr) \
137 VSF_HAL_ASSERT(timer_ptr != NULL); \
138 return vsf_remap_timer_enable(timer_ptr); \
140 fsm_rt_t vsf_imp_timer_disable(vsf_imp_timer_t *timer_ptr) \
142 VSF_HAL_ASSERT(timer_ptr != NULL); \
143 return vsf_remap_timer_disable(timer_ptr); \
145 void vsf_imp_timer_irq_enable(vsf_imp_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask) \
147 VSF_HAL_ASSERT(timer_ptr != NULL); \
148 vsf_remap_timer_irq_enable(timer_ptr, irq_mask); \
150 void vsf_imp_timer_irq_disable(vsf_imp_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask) \
152 VSF_HAL_ASSERT(timer_ptr != NULL); \
153 vsf_remap_timer_irq_disable(timer_ptr, irq_mask); \
155 vsf_timer_capability_t vsf_imp_timer_capability(vsf_imp_timer_t *timer_ptr) \
157 VSF_HAL_ASSERT(timer_ptr != NULL); \
158 return vsf_remap_timer_capability(timer_ptr); \
160 vsf_err_t vsf_imp_timer_pwm_set(vsf_imp_timer_t *timer_ptr, uint8_t channel, uint32_t period, uint32_t pulse) \
162 VSF_HAL_ASSERT(NULL != timer_ptr); \
163 return vsf_remap_timer_pwm_set(timer_ptr, channel, period, pulse); \
169#define VSF_HAL_TEMPLATE_IMP_NAME _timer
170#define VSF_HAL_TEMPLATE_IMP_UPCASE_NAME _TIMER
172#ifndef VSF_TIMER_CFG_IMP_PREFIX
173# error "Please define VSF_TIMER_CFG_IMP_PREFIX in timer driver"
176#ifndef VSF_TIMER_CFG_IMP_UPCASE_PREFIX
177# error "Please define VSF_TIMER_CFG_IMP_UPCASE_PREFIX in timer driver"
180#ifndef VSF_TIMER_CFG_IMP_COUNT_MASK_PREFIX
181# define VSF_TIMER_CFG_IMP_COUNT_MASK_PREFIX VSF_TIMER_CFG_IMP_UPCASE_PREFIX
184#ifdef VSF_TIMER_CFG_IMP_REMAP_FUNCTIONS
185# define VSF_HAL_CFG_IMP_REMAP_FUNCTIONS VSF_TIMER_CFG_IMP_REMAP_FUNCTIONS
190#undef VSF_TIMER_CFG_IMP_PREFIX
191#undef VSF_TIMER_CFG_IMP_COUNT_MASK_PREFIX
192#undef VSF_TIMER_CFG_IMP_UPCASE_PREFIX
193#undef VSF_TIMER_CFG_IMP_LV0
194#undef VSF_TIMER_CFG_IMP_REMAP_FUNCTIONS
195#undef VSF_TIMER_CFG_IMP_HAS_OP
196#undef VSF_TIMER_CFG_IMP_EXTERN_OP
198#undef vsf_imp_timer_t
199#undef vsf_imp_timer_init
200#undef vsf_imp_timer_fini
201#undef vsf_imp_timer_enable
202#undef vsf_imp_timer_disable
203#undef vsf_imp_timer_capability
204#undef vsf_imp_timer_irq_enable
205#undef vsf_imp_timer_irq_disable
206#undef vsf_imp_timer_pwm_set
208#undef vsf_remap_timer_t
209#undef vsf_remap_timer_init
210#undef vsf_remap_timer_fini
211#undef vsf_remap_timer_enable
212#undef vsf_remap_timer_disable
213#undef vsf_remap_timer_capability
214#undef vsf_remap_timer_irq_enable
215#undef vsf_remap_timer_irq_disable
216#undef vsf_remap_timer_pwm_set
vsf_err_t
Definition __type.h:42
@ VSF_ERR_FAIL
failed
Definition __type.h:51
#define VSF_TIMER_CFG_CAPABILITY_SUPPORT_PWM
Definition timer.c:203
#define VSF_TIMER_CFG_CAPABILITY_PWM_CHANNEL_CNT
Definition timer.c:204
#define VSF_TIMER_CFG_CAPABILITY_TIMER_BITLEN
Definition timer.c:202
#define VSF_TIMER_CFG_CAPABILITY_IRQ_MASK
Definition timer.c:201
#define NULL
Definition lvgl.h:26
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
Definition vsf_template_timer.h:161
uint8_t timer_bitlen
Definition vsf_template_timer.h:168
#define VSF_HAL_ASSERT(__CON)
all hal modules use this configuration file
Definition vsf_hal_cfg.h:36