source: rtems/cpukit/score/cpu/nios2/cpu.c @ cca8379

4.104.115
Last change on this file since cca8379 was cca8379, checked in by Joel Sherrill <joel.sherrill@…>, on 02/12/09 at 15:55:55

2009-02-12 Joel Sherrill <joel.sherrill@…>

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