-
Notifications
You must be signed in to change notification settings - Fork 0
/
SystemTickInit.s
71 lines (55 loc) · 1.14 KB
/
SystemTickInit.s
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
STCTRL EQU 0xE000E010
STRRELOAD EQU 0xE000E014
STCURRENT EQU 0xE000E018
SYSPRI3 EQU 0xE000ED20
AREA INIT_SYSTICK_, CODE, READONLY
THUMB
EXPORT INIT_SYSTICK
EXPORT systick_subR
EXTERN atd_sample
EXTERN atd_start
EXTERN take_fft
INIT_SYSTICK PROC
PUSH {R0, R1, LR}
LDR R1, =STCTRL
MOV R0, #0
STR R0, [R1]
LDR R1, =STRRELOAD
LDR R0, =2000
STR R0, [R1]
LDR R1, =STCURRENT
STR R0, [R1]
LDR R1, =SYSPRI3
MOV R0, #0x40000000
STR R0, [R1]
LDR R1, =STCTRL
MOV R0, #0x00003
STR R0, [R1]
POP {R0, R1, LR}
BX LR
ENDP
systick_subR PROC
;samples the ADC modules periodicly
PUSH {R4,LR}
BL atd_start
BL atd_sample
LDR R0, =0x20000800
LDR R1, [R0]
LSL R3, R1, #2
SUB R2, #0x60F
LSL R2, #4
MOV32 R4, #0x0000FFFF
AND R2, R4
STR R2, [R0, R3]
CMP R1, #256
BNE cont
MOVEQ R1, #0
BL take_fft
cont ADDNE r1, #1
;BEQ goto_freq_cal
STR R1, [R0]
POP {R4, LR}
BX LR
ENDP
ALIGN
END