1 // © 2021 Qualcomm Innovation Center, Inc. All rights reserved. 2 // 3 // SPDX-License-Identifier: BSD-3-Clause 4 5 // TODO: Add functions that work on other CPUs' queues. Important for migrating 6 // schedulers. 7 // FIXME: 8 9 // Initialise a timer object 10 void 11 timer_init_object(timer_t *timer, timer_action_t action); 12 13 // Returns whether this timer already belongs to a queue 14 bool 15 timer_is_queued(timer_t *timer); 16 17 // Add a timer object to this CPU's queue with the given absolute timeout 18 void 19 timer_enqueue(timer_t *timer, ticks_t timeout); 20 21 // Remove a timer object from a timer queue (if queued). 22 void 23 timer_dequeue(timer_t *timer); 24 25 // Update a timer object with a new absolute timeout. This will add the 26 // timer to this CPU's queue if not already queued. 27 void 28 timer_update(timer_t *timer, ticks_t timeout); 29 30 // Return the arch timer frequency 31 uint32_t 32 timer_get_timer_frequency(void); 33 34 // Return the counter value 35 ticks_t 36 timer_get_current_timer_ticks(void); 37 38 // Convert counter nanoseconds to ticks 39 ticks_t 40 timer_convert_ns_to_ticks(nanoseconds_t ns); 41 42 // Convert counter ticks to nanoseconds 43 nanoseconds_t 44 timer_convert_ticks_to_ns(ticks_t ticks); 45 46 // Get next timeout from cpu local queue 47 ticks_t 48 timer_queue_get_next_timeout(void) REQUIRE_PREEMPT_DISABLED; 49