source: rtems/c/src/exec/score/cpu/mips/cpu.c @ 2ff1d549

4.104.114.84.95
Last change on this file since 2ff1d549 was 32ef3dc, checked in by Joel Sherrill <joel.sherrill@…>, on 04/07/97 at 21:19:59

commented out sccs_id to eliminate warning.

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