coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
timer.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <timer.h>
4 #include <delay.h>
5 #include <device/mmio.h>
6 
7 #include "dmtimer.h"
8 #include "clock.h"
9 
11 
12 #define CLKSEL_M_OSC (0x01 << 0)
13 
15 {
16  return read32(&dmtimer_2->tcrr);
17 }
18 
20 {
22 }
23 
24 void init_timer(void)
25 {
27 
28  // Start the dmtimer in autoreload mode without any prescalers
29  // With M_OSC at 24MHz, this gives a few minutes before the timer overflows
31 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
static uint32_t read32(const void *addr)
Definition: mmio.h:22
#define M_OSC_MHZ
Definition: dmtimer.h:8
#define DMTIMER_2
Definition: dmtimer.h:35
#define TCLR_ST
Definition: dmtimer.h:32
#define TCLR_AR
Definition: dmtimer.h:33
static void mono_time_set_usecs(struct mono_time *mt, long us)
Definition: timer.h:53
__weak void init_timer(void)
Definition: timer.c:7
void timer_monotonic_get(struct mono_time *mt)
Definition: timer.c:7
static struct am335x_cm_dpll_regs *const am335x_cm_dpll
Definition: clock.h:179
static uint32_t timer_raw_value(void)
Definition: timer.c:14
struct am335x_dmtimer * dmtimer_2
Definition: timer.c:10
#define CLKSEL_M_OSC
Definition: timer.c:12
unsigned int uint32_t
Definition: stdint.h:14
uint32_t clksel_timer2_clk
Definition: clock.h:164
uint32_t tclr
Definition: dmtimer.h:21
uint32_t tcrr
Definition: dmtimer.h:22