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

📄 ppc.h

📁 motorola自己开发的针对coldfire 5272的Dbug bootloader程序
💻 H
字号:
/*
 * File:		src/include/cpu/ppc/ppc.h
 * Purpose:		Definitions common across all PowerPC processors
 *
 * Notes:
 *
 */

#ifndef _CPU_PPC_H
#define _CPU_PPC_H

/***********************************************************************/

/*
 * The basic data types
 */
typedef unsigned char		uint8;	/*  8 bits */
typedef unsigned short int	uint16;	/* 16 bits */
typedef unsigned int		uint32;	/* 32 bits */

typedef signed char			int8;	/*  8 bits */
typedef signed short int	int16;	/* 16 bits */
typedef signed int			int32;	/* 32 bits */

typedef volatile uint8		vuint8;  /*  8 bits */
typedef volatile uint16		vuint16; /* 16 bits */
typedef volatile uint32		vuint32; /* 32 bits */

/***********************************************************************/

/*
 * Routines and macros for accessing Input/Output devices
 */
uint32 cpu_iord_8  (void *);
uint32 cpu_iord_16 (void *);
uint32 cpu_iord_32 (void *);
void   cpu_iowr_8  (void *, uint32);
void   cpu_iowr_16 (void *, uint32);
void   cpu_iowr_32 (void *, uint32);

/* byte-reversed */
uint32 cpu_iord_16r (void *);
uint32 cpu_iord_32r (void *);
void   cpu_iowr_16r (void *, uint32);
void   cpu_iowr_32r (void *, uint32);

/*
 * Network-order access routines/macros (BIG ENDIAN ONLY)
 */
#define htons(DATA16)   DATA16
#define htonl(DATA32)   DATA32
#define ntohs(DATA16)   DATA16
#define ntohl(DATA32)   DATA32

/***********************************************************************/

#define MPC_CR_LT				(0x8)
#define MPC_CR_GT				(0x4)
#define MPC_CR_EQ				(0x2)
#define MPC_CR_SO				(0x1)
#define MPC_CR0_LT				(MPC_CR_LT << 28)
#define MPC_CR0_GT				(MPC_CR_GT << 28)
#define MPC_CR0_EQ				(MPC_CR_EQ << 28)
#define MPC_CR0_SO				(MPC_CR_SO << 28)
#define MPC_CR0					(0xF << 28)
#define MPC_CR1_LT				(MPC_CR_LT << 24)
#define MPC_CR1_GT				(MPC_CR_GT << 24)
#define MPC_CR1_EQ				(MPC_CR_EQ << 24)
#define MPC_CR1_SO				(MPC_CR_SO << 24)
#define MPC_CR1					(0xF << 24)
#define MPC_CR2_LT				(MPC_CR_LT << 20)
#define MPC_CR2_GT				(MPC_CR_GT << 20)
#define MPC_CR2_EQ				(MPC_CR_EQ << 20)
#define MPC_CR2_SO				(MPC_CR_SO << 20)
#define MPC_CR2					(0xF << 20)
#define MPC_CR3_LT				(MPC_CR_LT << 16)
#define MPC_CR3_GT				(MPC_CR_GT << 16)
#define MPC_CR3_EQ				(MPC_CR_EQ << 16)
#define MPC_CR3_SO				(MPC_CR_SO << 16)
#define MPC_CR3					(0xF << 16)
#define MPC_CR4_LT				(MPC_CR_LT << 12)
#define MPC_CR4_GT				(MPC_CR_GT << 12)
#define MPC_CR4_EQ				(MPC_CR_EQ << 12)
#define MPC_CR4_SO				(MPC_CR_SO << 12)
#define MPC_CR4					(0xF << 12)
#define MPC_CR5_LT				(MPC_CR_LT << 8)
#define MPC_CR5_GT				(MPC_CR_GT << 8)
#define MPC_CR5_EQ				(MPC_CR_EQ << 8)
#define MPC_CR5_SO				(MPC_CR_SO << 8)
#define MPC_CR5					(0xF << 8)
#define MPC_CR6_LT				(MPC_CR_LT << 4)
#define MPC_CR6_GT				(MPC_CR_GT << 4)
#define MPC_CR6_EQ				(MPC_CR_EQ << 4)
#define MPC_CR6_SO				(MPC_CR_SO << 4)
#define MPC_CR6					(0xF << 4)
#define MPC_CR7_LT				(MPC_CR_LT << 0)
#define MPC_CR7_GT				(MPC_CR_GT << 0)
#define MPC_CR7_EQ				(MPC_CR_EQ << 0)
#define MPC_CR7_SO				(MPC_CR_SO << 0)
#define MPC_CR7					(0xF << 0)

