OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [GCC/] [OpenRISC/] [portasm.S] - Blame information for rev 572

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 572 jeremybenn
#include "port_spr_defs.h"
2
 
3
        .file           "portasm.S"
4
        .section        .text
5
 
6
.text
7
.global vPortDisableInterrupts
8
.type   vPortDisableInterrupts, %function
9
vPortDisableInterrupts:
10
        l.mfspr r3, r0, SPR_SR          # get current SR
11
        l.addi  r4, r0, SPR_SR_TEE
12
        l.xori  r4, r4, 0xffffffff
13
        l.and   r3, r3, r4                      # disable Tick Timer Interrupt
14
        l.addi  r4, r0, SPR_SR_IEE
15
        l.xori  r4, r4, 0xffffffff
16
        l.and   r3, r3, r4                      # disable External Interrupt
17
        l.mtspr r0, r3, SPR_SR          # update SR
18
        l.jr    r9
19
.size   vPortDisableInterrupts, .-vPortDisableInterrupts
20
 
21
 
22
.text
23
.global vPortEnableInterrupts
24
.type   vPortEnableInterrupts, %function
25
vPortEnableInterrupts:
26
        l.mfspr r3, r0, SPR_SR          # get current SR
27
        l.ori   r3, r3, SPR_SR_TEE      # enable Tick Timer Interrup
28
        l.ori   r3, r3, SPR_SR_IEE      # enable External Interrupt
29
        l.mtspr r0, r3, SPR_SR          # update SR
30
        l.jr    r9
31
.size   vPortEnableInterrupts, .-vPortEnableInterrupts
32
 
33
.text
34
.global vTickHandler
35
.type   vTickHandler, %function
36
vTickHandler:
37
        # portSAVE_CONTEXT
38
        .global pxCurrentTCB
39
        # make rooms in stack
40
        l.addi  r1, r1, -128
41
        # early save r3-r5, these are clobber register
42
        l.sw    0x08(r1), r3
43
        l.sw    0x0C(r1), r4
44
        l.sw    0x10(r1), r5
45
        # save SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
46
        l.mfspr r3, r0, (0<<11) + 64
47
        l.mfspr r4, r0, (0<<11) + 32
48
        l.sw    0x78(r1), r3
49
        l.sw    0x7C(r1), r4
50
        l.sw    0x00(r1), r9
51
        # Save Context
52
        l.sw    0x04(r1), r2
53
        l.sw    0x14(r1), r6
54
        l.sw    0x18(r1), r7
55
        l.sw    0x1C(r1), r8
56
        l.sw    0x20(r1), r10
57
        l.sw    0x24(r1), r11
58
        l.sw    0x28(r1), r12
59
        l.sw    0x2C(r1), r13
60
        l.sw    0x30(r1), r14
61
        l.sw    0x34(r1), r15
62
        l.sw    0x38(r1), r16
63
        l.sw    0x3C(r1), r17
64
        l.sw    0x40(r1), r18
65
        l.sw    0x44(r1), r19
66
        l.sw    0x48(r1), r20
67
        l.sw    0x4C(r1), r21
68
        l.sw    0x50(r1), r22
69
        l.sw    0x54(r1), r23
70
        l.sw    0x58(r1), r24
71
        l.sw    0x5C(r1), r25
72
        l.sw    0x60(r1), r26
73
        l.sw    0x64(r1), r27
74
        l.sw    0x68(r1), r28
75
        l.sw    0x6C(r1), r29
76
        l.sw    0x70(r1), r30
77
        l.sw    0x74(r1), r31
78
        # Save the top of stack in TCB
79
        l.movhi r3, hi(pxCurrentTCB)
80
        l.ori   r3, r3, lo(pxCurrentTCB)
81
        l.lwz   r3, 0x0(r3)
82
        l.sw    0x0(r3), r1
83
        # restore clobber register
84
        l.lwz   r3, 0x08(r1)
85
        l.lwz   r4, 0x0C(r1)
86
        l.lwz   r5, 0x10(r1)
