Lines Matching refs:handle
121 static void delta_list_insert_timer(sl_sleeptimer_timer_handle_t *handle,
124 static sl_status_t delta_list_remove_timer(sl_sleeptimer_timer_handle_t *handle);
134 static sl_status_t create_timer(sl_sleeptimer_timer_handle_t *handle,
144 static void delay_callback(sl_sleeptimer_timer_handle_t *handle,
210 sl_status_t sl_sleeptimer_start_timer(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_start_timer() argument
219 if (handle == NULL) { in sl_sleeptimer_start_timer()
223 handle->conversion_error = 0; in sl_sleeptimer_start_timer()
224 handle->accumulated_error = 0; in sl_sleeptimer_start_timer()
226 sl_sleeptimer_is_timer_running(handle, &is_running); in sl_sleeptimer_start_timer()
231 return create_timer(handle, in sl_sleeptimer_start_timer()
243 sl_status_t sl_sleeptimer_restart_timer(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_restart_timer() argument
250 if (handle == NULL) { in sl_sleeptimer_restart_timer()
254 handle->conversion_error = 0; in sl_sleeptimer_restart_timer()
255 handle->accumulated_error = 0; in sl_sleeptimer_restart_timer()
258 sl_sleeptimer_stop_timer(handle); in sl_sleeptimer_restart_timer()
261 return create_timer(handle, in sl_sleeptimer_restart_timer()
273 sl_status_t sl_sleeptimer_start_periodic_timer(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_start_periodic_timer() argument
282 if (handle == NULL) { in sl_sleeptimer_start_periodic_timer()
286 handle->conversion_error = 0; in sl_sleeptimer_start_periodic_timer()
287 handle->accumulated_error = 0; in sl_sleeptimer_start_periodic_timer()
289 sl_sleeptimer_is_timer_running(handle, &is_running); in sl_sleeptimer_start_periodic_timer()
294 return create_timer(handle, in sl_sleeptimer_start_periodic_timer()
306 sl_status_t sl_sleeptimer_start_periodic_timer_ms(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_start_periodic_timer_ms() argument
317 if (handle == NULL) { in sl_sleeptimer_start_periodic_timer_ms()
321 sl_sleeptimer_is_timer_running(handle, &is_running); in sl_sleeptimer_start_periodic_timer_ms()
332 handle->conversion_error = 1000 in sl_sleeptimer_start_periodic_timer_ms()
335 if (handle->conversion_error == 1000) { in sl_sleeptimer_start_periodic_timer_ms()
336 handle->conversion_error = 0; in sl_sleeptimer_start_periodic_timer_ms()
341 handle->accumulated_error = 0; in sl_sleeptimer_start_periodic_timer_ms()
343 return create_timer(handle, in sl_sleeptimer_start_periodic_timer_ms()
355 sl_status_t sl_sleeptimer_restart_periodic_timer(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_restart_periodic_timer() argument
362 if (handle == NULL) { in sl_sleeptimer_restart_periodic_timer()
366 handle->conversion_error = 0; in sl_sleeptimer_restart_periodic_timer()
367 handle->accumulated_error = 0; in sl_sleeptimer_restart_periodic_timer()
370 sl_sleeptimer_stop_timer(handle); in sl_sleeptimer_restart_periodic_timer()
373 return create_timer(handle, in sl_sleeptimer_restart_periodic_timer()
385 sl_status_t sl_sleeptimer_restart_periodic_timer_ms(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_restart_periodic_timer_ms() argument
395 if (handle == NULL) { in sl_sleeptimer_restart_periodic_timer_ms()
405 handle->conversion_error = 1000 in sl_sleeptimer_restart_periodic_timer_ms()
408 if (handle->conversion_error == 1000) { in sl_sleeptimer_restart_periodic_timer_ms()
409 handle->conversion_error = 0; in sl_sleeptimer_restart_periodic_timer_ms()
415 handle->accumulated_error = 0; in sl_sleeptimer_restart_periodic_timer_ms()
418 sl_sleeptimer_stop_timer(handle); in sl_sleeptimer_restart_periodic_timer_ms()
421 return create_timer(handle, in sl_sleeptimer_restart_periodic_timer_ms()
433 sl_status_t sl_sleeptimer_stop_timer(sl_sleeptimer_timer_handle_t *handle) in sl_sleeptimer_stop_timer() argument
443 …if (handle->option_flags == (SLI_SLEEPTIMER_POWER_MANAGER_EARLY_WAKEUP_TIMER_FLAG | SLI_SLEEPTIMER… in sl_sleeptimer_stop_timer()
448 if (handle == NULL) { in sl_sleeptimer_stop_timer()
456 if (timer_head == handle) { in sl_sleeptimer_stop_timer()
460 error = delta_list_remove_timer(handle); in sl_sleeptimer_stop_timer()
481 sl_status_t sl_sleeptimer_is_timer_running(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_is_timer_running() argument
487 if (handle == NULL || running == NULL) { in sl_sleeptimer_is_timer_running()
494 if (current == handle) { in sl_sleeptimer_is_timer_running()
508 sl_status_t sl_sleeptimer_get_timer_time_remaining(sl_sleeptimer_timer_handle_t *handle, in sl_sleeptimer_get_timer_time_remaining() argument
514 if (handle == NULL || time == NULL) { in sl_sleeptimer_get_timer_time_remaining()
521 *time = handle->delta; in sl_sleeptimer_get_timer_time_remaining()
525 while (current != handle && current != NULL) { in sl_sleeptimer_get_timer_time_remaining()
530 if (current != handle) { in sl_sleeptimer_get_timer_time_remaining()
1381 static void delay_callback(sl_sleeptimer_timer_handle_t *handle, in delay_callback() argument
1386 (void)handle; // Unused parameter. in delay_callback()
1397 static void delta_list_insert_timer(sl_sleeptimer_timer_handle_t *handle, in delta_list_insert_timer() argument
1407 if (handle->option_flags == 0) { in delta_list_insert_timer()
1417 handle->delta = local_handle_delta; in delta_list_insert_timer()
1425 … || (((local_handle_delta - current->delta) == 0) && (handle->priority > current->priority)))) { in delta_list_insert_timer()
1427 handle->delta = local_handle_delta; in delta_list_insert_timer()
1434 prev->next = handle; in delta_list_insert_timer()
1436 timer_head = handle; in delta_list_insert_timer()
1438 handle->next = current; in delta_list_insert_timer()
1444 timer_head = handle; in delta_list_insert_timer()
1445 handle->next = NULL; in delta_list_insert_timer()
1456 static sl_status_t delta_list_remove_timer(sl_sleeptimer_timer_handle_t *handle) in delta_list_remove_timer() argument
1462 while (current != NULL && current != handle) { in delta_list_remove_timer()
1467 if (current != handle) { in delta_list_remove_timer()
1472 prev->next = handle->next; in delta_list_remove_timer()
1474 timer_head = handle->next; in delta_list_remove_timer()
1478 if (handle->next != NULL) { in delta_list_remove_timer()
1479 handle->next->delta += handle->delta; in delta_list_remove_timer()
1548 static sl_status_t create_timer(sl_sleeptimer_timer_handle_t *handle, in create_timer() argument
1558 handle->priority = priority; in create_timer()
1559 handle->callback_data = callback_data; in create_timer()
1560 handle->next = NULL; in create_timer()
1561 handle->timeout_periodic = timeout_periodic; in create_timer()
1562 handle->callback = callback; in create_timer()
1563 handle->option_flags = option_flags; in create_timer()
1565 handle->timeout_expected_tc = sleeptimer_hal_get_counter() + timeout_initial; in create_timer()
1567 handle->timeout_expected_tc = sleeptimer_hal_get_counter() + timeout_periodic; in create_timer()
1571 handle->delta = 0; in create_timer()
1572 if (handle->callback != NULL) { in create_timer()
1573 handle->callback(handle, handle->callback_data); in create_timer()
1594 delta_list_insert_timer(handle, timeout_initial); in create_timer()
1597 if (timer_head == handle) { in create_timer()