]> git.sur5r.net Git - freertos/blob - Demo/ColdFire_MCF52259_CodeWarrior/cpu/mcf5xxx_lo.s
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / ColdFire_MCF52259_CodeWarrior / cpu / mcf5xxx_lo.s
1 /*\r
2  * File:    mcf5xxx.s\r
3  * Purpose: Lowest level routines for all ColdFire processors.\r
4  *\r
5  * Notes:   \r
6  *\r
7  * License:     All software covered by license agreement in -\r
8  *              docs/Freescale_Software_License.pdf\r
9  */\r
10 \r
11 #define mcf5xxx_exception_handler   _mcf5xxx_exception_handler\r
12 \r
13     .extern mcf5xxx_exception_handler\r
14 \r
15     .global asm_exception_handler\r
16     .global _asm_exception_handler\r
17     .global asm_set_ipl\r
18     .global _asm_set_ipl\r
19     .global mcf5xxx_exe_wdebug\r
20     .global _mcf5xxx_exe_wdebug\r
21    .global mcf5xxx_move_line   //added by Mac\r
22    .global _mcf5xxx_move_line   //added by Mac\r
23     .global mcf5xxx_wr_cacr\r
24     .global _mcf5xxx_wr_cacr\r
25     .global mcf5xxx_wr_asid\r
26     .global _mcf5xxx_wr_asid\r
27     .global mcf5xxx_wr_acr0\r
28     .global _mcf5xxx_wr_acr0\r
29     .global mcf5xxx_wr_acr1\r
30     .global _mcf5xxx_wr_acr1\r
31     .global mcf5xxx_wr_acr2\r
32     .global _mcf5xxx_wr_acr2\r
33     .global mcf5xxx_wr_acr3\r
34     .global _mcf5xxx_wr_acr3\r
35     .global mcf5xxx_wr_mmubar\r
36     .global _mcf5xxx_wr_mmubar\r
37     .global mcf5xxx_wr_other_a7\r
38     .global _mcf5xxx_wr_other_a7\r
39     .global mcf5xxx_wr_vbr\r
40     .global _mcf5xxx_wr_vbr\r
41     .global mcf5xxx_wr_macsr\r
42     .global _mcf5xxx_wr_macsr\r
43     .global mcf5xxx_wr_mask\r
44     .global _mcf5xxx_wr_mask\r
45     .global mcf5xxx_wr_acc0\r
46     .global _mcf5xxx_wr_acc0\r
47     .global mcf5xxx_wr_accext01\r
48     .global _mcf5xxx_wr_accext01\r
49     .global mcf5xxx_wr_accext23\r
50     .global _mcf5xxx_wr_accext23\r
51     .global mcf5xxx_wr_acc1\r
52     .global _mcf5xxx_wr_acc1\r
53     .global mcf5xxx_wr_acc2\r
54     .global _mcf5xxx_wr_acc2\r
55     .global mcf5xxx_wr_acc3\r
56     .global _mcf5xxx_wr_acc3\r
57     .global mcf5xxx_wr_sr\r
58     .global _mcf5xxx_wr_sr\r
59     .global mcf5xxx_wr_pc\r
60     .global _mcf5xxx_wr_pc\r
61     .global mcf5xxx_wr_rombar0\r
62     .global _mcf5xxx_wr_rombar0\r
63     .global mcf5xxx_wr_rombar1\r
64     .global _mcf5xxx_wr_rombar1\r
65     .global mcf5xxx_wr_rambar0\r
66     .global _mcf5xxx_wr_rambar0\r
67     .global mcf5xxx_wr_rambar1\r
68     .global _mcf5xxx_wr_rambar1\r
69     .global mcf5xxx_wr_mpcr\r
70     .global _mcf5xxx_wr_mpcr\r
71     .global mcf5xxx_wr_secmbar\r
72     .global _mcf5xxx_wr_secmbar\r
73     .global mcf5xxx_wr_mbar\r
74     .global _mcf5xxx_wr_mbar\r
75 \r
76     .text\r
77 \r
78 /********************************************************************\r
79  * This routine is the lowest-level exception handler.\r
80  */\r
81  \r
82 asm_exception_handler:\r
83 _asm_exception_handler:\r
84     lea     -16(SP),SP\r
85     movem.l D0-D1/A0-A1,(SP)\r
86     lea     16(SP),A1\r
87     move.l  A1,-(SP)\r
88     jsr     mcf5xxx_exception_handler\r
89     lea     4(SP),SP\r
90     movem.l (SP),D0-D1/A0-A1\r
91     lea     16(SP),SP\r
92     rte\r
93 \r
94 /********************************************************************/\r
95 /*\r
96  * This routines changes the IPL to the value passed into the routine.\r
97  * It also returns the old IPL value back.\r
98  * Calling convention from C:\r
99  *   old_ipl = asm_set_ipl(new_ipl);\r
100  * For the Diab Data C compiler, it passes return value thru D0.\r
101  * Note that only the least significant three bits of the passed\r
102  * value are used.\r
103  */\r
104 \r
105 asm_set_ipl:\r
106 _asm_set_ipl:\r
107     link    A6,#-8\r
108     movem.l D6-D7,(SP)\r
109 \r
110     move.w  SR,D7       /* current sr    */\r
111 \r
112     move.l  D7,D0       /* prepare return value  */\r
113     andi.l  #0x0700,D0  /* mask out IPL  */\r
114     lsr.l   #8,D0       /* IPL   */\r
115 \r
116     move.l  8(A6),D6    /* get argument  */\r
117     andi.l  #0x07,D6        /* least significant three bits  */\r
118     lsl.l   #8,D6       /* move over to make mask    */\r
119 \r
120     andi.l  #0x0000F8FF,D7  /* zero out current IPL  */\r
121     or.l    D6,D7           /* place new IPL in sr   */\r
122     move.w  D7,SR\r
123 \r
124     movem.l (SP),D6-D7\r
125     lea     8(SP),SP\r
126     unlk    A6\r
127     rts\r
128 \r
129 /********************************************************************/\r
130 /*\r
131  * These routines execute special ColdFire instructions\r
132  */\r
133 \r
134 mcf5xxx_exe_wdebug:\r
135 _mcf5xxx_exe_wdebug:\r
136     move.l   4(sp),a0\r
137     wdebug.l (a0)\r
138     rts    \r
139  \r
140  mcf5xxx_move_line:\r
141 _mcf5xxx_move_line:\r
142     lea.l   -24(sp),sp\r
143     movem.l d0-d3/a0-a1,(sp) \r
144     movea.l 28(sp),a0       /* source in a0 */\r
145     movea.l 32(sp),a1       /* destination in a1 */\r
146     movem.l (a0),d0-d3      /* move line from source */\r
147     movem.l d0-d3,(a1)      /* move line to destination */\r
148     movem.l (sp),d0-d3/a0-a1\r
149     lea.l   24(sp),sp\r
150     rts\r
151  \r
152  \r
153 /********************************************************************/\r
154 /*\r
155  * These routines write to the special purpose registers in the ColdFire\r
156  * core.  Since these registers are write-only in the supervisor model,\r
157  * no corresponding read routines exist.\r
158  */\r
159  \r
160 mcf5xxx_wr_sr:\r
161 _mcf5xxx_wr_sr:\r
162     move.l  4(SP),D0\r
163     move.w  D0,SR\r
164     rts\r
165     \r
166 mcf5xxx_wr_cacr:\r
167 _mcf5xxx_wr_cacr:\r
168     move.l  4(SP),D0\r
169     .long   0x4e7b0002      /* movec d0,cacr */\r
170     nop\r
171     rts\r
172 \r
173 mcf5xxx_wr_asid:\r
174 _mcf5xxx_wr_asid:\r
175     move.l  4(SP),D0\r
176     .long   0x4e7b0003      /* movec d0,asid */\r
177     nop\r
178     rts\r
179 \r
180 mcf5xxx_wr_acr0:\r
181 _mcf5xxx_wr_acr0:\r
182     move.l  4(SP),D0\r
183     .long   0x4e7b0004      /* movec d0,ACR0 */\r
184     nop\r
185     rts\r
186 \r
187 mcf5xxx_wr_acr1:\r
188 _mcf5xxx_wr_acr1:\r
189     move.l  4(SP),D0\r
190     .long   0x4e7b0005      /* movec d0,ACR1 */\r
191     nop\r
192     rts\r
193 \r
194 mcf5xxx_wr_acr2:\r
195 _mcf5xxx_wr_acr2:\r
196     move.l  4(SP),D0\r
197     .long   0x4e7b0006      /* movec d0,ACR2 */\r
198     nop\r
199     rts\r
200 \r
201 mcf5xxx_wr_acr3:\r
202 _mcf5xxx_wr_acr3:\r
203     move.l  4(SP),D0\r
204     .long   0x4e7b0007      /* movec d0,ACR3 */\r
205     nop\r
206     rts\r
207 \r
208 mcf5xxx_wr_mmubar:\r
209 _mcf5xxx_wr_mmubar:\r
210     move.l  4(SP),D0\r
211     .long   0x4e7b0008      /* movec d0,MBAR */\r
212     nop\r
213     rts\r
214 \r
215 mcf5xxx_wr_other_a7:\r
216 _mcf5xxx_wr_other_a7:\r
217     move.l  4(SP),D0\r
218     .long   0x4e7b0800      /* movec d0,OTHER_A7 */\r
219     nop\r
220     rts\r
221     \r
222 mcf5xxx_wr_vbr:\r
223 _mcf5xxx_wr_vbr:\r
224     move.l  4(SP),D0\r
225     .long   0x4e7b0801      /* movec d0,VBR */\r
226     nop\r
227     rts\r
228 \r
229 mcf5xxx_wr_macsr:\r
230 _mcf5xxx_wr_macsr:\r
231     move.l  4(SP),D0\r
232     .long   0x4e7b0804      /* movec d0,MACSR */\r
233     nop\r
234     rts\r
235 \r
236 mcf5xxx_wr_mask:\r
237 _mcf5xxx_wr_mask:\r
238     move.l  4(SP),D0\r
239     .long   0x4e7b0805      /* movec d0,MASK */\r
240     nop\r
241     rts\r
242 \r
243 mcf5xxx_wr_acc0:\r
244 _mcf5xxx_wr_acc0:\r
245     move.l  4(SP),D0\r
246     .long   0x4e7b0806      /* movec d0,ACC0 */\r
247     nop\r
248     rts\r
249 \r
250 mcf5xxx_wr_accext01:\r
251 _mcf5xxx_wr_accext01:\r
252     move.l  4(SP),D0\r
253     .long   0x4e7b0807      /* movec d0,ACCEXT01 */\r
254     nop\r
255     rts\r
256 \r
257 mcf5xxx_wr_accext23:\r
258 _mcf5xxx_wr_accext23:\r
259     move.l  4(SP),D0\r
260     .long   0x4e7b0808      /* movec d0,ACCEXT23 */\r
261     nop\r
262     rts\r
263 \r
264 mcf5xxx_wr_acc1:\r
265 _mcf5xxx_wr_acc1:\r
266     move.l  4(SP),D0\r
267     .long   0x4e7b0809      /* movec d0,ACC1 */\r
268     nop\r
269     rts\r
270 \r
271 mcf5xxx_wr_acc2:\r
272 _mcf5xxx_wr_acc2:\r
273     move.l  4(SP),D0\r
274     .long   0x4e7b080A      /* movec d0,ACC2 */\r
275     nop\r
276     rts\r
277 \r
278 mcf5xxx_wr_acc3:\r
279 _mcf5xxx_wr_acc3:\r
280     move.l  4(SP),D0\r
281     .long   0x4e7b080B      /* movec d0,ACC3 */\r
282     nop\r
283     rts\r
284 \r
285 mcf5xxx_wr_pc:\r
286 _mcf5xxx_wr_pc:\r
287     move.l  4(SP),D0\r
288     .long   0x4e7b080F      /* movec d0,PC */\r
289     nop\r
290     rts\r
291 \r
292 mcf5xxx_wr_rombar0:\r
293 _mcf5xxx_wr_rombar0:\r
294     move.l  4(SP),D0\r
295     .long   0x4e7b0C00      /* movec d0,ROMBAR0 */\r
296     nop\r
297     rts\r
298 \r
299 mcf5xxx_wr_rombar1:\r
300 _mcf5xxx_wr_rombar1:\r
301     move.l  4(SP),D0\r
302     .long   0x4e7b0C01      /* movec d0,ROMBAR1 */\r
303     nop\r
304     rts\r
305 \r
306 mcf5xxx_wr_rambar0:\r
307 _mcf5xxx_wr_rambar0:\r
308     move.l  4(SP),D0\r
309     .long   0x4e7b0C04      /* movec d0,RAMBAR0 */\r
310     nop\r
311     rts\r
312 \r
313 mcf5xxx_wr_rambar1:\r
314 _mcf5xxx_wr_rambar1:\r
315     move.l  4(SP),D0\r
316     .long   0x4e7b0C05      /* movec d0,RAMBAR1 */\r
317     nop\r
318     rts\r
319 \r
320 mcf5xxx_wr_mpcr:\r
321 _mcf5xxx_wr_mpcr:\r
322     move.l  4(SP),D0\r
323     .long   0x4e7b0C0C      /* movec d0,MPCR */\r
324     nop\r
325     rts\r
326 \r
327 mcf5xxx_wr_secmbar:\r
328 _mcf5xxx_wr_secmbar:\r
329     move.l  4(SP),D0\r
330     .long   0x4e7b0C0E      /* movec d0,MBAR1   */\r
331     nop\r
332     rts\r
333 \r
334 mcf5xxx_wr_mbar:\r
335 _mcf5xxx_wr_mbar:\r
336     move.l  4(SP),D0\r
337     .long   0x4e7b0C0F      /* movec d0,MBAR0   */\r
338     nop\r
339     rts\r
340 \r
341 /********************************************************************/\r
342     .end\r