OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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 624 filepang
        l.nop
20 572 jeremybenn
.size   vPortDisableInterrupts, .-vPortDisableInterrupts
21
 
22
 
23
.text
24
.global vPortEnableInterrupts
25
.type   vPortEnableInterrupts, %function
26
vPortEnableInterrupts:
27
        l.mfspr r3, r0, SPR_SR          # get current SR
28
        l.ori   r3, r3, SPR_SR_TEE      # enable Tick Timer Interrup
29
        l.ori   r3, r3, SPR_SR_IEE      # enable External Interrupt
30
        l.mtspr r0, r3, SPR_SR          # update SR
31
        l.jr    r9
32 624 filepang
        l.nop
33 572 jeremybenn
.size   vPortEnableInterrupts, .-vPortEnableInterrupts
34
 
35 621 filepang
 
36
.macro portSAVE_REGISTER
37
        l.addi  r1, r1, -116
38
        l.sw    0x00(r1), r3
39
        l.sw    0x04(r1), r4
40
        l.sw    0x08(r1), r5
41
        l.sw    0x0c(r1), r6
42
        l.sw    0x10(r1), r7
43
        l.sw    0x14(r1), r8
44
        l.sw    0x18(r1), r9
45
        l.sw    0x1c(r1), r10
46
        l.sw    0x20(r1), r11
47
        l.sw    0x24(r1), r12
48
        l.sw    0x28(r1), r13
49
        l.sw    0x2c(r1), r14
50
        l.sw    0x30(r1), r15
51
        l.sw    0x34(r1), r16
52
        l.sw    0x38(r1), r17
53
        l.sw    0x3c(r1), r18
54
        l.sw    0x40(r1), r19
55
        l.sw    0x44(r1), r20
56
        l.sw    0x48(r1), r21
57
        l.sw    0x4c(r1), r22
58
        l.sw    0x50(r1), r23
59
        l.sw    0x54(r1), r24
60
        l.sw    0x58(r1), r25
61
        l.sw    0x5c(r1), r26
62
        l.sw    0x60(r1), r27
63
        l.sw    0x64(r1), r28
64
        l.sw    0x68(r1), r29
65
        l.sw    0x6c(r1), r30
66
        l.sw    0x70(r1), r31
67
.endm
68
 
69
 
70
.macro portRESTORE_REGISTER
71
        l.lwz   r3 , 0x00(r1)
72
        l.lwz   r4 , 0x04(r1)
73
        l.lwz   r5 , 0x08(r1)
74
        l.lwz   r6 , 0x0c(r1)
75
        l.lwz   r7 , 0x10(r1)
76
        l.lwz   r8 , 0x14(r1)
77
        l.lwz   r9 , 0x18(r1)
78
        l.lwz   r10, 0x1c(r1)
79
        l.lwz   r11, 0x20(r1)
80
        l.lwz   r12, 0x24(r1)
81
        l.lwz   r13, 0x28(r1)
82
        l.lwz   r14, 0x2c(r1)
83
        l.lwz   r15, 0x30(r1)
84
        l.lwz   r16, 0x34(r1)
85
        l.lwz   r17, 0x38(r1)
86
        l.lwz   r18, 0x3c(r1)
87
        l.lwz   r19, 0x40(r1)
88
        l.lwz   r20, 0x44(r1)
89
        l.lwz   r21, 0x48(r1)
90
        l.lwz   r22, 0x4c(r1)
91
        l.lwz   r23, 0x50(r1)
92
        l.lwz   r24, 0x54(r1)
93
        l.lwz   r25, 0x58(r1)
94
        l.lwz   r26, 0x5c(r1)
95
        l.lwz   r27, 0x60(r1)
96
        l.lwz   r28, 0x64(r1)
97
        l.lwz   r29, 0x68(r1)
98
        l.lwz   r30, 0x6c(r1)
99
        l.lwz   r31, 0x70(r1)
100
        l.addi  r1, r1, 116
101
.endm
102
 
103
 
104
.macro portSAVE_CONTEXT
105 572 jeremybenn
        .global pxCurrentTCB
