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

📄 cpu.h

📁 eCos/RedBoot for勤研ARM AnywhereII(4510) 含全部源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef __ARM_CPU_H__
#define __ARM_CPU_H__
//==========================================================================
//
//      cpu.h
//
//      ARM specific processor defines
//
//==========================================================================
//####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):    
// Contributors: gthomas
// Date:         1999-10-20
// Purpose:      ARM specific processor defines 
// Description:  ARM is a Registered Trademark of Advanced RISC Machines
//               Limited.
//               Other Brands and Trademarks are the property of their
//               respective owners.               
//
//####DESCRIPTIONEND####
//
//=========================================================================

#include <bsp/bsp.h>
#include <bsp/defs.h>
#ifdef __ECOS__
#include <cyg/hal/hal_arch.h>
#endif

/*
 * Only define __NEED_UNDERSCORE__ for arm-coff targets
 */
#if !defined(__ELF__)
#  define __NEED_UNDERSCORE__
#endif

/*
 * Macros to glue together two tokens.
 */
#  ifdef __STDC__
#    define XGLUE(a,b) a##b
#  else
#    define XGLUE(a,b) a/**/b
#  endif

#  define GLUE(a,b) XGLUE(a,b)

/*
 * Symbol Names with leading underscore if necessary
 */
#  ifdef __NEED_UNDERSCORE__
#    define SYM_NAME(name) GLUE(_,name)
#  else
#    define SYM_NAME(name) name
#  endif /* __NEED_UNDERSCORE__ */

/*
 * Various macros to better handle assembler/object format differences
 */
#if defined(__ASSEMBLER__)

/*
 * Assembly function start definition
 */
#ifdef __NEED_UNDERSCORE__
.macro FUNC_START name
	.global _\name
	.align  4
    _\name:
.endm
#else
.macro FUNC_START name
	.global \name
	.align  4
    \name:
.endm
#endif

/*
 * Assembly function end definition
 */
#ifdef __NEED_UNDERSCORE__
.macro FUNC_END name
.endm
#else
.macro FUNC_END name
.endm
#endif

/*
 * Register Prefix
 */
#  ifndef __REGISTER_PREFIX__
#    define __REGISTER_PREFIX__
#  endif /* __REGISTER_PREFIX__ */

/*
 * Immediate Prefix
 */
#  ifndef __IMM_PREFIX__
#    define __IMM_PREFIX__ #
#  endif /* __IMM_PREFIX__ */

/*
 * use the right prefix for registers.
 */
#  define REG(x) GLUE(__REGISTER_PREFIX__,x)

/*
 * use the right prefix for immediate values.
 */
#  define IMM(x) GLUE(__IMM_PREFIX__,x)

#endif /* defined(__ASSEMBLER__) */


/*
 * Setup register defines and such
 */
#if defined(__ASSEMBLER__)

#  define r0   REG (r0)
#  define r1   REG (r1)
#  define r2   REG (r2)
#  define r3   REG (r3)

#  define r4   REG (r4)
#  define r5   REG (r5)
#  define r6   REG (r6)
#  define r7   REG (r7)
#  define r8   REG (r8)
#  define r9   REG (r9)
#  define r10  REG (r10)
#  define r11  REG (r11)
#  define r12  REG (r12)
#  define r13  REG (r13)
#  define sp   REG (sp)
#  define r14  REG (r14)
#  define lr   REG (lr)
#  define pc   REG (pc)

#  define f0   REG (f0)
#  define f1   REG (f1)
#  define f2   REG (f2)
#  define f3   REG (f3)
#  define f4   REG (f4)
#  define f5   REG (f5)
#  define f6   REG (f6)
#  define f7   REG (f7)
#  define fps  REG (fps)

#  define cpsr REG (cpsr)
#  define spsr REG (spsr)

/*
 * Register offset definitions
 * These numbers are offsets into the ex_regs_t struct.
 */
#  define r0_o   0
#  define r1_o   4
#  define r2_o   8
#  define r3_o   12
#  define r4_o   16
#  define r5_o   20
#  define r6_o   24
#  define r7_o   28
#  define r8_o   32
#  define r9_o   36
#  define r10_o  40
#  define r11_o  44
#  define r12_o  48
#  define r13_o  52
#  define sp_o   r13_o
#  define r14_o  56
#  define lr_o   r14_o
#  define pc_o   60

#  define f0_o   64
#  define f1_o   76
#  define f2_o   88
#  define f3_o   100
#  define f4_o   112
#  define f5_o   124
#  define f6_o   136
#  define f7_o   148
#  define fps_o  160

#  define cpsr_o 164
#  define spsvc_o 168
#  define ARM_EX_REGS_T_SIZE 172

#else /* !defined(__ASSEMBLER__) */

  /*
   * Register name that is used in help strings and such
   */
# define REGNAME_EXAMPLE "r0"

  /*
   *  Register numbers. These are assumed to match the
   *  register numbers used by GDB.
   */
  enum __regnames {
      REG_R0,
      REG_R1,
      REG_R2,
      REG_R3,
      REG_R4,
      REG_R5,
      REG_R6,
      REG_R7,
      REG_R8,
      REG_R9,
      REG_R10,
      REG_R11,
      REG_R12,
      REG_R13,
      REG_SP=REG_R13,
      REG_R14,
      REG_LR=REG_R14,
      REG_PC,

      REG_F0,
      REG_F1,
      REG_F2,
      REG_F3,
      REG_F4,
      REG_F5,
      REG_F6,
      REG_F7,
      REG_FPS,

      REG_CPSR,
      REG_SPSVC,
      REG_MAX=REG_SPSVC
  };

  /*
   * 12-byte struct for storing Floating point registers
   */
  typedef struct
  {
      unsigned long high;
      unsigned long middle;
      unsigned long low;
  } fp_reg;

  /*
   *  How registers are stored for exceptions.
   */
#ifdef __ECOS__
#define ex_regs_t HAL_SavedRegisters
#define _r0       d[0]
#define _r1       d[1]
#define _r2       d[2]
#define _r3       d[3]
#define _r4       d[4]
#define _r5       d[5]
#define _r6       d[6]
#define _r7       d[7]
#define _r8       d[8]
#define _r9       d[9]
#define _r10      d[10]
#define _r11      fp
#define _r12      ip
#define _r13      sp
#define _r14      lr
#define _pc       pc
#define _cpsr     cpsr
#define _spsvc    msr
#else
  typedef struct
  {
    unsigned long _r0;
    unsigned long _r1;
    unsigned long _r2;
    unsigned long _r3;
    unsigned long _r4;
    unsigned long _r5;
    unsigned long _r6;
    unsigned long _r7;
    unsigned long _r8;
    unsigned long _r9;
    unsigned long _r10;
    unsigned long _r11;
    unsigned long _r12;
    unsigned long _r13;
    unsigned long _r14;
    unsigned long _pc;

    fp_reg        _f0;
    fp_reg        _f1;
    fp_reg        _f2;

⌨️ 快捷键说明

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