summaryrefslogtreecommitdiff
path: root/os/time.h
blob: 628783454bd17ffab268041053d2dad19d7d25c2 (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
#ifndef TIME_H
#define TIME_H

#include <stdint.h>

struct STK_t {
	volatile uint32_t CTRL;
	volatile uint32_t LOAD;
	volatile uint32_t VAL;
	volatile uint32_t CALIB;
};

static STK_t& STK = *(STK_t*)0xe000e010;

class Time {
	private:
		static volatile uint32_t systime;
	
	public:
		inline static void tick() {
			systime++;
		}
		
		inline static uint32_t time() {
			return systime;
		}
};

#endif