106
        # make rooms in stack
107
        l.addi  r1, r1, -128
108
        # early save r3-r5, these are clobber register
109
        l.sw    0x08(r1), r3
110
        l.sw    0x0C(r1), r4
111
        l.sw    0x10(r1), r5
112
        # save SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
113 621 filepang
        l.mfspr r3, r0, SPR_ESR_BASE
114
        l.mfspr r4, r0, SPR_EPCR_BASE
115 572 jeremybenn
        l.sw    0x78(r1), r3
116
        l.sw    0x7C(r1), r4
117
        l.sw    0x00(r1), r9
118
        # Save Context
119
        l.sw    0x04(r1), r2
120
        l.sw    0x14(r1), r6
121
        l.sw    0x18(r1), r7
122
        l.sw    0x1C(r1), r8
123
        l.sw    0x20(r1), r10
124
        l.sw    0x24(r1), r11
125
        l.sw    0x28(r1), r12
126
        l.sw    0x2C(r1), r13
127
        l.sw    0x30(r1), r14
128
        l.sw    0x34(r1), r15
129
        l.sw    0x38(r1), r16
130
        l.sw    0x3C(r1), r17
131
        l.sw    0x40(r1), r18
132
        l.sw    0x44(r1), r19
133
        l.sw    0x48(r1), r20
134
        l.sw    0x4C(r1), r21
135
        l.sw    0x50(r1), r22
136
        l.sw    0x54(r1), r23
137
        l.sw    0x58(r1), r24
138
        l.sw    0x5C(r1), r25
139
        l.sw    0x60(r1), r26
140
        l.sw    0x64(r1), r27
141
        l.sw    0x68(r1), r28
142
        l.sw    0x6C(r1), r29
143
        l.sw    0x70(r1), r30
144
        l.sw    0x74(r1), r31
145
        # Save the top of stack in TCB
146
        l.movhi r3, hi(pxCurrentTCB)
147
        l.ori   r3, r3, lo(pxCurrentTCB)
148
        l.lwz   r3, 0x0(r3)
149
        l.sw    0x0(r3), r1
150
        # restore clobber register
151
        l.lwz   r3, 0x08(r1)
152
        l.lwz   r4, 0x0C(r1)
153
        l.lwz   r5, 0x10(r1)
154 621 filepang
.endm
155 572 jeremybenn
 
156 621 filepang
 
157
.macro portRESTORE_CONTEXT
158 572 jeremybenn
        l.movhi r3, hi(pxCurrentTCB)
159
        l.ori   r3, r3, lo(pxCurrentTCB)
160
        l.lwz   r3, 0x0(r3)
161
        l.lwz   r1, 0x0(r3)
162
        # restore context
163
        l.lwz   r9, 0x00(r1)
164
        l.lwz   r2, 0x04(r1)
165
        l.lwz   r6, 0x14(r1)
166
        l.lwz   r7, 0x18(r1)
167
        l.lwz   r8, 0x1C(r1)
168
        l.lwz   r10, 0x20(r1)
169
        l.lwz   r11, 0x24(r1)
170
        l.lwz   r12, 0x28(r1)
171
        l.lwz   r13, 0x2C(r1)
172
        l.lwz   r14, 0x30(r1)
173
        l.lwz   r15, 0x34(r1)
174
        l.lwz   r16, 0x38(r1)
175
        l.lwz   r17, 0x3C(r1)
176
        l.lwz   r18, 0x40(r1)
177
        l.lwz   r19, 0x44(r1)
178
        l.lwz   r20, 0x48(r1)
179
        l.lwz   r21, 0x4C(r1)
180
        l.lwz   r22, 0x50(r1)
181
        l.lwz   r23, 0x54(r1)
182
        l.lwz   r24, 0x58(r1)
183
        l.lwz   r25, 0x5C(r1)
184
        l.lwz   r26, 0x60(r1)
185
        l.lwz   r27, 0x64(r1)
186
        l.lwz   r28, 0x68(r1)
187
        l.lwz   r29, 0x6C(r1)
188
        l.lwz   r30, 0x70(r1)
