source: rtems/c/src/exec/score/cpu/mips64orion/cpu.c @ 7e950a4

4.104.114.84.95
Last change on this file since 7e950a4 was 6e7e723c, checked in by Joel Sherrill <joel.sherrill@…>, on 04/11/01 at 13:48:30

2001-04-11 Joel Sherrill <joel@…>

  • cpu.c: Removed duplicate declaration for _ISR_Vector_table.
  • Property mode set to 100644
File size: 5.1 KB
Line 
1/*
2 *  Mips CPU Dependent Source
3 *
4 *  Author:     Craig Lebakken <craigl@transition.com>
5 *
6 *  COPYRIGHT (c) 1996 by Transition Networks Inc.
7 *
8 *  To anyone who acknowledges that this file is provided "AS IS"
9 *  without any express or implied warranty:
10 *      permission to use, copy, modify, and distribute this file
11 *      for any purpose is hereby granted without fee, provided that
12 *      the above copyright notice and this notice appears in all
13 *      copies, and that the name of Transition Networks not be used in
14 *      advertising or publicity pertaining to distribution of the
15 *      software without specific, written prior permission.
16 *      Transition Networks makes no representations about the suitability
17 *      of this software for any purpose.
18 *
19 *  Derived from source copyrighted as follows:
20 *
21 *  COPYRIGHT (c) 1989-1999.
22 *  On-Line Applications Research Corporation (OAR).
23 *
24 *  The license and distribution terms for this file may be
25 *  found in the file LICENSE in this distribution or at
26 *  http://www.OARcorp.com/rtems/license.html.
27 *
28 *  $Id$
29 */
30
31/*
32 *  Rather than deleting this, it is commented out to (hopefully) help
33 *  the submitter send updates.
34 *
35 * static char _sccsid[] = "@(#)cpu.c 08/20/96     1.5\n";
36 */
37
38#include <rtems/system.h>
39#include <rtems/score/isr.h>
40#include <rtems/score/wkspace.h>
41
42
43/*  _CPU_Initialize
44 *
45 *  This routine performs processor dependent initialization.
46 *
47 *  INPUT PARAMETERS:
48 *    cpu_table       - CPU table to initialize
49 *    thread_dispatch - address of disptaching routine
50 */
51
52
53void null_handler( void )
54{
55}
56
57
58void _CPU_Initialize(
59  rtems_cpu_table  *cpu_table,
60  void      (*thread_dispatch)      /* ignored on this CPU */
61)
62{
63   unsigned int i = ISR_NUMBER_OF_VECTORS;
64
65   while ( i-- )
66   {
67      _ISR_Vector_table[i] = (ISR_Handler_entry)null_handler;
68   }
69
70  /*
71   *  The thread_dispatch argument is the address of the entry point
72   *  for the routine called at the end of an ISR once it has been
73   *  decided a context switch is necessary.  On some compilation
74   *  systems it is difficult to call a high-level language routine
75   *  from assembly.  This allows us to trick these systems.
76   *
77   *  If you encounter this problem save the entry point in a CPU
78   *  dependent variable.
79   */
80
81  _CPU_Thread_dispatch_pointer = thread_dispatch;
82
83  /*
84   *  If there is not an easy way to initialize the FP context
85   *  during Context_Initialize, then it is usually easier to
86   *  save an "uninitialized" FP context here and copy it to
87   *  the task's during Context_Initialize.
88   */
89
90  /* FP context initialization support goes here */
91
92  _CPU_Table = *cpu_table;
93
94}
95
96/*PAGE
97 *
98 *  _CPU_ISR_Get_level
99 */
100 
101#if 0 /* located in cpu_asm.S */
102unsigned32 _CPU_ISR_Get_level( void )
103{
104  /*
105   *  This routine returns the current interrupt level.
106   */
107}
108#endif
109
110/*PAGE
111 *
112 *  _CPU_ISR_install_raw_handler
113 */
114 
115void _CPU_ISR_install_raw_handler(
116  unsigned32  vector,
117  proc_ptr    new_handler,
118  proc_ptr   *old_handler
119)
120{
121  /*
122   *  This is where we install the interrupt handler into the "raw" interrupt
123   *  table used by the CPU to dispatch interrupt handlers.
124   */
125
126#if 0 /* not necessary */
127/* use IDT/Sim to set interrupt vector.  Needed to co-exist with debugger. */
128   add_ext_int_func( vector, new_handler );
129#endif
130}
131
132/*PAGE
133 *
134 *  _CPU_ISR_install_vector
135 *
136 *  This kernel routine installs the RTEMS handler for the
137 *  specified vector.
138 *
139 *  Input parameters:
140 *    vector      - interrupt vector number
141 *    old_handler - former ISR for this vector number
142 *    new_handler - replacement ISR for this vector number
143 *
144 *  Output parameters:  NONE
145 *
146 */
147
148void _CPU_ISR_install_vector(
149  unsigned32  vector,
150  proc_ptr    new_handler,
151  proc_ptr   *old_handler
152)
153{
154   *old_handler = _ISR_Vector_table[ vector ];
155
156   /*
157    *  If the interrupt vector table is a table of pointer to isr entry
158    *  points, then we need to install the appropriate RTEMS interrupt
159    *  handler for this vector number.
160    */
161
162   _CPU_ISR_install_raw_handler( vector, _ISR_Handler, old_handler );
163
164   /*
165    *  We put the actual user ISR address in '_ISR_vector_table'.  This will
166    *  be used by the _ISR_Handler so the user gets control.
167    */
168
169    _ISR_Vector_table[ vector ] = new_handler;
170}
171
172/*PAGE
173 *
174 *  _CPU_Install_interrupt_stack
175 */
176
177void _CPU_Install_interrupt_stack( void )
178{
179/* we don't support this yet */
180}
181
182/*PAGE
183 *
184 *  _CPU_Internal_threads_Idle_thread_body
185 *
186 *  NOTES:
187 *
188 *  1. This is the same as the regular CPU independent algorithm.
189 *
190 *  2. If you implement this using a "halt", "idle", or "shutdown"
191 *     instruction, then don't forget to put it in an infinite loop.
192 *
193 *  3. Be warned. Some processors with onboard DMA have been known
194 *     to stop the DMA if the CPU were put in IDLE mode.  This might
195 *     also be a problem with other on-chip peripherals.  So use this
196 *     hook with caution.
197 */
198
199#if 0 /* located in cpu_asm.S */
200void _CPU_Thread_Idle_body( void )
201{
202
203  for( ; ; )
204    /* insert your "halt" instruction here */ ;
205}
206#endif
207
208extern void mips_break( int error );
209
210#include <stdio.h>
211
212void mips_fatal_error( int error )
213{
214   printf("fatal error 0x%x %d\n",error,error);
215   mips_break( error );
216}
Note: See TracBrowser for help on using the repository browser.