87
 
88
        l.mfspr r3, r0, SPR_TTMR
89
        l.movhi r4, hi(SPR_TTMR_IP)
90
        l.ori   r4, r4, lo(SPR_TTMR_IP)
91
        l.xori  r4, r4, 0xffffffff
92
        l.and   r3, r3, r4                              # clear tick timer interrupt
93
        l.mtspr r0, r3, SPR_TTMR
94
 
95
        l.jal   vTaskIncrementTick
96
        l.nop
97
.if configUSE_PREEMPTION == 0
98
        # do nothing
99
.else
100
        l.jal   vTaskSwitchContext
101
        l.nop
102
.endif
103
 
104
        # portRESTORE_CONTEXT
105
        l.movhi r3, hi(pxCurrentTCB)
106
        l.ori   r3, r3, lo(pxCurrentTCB)
107
        l.lwz   r3, 0x0(r3)
108
        l.lwz   r1, 0x0(r3)
109
        # restore context
110
        l.lwz   r9, 0x00(r1)
111
        l.lwz   r2, 0x04(r1)
112
        l.lwz   r6, 0x14(r1)
113
        l.lwz   r7, 0x18(r1)
114
        l.lwz   r8, 0x1C(r1)
115
        l.lwz   r10, 0x20(r1)
116
        l.lwz   r11, 0x24(r1)
117
        l.lwz   r12, 0x28(r1)
118
        l.lwz   r13, 0x2C(r1)
119
        l.lwz   r14, 0x30(r1)
120
        l.lwz   r15, 0x34(r1)
121
        l.lwz   r16, 0x38(r1)
122
        l.lwz   r17, 0x3C(r1)
123
        l.lwz   r18, 0x40(r1)
124
        l.lwz   r19, 0x44(r1)
125
        l.lwz   r20, 0x48(r1)
126
        l.lwz   r21, 0x4C(r1)
127
        l.lwz   r22, 0x50(r1)
128
        l.lwz   r23, 0x54(r1)
129
        l.lwz   r24, 0x58(r1)
130
        l.lwz   r25, 0x5C(r1)
131
        l.lwz   r26, 0x60(r1)
132
        l.lwz   r27, 0x64(r1)
133
        l.lwz   r28, 0x68(r1)
134
        l.lwz   r29, 0x6C(r1)
135
        l.lwz   r30, 0x70(r1)
136
        l.lwz   r31, 0x74(r1)
137
        # restore SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
138
        l.lwz   r3, 0x78(r1)
139
        l.lwz   r4, 0x7C(r1)
140
        l.mtspr r0, r3, (0<<11) + 64
141
        l.mtspr r0, r4, (0<<11) + 32
142
        # restore clobber register
143
        l.lwz   r3, 0x08(r1)
144
        l.lwz   r4, 0x0C(r1)
145
        l.lwz   r5, 0x10(r1)
146
        l.addi  r1, r1, 128
147
        l.rfe
148
        l.nop
149
 
150
.size   vTickHandler, .-vTickHandler
151
 
152
 
153
.text
154
.global PortCC
155
.type   PortCC, %function
156
PortCC:
157
        # portSAVE_CONTEXT
158
        .global pxCurrentTCB
159
        l.lwz   r11, 0x0(r1)
160
        l.addi  r1, r1, 4
161
        # make rooms in stack
162
        l.addi  r1, r1, -128
163
        # early save r3-r5, these are clobber register
164
        l.sw    0x08(r1), r3
165
        l.sw    0x0C(r1), r4
166
        l.sw    0x10(r1), r5
167
        # save SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
168
        l.mfspr r3, r0, (0<<11) + 64
169
        l.mfspr r4, r0, (0<<11) + 32
170
        l.sw    0x78(r1), r3
171
        l.sw    0x7C(r1), r4
172
        l.sw    0x00(r1), r9
173
        # Save Context
174
        l.sw    0x04(r1), r2
175
        l.sw    0x14(r1), r6
