blob: c68d8dea80f85f672d84ec09f3d592471e0d6aa7 (
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
|
#ifndef SYS_CORE_H
#define SYS_CORE_H
static inline unsigned long load32(unsigned long addr)
{
return *(volatile unsigned long*)addr;
}
static inline void store32(unsigned long value, unsigned long addr)
{
*(volatile unsigned long*)addr = value;
}
static inline void delay(unsigned long cycles)
{
asm volatile("__delay_%=: subs %[cycles], %[cycles], #1;bne __delay_%=\n"
: "=r"(cycles): [cycles]"0"(cycles) : "cc");
}
static inline void* getlr(void)
{
void* out;
asm volatile ("mov %0, lr" : "=r"(out));
return out;
}
static inline void* getpc(void)
{
void* out;
asm volatile ("mov %0, pc" : "=r"(out));
return out;
}
static inline void* getsp(void)
{
void* out;
asm volatile ("mov %0, sp" : "=r"(out));
return out;
}
static inline void setsp(void* in)
{
asm volatile ("mov sp, %0" :: "r"(in));
}
static inline void* heap_end(void)
{
unsigned long value;
asm volatile ("ldr %0, =__bss_end": "=r"(value));
return (void*)value;
}
void sysinit(void);
#endif
|