189
        l.lwz   r31, 0x74(r1)
190
        # restore SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
191
        l.lwz   r3, 0x78(r1)
192
        l.lwz   r4, 0x7C(r1)
193 621 filepang
        l.mtspr r0, r3, SPR_ESR_BASE
194
        l.mtspr r0, r4, SPR_EPCR_BASE
195 572 jeremybenn
        # restore clobber register
196
        l.lwz   r3, 0x08(r1)
197
        l.lwz   r4, 0x0C(r1)
198
        l.lwz   r5, 0x10(r1)
199
        l.addi  r1, r1, 128
200
        l.rfe
201
        l.nop
202 621 filepang
.endm
203 572 jeremybenn
 
204
 
205 621 filepang
.text
206
.global vPortTickHandler
207
.type   vPortTickHandler, %function
208
vPortTickHandler:
209
        portSAVE_CONTEXT
210
 
211
        l.mfspr r3, r0, SPR_TTMR
212
        l.movhi r4, hi(SPR_TTMR_IP)
213
        l.ori   r4, r4, lo(SPR_TTMR_IP)
214
        l.xori  r4, r4, 0xffffffff
215
        l.and   r3, r3, r4                              # clear tick timer interrupt
216
        l.mtspr r0, r3, SPR_TTMR
217 572 jeremybenn
 
218 621 filepang
        l.jal   vTaskIncrementTick
219
        l.nop
220
.if configUSE_PREEMPTION == 0
221
        # do nothing
222
.else
223
        l.jal   vTaskSwitchContext
224
        l.nop
225
.endif
226
 
227
        portRESTORE_CONTEXT
228
.size   vPortTickHandler, .-vPortTickHandler
229
 
230
 
231 572 jeremybenn
.text
232 621 filepang
.global vPortSystemCall
233
.type   vPortSystemCall, %function
234
vPortSystemCall:
235
        l.sfeqi r11, 0xFCC
236
        l.bf    1f
237
        l.nop
238
 
239
        l.sw    -120(r1), r11
240
        l.lwz   r11, -4(r1)
241
        portSAVE_REGISTER
242 572 jeremybenn
 
243 621 filepang
        l.jal   syscall_except
244
        l.lwz   r3, -4(r1)
245
 
246
        portRESTORE_REGISTER
247
        l.rfe
248 572 jeremybenn
        l.nop
249 621 filepang
 
250
1:
251
        l.sw    -132(r1), r11
252
        l.lwz   r11, -4(r1)
253
        portSAVE_CONTEXT
254
 
255
        l.jal   syscall_except
256
        l.lwz   r3, -4(r1)
257
 
258
        portRESTORE_CONTEXT
259
.size   vPortSystemCall, .-vPortSystemCall
260
 
261
 
262
.text
263
.global vPortExtIntHandler
264
.type   vPortExtIntHandler, %function
265
vPortExtIntHandler:
266
        portSAVE_CONTEXT
267
 
268
    l.jal       int_main
269
        l.nop
270
 
271
.if configUSE_PREEMPTION == 0
272
        # do nothing
273
.else
274 572 jeremybenn
        l.jal   vTaskSwitchContext
275
        l.nop
276 621 filepang
.endif
277 572 jeremybenn
 
278 621 filepang
        portRESTORE_CONTEXT
279
.size   vPortExtIntHandler, .-vPortExtIntHandler
280 572 jeremybenn
 
281 621 filepang
 
282
.text
283
.global vPortMiscIntHandler
284
.type   vPortMiscIntHandler, %function
285
vPortMiscIntHandler:
286
        portSAVE_CONTEXT
287
 
288
    l.jal       misc_int_handler
289
        l.lwz   r3, -4(r1)
290
 
291
.if configUSE_PREEMPTION == 0
292
        # do nothing
293
.else
294
        l.jal   vTaskSwitchContext
295
        l.nop
296
.endif
297
 
298
        portRESTORE_CONTEXT
299
.size   vPortMiscIntHandler, .-vPortMiscIntHandler

powered by: WebSVN 2.1.0

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