Lines Matching full:timer
14 static void zephyr_timer_wrapper(struct k_timer *timer);
27 static void zephyr_timer_wrapper(struct k_timer *timer) in zephyr_timer_wrapper() argument
31 cm_timer = CONTAINER_OF(timer, struct timer_obj, ztimer); in zephyr_timer_wrapper()
36 * @brief Create a Timer
41 struct timer_obj *timer; in osTimerCreate() local
51 if (k_mem_slab_alloc(&cmsis_timer_slab, (void **)&timer, K_MSEC(100)) == 0) { in osTimerCreate()
52 (void)memset(timer, 0, sizeof(struct timer_obj)); in osTimerCreate()
57 timer->callback_function = timer_def->ptimer; in osTimerCreate()
58 timer->arg = argument; in osTimerCreate()
59 timer->type = type; in osTimerCreate()
60 timer->status = NOT_ACTIVE; in osTimerCreate()
62 k_timer_init(&timer->ztimer, zephyr_timer_wrapper, NULL); in osTimerCreate()
64 return (osTimerId)timer; in osTimerCreate()
68 * @brief Start or restart a Timer
72 struct timer_obj *timer = (struct timer_obj *) timer_id; in osTimerStart() local
74 if (timer == NULL) { in osTimerStart()
82 if (timer->type == osTimerOnce) { in osTimerStart()
83 k_timer_start(&timer->ztimer, K_MSEC(millisec), K_NO_WAIT); in osTimerStart()
84 } else if (timer->type == osTimerPeriodic) { in osTimerStart()
85 k_timer_start(&timer->ztimer, K_MSEC(millisec), in osTimerStart()
89 timer->status = ACTIVE; in osTimerStart()
94 * @brief Stop the Timer
98 struct timer_obj *timer = (struct timer_obj *) timer_id; in osTimerStop() local
100 if (timer == NULL) { in osTimerStop()
108 if (timer->status == NOT_ACTIVE) { in osTimerStop()
112 k_timer_stop(&timer->ztimer); in osTimerStop()
113 timer->status = NOT_ACTIVE; in osTimerStop()
118 * @brief Delete the timer that was created by osTimerCreate
122 struct timer_obj *timer = (struct timer_obj *) timer_id; in osTimerDelete() local
124 if (timer == NULL) { in osTimerDelete()
132 if (timer->status == ACTIVE) { in osTimerDelete()
133 k_timer_stop(&timer->ztimer); in osTimerDelete()
134 timer->status = NOT_ACTIVE; in osTimerDelete()
137 k_mem_slab_free(&cmsis_timer_slab, (void *)timer); in osTimerDelete()