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

Go to the source code of this file.

Functions

__weak void timer_prepare (void)
 
static uint64_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

static struct mtk_gpt_regs *const mtk_gpt = (void *)GPT_BASE
 

Function Documentation

◆ init_timer()

void init_timer ( void  )

Init Global System Timers Unit (GTI).

Configure timer to run at 1MHz tick-rate.

Definition at line 33 of file timer.c.

References clrbits32, GPT6_CLK_CLK6_SYS, GPT6_CLK_CLKDIV_DIV1, GPT6_CLOCK_REG, mtk_gpt_regs::gpt6_con, GPT6_CON_CLR, GPT6_CON_EN, GPT6_MODE_FREERUN, mtk_gpt, SET32_BITFIELDS, setbits32, and timer_prepare().

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 28 of file timer.c.

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

Here is the call graph for this function:

◆ timer_prepare()

__weak void timer_prepare ( void  )

Definition at line 13 of file timer.c.

Referenced by init_timer().

Here is the caller graph for this function:

◆ timer_raw_value()

static uint64_t timer_raw_value ( void  )
static

Definition at line 15 of file timer.c.

References mtk_gpt_regs::gpt6_cnt_h, mtk_gpt_regs::gpt6_cnt_l, mtk_gpt, and read32().

Referenced by timer_monotonic_get().

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

Variable Documentation

◆ mtk_gpt

struct mtk_gpt_regs* const mtk_gpt = (void *)GPT_BASE
static

Definition at line 11 of file timer.c.

Referenced by init_timer(), and timer_raw_value().