18#ifndef __VSF_TEMPLATE_TIMER_H__
19#define __VSF_TEMPLATE_TIMER_H__
33#ifndef VSF_TIMER_CFG_MULTI_CLASS
34# define VSF_TIMER_CFG_MULTI_CLASS ENABLED
37#if defined(VSF_HW_TIMER_COUNT) && !defined(VSF_HW_TIMER_MASK)
38# define VSF_HW_TIMER_MASK VSF_HAL_COUNT_TO_MASK(VSF_HW_TIMER_COUNT)
41#if defined(VSF_HW_TIMER_MASK) && !defined(VSF_HW_TIMER_COUNT)
42# define VSF_HW_TIMER_COUNT VSF_HAL_MASK_TO_COUNT(VSF_HW_TIMER_MASK)
46#ifndef VSF_TIMER_CFG_PREFIX
47# if VSF_TIMER_CFG_MULTI_CLASS == ENABLED
48# define VSF_TIMER_CFG_PREFIX vsf
49# elif defined(VSF_HW_TIMER_COUNT) && (VSF_HW_TIMER_COUNT != 0)
50# define VSF_TIMER_CFG_PREFIX vsf_hw
52# define VSF_TIMER_CFG_PREFIX vsf
56#ifndef VSF_TIMER_CFG_FUNCTION_RENAME
57# define VSF_TIMER_CFG_FUNCTION_RENAME ENABLED
60#ifndef VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK
61# define VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED
67#if VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
68# define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG DISABLED
74#if VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
75# define VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED
78#ifndef VSF_TIMER_CFG_INHERT_HAL_CAPABILITY
79# define VSF_TIMER_CFG_INHERT_HAL_CAPABILITY ENABLED
84#define VSF_TIMER_APIS(__prefix_name) \
85 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, init, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, vsf_timer_cfg_t *cfg_ptr) \
86 __VSF_HAL_TEMPLATE_API(__prefix_name, void, timer, fini, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
87 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, timer, enable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
88 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, timer, disable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
89 __VSF_HAL_TEMPLATE_API(__prefix_name, void, timer, irq_enable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, vsf_timer_irq_mask_t irq_mask) \
90 __VSF_HAL_TEMPLATE_API(__prefix_name, void, timer, irq_disable, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, vsf_timer_irq_mask_t irq_mask) \
91 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_timer_capability_t, timer, capability, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr) \
92 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, set_period, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint32_t period) \
93 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, timer, pwm_set, VSF_MCONNECT(__prefix_name, _timer_t) *timer_ptr, uint8_t channel, uint32_t period, uint32_t pulse)
99#if VSF_TIMER_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE == DISABLED
122#if VSF_TIMER_CFG_REIMPLEMENT_TYPE_IRQ_MASK == DISABLED
133#if VSF_TIMER_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
160#if VSF_TIMER_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
162#if VSF_TIMER_CFG_INHERT_HAL_CAPABILITY == ENABLED
177#undef __VSF_HAL_TEMPLATE_API
178#define __VSF_HAL_TEMPLATE_API VSF_HAL_TEMPLATE_API_FP
183#if VSF_TIMER_CFG_MULTI_CLASS == ENABLED
337#if VSF_TIMER_CFG_FUNCTION_RENAME == ENABLED
338# define __vsf_timer_t VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_t)
339# define vsf_timer_init(__TIME, ...) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_init) ((__vsf_timer_t *)(__TIME), ##__VA_ARGS__)
340# define vsf_timer_fini(__TIME, ...) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_fini) ((__vsf_timer_t *)(__TIME))
341# define vsf_timer_enable(__TIME) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_enable) ((__vsf_timer_t *)(__TIME))
342# define vsf_timer_disable(__TIME) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_disable) ((__vsf_timer_t *)(__TIME))
343# define vsf_timer_capability(__TIME) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_capability) ((__vsf_timer_t *)(__TIME))
344# define vsf_timer_irq_enable(__TIME, ...) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_irq_enable) ((__vsf_timer_t *)(__TIME), ##__VA_ARGS__)
345# define vsf_timer_irq_disable(__TIME, ...) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_irq_disable) ((__vsf_timer_t *)(__TIME), ##__VA_ARGS__)
346# define vsf_timer_set_period(__TIME, ...) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_set_period) ((__vsf_timer_t *)(__TIME), ##__VA_ARGS__)
347# define vsf_timer_pwm_set(__TIME, ...) VSF_MCONNECT(VSF_TIMER_CFG_PREFIX, _timer_pwm_set) ((__vsf_timer_t *)(__TIME), ##__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
Definition vsf_template_hal_driver.h:203
Definition vsf_template_timer.h:161
uint8_t timer_bitlen
Definition vsf_template_timer.h:168
inherit(vsf_peripheral_capability_t) vsf_timer_irq_mask_t irq_mask
uint8_t pwm_channel_cnt
Definition vsf_template_timer.h:171
uint8_t support_pwm
Definition vsf_template_timer.h:170
timer configuration
Definition vsf_template_timer.h:147
uint32_t freq
Definition vsf_template_timer.h:152
uint32_t min_freq
Definition vsf_template_timer.h:153
uint32_t period
Definition vsf_template_timer.h:150
vsf_timer_mode_t mode
Definition vsf_template_timer.h:148
vsf_timer_isr_t isr
Definition vsf_template_timer.h:156
Definition vsf_template_timer.h:140
vsf_arch_prio_t prio
Definition vsf_template_timer.h:143
vsf_timer_isr_handler_t * handler_fn
Definition vsf_template_timer.h:141
void * target_ptr
Definition vsf_template_timer.h:142
Definition vsf_template_timer.h:176
Definition vsf_template_timer.h:184
const vsf_timer_op_t * op
Definition vsf_template_timer.h:185
fsm_rt_t
Definition vsf_fsm.h:315
#define VSF_TIMER_APIS(__prefix_name)
Definition vsf_template_timer.h:84
#define vsf_timer_disable(__TIME)
Definition vsf_template_timer.h:342
#define vsf_timer_capability(__TIME)
Definition vsf_template_timer.h:343
vsf_timer_irq_mask_t
Definition vsf_template_timer.h:123
@ VSF_TIMER_IRQ_MASK_OVERFLOW
Definition vsf_template_timer.h:124
#define vsf_timer_init(__TIME,...)
Definition vsf_template_timer.h:339
#define vsf_timer_pwm_set(__TIME,...)
Definition vsf_template_timer.h:347
#define vsf_timer_irq_enable(__TIME,...)
Definition vsf_template_timer.h:344
#define vsf_timer_fini(__TIME,...)
Definition vsf_template_timer.h:340
void vsf_timer_isr_handler_t(void *target_ptr, vsf_timer_t *timer_ptr, vsf_timer_irq_mask_t irq_mask)
Definition vsf_template_timer.h:136
@ VSF_TIMER_IRQ_ALL_BITS_MASK
Definition vsf_template_timer.h:130
@ VSF_TIMER_IRQ_COUNT
Definition vsf_template_timer.h:129
vsf_timer_mode_t
Definition vsf_template_timer.h:100
@ VSF_TIMER_MODE_CONTINUES
Definition vsf_template_timer.h:102
@ VSF_TIMER_MODE_NO_PWM
Definition vsf_template_timer.h:105
@ VSF_TIMER_MODE_PWM
Definition vsf_template_timer.h:104
@ VSF_TIMER_MODE_ONESHOT
Definition vsf_template_timer.h:101
#define vsf_timer_irq_disable(__TIME,...)
Definition vsf_template_timer.h:345
#define vsf_timer_set_period(__TIME,...)
Definition vsf_template_timer.h:346
#define vsf_timer_enable(__TIME)
Definition vsf_template_timer.h:341
@ VSF_TIMER_MODE_PWM_COUNT
Definition vsf_template_timer.h:114
@ VSF_TIMER_MODE_ALL_BITS_MASK
Definition vsf_template_timer.h:119
@ VSF_TIMER_MODE_RESTART_COUNT
Definition vsf_template_timer.h:110
@ VSF_TIMER_MODE_RESTART_MASK
Definition vsf_template_timer.h:111
@ VSF_TIMER_MODE_PWM_MASK
Definition vsf_template_timer.h:115
@ VSF_TIMER_MODE_MASK_COUNT
Definition vsf_template_timer.h:118