#define MPC_XER_SO				(0x80000000)
#define MPC_XER_OV				(0x40000000)
#define MPC_XER_CA				(0x20000000)
#define MPC_XER_BYTE			(0x000000FF)

#define MPC_MSR_POW				(0x00040000)
#define MPC_MSR_TGPR			(0x00020000)
#define MPC_MSR_ILE				(0x00010000)
#define MPC_MSR_EE				(0x00008000)
#define MPC_MSR_PR				(0x00004000)
#define MPC_MSR_FP				(0x00002000)
#define MPC_MSR_ME				(0x00001000)
#define MPC_MSR_FE0				(0x00000800)
#define MPC_MSR_SE				(0x00000400)
#define MPC_MSR_BE				(0x00000200)
#define MPC_MSR_FE1				(0x00000100)
#define MPC_MSR_IP				(0x00000040)
#define MPC_MSR_IR				(0x00000020)
#define MPC_MSR_DR				(0x00000010)
#define MPC_MSR_RI				(0x00000002)
#define MPC_MSR_LE				(0x00000001)

#define MPC_PVR_VER				(0xFFFF0000)
#define MPC_PVR_REV				(0x0000FFFF)
#define MPC_PVR_601				(0x00010000)
#define MPC_PVR_602				(0x00020000)
#define MPC_PVR_603				(0x00030000)
#define MPC_PVR_604				(0x00040000)
#define MPC_PVR_603E			(0x00060000)
#define MPC_PVR_603EV			(0x00070000)
#define MPC_PVR_750				(0x00080000)
#define MPC_PVR_604E			(0x00090000)
#define MPC_PVR_MACH5			(0x000A0000)
#define MPC_PVR_620				(0x00140000)

/***********************************************************************/

/*
 * Function prototypes for PowerPC processors
 */
void   mpc_wr_msr (uint32);
uint32 mpc_rd_msr (void);

uint32 mpc_rd_xer (void);

void   mpc_wr_ctr (uint32);
uint32 mpc_rd_ctr (void);

void   mpc_wr_dsisr (uint32);
uint32 mpc_rd_dsisr (void);

void   mpc_wr_dar (uint32);
uint32 mpc_rd_dar (void);

void   mpc_wr_dec (uint32);
uint32 mpc_rd_dec (void);

uint32 mpc_rd_pvr (void);

void   mpc_wr_tbl (uint32);
uint32 mpc_rd_tbl (void);
void   mpc_wr_tbu (uint32);
uint32 mpc_rd_tbu (void);

/***********************************************************************/

/*
 * Now do specific processor
 */
#if     (defined(CPU_FAM_MPC5XX))
#include "src/include/cpu/ppc/mpc5xx/mpc5xx.h"

#elif	(defined(CPU_FAM_MPC6XX))
#include "src/include/cpu/ppc/mpc6xx/mpc6xx.h"

#elif	(defined(CPU_MPC821))
#include "src/include/cpu/ppc/mpc8xx/mpc821.h"

#elif	(defined(CPU_MPC823))
#include "src/include/cpu/ppc/mpc8xx/mpc823.h"

#elif	(defined(CPU_MPC850))
#include "src/include/cpu/ppc/mpc8xx/mpc850.h"

#elif	(defined(CPU_MPC860))
#include "src/include/cpu/ppc/mpc8xx/mpc860.h"

#elif	(defined(CPU_MPC860SAR))
#include "src/include/cpu/ppc/mpc8xx/mpc860sar.h"

#elif	(defined(CPU_MPC860T))
#include "src/include/cpu/ppc/mpc8xx/mpc860t.h"

#else
#error "Error: Unsuported PowerPC processor"
#endif

/***********************************************************************/

#endif /* _CPU_PPC_H */

⌨️ 快捷键说明

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