Ryan Harkin | 9055c7d | 2015-03-17 14:50:05 +0000 | [diff] [blame] | 1 | /* |
Roberto Vargas | 9fb8af3 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Ryan Harkin | 9055c7d | 2015-03-17 14:50:05 +0000 | [diff] [blame] | 3 | * |
dp-arm | 82cb2c1 | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Ryan Harkin | 9055c7d | 2015-03-17 14:50:05 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | c3cf06f | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef DELAY_TIMER_H |
| 8 | #define DELAY_TIMER_H |
Ryan Harkin | 9055c7d | 2015-03-17 14:50:05 +0000 | [diff] [blame] | 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 |
Juan Castillo | 540a5ba | 2015-12-01 16:10:15 +0000 | [diff] [blame] | 17 | * the clock period in microseconds. |
Ryan Harkin | 9055c7d | 2015-03-17 14:50:05 +0000 | [diff] [blame] | 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); |
Roberto Vargas | 9fb8af3 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 28 | void timer_init(const timer_ops_t *ops_ptr); |
Ryan Harkin | 9055c7d | 2015-03-17 14:50:05 +0000 | [diff] [blame] | 29 | |
Antonio Nino Diaz | c3cf06f | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 30 | #endif /* DELAY_TIMER_H */ |