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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [IAR/] [V850ES/] [portasm_Hx2.s85] - Blame information for rev 572

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 572 jeremybenn
;/*
2
;    FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
3
;
4
;    ***************************************************************************
5
;    *                                                                         *
6
;    * If you are:                                                             *
7
;    *                                                                         *
8
;    *    + New to FreeRTOS,                                                   *
9
;    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
10
;    *    + Looking for basic training,                                        *
11
;    *    + Wanting to improve your FreeRTOS skills and productivity           *
12
;    *                                                                         *
13
;    * then take a look at the FreeRTOS books - available as PDF or paperback  *
14
;    *                                                                         *
15
;    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
16
;    *                  http://www.FreeRTOS.org/Documentation                  *
17
;    *                                                                         *
18
;    * A pdf reference manual is also available.  Both are usually delivered   *
19
;    * to your inbox within 20 minutes to two hours when purchased between 8am *
20
;    * and 8pm GMT (although please allow up to 24 hours in case of            *
21
;    * exceptional circumstances).  Thank you for your support!                *
22
;    *                                                                         *
23
;    ***************************************************************************
24
;
25
;    This file is part of the FreeRTOS distribution.
26
;
27
;    FreeRTOS is free software; you can redistribute it and/or modify it under
28
;    the terms of the GNU General Public License (version 2) as published by the
29
;    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
30
;    ***NOTE*** The exception to the GPL is included to allow you to distribute
31
;    a combined work that includes FreeRTOS without being obliged to provide the
32
;    source code for proprietary components outside of the FreeRTOS kernel.
33
;    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
34
;    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35
;    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
36
;    more details. You should have received a copy of the GNU General Public
37
;    License and the FreeRTOS license exception along with FreeRTOS; if not it
38
;    can be viewed here: http://www.freertos.org/a00114.html and also obtained
39
;    by writing to Richard Barry, contact details for whom are available on the
40
;    FreeRTOS WEB site.
41
;
42
;    1 tab == 4 spaces!
43
;
44
;    http://www.FreeRTOS.org - Documentation, latest information, license and
45
;    contact details.
46
;
47
;    http://www.SafeRTOS.com - A version that is certified for use in safety
48
;    critical systems.
49
;
50
;    http://www.OpenRTOS.com - Commercial support, development, porting,
51
;    licensing and training services.
52
;*/
53
; Note: Select the correct include files for the device used by the application.
54
#include "FreeRTOSConfig.h"
55
;------------------------------------------------------------------------------
56
 
57
; Functions used by scheduler
58
;------------------------------------------------------------------------------
59
    EXTERN    vTaskSwitchContext
60
    EXTERN    vTaskIncrementTick
61
 
62
; Variables used by scheduler
63
;------------------------------------------------------------------------------
64
    EXTERN    pxCurrentTCB
65
    EXTERN    usCriticalNesting
66
 
67
; Functions implemented in this file
68
;------------------------------------------------------------------------------
69
    PUBLIC    vPortYield
70
    PUBLIC    vPortStart
71
 
72
; Security ID definition
73
;------------------------------------------------------------------------------
74
#define CG_SECURITY0    0FFH
75
#define CG_SECURITY1    0FFH
76
#define CG_SECURITY2    0FFH
77
#define CG_SECURITY3    0FFH
78
#define CG_SECURITY4    0FFH
79
#define CG_SECURITY5    0FFH
80
#define CG_SECURITY6    0FFH
81
#define CG_SECURITY7    0FFH
82
#define CG_SECURITY8    0FFH
83
#define CG_SECURITY9    0FFH
84
 
85
; Tick ISR Prototype
86
;------------------------------------------------------------------------------
87
        PUBWEAK `??MD_INTTM0EQ0??INTVEC 544`
88
        PUBLIC MD_INTTM0EQ0
89
 
90
MD_INTTM0EQ0        SYMBOL "MD_INTTM0EQ0"
91
`??MD_INTTM0EQ0??INTVEC 544` SYMBOL "??INTVEC 544", MD_INTTM0EQ0
92
 
