⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h8s_stub.h

📁 ecos移植到R8H系列的源码。源码包来自http://www.cetoni.de/develop/develop_ecosh8s_en.html
💻 H
字号:
#ifndef CYGONCE_HAL_H8S_STUB_H
#define CYGONCE_HAL_H8S_STUB_H
//========================================================================
//
//      h8s_stub.h
//
//      H8S-specific definitions for generic stub
//
//========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):     yoshinori sato
// Contributors:  yoshinori sato, Uwe Kindler
// Date:          2003-12-06
// Purpose:       
// Description:   H8S-specific definitions for generic stub
// Usage:         
//
//####DESCRIPTIONEND####
//
//========================================================================


//=============================================================================
//                            DOXYGEN FILE HEADER
/// \file    h8s_stub.h
/// \brief   H8S-specific definitions for generic stub
/// \author  Uwe Kindler, Yoshinori Sato
/// \date    2003-12-06
///
/// Usage:   include <cyg/hal/h8s_stub.h>
//=============================================================================

#ifdef __cplusplus
extern "C" {
#endif

//========================================================================
//                                 DEFINES
//========================================================================

//------------------------------------------------------------------------
// H8S register definitions - these definitions are required by the 
// generic stub generic_stub.c
//
#if defined(CYGHWR_HAL_H8S_USE_MAC)
  #define NUMREGS       16
#else
  #define NUMREGS       12
#endif

#define NUMREGBYTES   (4 * NUMREGS)
#define REGSIZE(_x_)  (4)

///
/// The H8S registers numbered accoring to the GDB host side
///
enum regnames {
  ER0, ER1, ER2, ER3, ER4, ER5, ER6,  
  SP, 
  CCR, 
  PC, 
  CYCL, 
  EXR,
//
// if we use MAC register an would like to debug it then we have to define
// some more regs for GDB
//
#if defined(CYGHWR_HAL_H8S_USE_MAC)
  TICK,
  INST,
  MACH,
  MACL,
#endif
};


//========================================================================
//                              DATA TYPES
//========================================================================
typedef unsigned long target_register_t; ///< stores content of H8S register 
typedef enum regnames regnames_t;        ///< required for generic stub


//========================================================================
//                              EXTERNALS
//========================================================================

//------------------------------------------------------------------------
// Given a trap value TRAP, return the corresponding signal.
//
extern int __computeSignal (unsigned int trap_number);


//------------------------------------------------------------------------
// Return the trap number corresponding to the last-taken trap.
//
extern int __get_trap_number (void);
         

//------------------------------------------------------------------------
// Return the currently-saved value corresponding to register REG.
//
extern target_register_t get_register (regnames_t reg);
   

//------------------------------------------------------------------------
// Store VALUE in the register corresponding to WHICH. 
//
extern void put_register (regnames_t which, target_register_t value);


//------------------------------------------------------------------------
// Set the currently-saved pc register value to PC. This also updates NPC
// as needed.
//
extern void set_pc (target_register_t pc);


//------------------------------------------------------------------------
// Set things up so that the next user resume will execute one instruction.
// This may be done by setting breakpoints or setting a single step flag
// in the saved user registers, for example. 
//
void __single_step (void);
           

//------------------------------------------------------------------------
// Clear the single-step state.
//
void __clear_single_step (void);
    

//------------------------------------------------------------------------
// If the breakpoint we hit is in the breakpoint() instruction, return a
// non-zero value. 
//
extern int __is_breakpoint_function (void);


//------------------------------------------------------------------------
// Skip the current instruction.
//
extern void __skipinst (void);

extern void __install_breakpoints (void);

extern void __clear_breakpoints (void);  


//------------------------------------------------------------------------
// Some architectures may need to fix the PC in case of a partial
// or fully executed trap instruction. GDB only takes correct action
// when the PC is pointing to the breakpoint instruction it set.
// 
// Most architectures would leave PC pointing at the trap
// instruction itself though, and so do not need to do anything
// special. In H8S architecture the PC will point to the next
// instruction after TRAP so we have to rewind PC
//
#define HAL_STUB_PLATFORM_STUBS_FIXUP()                         \
    CYG_MACRO_START                                             \
    if (CYGNUM_HAL_VECTOR_TRAP3 == __get_trap_number())         \
        put_register(PC, get_register(PC) - 2);                 \
    CYG_MACRO_END


#ifdef __cplusplus
}   /* extern "C" */
#endif

//------------------------------------------------------------------------
#endif // ifndef CYGONCE_HAL_H8S_STUB_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -