xref: /rk3399_ARM-atf/include/drivers/delay_timer.h (revision c948f77136c42a92d0bb660543a3600c36dcf7f1)
1 /*
2  * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef DELAY_TIMER_H
8 #define DELAY_TIMER_H
9 
10 #include <stdint.h>
11 
12 /********************************************************************
13  * A simple timer driver providing synchronous delay functionality.
14  * The driver must be initialized with a structure that provides a
15  * function pointer to return the timer value and a clock
16  * multiplier/divider. The ratio of the multiplier and the divider is
17  * the clock period in microseconds.
18  ********************************************************************/
19 
20 typedef struct timer_ops {
21 	uint32_t (*get_timer_value)(void);
22 	uint32_t clk_mult;
23 	uint32_t clk_div;
24 } timer_ops_t;
25 
26 void mdelay(uint32_t msec);
27 void udelay(uint32_t usec);
28 void timer_init(const timer_ops_t *ops_ptr);
29 
30 #endif /* DELAY_TIMER_H */
31