xtensa_timer1.S
3.04 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include "os_type.h"
#if 1//def TIMER1_ENABLE
//#include "tx_port.h"
//#include "xtensa_rtos.h"
//#include "xtensa_timer.h"
#include "xtensa_context.h"
#define XT_TIMER_INDEX 1
#define XT_CCOMPARE (CCOMPARE + XT_TIMER_INDEX)
#define XT_TIMER_INTNUM XCHAL_TIMER_INTERRUPT(XT_TIMER_INDEX)
#define XT_TIMER_INTPRI XCHAL_INT_LEVEL(XT_TIMER_INTNUM)
#define XT_TIMER_INTEN (1 << XT_TIMER_INTNUM)
.text
.align 4
/* .literal_position*/
/* .section ._xtensa_timer1_init, "ax"*/
/* .section .internal_ram_1_text, "ax"*/
.global xtensa_timer1_init
.type xtensa_timer1_init, @function
.extern _xt_tick1_divisor
xtensa_timer1_init:
//ENTRY(16)
entry sp, 16
#if 1
/* Set up the periodic tick timer (assume enough time to complete init). */
#if 0//def XT_CLOCK_FREQ
movi a3, XT_TICK_DIVISOR
#else
movi a2, _xt_tick1_divisor
l32i a3, a2, 0
#endif
rsr a2, CCOUNT /* current cycle count */
add a2, a2, a3 /* time of first timer interrupt */
wsr a2, XT_CCOMPARE /* set the comparator */
#else
/* Set up the periodic tick timer (assume enough time to complete init). */
movi a2, _xt_tick1_divisor
l32i a3, a2, 0
rsr a2, CCOUNT /* current cycle count */
add a2, a2, a3 /* time of first timer interrupt */
wsr a2, CCOMPARE1 /* set the comparator */
#endif
#if 0
/* Enable the timer interrupt at the device level. */
movi a2, 0 /* protect critical section */
xsr a2, INTENABLE
movi a3, XT_TIMER_INTEN
or a2, a2, a3
wsr a2, INTENABLE /* set new INTENABLE, no need to rsync */
#endif
#if 0
/* Enable the timer interrupt at the device level. */
movi a2, 0 /* protect critical section */
// xsr a2, INTENABLE
rsr a2, INTENABLE
// movi a3, XT_TIMER1_INTEN
movi a3, (1 << 10)
or a2, a2, a3
wsr a2, INTENABLE /* set new INTENABLE, no need to rsync */
#endif
#if 0
/* Enable the timer interrupt at the device level. */
// movi a2, 0 /* protect critical section */
rsr a2, INTENABLE
// movi a3, XT_TIMER1_INTEN
movi a3, (1 << 10)
or a2, a2, a3
wsr a2, INTENABLE /* set new INTENABLE, no need to rsync */
#endif
//RET(16)
retw
.text
/* .align 4*/
/* .literal_position*/
/* .section ._xtensa_timer1_init, "ax"*/
.section .internal_ram_1_text, "ax"
.global xtensa_timer1_updata
.type xtensa_timer1_updata, @function
.align 4
xtensa_timer1_updata:
//ENTRY(16)
entry sp, 16
/* Update the timer comparator for the next tick. */
movi a3, _xt_tick1_divisor
l32i a2, a3, 0 /* a2 = comparator increment */
// rsr a3, CCOMPARE1 /* a3 = old comparator value */
rsr a3, CCOUNT /* current cycle count */
add a4, a3, a2 /* a4 = new comparator value */
wsr a4, CCOMPARE1 /* update comp. and clear interrupt */
esync
//RET(16)
retw
#endif //TIMER1_ENABLE