source: rtems-schedsim/schedsim/rtems/sched_cpu/cpu.c @ 2d51251

Last change on this file since 2d51251 was 2d51251, checked in by Jennifer Averett <jennifer.averett@…>, on 05/09/14 at 13:35:58

schedsim: Add smp support.

  • Property mode set to 100644
File size: 3.3 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
22int _CPU_ISR_level_on_sched_cpu;
23
24/*  _CPU_Initialize
25 *
26 *  This routine performs processor dependent initialization.
27 *
28 *  INPUT PARAMETERS: NONE
29 *
30 *  NO_CPU Specific Information:
31 *
32 *  XXX document implementation including references if appropriate
33 */
34
35void _CPU_Initialize(void)
36{
37  _CPU_ISR_level_on_sched_cpu = 1;
38}
39
40/*
41 *  _CPU_ISR_install_raw_handler
42 *
43 *  NO_CPU Specific Information:
44 *
45 *  XXX document implementation including references if appropriate
46 */
47
48void _CPU_ISR_install_raw_handler(
49  uint32_t    vector,
50  proc_ptr    new_handler,
51  proc_ptr   *old_handler
52)
53{
54  /*
55   *  This is where we install the interrupt handler into the "raw" interrupt
56   *  table used by the CPU to dispatch interrupt handlers.
57   */
58}
59
60/*
61 *  _CPU_ISR_install_vector
62 *
63 *  This kernel routine installs the RTEMS handler for the
64 *  specified vector.
65 *
66 *  Input parameters:
67 *    vector      - interrupt vector number
68 *    old_handler - former ISR for this vector number
69 *    new_handler - replacement ISR for this vector number
70 *
71 *  Output parameters:  NONE
72 *
73 *
74 *  NO_CPU Specific Information:
75 *
76 *  XXX document implementation including references if appropriate
77 */
78
79void _CPU_ISR_install_vector(
80  uint32_t    vector,
81  proc_ptr    new_handler,
82  proc_ptr   *old_handler
83)
84{
85   *old_handler = _ISR_Vector_table[ vector ];
86
87   /*
88    *  If the interrupt vector table is a table of pointer to isr entry
89    *  points, then we need to install the appropriate RTEMS interrupt
90    *  handler for this vector number.
91    */
92
93   _CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
94
95   /*
96    *  We put the actual user ISR address in '_ISR_vector_table'.  This will
97    *  be used by the _ISR_Handler so the user gets control.
98    */
99
100    _ISR_Vector_table[ vector ] = new_handler;
101}
102
103/*
104 *  _CPU_Install_interrupt_stack
105 *
106 *  NO_CPU Specific Information:
107 *
108 *  XXX document implementation including references if appropriate
109 */
110
111void _CPU_Install_interrupt_stack( void )
112{
113}
114
115/*
116 *  _CPU_Thread_Idle_body
117 *
118 *  NOTES:
119 *
120 *  1. This is the same as the regular CPU independent algorithm.
121 *
122 *  2. If you implement this using a "halt", "idle", or "shutdown"
123 *     instruction, then don't forget to put it in an infinite loop.
124 *
125 *  3. Be warned. Some processors with onboard DMA have been known
126 *     to stop the DMA if the CPU were put in IDLE mode.  This might
127 *     also be a problem with other on-chip peripherals.  So use this
128 *     hook with caution.
129 *
130 *  NO_CPU Specific Information:
131 *
132 *  XXX document implementation including references if appropriate
133 */
134
135void *_CPU_Thread_Idle_body( uintptr_t ignored )
136{
137
138  for( ; ; )
139    /* insert your "halt" instruction here */ ;
140}
141
142#include <stdio.h>
143void _SMP_cpu_swap(
144  uint32_t *a,
145  uint32_t *value,
146  uint32_t *prev
147)
148{
149  *prev = *a;
150  *a = *value;
151  // printf( "(%d %d) ", *prev, *value );
152}
Note: See TracBrowser for help on using the repository browser.