Lines Matching refs:ctx

79     struct timer_dev_ctx *ctx,  in _time_to_timestamp()  argument
86 fwk_assert(ctx != NULL); in _time_to_timestamp()
89 status = ctx->driver->get_frequency(ctx->driver_dev_id, &frequency); in _time_to_timestamp()
100 struct timer_dev_ctx *ctx, in _timestamp_from_now() argument
107 fwk_assert(ctx != NULL); in _timestamp_from_now()
110 status = _time_to_timestamp(ctx, microseconds, timestamp); in _timestamp_from_now()
115 status = ctx->driver->get_counter(ctx->driver_dev_id, &counter); in _timestamp_from_now()
126 const struct timer_dev_ctx *ctx, in _remaining() argument
133 fwk_assert(ctx != NULL); in _remaining()
136 status = ctx->driver->get_counter(ctx->driver_dev_id, &counter); in _remaining()
151 static void _configure_timer_with_next_alarm(struct timer_dev_ctx *ctx) in _configure_timer_with_next_alarm() argument
156 fwk_assert(ctx != NULL); in _configure_timer_with_next_alarm()
159 (struct alarm_sub_element_ctx *)fwk_list_head(&ctx->alarms_active); in _configure_timer_with_next_alarm()
163 ctx->driver->set_timer(ctx->driver_dev_id, alarm_head->timestamp); in _configure_timer_with_next_alarm()
168 status = ctx->driver->enable(ctx->driver_dev_id); in _configure_timer_with_next_alarm()
176 struct timer_dev_ctx *ctx, in _insert_alarm_ctx_into_active_queue() argument
182 fwk_assert(ctx != NULL); in _insert_alarm_ctx_into_active_queue()
189 alarm_node = fwk_list_head(&ctx->alarms_active); in _insert_alarm_ctx_into_active_queue()
193 alarm_node = fwk_list_next(&ctx->alarms_active, alarm_node); in _insert_alarm_ctx_into_active_queue()
198 fwk_list_insert(&ctx->alarms_active, in _insert_alarm_ctx_into_active_queue()
212 struct timer_dev_ctx *ctx; in get_frequency() local
214 ctx = &ctx_table[fwk_id_get_element_idx(dev_id)]; in get_frequency()
220 return ctx->driver->get_frequency(ctx->driver_dev_id, frequency); in get_frequency()
227 struct timer_dev_ctx *ctx; in time_to_timestamp() local
233 ctx = &ctx_table[fwk_id_get_element_idx(dev_id)]; in time_to_timestamp()
235 return _time_to_timestamp(ctx, microseconds, timestamp); in time_to_timestamp()
240 struct timer_dev_ctx *ctx; in get_counter() local
242 ctx = &ctx_table[fwk_id_get_element_idx(dev_id)]; in get_counter()
249 return ctx->driver->get_counter(ctx->driver_dev_id, counter); in get_counter()
255 struct timer_dev_ctx *ctx; in delay() local
258 ctx = &ctx_table[fwk_id_get_element_idx(dev_id)]; in delay()
260 status = _timestamp_from_now(ctx, microseconds, &counter_limit); in delay()
266 status = ctx->driver->get_counter(ctx->driver_dev_id, &counter); in delay()
280 struct timer_dev_ctx *ctx; in wait() local
284 ctx = &ctx_table[fwk_id_get_element_idx(dev_id)]; in wait()
286 status = _timestamp_from_now(ctx, microseconds, &counter_limit); in wait()
296 status = ctx->driver->get_counter(ctx->driver_dev_id, &counter); in wait()
318 struct timer_dev_ctx *ctx; in remaining() local
320 ctx = &ctx_table[fwk_id_get_element_idx(dev_id)]; in remaining()
326 return _remaining(ctx, timestamp, remaining_ticks); in remaining()
334 const struct timer_dev_ctx *ctx; in get_next_alarm_remaining() local
345 ctx = &ctx_table[fwk_id_get_element_idx(dev_id)]; in get_next_alarm_remaining()
351 status = ctx->driver->disable(ctx->driver_dev_id); in get_next_alarm_remaining()
356 *has_alarm = !fwk_list_is_empty(&ctx->alarms_active); in get_next_alarm_remaining()
359 alarm_ctx_node = fwk_list_head(&ctx->alarms_active); in get_next_alarm_remaining()
363 exit_status = _remaining(ctx, alarm_ctx->timestamp, remaining_ticks); in get_next_alarm_remaining()
368 status = ctx->driver->enable(ctx->driver_dev_id); in get_next_alarm_remaining()
393 struct timer_dev_ctx *ctx; in alarm_stop() local
399 ctx = &ctx_table[fwk_id_get_element_idx(alarm_id)]; in alarm_stop()
410 if (interrupt == ctx->config->timer_irq) { in alarm_stop()
423 alarm = &ctx->alarm_pool[fwk_id_get_sub_element_idx(alarm_id)]; in alarm_stop()
426 status = ctx->driver->disable(ctx->driver_dev_id); in alarm_stop()
432 status = ctx->driver->enable(ctx->driver_dev_id); in alarm_stop()
455 status = fwk_interrupt_clear_pending(ctx->config->timer_irq); in alarm_stop()
460 fwk_list_remove(&ctx->alarms_active, (struct fwk_dlist_node *)alarm); in alarm_stop()
463 _configure_timer_with_next_alarm(ctx); in alarm_stop()
475 struct timer_dev_ctx *ctx; in alarm_start() local
490 ctx = ctx_table + fwk_id_get_element_idx(alarm_id); in alarm_start()
491 alarm = &ctx->alarm_pool[fwk_id_get_sub_element_idx(alarm_id)]; in alarm_start()
511 status = _timestamp_from_now(ctx, in alarm_start()
519 status = ctx->driver->disable(ctx->driver_dev_id); in alarm_start()
524 _insert_alarm_ctx_into_active_queue(ctx, alarm); in alarm_start()
526 _configure_timer_with_next_alarm(ctx); in alarm_start()
540 struct timer_dev_ctx *ctx = (struct timer_dev_ctx *)ctx_ptr; in timer_isr() local
543 fwk_assert(ctx != NULL); in timer_isr()
546 status = ctx->driver->disable(ctx->driver_dev_id); in timer_isr()
551 status = fwk_interrupt_clear_pending(ctx->config->timer_irq); in timer_isr()
557 (struct alarm_sub_element_ctx *)fwk_list_pop_head(&ctx->alarms_active); in timer_isr()
572 status = _time_to_timestamp(ctx, alarm->microseconds, &timestamp); in timer_isr()
576 _insert_alarm_ctx_into_active_queue(ctx, alarm); in timer_isr()
584 _configure_timer_with_next_alarm(ctx); in timer_isr()
603 struct timer_dev_ctx *ctx; in timer_device_init() local
607 ctx = ctx_table + fwk_id_get_element_idx(element_id); in timer_device_init()
608 ctx->config = data; in timer_device_init()
611 ctx->alarm_pool = in timer_device_init()
621 struct timer_dev_ctx *ctx; in timer_bind() local
634 ctx = ctx_table + fwk_id_get_element_idx(id); in timer_bind()
635 ctx->driver_dev_id = ctx->config->id; in timer_bind()
638 driver_module_idx = fwk_id_get_module_idx(ctx->driver_dev_id); in timer_bind()
639 status = fwk_module_bind(ctx->driver_dev_id, in timer_bind()
652 ctx->driver = driver; in timer_bind()
662 struct timer_dev_ctx *ctx; in timer_process_bind_request() local
682 ctx = ctx_table + fwk_id_get_element_idx(id); in timer_process_bind_request()
683 alarm_ctx = &ctx->alarm_pool[fwk_id_get_sub_element_idx(id)]; in timer_process_bind_request()
699 struct timer_dev_ctx *ctx; in timer_start() local
705 ctx = ctx_table + fwk_id_get_element_idx(id); in timer_start()
707 fwk_list_init(&ctx->alarms_active); in timer_start()
710 ctx->config->timer_irq, timer_isr, (uintptr_t)ctx); in timer_start()
715 return fwk_interrupt_enable(ctx->config->timer_irq); in timer_start()