source: rtems/cpukit/score/cpu/nios2/cpu.c @ 7c2f2448

4.115
Last change on this file since 7c2f2448 was 7c2f2448, checked in by Joel Sherrill <joel.sherrill@…>, on 07/24/11 at 23:43:20

2011-07-24 Joel Sherrill <joel.sherrill@…>

  • cpu.c: Remove /*PAGE markers which were interpreted by a long dead print script.
  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 *  NIOS2 CPU Dependent Source
3 *
4 *  COPYRIGHT (c) 1989-2006
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/wkspace.h>
21
22/*  _CPU_Initialize
23 *
24 *  This routine performs processor dependent initialization.
25 *
26 *  INPUT PARAMETERS: NONE
27 *
28 *  NO_CPU Specific Information:
29 *
30 *  XXX document implementation including references if appropriate
31 */
32
33void _CPU_Initialize(void)
34{
35  /*
36   *  If there is not an easy way to initialize the FP context
37   *  during Context_Initialize, then it is usually easier to
38   *  save an "uninitialized" FP context here and copy it to
39   *  the task's during Context_Initialize.
40   */
41
42  /* FP context initialization support goes here */
43}
44
45/*
46 *  _CPU_ISR_Get_level
47 *
48 *  NO_CPU Specific Information:
49 *
50 *  XXX document implementation including references if appropriate
51 */
52
53uint32_t   _CPU_ISR_Get_level( void )
54{
55  /*
56   *  This routine returns the current interrupt level.
57   */
58
59  return 0;
60}
61
62/*
63 *  _CPU_ISR_install_raw_handler
64 *
65 *  NO_CPU Specific Information:
66 *
67 *  XXX document implementation including references if appropriate
68 */
69
70void _CPU_ISR_install_raw_handler(
71  uint32_t    vector,
72  proc_ptr    new_handler,
73  proc_ptr   *old_handler
74)
75{
76  /*
77   *  This is where we install the interrupt handler into the "raw" interrupt
78   *  table used by the CPU to dispatch interrupt handlers.
79   */
80}
81
82/*
83 *  _CPU_ISR_install_vector
84 *
85 *  This kernel routine installs the RTEMS handler for the
86 *  specified vector.
87 *
88 *  Input parameters:
89 *    vector      - interrupt vector number
90 *    old_handler - former ISR for this vector number
91 *    new_handler - replacement ISR for this vector number
92 *
93 *  Output parameters:  NONE
94 *
95 *
96 *  NO_CPU Specific Information:
97 *
98 *  XXX document implementation including references if appropriate
99 */
100
101void _CPU_ISR_install_vector(
102  uint32_t    vector,
103  proc_ptr    new_handler,
104  proc_ptr   *old_handler
105)
106{
107   *old_handler = _ISR_Vector_table[ vector ];
108
109   /*
110    *  If the interrupt vector table is a table of pointer to isr entry
111    *  points, then we need to install the appropriate RTEMS interrupt
112    *  handler for this vector number.
113    */
114
115   _CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
116
117   /*
118    *  We put the actual user ISR address in '_ISR_vector_table'.  This will
119    *  be used by the _ISR_Handler so the user gets control.
120    */
121
122    _ISR_Vector_table[ vector ] = new_handler;
123}
124
125/*
126 *  _CPU_Install_interrupt_stack
127 *
128 *  NO_CPU Specific Information:
129 *
130 *  XXX document implementation including references if appropriate
131 */
132
133void _CPU_Install_interrupt_stack( void )
134{
135}
136
137/*
138 *  _CPU_Thread_Idle_body
139 *
140 *  NOTES:
141 *
142 *  1. This is the same as the regular CPU independent algorithm.
143 *
144 *  2. If you implement this using a "halt", "idle", or "shutdown"
145 *     instruction, then don't forget to put it in an infinite loop.
146 *
147 *  3. Be warned. Some processors with onboard DMA have been known
148 *     to stop the DMA if the CPU were put in IDLE mode.  This might
149 *     also be a problem with other on-chip peripherals.  So use this
150 *     hook with caution.
151 *
152 *  NO_CPU Specific Information:
153 *
154 *  XXX document implementation including references if appropriate
155 */
156
157void *_CPU_Thread_Idle_body( uintptr_t ignored )
158{
159#if 1
160  for(;;);
161#else
162  for(;;)
163  {
164    uint32_t st = __builtin_rdctl(0); /* read status  register */
165
166    /* Differentiate between IRQ off and on (for debugging) */
167    if(st & 1)
168      for(;;);
169    else
170      for(;;);
171
172    /* insert your "halt" instruction here */ ;
173  }
174#endif
175}
Note: See TracBrowser for help on using the repository browser.