source: rtems/cpukit/score/cpu/avr/cpu_asm.c @ 78aa060

4.104.115
Last change on this file since 78aa060 was 78aa060, checked in by Joel Sherrill <joel.sherrill@…>, on 12/11/08 at 21:10:26

2008-12-11 Joel Sherrill <joel.sherrill@…>

  • cpu.c, cpu_asm.c: Remove warnings -- even if code is just temporary.
  • Property mode set to 100644
File size: 5.4 KB
Line 
1/*  cpu_asm.c  ===> cpu_asm.S or cpu_asm.s
2 *
3 *  This file contains the basic algorithms for all assembly code used
4 *  in an specific CPU port of RTEMS.  These algorithms must be implemented
5 *  in assembly language
6 *
7 *  NOTE:  This is supposed to be a .S or .s file NOT a C file.
8 *
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19/*
20 *  This is supposed to be an assembly file.  This means that system.h
21 *  and cpu.h should not be included in a "real" cpu_asm file.  An
22 *  implementation in assembly should include "cpu_asm.h>
23 */
24
25#include <rtems/system.h>
26#include <rtems/score/cpu.h>
27/* #include "cpu_asm.h> */
28
29#include <rtems/bspIo.h> /* XXX remove me later */
30
31/*
32 *  _CPU_Context_save_fp_context
33 *
34 *  This routine is responsible for saving the FP context
35 *  at *fp_context_ptr.  If the point to load the FP context
36 *  from is changed then the pointer is modified by this routine.
37 *
38 *  Sometimes a macro implementation of this is in cpu.h which dereferences
39 *  the ** and a similarly named routine in this file is passed something
40 *  like a (Context_Control_fp *).  The general rule on making this decision
41 *  is to avoid writing assembly language.
42 *
43 *  NO_CPU Specific Information:
44 *
45 *  XXX document implementation including references if appropriate
46 */
47
48void _CPU_Context_save_fp(
49  Context_Control_fp **fp_context_ptr
50)
51{
52}
53
54/*
55 *  _CPU_Context_restore_fp_context
56 *
57 *  This routine is responsible for restoring the FP context
58 *  at *fp_context_ptr.  If the point to load the FP context
59 *  from is changed then the pointer is modified by this routine.
60 *
61 *  Sometimes a macro implementation of this is in cpu.h which dereferences
62 *  the ** and a similarly named routine in this file is passed something
63 *  like a (Context_Control_fp *).  The general rule on making this decision
64 *  is to avoid writing assembly language.
65 *
66 *  NO_CPU Specific Information:
67 *
68 *  XXX document implementation including references if appropriate
69 */
70
71void _CPU_Context_restore_fp(
72  Context_Control_fp **fp_context_ptr
73)
74{
75}
76
77/*  _CPU_Context_switch
78 *
79 *  This routine performs a normal non-FP context switch.
80 *
81 *  NO_CPU Specific Information:
82 *
83 *  XXX document implementation including references if appropriate
84 */
85
86void _CPU_Context_switch(
87  Context_Control  *run,
88  Context_Control  *heir
89)
90{
91  printk( "AVR _CPU_Context_switch\n" );
92}
93
94/*
95 *  _CPU_Context_restore
96 *
97 *  This routine is generally used only to restart self in an
98 *  efficient manner.  It may simply be a label in _CPU_Context_switch.
99 *
100 *  NOTE: May be unnecessary to reload some registers.
101 *
102 *  NO_CPU Specific Information:
103 *
104 *  XXX document implementation including references if appropriate
105 */
106
107void _CPU_Context_restore(
108  Context_Control *new_context
109)
110{
111  printk( "AVR _CPU_Context_restore\n" );
112}
113
114/*  void __ISR_Handler()
115 *
116 *  This routine provides the RTEMS interrupt management.
117 *
118 *  NO_CPU Specific Information:
119 *
120 *  XXX document implementation including references if appropriate
121 */
122
123void _ISR_Handler(void)
124{
125   /*
126    *  This discussion ignores a lot of the ugly details in a real
127    *  implementation such as saving enough registers/state to be
128    *  able to do something real.  Keep in mind that the goal is
129    *  to invoke a user's ISR handler which is written in C and
130    *  uses a certain set of registers.
131    *
132    *  Also note that the exact order is to a large extent flexible.
133    *  Hardware will dictate a sequence for a certain subset of
134    *  _ISR_Handler while requirements for setting
135    */
136
137  /*
138   *  At entry to "common" _ISR_Handler, the vector number must be
139   *  available.  On some CPUs the hardware puts either the vector
140   *  number or the offset into the vector table for this ISR in a
141   *  known place.  If the hardware does not give us this information,
142   *  then the assembly portion of RTEMS for this port will contain
143   *  a set of distinct interrupt entry points which somehow place
144   *  the vector number in a known place (which is safe if another
145   *  interrupt nests this one) and branches to _ISR_Handler.
146   *
147   *  save some or all context on stack
148   *  may need to save some special interrupt information for exit
149   *
150   *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
151   *    if ( _ISR_Nest_level == 0 )
152   *      switch to software interrupt stack
153   *  #endif
154   *
155   *  _ISR_Nest_level++;
156   *
157   *  _Thread_Dispatch_disable_level++;
158   *
159   *  (*_ISR_Vector_table[ vector ])( vector );
160   *
161   *  _Thread_Dispatch_disable_level--;
162   *
163   *  --_ISR_Nest_level;
164   *
165   *  if ( _ISR_Nest_level )
166   *    goto the label "exit interrupt (simple case)"
167   *
168   *  if ( _Thread_Dispatch_disable_level )
169   *    _ISR_Signals_to_thread_executing = FALSE;
170   *    goto the label "exit interrupt (simple case)"
171   *
172   *  if ( _Context_Switch_necessary || _ISR_Signals_to_thread_executing ) {
173   *    _ISR_Signals_to_thread_executing = FALSE;
174   *    call _Thread_Dispatch() or prepare to return to _ISR_Dispatch
175   *    prepare to get out of interrupt
176   *    return from interrupt  (maybe to _ISR_Dispatch)
177   *
178   *  LABEL "exit interrupt (simple case):
179   *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
180   *    if outermost interrupt
181   *      restore stack
182   *  #endif
183   *  prepare to get out of interrupt
184   *  return from interrupt
185   */
186}
Note: See TracBrowser for help on using the repository browser.