176
        l.sw    0x18(r1), r7
177
        l.sw    0x1C(r1), r8
178
        l.sw    0x20(r1), r10
179
        l.sw    0x24(r1), r11
180
        l.sw    0x28(r1), r12
181
        l.sw    0x2C(r1), r13
182
        l.sw    0x30(r1), r14
183
        l.sw    0x34(r1), r15
184
        l.sw    0x38(r1), r16
185
        l.sw    0x3C(r1), r17
186
        l.sw    0x40(r1), r18
187
        l.sw    0x44(r1), r19
188
        l.sw    0x48(r1), r20
189
        l.sw    0x4C(r1), r21
190
        l.sw    0x50(r1), r22
191
        l.sw    0x54(r1), r23
192
        l.sw    0x58(r1), r24
193
        l.sw    0x5C(r1), r25
194
        l.sw    0x60(r1), r26
195
        l.sw    0x64(r1), r27
196
        l.sw    0x68(r1), r28
197
        l.sw    0x6C(r1), r29
198
        l.sw    0x70(r1), r30
199
        l.sw    0x74(r1), r31
200
        # Save the top of stack in TCB
201
        l.movhi r3, hi(pxCurrentTCB)
202
        l.ori   r3, r3, lo(pxCurrentTCB)
203
        l.lwz   r3, 0x0(r3)
204
        l.sw    0x0(r3), r1
205
        # restore clobber register
206
        l.lwz   r3, 0x08(r1)
207
        l.lwz   r4, 0x0C(r1)
208
        l.lwz   r5, 0x10(r1)
209
 
210
        l.nop
211
        l.jal   vTaskSwitchContext
212
        l.nop
213
 
214
        # portRESTORE_CONTEXT
215
        l.movhi r3, hi(pxCurrentTCB)
216
        l.ori   r3, r3, lo(pxCurrentTCB)
217
        l.lwz   r3, 0x0(r3)
218
        l.lwz   r1, 0x0(r3)
219
        # restore context
220
        l.lwz   r9, 0x00(r1)
221
        l.lwz   r2, 0x04(r1)
222
        l.lwz   r6, 0x14(r1)
223
        l.lwz   r7, 0x18(r1)
224
        l.lwz   r8, 0x1C(r1)
225
        l.lwz   r10, 0x20(r1)
226
        l.lwz   r11, 0x24(r1)
227
        l.lwz   r12, 0x28(r1)
228
        l.lwz   r13, 0x2C(r1)
229
        l.lwz   r14, 0x30(r1)
230
        l.lwz   r15, 0x34(r1)
231
        l.lwz   r16, 0x38(r1)
232
        l.lwz   r17, 0x3C(r1)
233
        l.lwz   r18, 0x40(r1)
234
        l.lwz   r19, 0x44(r1)
235
        l.lwz   r20, 0x48(r1)
236
        l.lwz   r21, 0x4C(r1)
237
        l.lwz   r22, 0x50(r1)
238
        l.lwz   r23, 0x54(r1)
239
        l.lwz   r24, 0x58(r1)
240
        l.lwz   r25, 0x5C(r1)
241
        l.lwz   r26, 0x60(r1)
242
        l.lwz   r27, 0x64(r1)
243
        l.lwz   r28, 0x68(r1)
244
        l.lwz   r29, 0x6C(r1)
245
        l.lwz   r30, 0x70(r1)
246
        l.lwz   r31, 0x74(r1)
247
        # restore SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
248
        l.lwz   r3, 0x78(r1)
249
        l.lwz   r4, 0x7C(r1)
250
        l.mtspr r0, r3, (0<<11) + 64
251
        l.mtspr r0, r4, (0<<11) + 32
252
        # restore clobber register
253
        l.lwz   r3, 0x08(r1)
254
        l.lwz   r4, 0x0C(r1)
255
        l.lwz   r5, 0x10(r1)
256
        l.addi  r1, r1, 128
257
        l.rfe
258
        l.nop
259
 
260
.size   PortCC, .-PortCC

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.