93
;------------------------------------------------------------------------------
94
;   portSAVE_CONTEXT MACRO
95
;   Saves the context of the remaining general purpose registers
96
;   and the usCriticalNesting Value of the active Task onto the task stack
97
;   saves stack pointer to the TCB
98
;------------------------------------------------------------------------------
99
portSAVE_CONTEXT MACRO
100
#if configDATA_MODE == 1                                        ; Using the Tiny data model
101
    prepare {r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30},76,sp ; save general purpose registers
102
    sst.w   r19,72[ep]
103
    sst.w   r18,68[ep]
104
    sst.w   r17,64[ep]
105
    sst.w   r16,60[ep]
106
    sst.w   r15,56[ep]
107
    sst.w   r14,52[ep]
108
    sst.w   r13,48[ep]
109
    sst.w   r12,44[ep]
110
    sst.w   r11,40[ep]
111
    sst.w   r10,36[ep]
112
    sst.w   r9,32[ep]
113
    sst.w   r8,28[ep]
114
    sst.w   r7,24[ep]
115
    sst.w   r6,20[ep]
116
    sst.w   r5,16[ep]
117
    sst.w   r4,12[ep]
118
#else                                                           ; Using the Small/Large data model
119
    prepare {r20,r21,r22,r23,r24,r26,r27,r28,r29,r30},72,sp     ; save general purpose registers
120
    sst.w   r19,68[ep]
121
    sst.w   r18,64[ep]
122
    sst.w   r17,60[ep]
123
    sst.w   r16,56[ep]
124
    sst.w   r15,52[ep]
125
    sst.w   r14,48[ep]
126
    sst.w   r13,44[ep]
127
    sst.w   r12,40[ep]
128
    sst.w   r11,36[ep]
129
    sst.w   r10,32[ep]
130
    sst.w   r9,28[ep]
131
    sst.w   r8,24[ep]
132
    sst.w   r7,20[ep]
133
    sst.w   r6,16[ep]
134
    sst.w   r5,12[ep]
135
#endif /* configDATA_MODE */
136
    sst.w   r2,8[ep]
137
    sst.w   r1,4[ep]
138
    MOVHI   hi1(usCriticalNesting),r0,r1                        ; save usCriticalNesting value to stack
139
    ld.w    lw1(usCriticalNesting)[r1],r2
140
    sst.w   r2,0[ep]
141
    MOVHI   hi1(pxCurrentTCB),r0,r1                             ; save SP to top of current TCB
142
    ld.w    lw1(pxCurrentTCB)[r1],r2
143
    st.w    sp,0[r2]
144
    ENDM
145
;------------------------------------------------------------------------------
146
 
147
;------------------------------------------------------------------------------
148
;   portRESTORE_CONTEXT MACRO
149
;   Gets stack pointer from the current TCB
150
;   Restores the context of the usCriticalNesting value and general purpose
151
;   registers of the selected task from the task stack
152
;------------------------------------------------------------------------------
153
portRESTORE_CONTEXT MACRO
154
    MOVHI   hi1(pxCurrentTCB),r0,r1         ; get Stackpointer address
155
    ld.w    lw1(pxCurrentTCB)[r1],sp
156
    MOV     sp,r1
157
    ld.w    0[r1],sp                        ; load stackpointer
158
    MOV     sp,ep                           ; set stack pointer to element pointer
159
    sld.w   0[ep],r1                        ; load usCriticalNesting value from stack
160
    MOVHI   hi1(usCriticalNesting),r0,r2
161
    st.w    r1,lw1(usCriticalNesting)[r2]
162
    sld.w   4[ep],r1                        ; restore general purpose registers
163
    sld.w   8[ep],r2
164
#if configDATA_MODE == 1                    ; Using Tiny data model
165
    sld.w   12[ep],r4
166
    sld.w   16[ep],r5
167
    sld.w   20[ep],r6
168
    sld.w   24[ep],r7
169
    sld.w   28[ep],r8
170
    sld.w   32[ep],r9
171
    sld.w   36[ep],r10
172
    sld.w   40[ep],r11
173
    sld.w   44[ep],r12
