23#if VSF_USE_KERNEL == ENABLED && defined(__EDA_GADGET__)
25#if __IS_COMPILER_IAR__
27# pragma diag_suppress=pe111
33#if VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR == ENABLED
34# define __vsf_callback_timer_protect vsf_protect(interrupt)
35# define __vsf_callback_timer_unprotect vsf_unprotect(interrupt)
37# define __vsf_callback_timer_protect vsf_protect(scheduler)
38# define __vsf_callback_timer_unprotect vsf_unprotect(scheduler)
46#if VSF_KERNEL_CFG_EDA_SUPPORT_TIMER == ENABLED
47# if VSF_SYSTIMER_CFG_IMPL_MODE != VSF_SYSTIMER_IMPL_NONE
48# if (VSF_KERNEL_CFG_TIMER_MODE == VSF_KERNEL_CFG_TIMER_MODE_TICKLESS) \
49 && (VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_TICK_MODE)
50# error systimer is in tick mode while tickless mode is required on kernel
52# if (VSF_KERNEL_CFG_TIMER_MODE == VSF_KERNEL_CFG_TIMER_MODE_TICK) \
53 && (VSF_SYSTIMER_CFG_IMPL_MODE != VSF_SYSTIMER_IMPL_TICK_MODE)
54# warning systimer is not in tick mode while tick mode is required on kernel,\
55 ignore this warning if your arch does not support tick mode systimer,\
56 or set VSF_SYSTIMER_CFG_IMPL_MODE to VSF_SYSTIMER_IMPL_TICK_MODE\
57 for better optimization.
61# if VSF_KERNEL_CFG_TIMER_MODE == VSF_KERNEL_CFG_TIMER_MODE_TICKLESS \
62 && (VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_NONE)
81#if VSF_KERNEL_CFG_EDA_SUPPORT_TIMER == ENABLED
82#if VSF_KERNEL_CFG_TIMER_MODE == VSF_KERNEL_CFG_TIMER_MODE_TICKLESS
84static void __vsf_systimer_wakeup(
void)
86 if (!__vsf_eda.timer.processing) {
87 __vsf_eda.timer.processing =
true;
89 __vsf_eda.timer.processing =
false;
94#if VSF_SYSTIMER_CFG_IMPL_MODE != VSF_SYSTIMER_IMPL_NONE
95static void __vsf_systimer_update(
bool force)
103 }
else if (force || (teda->due != __vsf_eda.timer.pre_tick)) {
104 __vsf_eda.timer.pre_tick = teda->due;
106 __vsf_systimer_wakeup();
111static void __vsf_systimer_update(
bool force)
124static
void __vsf_systimer_start(
void)
134#if VSF_KERNEL_CFG_TRACE == ENABLED
135 if (!__vsf_eda.timer.is_isr_info_sent) {
136 __vsf_eda.timer.is_isr_info_sent =
true;
143 __vsf_systimer_wakeup();
145#if VSF_KERNEL_CFG_TRACE == ENABLED
153 __vsf_teda_timer_enqueue(this_ptr, due);
154 __vsf_systimer_update(
false);
165static
void __vsf_systimer_start(
void)
185 __vsf_teda_timer_enqueue(this_ptr, due);
197static
void __vsf_systimer_init(
void)
199#if VSF_KERNEL_CFG_TIMER_MODE == VSF_KERNEL_CFG_TIMER_MODE_TICKLESS
200 __vsf_eda.timer.processing =
false;
203#if VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER == ENABLED
208#if VSF_SYSTIMER_CFG_IMPL_MODE != VSF_SYSTIMER_IMPL_NONE
220 this_ptr->use_as__vsf_eda_t.flag.state.is_timed =
true;
221#if VSF_KERNEL_OPT_AVOID_UNNECESSARY_YIELD_EVT == ENABLED
223 this_ptr->use_as__vsf_eda_t.is_evt_incoming =
true;
228#if VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER == ENABLED
239# if VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR == ENABLED
242 bool is_to_update =
false;
245 if (timer->due != 0) {
251# if VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR == ENABLED
252 lock_status = __vsf_callback_timer_protect();
256 if (
NULL == timer->timer_node.prev) {
259# if VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR == ENABLED
260 __vsf_callback_timer_unprotect(lock_status);
264 __vsf_teda_set_timer_imp((
vsf_teda_t *)&__vsf_eda.task, timer->due);
276 lock_status = __vsf_callback_timer_protect();
277 if (timer->due != 0) {
281 __vsf_callback_timer_unprotect(lock_status);
285# if VSF_CALLBACK_TIMER_CFG_SUPPORT_ISR == ENABLED
290 if (timer->due != 0) {
310 if (to_time >= from_time) {
346#if __IS_COMPILER_ARM_COMPILER_6__
347# pragma clang diagnostic push
348# pragma clang diagnostic ignored "-Wcast-align"
351#if __IS_COMPILER_GCC__
352# pragma GCC diagnostic push
353# pragma GCC diagnostic ignored "-Wcast-align"
364#if __IS_COMPILER_ARM_COMPILER_6__
365# pragma clang diagnostic pop
368#if __IS_COMPILER_GCC__
369# pragma GCC diagnostic pop
372#if __IS_COMPILER_ARM_COMPILER_6__
373# pragma clang diagnostic push
374# pragma clang diagnostic ignored "-Wcast-align"
377#if __IS_COMPILER_GCC__
378# pragma GCC diagnostic push
379# pragma GCC diagnostic ignored "-Wcast-align"
391 if (this_ptr->use_as__vsf_eda_t.flag.state.is_timed) {
393 this_ptr->use_as__vsf_eda_t.flag.state.is_timed =
false;
403#if VSF_KERNEL_CFG_ALLOW_KERNEL_BEING_PREEMPTED == ENABLED
409#if __IS_COMPILER_ARM_COMPILER_6__
410# pragma clang diagnostic pop
413#if __IS_COMPILER_GCC__
414# pragma GCC diagnostic pop
419#if __IS_COMPILER_IAR__
421# pragma diag_warning=pe111
#define VSF_CAL_SECTION(__SEC)
Definition __compiler.h:181
#define VSF_UNUSED_PARAM(__VAL)
Definition __type.h:190
vsf_err_t
Definition __type.h:42
@ VSF_ERR_NONE
none error
Definition __type.h:44
@ VSF_ERR_NOT_AVAILABLE
service not available
Definition __type.h:47
@ VSF_ERR_FAIL
failed
Definition __type.h:51
uint64_t vsf_systimer_tick_t
Definition cortex_a_generic.h:73
void vsf_systimer_prio_set(vsf_arch_prio_t priority)
Definition cortex_m_generic.c:185
int vsf_get_interrupt_id(void)
Definition cortex_m_generic.c:370
vsf_systimer_tick_t vsf_systimer_get(void)
Definition linux_generic.c:402
void vsf_systimer_set_idle(void)
Definition linux_generic.c:398
vsf_systimer_tick_t vsf_systimer_tick_to_us(vsf_systimer_tick_t tick)
Definition linux_generic.c:445
vsf_err_t vsf_systimer_init(void)
initialise SysTick to generate a system timer !
Definition linux_generic.c:365
bool vsf_systimer_is_due(vsf_systimer_tick_t due)
Definition linux_generic.c:430
vsf_systimer_tick_t vsf_systimer_ms_to_tick(uint_fast32_t time_ms)
Definition linux_generic.c:440
vsf_systimer_tick_t vsf_systimer_us_to_tick(uint_fast32_t time_us)
Definition linux_generic.c:435
vsf_systimer_tick_t vsf_systimer_tick_to_ms(vsf_systimer_tick_t tick)
Definition linux_generic.c:450
vsf_err_t vsf_systimer_start(void)
Definition linux_generic.c:390
bool vsf_systimer_set(vsf_systimer_tick_t due)
Definition linux_generic.c:409
#define NULL
Definition lvgl.h:26
int32_t vsf_systimer_tick_signed_t
Definition mcs51_generic.h:58
unsigned int uint_fast32_t
Definition stdint.h:27
uintalu_t vsf_protect_t
Definition vsf_arch_abstraction.h:53
#define vsf_protect_int
Definition vsf_arch_abstraction.h:321
#define vsf_unprotect_int
Definition vsf_arch_abstraction.h:322
vsf_err_t vsf_eda_post_evt(vsf_eda_t *pthis, vsf_evt_t evt)
Definition vsf_eda.c:929
vsf_err_t vsf_eda_post_evt_msg(vsf_eda_t *pthis, vsf_evt_t evt, void *msg)
Definition vsf_eda.c:963
vsf_eda_t * vsf_eda_get_cur(void)
Definition vsf_eda.c:416
vsf_err_t vsf_eda_start(vsf_eda_t *pthis, vsf_eda_cfg_t *cfg_ptr)
Definition vsf_eda.c:832
void vsf_kernel_err_report(enum vsf_kernel_error_t err)
Definition vsf_eda.c:409
void vsf_systimer_on_tick(void)
vsf_err_t vsf_teda_cancel_timer(void)
vsf_err_t vsf_callback_timer_add_isr(vsf_callback_timer_t *timer, vsf_systimer_tick_t tick)
vsf_err_t vsf_callback_timer_remove_isr(vsf_callback_timer_t *timer)
vsf_err_t vsf_teda_set_timer(vsf_systimer_tick_t tick)
@ VSF_KERNEL_ERR_INVALID_USAGE
Definition vsf_eda.h:1086
void vsf_callback_timer_init(vsf_callback_timer_t *timer)
vsf_systimer_tick_t vsf_systimer_get_elapsed(vsf_systimer_tick_t from_time)
@ VSF_EVT_TIMER
Definition vsf_eda.h:612
vsf_systimer_tick_t vsf_systimer_get_tick(void)
vsf_err_t vsf_teda_set_timer_ex(vsf_teda_t *pthis, vsf_systimer_tick_t tick)
vsf_err_t vsf_callback_timer_add(vsf_callback_timer_t *timer, vsf_systimer_tick_t tick)
vsf_err_t vsf_teda_start(vsf_teda_t *pthis, vsf_eda_cfg_t *cfg)
vsf_systimer_tick_t vsf_systimer_get_duration(vsf_systimer_tick_t from_time, vsf_systimer_tick_t to_time)
vsf_err_t __vsf_teda_cancel_timer(vsf_teda_t *pthis)
vsf_err_t vsf_callback_timer_remove(vsf_callback_timer_t *timer)
@ VSF_KERNEL_EVT_CALLBACK_TIMER_ADD
Definition vsf_eda.h:627
void vsf_evtq_clean_evt(vsf_evt_t evt)
Definition vsf_evtq_list.c:254
#define VSF_KERNEL_ASSERT
Definition vsf_kernel_cfg.h:32
#define vsf_protect_sched()
Definition vsf_os.h:88
#define vsf_unprotect_sched(__prot)
Definition vsf_os.h:89
#define vsf_callback_timq_remove(__queue, __timer)
Definition vsf_timq_dlist.h:76
#define vsf_timq_peek(__queue, __teda)
Definition vsf_timq_dlist.h:47
#define vsf_timq_init(__queue)
Definition vsf_timq_dlist.h:32
#define vsf_timq_insert(__queue, __teda)
Definition vsf_timq_dlist.h:34
#define vsf_callback_timq_init(__queue)
Definition vsf_timq_dlist.h:61
#define vsf_timq_remove(__queue, __teda)
Definition vsf_timq_dlist.h:41
#define vsf_callback_timq_insert(__queue, __timer)
Definition vsf_timq_dlist.h:69