summaryrefslogtreecommitdiff
path: root/kernel/old/include/clock.h
blob: 6eae41f89ecc800a927afb71821f992e97e0e99f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
** @file	clock.h
**
** @author	CSCI-452 class of 20245
**
** @brief	Clock module declarations
*/

#ifndef CLOCK_H_
#define CLOCK_H_

#include <common.h>

/*
** General (C and/or assembly) definitions
*/

// conversion functions for seconds, ms, and ticks
// (SEC_TO_MS is defined in defs.h)
#define MS_TO_TICKS(n)           ((n))
#define SEC_TO_TICKS(n)          (MS_TO_TICKS(SEC_TO_MS(n)))
#define TICKS_TO_SEC(n)          ((n) / CLOCK_FREQ)
#define TICKS_TO_SEC_ROUNDED(n)  (((n)+(CLOCK_FREQ-1)) / CLOCK_FREQ)

#ifndef ASM_SRC

/*
** Start of C-only definitions
*/

/*
** Types
*/

/*
** Globals
*/

// current system time
extern uint32_t system_time;

/*
** Prototypes
*/

/**
** Name:	clk_init
**
** Clock module initialization
*/
void clk_init( void );

#endif  /* !ASM_SRC */

#endif