Lines Matching refs:timer
42 if (osi_info.timer[index].state == OSI_FREE) { in OSI_timer_allocate()
44 free_timer = (tOSI_TIMER_HANDLER)&osi_info.timer[index]; in OSI_timer_allocate()
46 if ((char const*)osi_info.timer[index].name == NULL) continue; in OSI_timer_allocate()
48 if (strcmp((char const*)osi_info.timer[index].name, in OSI_timer_allocate()
73 int OSI_timer_start(tOSI_TIMER_HANDLER timer, uint32_t timeout, in OSI_timer_start() argument
78 if (timer == NULL) { in OSI_timer_start()
81 } else if (timer->state == OSI_FREE) { in OSI_timer_start()
87 timer->timeout = timeout; in OSI_timer_start()
88 timer->exact_time = OSI_timer_get_current_time(); in OSI_timer_start()
89 timer->init_timeout = timeout - 10; in OSI_timer_start()
90 timer->callback = callback; in OSI_timer_start()
91 timer->callback_param = param; in OSI_timer_start()
93 if (timer->state != OSI_RUN) { in OSI_timer_start()
94 timer->state = OSI_RUN; in OSI_timer_start()
129 void OSI_timer_stop(tOSI_TIMER_HANDLER timer) { in OSI_timer_stop() argument
130 if (timer == NULL) { in OSI_timer_stop()
132 } else if (timer->state != OSI_RUN) { in OSI_timer_stop()
136 timer->state = OSI_STOP; in OSI_timer_stop()
148 void OSI_timer_free(tOSI_TIMER_HANDLER timer) { in OSI_timer_free() argument
149 if (timer) { in OSI_timer_free()
152 if (timer->state == OSI_RUN) osi_info.usingTimer--; in OSI_timer_free()
154 timer->state = OSI_FREE; in OSI_timer_free()
155 timer->name = NULL; in OSI_timer_free()
156 timer->callback = NULL; in OSI_timer_free()
157 timer->callback_param = NULL; in OSI_timer_free()
164 tOSI_TIMER_HANDLER timer = NULL; in OSI_timer_get_handler() local
171 if ((char const*)osi_info.timer[index].name == NULL) continue; in OSI_timer_get_handler()
173 if (strcmp((char const*)osi_info.timer[index].name, (char const*)name) == in OSI_timer_get_handler()
175 timer = &osi_info.timer[index]; in OSI_timer_get_handler()
181 return timer; in OSI_timer_get_handler()
211 if (osi_info.timer[index].state == OSI_RUN) { in OSI_timer_update()
212 osi_info.timer[index].timeout -= tick; in OSI_timer_update()
214 if (osi_info.timer[index].timeout <= 0) { in OSI_timer_update()
216 if (((OSI_timer_get_current_time() - osi_info.timer[index].exact_time) > in OSI_timer_update()
217 osi_info.timer[index].init_timeout) || in OSI_timer_update()
218 (OSI_timer_get_current_time() < osi_info.timer[index].exact_time)) in OSI_timer_update()
221 osi_info.timer[index].state = OSI_STOP; in OSI_timer_update()
224 if (osi_info.timer[index].callback != NULL) in OSI_timer_update()
225 osi_info.timer[index].callback( in OSI_timer_update()
226 osi_info.timer[index].callback_param); in OSI_timer_update()
228 osi_info.timer[index].timeout = in OSI_timer_update()
229 osi_info.timer[index].init_timeout - in OSI_timer_update()
230 (OSI_timer_get_current_time() - osi_info.timer[index].exact_time); in OSI_timer_update()