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

Go to the source code of this file.

Macros

#define DGT_MHZ_NUM   25
 
#define DGT_MHZ_DEN   4
 
#define TIMER_TICKS(us)   ((DGT_MHZ_NUM*(us) + (DGT_MHZ_DEN - 1)) / DGT_MHZ_DEN)
 
#define TIMER_USECS(ticks)   (DGT_MHZ_DEN*(ticks) / DGT_MHZ_NUM)
 
#define DGT_CLK_DIV_1   0
 
#define DGT_CLK_DIV_2   1
 
#define DGT_CLK_DIV_3   2
 
#define DGT_CLK_DIV_4   3
 

Functions

void init_timer (void)
 init_timer - initialize timer More...
 
void udelay (unsigned int usec)
 udelay - generates micro second delay. More...
 
void timer_monotonic_get (struct mono_time *mt)
 Get GTI counter value. More...
 

Macro Definition Documentation

◆ DGT_CLK_DIV_1

#define DGT_CLK_DIV_1   0

Definition at line 18 of file timer.c.

◆ DGT_CLK_DIV_2

#define DGT_CLK_DIV_2   1

Definition at line 19 of file timer.c.

◆ DGT_CLK_DIV_3

#define DGT_CLK_DIV_3   2

Definition at line 20 of file timer.c.

◆ DGT_CLK_DIV_4

#define DGT_CLK_DIV_4   3

Definition at line 21 of file timer.c.

◆ DGT_MHZ_DEN

#define DGT_MHZ_DEN   4

Definition at line 12 of file timer.c.

◆ DGT_MHZ_NUM

#define DGT_MHZ_NUM   25

Definition at line 11 of file timer.c.

◆ TIMER_TICKS

#define TIMER_TICKS (   us)    ((DGT_MHZ_NUM*(us) + (DGT_MHZ_DEN - 1)) / DGT_MHZ_DEN)

Definition at line 14 of file timer.c.

◆ TIMER_USECS

#define TIMER_USECS (   ticks)    (DGT_MHZ_DEN*(ticks) / DGT_MHZ_NUM)

Definition at line 15 of file timer.c.

Function Documentation

◆ init_timer()

void init_timer ( void  )

init_timer - initialize timer

Init Global System Timers Unit (GTI).

Definition at line 26 of file timer.c.

References DGT_CLEAR, DGT_CLK_CTL, DGT_CLK_DIV_4, DGT_ENABLE, DGT_ENABLE_EN, and writel_i.

◆ timer_monotonic_get()

void timer_monotonic_get ( struct mono_time mt)

Get GTI counter value.

Parameters
mtStructure to fill

Definition at line 68 of file timer.c.

References DGT_COUNT_VAL, mono_time_set_usecs(), readl_i, and TIMER_USECS.

Here is the call graph for this function:

◆ udelay()

void udelay ( unsigned int  usec)

udelay - generates micro second delay.

Parameters
usecdelay duration in microseconds

Definition at line 47 of file timer.c.

References DGT_COUNT_VAL, readl_i, and TIMER_TICKS.