delay_timer.h 886 Bytes
Newer Older
1
/*
2
 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

7
8
#ifndef DELAY_TIMER_H
#define DELAY_TIMER_H
9
10
11
12
13
14
15
16

#include <stdint.h>

/********************************************************************
 * A simple timer driver providing synchronous delay functionality.
 * The driver must be initialized with a structure that provides a
 * function pointer to return the timer value and a clock
 * multiplier/divider. The ratio of the multiplier and the divider is
Juan Castillo's avatar
Juan Castillo committed
17
 * the clock period in microseconds.
18
19
20
21
22
23
24
25
26
27
 ********************************************************************/

typedef struct timer_ops {
	uint32_t (*get_timer_value)(void);
	uint32_t clk_mult;
	uint32_t clk_div;
} timer_ops_t;

void mdelay(uint32_t msec);
void udelay(uint32_t usec);
28
void timer_init(const timer_ops_t *ops_ptr);
29

30
#endif /* DELAY_TIMER_H */