174
    sld.w   48[ep],r13
175
    sld.w   52[ep],r14
176
    sld.w   56[ep],r15
177
    sld.w   60[ep],r16
178
    sld.w   64[ep],r17
179
    sld.w   68[ep],r18
180
    sld.w   72[ep],r19
181
    dispose 76,{r20,r21,r22,r23,r24,r25,r26,r27,r28,r29,r30}
182
#else                                       ; Using Small/Large data model
183
    sld.w   12[ep],r5
184
    sld.w   16[ep],r6
185
    sld.w   20[ep],r7
186
    sld.w   24[ep],r8
187
    sld.w   28[ep],r9
188
    sld.w   32[ep],r10
189
    sld.w   36[ep],r11
190
    sld.w   40[ep],r12
191
    sld.w   44[ep],r13
192
    sld.w   48[ep],r14
193
    sld.w   52[ep],r15
194
    sld.w   56[ep],r16
195
    sld.w   60[ep],r17
196
    sld.w   64[ep],r18
197
    sld.w   68[ep],r19
198
    dispose 72,{r20,r21,r22,r23,r24,r26,r27,r28,r29,r30}
199
#endif /* configDATA_MODE */
200
    ENDM
201
;------------------------------------------------------------------------------
202
 
203
;------------------------------------------------------------------------------
204
;   Restore the context of the first task that is going to run.
205
;
206
;   Input:  NONE
207
;
208
;   Call:   CALL    vPortStart
209
;
210
;   Output: NONE
211
;------------------------------------------------------------------------------
212
    RSEG CODE:CODE
213
vPortStart:
214
    portRESTORE_CONTEXT                     ; Restore the context of whichever task the ...
215
    ld.w    0[sp],lp
216
    ldsr    lp,5                            ; restore PSW
217
    DI
218
    ld.w    4[sp],lp                        ; restore LP
219
    ld.w    8[sp],lp                        ; restore LP
220
    ADD     0x0C,sp                         ; set SP to right position
221
    EI
222
    jmp     [lp]
223
;------------------------------------------------------------------------------
224
 
225
;------------------------------------------------------------------------------
226
;   Port Yield function to check for a Task switch in the cooperative and
227
;   preemptive mode
228
;
229
;   Input:  NONE
230
;
231
;   Call:   CALL    vPortYield
232
;
233
;   Output: NONE
234
;------------------------------------------------------------------------------
235
 
236
        RSEG CODE:CODE
237
vPortYield:
238
 
239
    add     -0x0C,sp                          ; prepare stack to save necessary values
240
    st.w    lp,8[sp]                        ; store LP to stack
241
    stsr    0,r31
242
    st.w    lp,4[sp]                        ; store EIPC to stack
243
    stsr    1,lp
244
    st.w    lp,0[sp]                        ; store EIPSW to stack
245
    portSAVE_CONTEXT                        ; Save the context of the current task.
246
    jarl    vTaskSwitchContext,lp           ; Call the scheduler.
247
    portRESTORE_CONTEXT                     ; Restore the context of whichever task the ...
248
                                            ; ... scheduler decided should run.
249
        ld.w    0[sp],lp                        ; restore EIPSW from stack
250
    ldsr    lp,1
251
    ld.w    4[sp],lp                        ; restore EIPC from stack
252
    ldsr    lp,0
253
    ld.w    8[sp],lp                        ; restore LP from stack
254
    add     0x0C,sp                         ; set SP to right position
255
 
256
    RETI
257
 
258
;------------------------------------------------------------------------------
259
 
260
;------------------------------------------------------------------------------
261
;   Perform the necessary steps of the Tick Count Increment and Task Switch
262
;   depending on the chosen kernel configuration
263
;
264
;   Input:  NONE
265
;
266
;   Call:   ISR
267
;
268
;   Output: NONE
269
;------------------------------------------------------------------------------
270
#if configUSE_PREEMPTION == 1               ; use preemptive kernel mode
271
 
272
MD_INTTM0EQ0:
273
 
274
    add     -0x0C,sp                          ; prepare stack to save necessary values
