1/*
2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#include <drivers/timer/arm_global.h>
8
9timer_t *const globalTimer = (timer_t *) TIMER_PPTR;
10
11/** DONT_TRANSLATE */
12BOOT_CODE void initTimer(void)
13{
14    /* disable the timer */
15    globalTimer->control = 0;
16    /* zero the timer */
17    globalTimer->countLower = 0;
18    globalTimer->countUpper = 0;
19    /* turn it on again, wih interrupts on, comparator register off,
20     * in one-shot mode, with standard prescaler */
21    globalTimer->control = BIT(ENABLE) | BIT(IRQ_ENABLE);
22
23    /* this timer will overflow in about 1000 years */
24}
25