-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhw.h
More file actions
50 lines (42 loc) · 852 Bytes
/
hw.h
File metadata and controls
50 lines (42 loc) · 852 Bytes
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
#ifndef HW_H
#define HW_H
#include "types.h"
/** @macro instruction to enable interrupts */
#define ENABLE_IRQ() \
asm("\tpush {r0}\n\t" \
"mrs r0,cpsr\n\t" \
"bic r0,r0,#0x80\n\t" \
"msr cpsr_c,r0\n\t" \
"pop {r0}" \
: \
: \
: "r0");
/** @macro instruction to disable interrupts */
#define DISABLE_IRQ() \
asm("\tpush {r0}\n\t" \
"mrs r0,cpsr\n\t" \
"orr r0,r0,#0x80\n\t" \
"msr cpsr_c,r0\n\t" \
"pop {r0}" \
: \
: \
: "r0");
/**
* Set a delay of 0x80000 and enable the IRQ timer
*/
void hw_set_tick_and_enable_timer();
/**
* Shut the led
*/
void hw_led_off();
/**
* Light the led
*/
void hw_led_on();
/**
* Init the hardware
*
* @return the success of the operation
*/
bool hw_init();
#endif