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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [cpu/] [mips64orion/] [cpu.c] - Blame information for rev 173

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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