00001 #ifndef CYGONCE_HAL_H8S_STUB_H 00002 #define CYGONCE_HAL_H8S_STUB_H 00003 //======================================================================== 00004 // 00005 // h8s_stub.h 00006 // 00007 // H8S-specific definitions for generic stub 00008 // 00009 //======================================================================== 00010 //####ECOSGPLCOPYRIGHTBEGIN#### 00011 // ------------------------------------------- 00012 // This file is part of eCos, the Embedded Configurable Operating System. 00013 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. 00014 // 00015 // eCos is free software; you can redistribute it and/or modify it under 00016 // the terms of the GNU General Public License as published by the Free 00017 // Software Foundation; either version 2 or (at your option) any later version. 00018 // 00019 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY 00020 // WARRANTY; without even the implied warranty of MERCHANTABILITY or 00021 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00022 // for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License along 00025 // with eCos; if not, write to the Free Software Foundation, Inc., 00026 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00027 // 00028 // As a special exception, if other files instantiate templates or use macros 00029 // or inline functions from this file, or you compile this file and link it 00030 // with other works to produce a work based on this file, this file does not 00031 // by itself cause the resulting work to be covered by the GNU General Public 00032 // License. However the source code for this file must still be made available 00033 // in accordance with section (3) of the GNU General Public License. 00034 // 00035 // This exception does not invalidate any other reasons why a work based on 00036 // this file might be covered by the GNU General Public License. 00037 // 00038 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. 00039 // at http://sources.redhat.com/ecos/ecos-license/ 00040 // ------------------------------------------- 00041 //####ECOSGPLCOPYRIGHTEND#### 00042 //======================================================================== 00043 //#####DESCRIPTIONBEGIN#### 00044 // 00045 // Author(s): yoshinori sato 00046 // Contributors: yoshinori sato, Uwe Kindler 00047 // Date: 2003-12-06 00048 // Purpose: 00049 // Description: H8S-specific definitions for generic stub 00050 // Usage: 00051 // 00052 //####DESCRIPTIONEND#### 00053 // 00054 //======================================================================== 00055 00056 00057 //============================================================================= 00058 // DOXYGEN FILE HEADER 00065 //============================================================================= 00066 00067 #ifdef __cplusplus 00068 extern "C" { 00069 #endif 00070 00071 //======================================================================== 00072 // DEFINES 00073 //======================================================================== 00074 00075 //------------------------------------------------------------------------ 00076 // H8S register definitions - these definitions are required by the 00077 // generic stub generic_stub.c 00078 // 00079 #if defined(CYGHWR_HAL_H8S_USE_MAC) 00080 #define NUMREGS 16 00081 #else 00082 #define NUMREGS 12 00083 #endif 00084 00085 #define NUMREGBYTES (4 * NUMREGS) 00086 #define REGSIZE(_x_) (4) 00087 00091 enum regnames { 00092 ER0, ER1, ER2, ER3, ER4, ER5, ER6, 00093 SP, 00094 CCR, 00095 PC, 00096 CYCL, 00097 EXR, 00098 // 00099 // if we use MAC register an would like to debug it then we have to define 00100 // some more regs for GDB 00101 // 00102 #if defined(CYGHWR_HAL_H8S_USE_MAC) 00103 TICK, 00104 INST, 00105 MACH, 00106 MACL, 00107 #endif 00108 }; 00109 00110 00111 //======================================================================== 00112 // DATA TYPES 00113 //======================================================================== 00114 typedef unsigned long target_register_t; 00115 typedef enum regnames regnames_t; 00116 00117 00118 //======================================================================== 00119 // EXTERNALS 00120 //======================================================================== 00121 00122 //------------------------------------------------------------------------ 00123 // Given a trap value TRAP, return the corresponding signal. 00124 // 00125 extern int __computeSignal (unsigned int trap_number); 00126 00127 00128 //------------------------------------------------------------------------ 00129 // Return the trap number corresponding to the last-taken trap. 00130 // 00131 extern int __get_trap_number (void); 00132 00133 00134 //------------------------------------------------------------------------ 00135 // Return the currently-saved value corresponding to register REG. 00136 // 00137 extern target_register_t get_register (regnames_t reg); 00138 00139 00140 //------------------------------------------------------------------------ 00141 // Store VALUE in the register corresponding to WHICH. 00142 // 00143 extern void put_register (regnames_t which, target_register_t value); 00144 00145 00146 //------------------------------------------------------------------------ 00147 // Set the currently-saved pc register value to PC. This also updates NPC 00148 // as needed. 00149 // 00150 extern void set_pc (target_register_t pc); 00151 00152 00153 //------------------------------------------------------------------------ 00154 // Set things up so that the next user resume will execute one instruction. 00155 // This may be done by setting breakpoints or setting a single step flag 00156 // in the saved user registers, for example. 00157 // 00158 void __single_step (void); 00159 00160 00161 //------------------------------------------------------------------------ 00162 // Clear the single-step state. 00163 // 00164 void __clear_single_step (void); 00165 00166 00167 //------------------------------------------------------------------------ 00168 // If the breakpoint we hit is in the breakpoint() instruction, return a 00169 // non-zero value. 00170 // 00171 extern int __is_breakpoint_function (void); 00172 00173 00174 //------------------------------------------------------------------------ 00175 // Skip the current instruction. 00176 // 00177 extern void __skipinst (void); 00178 00179 extern void __install_breakpoints (void); 00180 00181 extern void __clear_breakpoints (void); 00182 00183 00184 //------------------------------------------------------------------------ 00185 // Some architectures may need to fix the PC in case of a partial 00186 // or fully executed trap instruction. GDB only takes correct action 00187 // when the PC is pointing to the breakpoint instruction it set. 00188 // 00189 // Most architectures would leave PC pointing at the trap 00190 // instruction itself though, and so do not need to do anything 00191 // special. In H8S architecture the PC will point to the next 00192 // instruction after TRAP so we have to rewind PC 00193 // 00194 #define HAL_STUB_PLATFORM_STUBS_FIXUP() \ 00195 CYG_MACRO_START \ 00196 if (CYGNUM_HAL_VECTOR_TRAP3 == __get_trap_number()) \ 00197 put_register(PC, get_register(PC) - 2); \ 00198 CYG_MACRO_END 00199 00200 00201 #ifdef __cplusplus 00202 } /* extern "C" */ 00203 #endif 00204 00205 //------------------------------------------------------------------------ 00206 #endif // ifndef CYGONCE_HAL_H8S_STUB_H
1.3.5