source: rtems-schedsim/schedsim/rtems/sched_cpu/cpu.c @ a2aad55

Last change on this file since a2aad55 was a2aad55, checked in by Joel Sherrill <joel.sherrill@…>, on May 1, 2013 at 12:41:56 AM

Remove CVS $

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 *  XXX CPU Dependent Source
3 *
4 *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
5 *
6 *  COPYRIGHT (c) 1989-2013.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
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/*PAGE
46 *
47 *  _CPU_ISR_Get_level
48 *
49 *  NO_CPU Specific Information:
50 *
51 *  XXX document implementation including references if appropriate
52 */
53
54uint32_t   _CPU_ISR_Get_level( void )
55{
56  /*
57   *  This routine returns the current interrupt level.
58   */
59
60  return 0;
61}
62
63/*PAGE
64 *
65 *  _CPU_ISR_install_raw_handler
66 *
67 *  NO_CPU Specific Information:
68 *
69 *  XXX document implementation including references if appropriate
70 */
71
72void _CPU_ISR_install_raw_handler(
73  uint32_t    vector,
74  proc_ptr    new_handler,
75  proc_ptr   *old_handler
76)
77{
78  /*
79   *  This is where we install the interrupt handler into the "raw" interrupt
80   *  table used by the CPU to dispatch interrupt handlers.
81   */
82}
83
84/*PAGE
85 *
86 *  _CPU_ISR_install_vector
87 *
88 *  This kernel routine installs the RTEMS handler for the
89 *  specified vector.
90 *
91 *  Input parameters:
92 *    vector      - interrupt vector number
93 *    old_handler - former ISR for this vector number
94 *    new_handler - replacement ISR for this vector number
95 *
96 *  Output parameters:  NONE
97 *
98 *
99 *  NO_CPU Specific Information:
100 *
101 *  XXX document implementation including references if appropriate
102 */
103
104void _CPU_ISR_install_vector(
105  uint32_t    vector,
106  proc_ptr    new_handler,
107  proc_ptr   *old_handler
108)
109{
110   *old_handler = _ISR_Vector_table[ vector ];
111
112   /*
113    *  If the interrupt vector table is a table of pointer to isr entry
114    *  points, then we need to install the appropriate RTEMS interrupt
115    *  handler for this vector number.
116    */
117
118   _CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
119
120   /*
121    *  We put the actual user ISR address in '_ISR_vector_table'.  This will
122    *  be used by the _ISR_Handler so the user gets control.
123    */
124
125    _ISR_Vector_table[ vector ] = new_handler;
126}
127
128/*PAGE
129 *
130 *  _CPU_Install_interrupt_stack
131 *
132 *  NO_CPU Specific Information:
133 *
134 *  XXX document implementation including references if appropriate
135 */
136
137void _CPU_Install_interrupt_stack( void )
138{
139}
140
141/*PAGE
142 *
143 *  _CPU_Thread_Idle_body
144 *
145 *  NOTES:
146 *
147 *  1. This is the same as the regular CPU independent algorithm.
148 *
149 *  2. If you implement this using a "halt", "idle", or "shutdown"
150 *     instruction, then don't forget to put it in an infinite loop.
151 *
152 *  3. Be warned. Some processors with onboard DMA have been known
153 *     to stop the DMA if the CPU were put in IDLE mode.  This might
154 *     also be a problem with other on-chip peripherals.  So use this
155 *     hook with caution.
156 *
157 *  NO_CPU Specific Information:
158 *
159 *  XXX document implementation including references if appropriate
160 */
161
162void *_CPU_Thread_Idle_body( uintptr_t ignored )
163{
164
165  for( ; ; )
166    /* insert your "halt" instruction here */ ;
167}
168
169#include <stdio.h>
170void _SMP_cpu_swap( 
171  uint32_t *a,
172  uint32_t *value,
173  uint32_t *prev
174)
175{
176  *prev = *a;
177  *a = *value;
178  // printf( "(%d %d) ", *prev, *value );
179}
Note: See TracBrowser for help on using the repository browser.