coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
timer.c File Reference
#include <timer.h>
#include <delay.h>
#include <device/mmio.h>
#include "dmtimer.h"
#include "clock.h"
Include dependency graph for timer.c:

Go to the source code of this file.

Macros

#define CLKSEL_M_OSC   (0x01 << 0)
 

Functions

static uint32_t timer_raw_value (void)
 
void timer_monotonic_get (struct mono_time *mt)
 Get GTI counter value. More...
 
void init_timer (void)
 Init Global System Timers Unit (GTI). More...
 

Variables

struct am335x_dmtimerdmtimer_2 = (struct am335x_dmtimer *)DMTIMER_2
 

Macro Definition Documentation

◆ CLKSEL_M_OSC

#define CLKSEL_M_OSC   (0x01 << 0)

Definition at line 12 of file timer.c.

Function Documentation

◆ init_timer()

void init_timer ( void  )

Init Global System Timers Unit (GTI).

Configure timer to run at 1MHz tick-rate.

Init Global System Timers Unit (GTI).

Definition at line 24 of file timer.c.

References am335x_cm_dpll, CLKSEL_M_OSC, am335x_cm_dpll_regs::clksel_timer2_clk, dmtimer_2, am335x_dmtimer::tclr, TCLR_AR, TCLR_ST, and write32().

Here is the call graph for this function:

◆ timer_monotonic_get()

void timer_monotonic_get ( struct mono_time mt)

Get GTI counter value.

Parameters
mtStructure to fill

Definition at line 19 of file timer.c.

References M_OSC_MHZ, mono_time_set_usecs(), and timer_raw_value().

Referenced by stopwatch_init(), and stopwatch_tick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timer_raw_value()

static uint32_t timer_raw_value ( void  )
static

Definition at line 14 of file timer.c.

References dmtimer_2, read32(), and am335x_dmtimer::tcrr.

Referenced by timer_monotonic_get().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dmtimer_2

struct am335x_dmtimer* dmtimer_2 = (struct am335x_dmtimer *)DMTIMER_2

Definition at line 10 of file timer.c.

Referenced by init_timer(), and timer_raw_value().