-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrpi-armtimer.h
48 lines (35 loc) · 1.24 KB
/
rpi-armtimer.h
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
/*
Reference:
Brian Sidebotham's Bare Metal Pi Tutorial. www.valvers.com
Davis Welch's Pi Repo. www.github.com/dwelch67/raspberrypi
Huanle Zhang at UC Davis. www.huanlezhang.com
April 28, 2017
*/
#ifndef _RPI_ARM_TIMER_H_
#define _RPI_ARM_TIMER_H_
#include "rpiArgs.h"
#define ARMTIMER_BASE ( TIMER_BASE + 0x400 )
#define ARMTIMER_CONTROL_16BIT ( 0 << 1 )
#define ARMTIMER_CONTROL_23BIT ( 1 << 1)
#define ARMTIMER_CONTROL_PRESCALE_1 ( 0 << 2 )
#define ARMTIMER_CONTROL_PRESCALE_16 ( 1 << 2 )
#define ARMTIMER_CONTROL_PRESCALE_256 ( 2 << 2 )
#define ARMTIMER_CONTROL_TIMER_INTERRUPT_DISABLE ( 0 << 5 )
#define ARMTIMER_CONTROL_TIMER_INTERRUPT_ENABLE ( 1 << 5 )
#define ARMTIMER_CONTROL_TIMER_DISABLE ( 0 << 7 )
#define ARMTIMER_CONTROL_TIMER_ENABLE ( 1 << 7 )
typedef struct {
volatile unsigned int Load;
volatile unsigned int Value;
volatile unsigned int Control;
volatile unsigned int IRQ_ClearAck;
volatile unsigned int RAW_IRQ;
volatile unsigned int Masked_IRQ;
volatile unsigned int Reload;
volatile unsigned int PreDivider;
volatile unsigned int Free_Running_Counter;
} Arm_timer_t;
void setTimer(unsigned int us);
void cancelTimer(void);
inline void clearTimerPendingBit(void);
#endif