source: rtems/c/src/lib/libcpu/sh/sh7750/score/ispsh7750.c @ 4cf920c4

4.104.114.84.95
Last change on this file since 4cf920c4 was 12ae6d9e, checked in by Joel Sherrill <joel.sherrill@…>, on 10/15/01 at 18:01:12

2001-10-15 Ralf Corsepius <corsepiu@…>

  • include/sh4uart.h: move to include/sh/sh4uart.h.
  • include/ispsh7750.h: move to include/rtems/score/ispsh7750.h.
  • include/iosh7750.h: move include/rtems/score/iosh7750.h.
  • include/sh7750_regs.h: move to include/rtems/score/sh7750_regs.h.
  • include/rtems/score/ipl.h: move to include/rtems/score/ipl.h.
  • include/rtems/score/sh4_regs.h: Reintroduce from Alexandra Kossovsky's original sources.
  • include/Makefile.am: reflect changes above, remove EXTRA_DIST, require automake 1.5.
  • sci/Makefile.am: Disable compilation of console.c.
  • sci/sh4uart.c: include <sh/sh4uart.h>, add SH7750_SCSMR_CHK_S, remove SH4_CPU_HZ_Frequency;
  • score/isph7750.c: Remove #if !defined(sh7750), include sh4_regs.h.
  • Property mode set to 100644
