Ryan Harkin | 0392579 | 2015-03-17 14:52:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Ryan Harkin | 0392579 | 2015-03-17 14:52:39 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef SP804_DELAY_TIMER_H |
| 8 | #define SP804_DELAY_TIMER_H |
Ryan Harkin | 0392579 | 2015-03-17 14:52:39 +0000 | [diff] [blame] | 9 | |
Ryan Harkin | 0392579 | 2015-03-17 14:52:39 +0000 | [diff] [blame] | 10 | #include <stdint.h> |
| 11 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 12 | #include <drivers/delay_timer.h> |
Ryan Harkin | 0392579 | 2015-03-17 14:52:39 +0000 | [diff] [blame] | 13 | |
| 14 | uint32_t sp804_get_timer_value(void); |
| 15 | |
| 16 | void sp804_timer_ops_init(uintptr_t base_addr, const timer_ops_t *ops); |
| 17 | |
| 18 | #define sp804_timer_init(base_addr, clk_mult, clk_div) \ |
Sandrine Bailleux | abad701 | 2015-09-28 16:32:38 +0100 | [diff] [blame] | 19 | do { \ |
| 20 | static const timer_ops_t sp804_timer_ops = { \ |
| 21 | sp804_get_timer_value, \ |
| 22 | (clk_mult), \ |
| 23 | (clk_div) \ |
| 24 | }; \ |
| 25 | sp804_timer_ops_init((base_addr), &sp804_timer_ops); \ |
| 26 | } while (0) |
Ryan Harkin | 0392579 | 2015-03-17 14:52:39 +0000 | [diff] [blame] | 27 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 28 | #endif /* SP804_DELAY_TIMER_H */ |