275
    st.w    lp,8[sp]                        ; store LP to stack
276
    stsr    0,r31
277
    st.w    lp,4[sp]                        ; store EIPC to stack
278
    stsr    1,lp
279
    st.w    lp,0[sp]                        ; store EIPSW to stack
280
    portSAVE_CONTEXT                        ; Save the context of the current task.
281
    jarl    vTaskIncrementTick,lp           ; Call the timer tick function.
282
    jarl    vTaskSwitchContext,lp           ; Call the scheduler.
283
    portRESTORE_CONTEXT                     ; Restore the context of whichever task the ...
284
                                            ; ... scheduler decided should run.
285
    ld.w    0[sp],lp                        ; restore EIPSW from stack
286
    ldsr    lp,1
287
    ld.w    4[sp],lp                        ; restore EIPC from stack
288
    ldsr    lp,0
289
    ld.w    8[sp],lp                        ; restore LP from stack
290
    add     0x0C,sp                         ; set SP to right position
291
 
292
    RETI
293
;------------------------------------------------------------------------------
294
#else                                       ; use cooperative kernel mode
295
 
296
MD_INTTM0EQ0:
297
    prepare {lp,ep},8,sp
298
    sst.w   r1,4[ep]
299
    sst.w   r5,0[ep]
300
    jarl    vTaskIncrementTick,lp           ; Call the timer tick function.
301
    sld.w   0[ep],r5
302
    sld.w   4[ep],r1
303
    dispose 8,{lp,ep}
304
    RETI
305
#endif /* configUSE_PREEMPTION */
306
 
307
;------------------------------------------------------------------------------
308
        COMMON INTVEC:CODE:ROOT(2)
309
        ORG 544
310
`??MD_INTTM0EQ0??INTVEC 544`:
311
        JR MD_INTTM0EQ0
312
 
313
        RSEG NEAR_ID:CONST:SORT:NOROOT(2)
314
`?`:
315
        DW 10
316
 
317
      COMMON INTVEC:CODE:ROOT(2)
318
      ORG 40H
319
`??vPortYield??INTVEC 40`:
320
        JR vPortYield
321
 
322
;------------------------------------------------------------------------------
323
; set microcontroller security ID
324
 
325
      COMMON INTVEC:CODE:ROOT(2)
326
      ORG 70H
327
`SECUID`:
328
      DB CG_SECURITY0
329
      DB CG_SECURITY1
330
      DB CG_SECURITY2
331
      DB CG_SECURITY3
332
      DB CG_SECURITY4
333
      DB CG_SECURITY5
334
      DB CG_SECURITY6
335
      DB CG_SECURITY7
336
      DB CG_SECURITY8
337
      DB CG_SECURITY9
338
 
339
 
340
; set microcontroller Option bytes
341
 
342
      COMMON INTVEC:CODE:ROOT(2)
343
      ORG 122
344
`OPTBYTES`:
345
      DB 0xFD
346
      DB 0xFF
347
      DB 0xFF
348
      DB 0xFF
349
      DB 0xFF
350
      DB 0xFF
351
 
352
#if configOCD_USAGE == 1
353
 
354
      COMMON   INTVEC:CODE:ROOT(4)
355
      ORG      0x230
356
      PUBLIC ROM_INT2
357
ROM_INT2:
358
      DB 0xff, 0xff, 0xff, 0xff
359
      DB 0xff, 0xff, 0xff, 0xff
360
      DB 0xff, 0xff, 0xff, 0xff
361
      DB 0xff, 0xff, 0xff, 0xff
362
 
363
 
364
      COMMON   INTVEC:CODE:ROOT(4)
365
      ORG      0x60
366
      PUBLIC   ROM_INT
367
ROM_INT:
368
      DB 0xff, 0xff, 0xff, 0xff
369
      DB 0xff, 0xff, 0xff, 0xff
370
      DB 0xff, 0xff, 0xff, 0xff
371
      DB 0xff, 0xff, 0xff, 0xff
372
 
373
#endif /* configOCD_USAGE */
374
 
375
      END
376
 

powered by: WebSVN 2.1.0

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