File size: 9.7 KB
Line 
1/*
2 * SH7750 interrupt support.
3 *
4 * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
5 * Author: Victor V. Vengerov <vvv@oktet.ru>
6 *
7 *  Based on work:
8 *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
9 *           Bernd Becker (becker@faw.uni-ulm.de)
10 *
11 *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
12 *
13 *  This program is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
16 *
17 *
18 *  COPYRIGHT (c) 1998.
19 *  On-Line Applications Research Corporation (OAR).
20 *
21 *  The license and distribution terms for this file may be
22 *  found in the file LICENSE in this distribution or at
23 *  http://www.OARcorp.com/rtems/license.html.
24 *
25 *      Modified to reflect isp entries for sh7045 processor:
26 *      John M. Mills (jmills@tga.com)
27 *      TGA Technologies, Inc.
28 *      100 Pinnacle Way, Suite 140
29 *      Norcross, GA 30071 U.S.A.
30 *      August, 1999
31 *
32 *      This modified file may be copied and distributed in accordance
33 *      the above-referenced license. It is provided for critique and
34 *      developmental purposes without any warranty nor representation
35 *      by the authors or by TGA Technologies.
36 *
37 *  $Id$
38 */
39
40#include <rtems/system.h>
41#include <rtems/score/shtypes.h>
42#include <rtems/score/isr.h>
43
44/*
45 * This is a exception vector table
46 *
47 * It has the same structure as the actual vector table (vectab)
48 */
49
50
51#include <rtems/score/ispsh7750.h>
52#include <rtems/score/sh4_regs.h>
53#include <rtems/score/sh7750_regs.h>
54
55/* VBR register contents saved on startup -- used to hook exception by debug
56 * agent */
57void *_VBR_Saved;
58
59/*PAGE
60 *
61 *  _CPU_ISR_install_vector
62 *
63 *  This kernel routine installs the RTEMS handler for the
64 *  specified vector.
65 *
66 *  Input parameters:
67 *    vector      - interrupt vector number
68 *    old_handler - former ISR for this vector number
69 *    new_handler - replacement ISR for this vector number
70 *
71 *  Output parameters:  NONE
72 *
73 */
74void _CPU_ISR_install_vector(
75  unsigned32  vector,
76  proc_ptr    new_handler,
77  proc_ptr   *old_handler
78)
79{
80   *old_handler = _ISR_Vector_table[vector];
81   _ISR_Vector_table[vector] = new_handler;
82}
83
84
85#define __STRINGIFY1__(x) #x
86#define __STRINGIFY__(x) __STRINGIFY1__(x)
87
88#define STOP_TIMER \
89     "        mov.l TSTR_k,r0      \n"                             \
90     "        mov.b @r0,r1         \n"                             \
91     "        and   #" __STRINGIFY__(~SH7750_TSTR_STR0) ",r1\n"    \
92     "        mov.b r1,@r0         \n"
93
94#define START_TIMER \
95     "        mov.l TSTR_k,r0      \n"                             \
96     "        mov.b @r0,r1         \n"                             \
97     "        or    #" __STRINGIFY__(SH7750_TSTR_STR0) ",r1\n"     \
98     "        mov.b r1,@r0         \n"
99
100asm ("        .text\n"
101     "        .balign 256\n"
102     "        .global __vbr_base\n"
103     "__vbr_base:\n"
104     "        .org __vbr_base + 0x100\n"
105     "vbr_100:\n"
106     "        mov.l  r0,@-r15\n"
107     "        mov.l  r1,@-r15\n"
108     "        mov.l  __VBR_Saved100_k, r0\n"
109     "        mov.l  offset100_k,r1\n"
110     "        mov.l  @r0,r0\n"
111     "        add    r1,r0\n"
112     "        mov.l  @r15+,r1\n"
113     "        jmp    @r0\n"
114     "        mov.l  @r15+,r0\n"
115     "        .align 2\n"
116     "__VBR_Saved100_k:\n"
117     "        .long __VBR_Saved\n"
118     "offset100_k:\n"
119     "        .long  0x100\n"
120     
121     "        .org __vbr_base + 0x400\n"
122     "vbr_400:\n"
123     "        mov.l  r0,@-r15\n"
124     "        mov.l  r1,@-r15\n"
125     "        mov.l  __VBR_Saved400_k, r0\n"
126     "        mov.l  offset400_k,r1\n"
127     "        mov.l  @r0,r0\n"
128     "        add    r1,r0\n"
129     "        mov.l  @r15+,r1\n"
130     "        jmp    @r0\n"
131     "        mov.l  @r15+,r0\n"
132     "        .align 2\n"
133     "__VBR_Saved400_k:\n"
134     "        .long __VBR_Saved\n"
135     "offset400_k:\n"
136     "        .long  0x400\n"
137
138     "        .org __vbr_base + 0x600\n"
139     "vbr_600:\n"
140     "    mov.l r0,@-r15   \n"
141     "    mov.l r1,@-r15   \n"
142     "    stc   sr,r0      \n"
143     "    mov.l __vbr_600_sr_and_k,r1\n"
144     "    and   r1,r0      \n"
145     "    mov.l __vbr_600_sr_or_k,r1\n"
146     "    or    r1,r0      \n"
147     "    ldc   r0,sr      \n"
148     "    ldc.l @r15+,r1_bank\n"
149     "    ldc.l @r15+,r0_bank\n"
150     "    mov.l r0,@-r15   \n"
151     "    mov.l r1,@-r15   \n"
152     "    mov.l r2,@-r15   \n"
153     "    mov.l r3,@-r15   \n"
154     "    mov.l r4,@-r15   \n"
155     "    mov.l r5,@-r15   \n"
156     "    mov.l r6,@-r15   \n"
157     "    mov.l r7,@-r15   \n"
158#if 0     
159     "    mov.l r8,@-r15   \n"
160     "    mov.l r9,@-r15   \n"
161     "    mov.l r10,@-r15  \n"
162     "    mov.l r11,@-r15  \n"
163     "    mov.l r12,@-r15  \n"
164     "    mov.l r13,@-r15  \n"
165#endif
166     "    mov.l r14,@-r15  \n"
167     "    sts.l fpscr,@-r15\n"
168     "    sts.l fpul,@-r15 \n"
169     "    mov.l __ISR_temp_fpscr_k,r0   \n"
170     "    lds   r0,fpscr   \n"
171     "    fmov  fr0,@-r15  \n"
172     "    fmov  fr1,@-r15  \n"
173     "    fmov  fr2,@-r15  \n"
174     "    fmov  fr3,@-r15  \n"
175     "    fmov  fr4,@-r15  \n"
176     "    fmov  fr5,@-r15  \n"
177     "    fmov  fr6,@-r15  \n"
178     "    fmov  fr7,@-r15  \n"
179     "    fmov  fr8,@-r15  \n"
180     "    fmov  fr9,@-r15  \n"
181     "    fmov  fr10,@-r15 \n"
182     "    fmov  fr11,@-r15 \n"
183     "    fmov  fr12,@-r15 \n"
184     "    fmov  fr13,@-r15 \n"
185     "    fmov  fr14,@-r15 \n"
186     "    fmov  fr15,@-r15 \n"
187     
188     "    sts.l pr,@-r15   \n"
189     "    sts.l mach,@-r15 \n"
190     "    sts.l macl,@-r15 \n"
191     "    stc.l spc,@-r15  \n"
192     "    stc.l ssr,@-r15  \n"
193     "    mov r15,r14      \n"
194#if 0
195     "    stc   ssr,r0     \n"
196     "    ldc   r0,sr      \n"
197#endif
198     "    mov.l __ISR_Handler_k, r1\n"
199     "    mov.l _INTEVT_k,r4\n"
200     "    mov.l @r4,r4     \n"
201     "    shlr2 r4         \n"
202     "    shlr  r4         \n"
203     
204     "    mov.l _ISR_Table_k,r0\n"
205     "    mov.l @r0,r0     \n"
206     "    add   r4,r0      \n"
207     "    mov.l @r0,r0     \n"
208     "    cmp/eq #0,r0     \n"
209     "    bt    _ipl_hook  \n"
210
211
212     "    jsr @r1          \n"
213     "     shlr2 r4        \n"
214     "    mov   r14,r15    \n"
215     "    ldc.l @r15+,ssr  \n"
216     "    ldc.l @r15+,spc  \n"
217     "    lds.l @r15+,macl \n"
218     "    lds.l @r15+,mach \n"
219     "    lds.l @r15+,pr   \n"
220     "    mov.l __ISR_temp_fpscr_k,r0   \n"
221     "    lds   r0,fpscr   \n"
222
223     "    fmov  @r15+,fr15 \n"
224     "    fmov  @r15+,fr14 \n"
225     "    fmov  @r15+,fr13 \n"
226     "    fmov  @r15+,fr12 \n"
227     "    fmov  @r15+,fr11 \n"
228     "    fmov  @r15+,fr10 \n"
229     "    fmov  @r15+,fr9  \n"
230     "    fmov  @r15+,fr8  \n"
231     "    fmov  @r15+,fr7  \n"
232     "    fmov  @r15+,fr6  \n"
233     "    fmov  @r15+,fr5  \n"
234     "    fmov  @r15+,fr4  \n"
235     "    fmov  @r15+,fr3  \n"
236     "    fmov  @r15+,fr2  \n"
237     "    fmov  @r15+,fr1  \n"
238     "    fmov  @r15+,fr0  \n"
239     "    lds.l @r15+,fpul \n"
240     "    lds.l @r15+,fpscr\n"
241     "    mov.l @r15+,r14  \n"
242#if 0
243     "    mov.l @r15+,r13  \n"
244     "    mov.l @r15+,r12  \n"
245     "    mov.l @r15+,r11  \n"
246     "    mov.l @r15+,r10  \n"
247     "    mov.l @r15+,r9   \n"
248     "    mov.l @r15+,r8   \n"
249#endif
250     
251     "    mov.l @r15+,r7   \n"
252     "    mov.l @r15+,r6   \n"
253     "    mov.l @r15+,r5   \n"
254     "    mov.l @r15+,r4   \n"
255     "    mov.l @r15+,r3   \n"
256     "    mov.l @r15+,r2   \n"
257     "    mov.l @r15+,r1   \n"
258     "    mov.l @r15+,r0   \n"
259     "    rte              \n"
260     "    nop              \n"
261     "    .align 2         \n"
262     "__vbr_600_sr_and_k:    \n"
263     "    .long " __STRINGIFY__(~(SH4_SR_RB | SH4_SR_BL)) "\n"
264     "__vbr_600_sr_or_k:     \n"
265     "    .long " __STRINGIFY__(SH4_SR_IMASK) "\n"
266     "__ISR_Handler_k:     \n"
267     "    .long ___ISR_Handler\n"
268     "_INTEVT_k:           \n"
269     "    .long " __STRINGIFY__(SH7750_INTEVT) "\n"
270     "_ISR_Table_k:        \n"
271     "    .long   __ISR_Vector_table\n"
272
273     "_ipl_hook:           \n"
274     "    mov   r14,r15    \n"
275     "    ldc.l @r15+,ssr  \n"
276     "    ldc.l @r15+,spc  \n"
277     "    lds.l @r15+,macl \n"
278     "    lds.l @r15+,mach \n"
279     "    lds.l @r15+,pr   \n"
280     "    mov.l __ISR_temp_fpscr_k,r0   \n"
281     "    lds   r0,fpscr   \n"
282     "    fmov  @r15+,fr15 \n"
283     "    fmov  @r15+,fr14 \n"
284     "    fmov  @r15+,fr13 \n"
285     "    fmov  @r15+,fr12 \n"
286     "    fmov  @r15+,fr11 \n"
287     "    fmov  @r15+,fr10 \n"
288     "    fmov  @r15+,fr9  \n"
289     "    fmov  @r15+,fr8  \n"
290     "    fmov  @r15+,fr7  \n"
291     "    fmov  @r15+,fr6  \n"
292     "    fmov  @r15+,fr5  \n"
293     "    fmov  @r15+,fr4  \n"
294     "    fmov  @r15+,fr3  \n"
295     "    fmov  @r15+,fr2  \n"
296     "    fmov  @r15+,fr1  \n"
297     "    fmov  @r15+,fr0  \n"
298     "    lds.l @r15+,fpul \n"
299     "    lds.l @r15+,fpscr\n"
300     "    mov.l @r15+,r14  \n"
301     
302     "    mov.l @r15+,r13  \n"
303     "    mov.l @r15+,r12  \n"
304     "    mov.l @r15+,r11  \n"
305     "    mov.l @r15+,r10  \n"
306     "    mov.l @r15+,r9   \n"
307     "    mov.l @r15+,r8   \n"
308     
309     
310     "    mov.l @r15+,r7   \n"
311     "    mov.l @r15+,r6   \n"
312     "    mov.l @r15+,r5   \n"
313     "    mov.l @r15+,r4   \n"
314     "    mov.l @r15+,r3   \n"
315     "    mov.l @r15+,r2   \n"
316     "    mov.l  __VBR_Saved600_k, r0\n"
317     "    mov.l  offset600_k,r1\n"
318     "    mov.l  @r0,r0\n"
319     "    add    r1,r0\n"
320     "    mov.l  @r15+,r1\n"
321     "    jmp    @r0\n"
322     "    mov.l  @r15+,r0\n"
323     "    .align 2\n"
324     "__ISR_temp_fpscr_k:  \n"
325     "    .long  " __STRINGIFY__(SH4_FPSCR_PR) " \n"
326     "__VBR_Saved600_k:\n"
327     "        .long __VBR_Saved\n"
328     "offset600_k:\n"
329     "        .long  0x600\n"
330
331 );
332     
333
334/************************************************
335 * Dummy interrupt service procedure for
336 * interrupts being not allowed --> Trap 2
337 ************************************************/
338asm(" .section .text
339.global __dummy_isp
340__dummy_isp:
341      mov.l r14,@-r15
342      mov   r15, r14
343      trapa #2
344      mov.l @r15+,r14
345      rte
346      nop");
347
Note: See TracBrowser for help on using the repository browser.