source: rtems/cpukit/score/cpu/m32c/cpu.c @ c9f5531

4.104.11
Last change on this file since c9f5531 was c9f5531, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 27, 2010 at 3:01:57 PM

2010-03-27 Joel Sherrill <joel.sherrill@…>

  • context_init.c, context_switch.S, cpu.c, cpu_asm.c, varvects.S: Add include of config.h
  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 *  XXX CPU Dependent Source
3 *
4 *  COPYRIGHT (c) 1989-1999.
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 <varvects.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  asm volatile( "ldc    #__var_vects,intb" );
36}
37
38/*
39 *  This routine returns the current interrupt level.
40 *
41 *  NO_CPU Specific Information:
42 *
43 *  XXX document implementation including references if appropriate
44 */
45
46uint32_t   _CPU_ISR_Get_level( void )
47{
48  int flag;
49  m32c_get_flg( flag );
50
51  return ((flag & 0x40) ? 0 : 1);
52}
53
54/*PAGE
55 *
56 *  _CPU_ISR_install_raw_handler
57 *
58 *  NO_CPU Specific Information:
59 *
60 *  XXX document implementation including references if appropriate
61 */
62
63void _CPU_ISR_install_raw_handler(
64  uint32_t    vector,
65  proc_ptr    new_handler,
66  proc_ptr   *old_handler
67)
68{
69  /*
70   *  This is where we install the interrupt handler into the "raw" interrupt
71   *  table used by the CPU to dispatch interrupt handlers.
72   */
73  _set_var_vect(new_handler,vector);
74}
75
76/*PAGE
77 *
78 *  _CPU_ISR_install_vector
79 *
80 *  This kernel routine installs the RTEMS handler for the
81 *  specified vector.
82 *
83 *  Input parameters:
84 *    vector      - interrupt vector number
85 *    old_handler - former ISR for this vector number
86 *    new_handler - replacement ISR for this vector number
87 *
88 *  Output parameters:  NONE
89 *
90 *
91 *  NO_CPU Specific Information:
92 *
93 *  XXX document implementation including references if appropriate
94 */
95
96void _CPU_ISR_install_vector(
97  uint32_t    vector,
98  proc_ptr    new_handler,
99  proc_ptr   *old_handler
100)
101{
102   *old_handler = _ISR_Vector_table[ vector ];
103
104   /*
105    *  If the interrupt vector table is a table of pointer to isr entry
106    *  points, then we need to install the appropriate RTEMS interrupt
107    *  handler for this vector number.
108    */
109
110   _CPU_ISR_install_raw_handler( vector, new_handler, old_handler );
111
112   /*
113    *  We put the actual user ISR address in '_ISR_vector_table'.  This will
114    *  be used by the _ISR_Handler so the user gets control.
115    */
116
117    _ISR_Vector_table[ vector ] = new_handler;
118}
119
120/*PAGE
121 *
122 *  _CPU_Install_interrupt_stack
123 *
124 *  NO_CPU Specific Information:
125 *
126 *  XXX document implementation including references if appropriate
127 */
128
129void _CPU_Install_interrupt_stack( void )
130{
131}
132
133/*PAGE
134 *
135 *  _CPU_Thread_Idle_body
136 *
137 *  NOTES:
138 *
139 *  1. This is the same as the regular CPU independent algorithm.
140 *
141 *  2. If you implement this using a "halt", "idle", or "shutdown"
142 *     instruction, then don't forget to put it in an infinite loop.
143 *
144 *  3. Be warned. Some processors with onboard DMA have been known
145 *     to stop the DMA if the CPU were put in IDLE mode.  This might
146 *     also be a problem with other on-chip peripherals.  So use this
147 *     hook with caution.
148 *
149 *  NO_CPU Specific Information:
150 *
151 *  XXX document implementation including references if appropriate
152 */
153
154void *_CPU_Thread_Idle_body( uintptr_t ignored )
155{
156
157  for( ; ; )
158    /* insert your "halt" instruction here */ ;
159}
Note: See TracBrowser for help on using the repository browser.