xref: /optee_os/core/include/kernel/timer.h (revision 9f34db38245c9b3a4e6e7e63eb78a75e23ab2da3)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (C) 2018, 2024, Linaro Limited
4  */
5 
6 #ifndef __KERNEL_TIMER_H
7 #define __KERNEL_TIMER_H
8 
9 #include <kernel/interrupt.h>
10 #include <types_ext.h>
11 
12 void generic_timer_start(uint32_t time_ms);
13 void generic_timer_stop(void);
14 
15 /* Handler for timer expiry interrupt */
16 void generic_timer_handler(uint32_t time_ms);
17 
18 /*
19  * timer_init_callout_service() - Initializes the callout service
20  * @itr_chip:	Interrupt chip, typically interrupt_get_main_chip()
21  * @itr_number:	Interrupt number in @itr_chip space for the timer.
22  *
23  * This function starts the callout service via interrupts from the timer.
24  * The platform or architecture specific code provides the implementation
25  * of this function. The interrupt callback function for the timer calls
26  * callout_service_cb() to drive the callout service.
27  *
28  * Note that usage of this function is incompatible with usage of the
29  * generic_timer_start(), generic_timer_stop() and generic_timer_handler()
30  * functions.
31  */
32 void timer_init_callout_service(struct itr_chip *itr_chip, size_t itr_number);
33 
34 #endif /* __KERNEL_TIMER_H */
35