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

📄 rominit.s

📁 ADS88x BSP
💻 S
📖 第 1 页 / 共 2 页
字号:
/* romInit.s - Motorola DUETads ROM initialization module *//* Copyright 1984-2003 Wind River Systems, Inc. */	.data	.globl  copyright_wind_river	.long   copyright_wind_river/*modification history--------------------*//*DESCRIPTIONThis module contains the entry code for the VxWorks bootrom.The entry point romInit, is the first code executed on power-up.It sets the BOOT_COLD parameter to be passed to the genericromStart() routine.The routine sysToMonitor() jumps to the location 4 bytespast the beginning of romInit, to perform a "warm boot".This entry point allows a parameter to be passed to romStart().*/#define	_ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "cacheLib.h"#include "config.h"#include "regs.h"	#include "sysLib.h"#include "drv/multi/ppc860Siu.h"	#define MAMR_DEFAULT_VALUE (MAMR_PTAE | MAMR_AMA_TYPE_2 | 		\			    MAMR_DSA_1_CYCL | MAMR_G0CLA_A12 | 		\			    MAMR_GPL_A4DIS | MAMR_RLFA_1X | 		\			    MAMR_WLFA_1X | MAMR_TLFA_4X) #define MBMR_DEFAULT_VALUE (MAMR_AMA_TYPE_0 | MAMR_DSA_1_CYCL | 	\			    MAMR_G0CLA_A11 | MAMR_RLFA_1X | 		\			    MAMR_WLFA_1X | MAMR_TLFA_1X)	/* internals */	FUNC_EXPORT(_romInit)		/* start of system code */	FUNC_EXPORT(romInit)		/* start of system code */		/* externals */	.extern romStart	/* system initialization routine */	_WRS_TEXT_SEG_START/******************************************************************************** romInit - entry point for VxWorks in ROM** romInit*     (*     int startType	/@ only used by 2nd entry point @/*     )*/FUNC_BEGIN(_romInit)FUNC_BEGIN(romInit)	bl	cold		/* jump to the cold boot initialization */		bl	start		/* jump to the warm boot initialization */	/* copyright notice appears at beginning of ROM (in TEXT segment) */	.ascii   "Copyright 1984-2003 Wind River Systems, Inc."	.balign  _PPC_TEXT_SEG_ALIGNcold:	li	r3, BOOT_COLD	/* set cold boot as start type */	/*	 * When the PowerPC 860 is powered on, the processor fletch the	 * instructions located at the address 0x100. We need to jump	 * from the address 0x100 to the Flash space.	 */	/* SYPCR - turn off the system protection stuff */	mfspr	r4, IMMR		/* read it back, to be sure */	rlwinm  r4, r4, 0, 0, 15	/* only high 16 bits count */		lis	r5, HIADJ(0xFFFFFF88)	        /* Disable watchdog */	addi	r5, r5, LO(0xffffff88)         /* Disable watchdog */	stw	r5, SYPCR(0)(r4)	lis	r4, HIADJ(start)		/* load r4 with the address */	addi	r4, r4, LO(start)		/* of start */	lis	r5, HIADJ(romInit)		/* load r5 with the address */	addi	r5, r5, LO(romInit)		/* of romInit() */	lis	r6, HIADJ(ROM_TEXT_ADRS)	/* load r6 with the address */	addi	r6, r6, LO(ROM_TEXT_ADRS)	/* of ROM_TEXT_ADRS */	sub	r4, r4, r5			/*  */	add	r4, r4, r6 	mtspr	LR, r4				/* save destination address*/						/* into LR register */	blr					/* jump to flash mem address */			start:	xor	r4, r4, r4		/* clear register R4 */	/* set the MSR register to a known state */	mtmsr 	r4			/* cleat the MSR register */	/* DER - clear the Debug Enable Register */	mtspr	DER, r4	/* ICR - clear the Interrupt Cause Register */	mtspr	ICR, r4	/* ICTRL - initialize the Intstruction Support Control register */	lis	r5, HIADJ(0x00000007)	addi	r5, r5, LO(0x00000007)	mtspr	ICTRL, r5	/* disable the instruction/data cache */		lis	r4, HIADJ ( CACHE_CMD_DISABLE)		/* load disable cmd */	addi	r4, r4, LO (CACHE_CMD_DISABLE)	mtspr	IC_CST, r4				/* disable I cache */	mtspr	DC_CST, r4				/* disable D cache */	/* unlock the instruction/data cache */	lis	r4, HIADJ ( CACHE_CMD_UNLOCK_ALL)	/* load unlock cmd */	addi	r4, r4, LO (CACHE_CMD_UNLOCK_ALL)	mtspr	IC_CST, r4			/* unlock all I cache lines */	mtspr	DC_CST, r4			/* unlock all D cache lines */	/* invalidate the instruction/data cache */	lis	r4, HIADJ (CACHE_CMD_INVALIDATE)   /* load invalidate cmd*/	addi	r4, r4, LO (CACHE_CMD_INVALIDATE)	mtspr	IC_CST, r4		/* invalidate all I cache lines */	mtspr	DC_CST, r4		/* invalidate all D cache lines */	/*	 * initialize the IMMR register before any non-core registers	 * modification.	 */	lis	r4, HIADJ( INTERNAL_MEM_MAP_ADDR)		addi	r4, r4, LO(INTERNAL_MEM_MAP_ADDR)	mtspr	IMMR, r4		/* initialize the IMMR register */	mfspr	r4, IMMR		/* read it back, to be sure */	rlwinm  r4, r4, 0, 0, 15	/* only high 16 bits count */	/*	 * Map the bank 0 to the flash area - On the ADS board at reset time	 * the bank 0 is already used to map the flash.	 */	lis	r5, HIADJ( (ROM_BASE_ADRS & BR_BA_MSK) | BR_V)	addi	r5, r5, LO((ROM_BASE_ADRS & BR_BA_MSK) | BR_V)	stw	r5, BR0(0)(r4)	lis	r5, HIADJ( 0xffe00D34)	addi	r5, r5, LO(0xffe00D34)	stw	r5, OR0(0)(r4)		/*	 * Map the bank 1 to the Board Status and Control Registers	 */	lis	r5, HIADJ( (BCSR0 & BR_BA_MSK) | BR_V)	addi	r5, r5, LO((BCSR0 & BR_BA_MSK) | BR_V)	stw	r5, BR1(0)(r4)	lis	r5, HIADJ( (0xffff8000 & OR_AM_MSK) | OR_BI | OR_SCY_1_CLK)	addi	r5, r5, LO((0xffff8000 & OR_AM_MSK) | OR_BI | OR_SCY_1_CLK)	stw	r5, OR1(0)(r4)		/* SYPCR - turn off the system protection stuff */		lis	r5, HIADJ( SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF)	addi	r5, r5, LO(SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF)	stw	r5, SYPCR(0)(r4)        /* SPR 65678 - Lock the Key Registers (they protect the register         * values from corruption on power cycle.  See MCG's EWT # 867 for         * the symptoms and outcome of corrupted registers.         *         * r4 holds the address of the IMMR         *         * xxK registers are locked by writing any value other than 0x55CCAA33          * to the register, or by reading the register.  They are unlocked          * by writing 0x55CCAA33 to the register.  After locking, any write          * access to the locked SIU register will cause a MCE. (in one case,         * not an MCE but a software emulation exception.  See the MPC860         * user's manual, section 11 page 11 ff.)         */#ifdef USE_KEYED_REGS        /* pre-loading r7 with '~KEYED_REG_UNLOCK_VALUE' (ie, 'lock it')         * pre-loading r8 with ' KEYED_REG_UNLOCK_VALUE' (ie, 'unlock it')         ***/	lis    r7, HIADJ(  ~KEYED_REG_UNLOCK_VALUE ) 	addi   r7, r7, LO( ~KEYED_REG_UNLOCK_VALUE )	lis    r8, HIADJ(   KEYED_REG_UNLOCK_VALUE )	addi   r8, r8, LO(  KEYED_REG_UNLOCK_VALUE )#else        /* pre-loading r7 with ' KEYED_REG_UNLOCK_VALUE' (ie, 'unlock it') */	lis    r7, HIADJ(   KEYED_REG_UNLOCK_VALUE ) 	addi   r7, r7, LO(  KEYED_REG_UNLOCK_VALUE )#endif	stw    r7, TBSCRK(0)(r4) 	stw    r7, TBREFF0K(0)(r4)	stw    r7, TBREFF1K(0)(r4)	stw    r7, TBK(0)(r4)	stw    r7, RTCSCK(0)(r4)	stw    r7, RTCK(0)(r4)	stw    r7, RTSECK(0)(r4)	stw    r7, RTCALK(0)(r4)	stw    r7, PISCRK(0)(r4)	stw    r7, PITCK(0)(r4)	stw    r7, SCCRK(0)(r4)	stw    r7, PLPRCRK(0)(r4)	stw    r7, RSRK(0)(r4)        isync	/* TBSCR - initialize the Time Base Status and Control register */#ifdef USE_KEYED_REGS	stw     r8, TBSCRK(0)(r4) /* others are TBREFF0K, TBREFF1K and TBK */        isync#endif	lis	r5, HIADJ( TBSCR_REFA | TBSCR_REFB)	addi	r5, r5, LO(TBSCR_REFA | TBSCR_REFB)	sth	r5, TBSCR(0)(r4)#ifdef USE_KEYED_REGS	stw     r7, TBSCRK(0)(r4)#endif#ifdef USE_KEYED_REGS	stw     r8, PISCRK(0)(r4) /* others are TBREFF0K, TBREFF1K and TBK */        isync#endif	/* set PIT status and control init value */	li	r5, PISCR_PS | PISCR_PITF	sth	r5, PISCR(0)(r4)#ifdef USE_KEYED_REGS	stw     r7, PISCRK(0)(r4)#endif	/* set the SPLL frequency */	lis	r5, HIADJ(PLPRCR_VAL)	addi	r5, r5, LO(PLPRCR_VAL)#ifdef USE_KEYED_REGS	stw     r8, PLPRCRK(0)(r4) /* others are TBREFF0K, TBREFF1K and TBK */        isync#endif/** For Errata MPC860 SIU9 * Delay to stop bus access while bus stablises after write to this register * Set delay to the longest bus access possible for your setup               * Can cause reset if delay isn't long enough				     * Note cache not enabled at this point*/	nop	nop	isync	stw	r5, PLPRCR(0)(r4)	isync	divw	r5, r4, r4		/* waste time (r4 != 0) */	divw	r5, r4, r5		/* 13 clocks		*/	nop	nop	isync	#ifdef USE_KEYED_REGS	stw     r7, PLPRCRK(0)(r4)#endif	/* SIUMCR */	

⌨️ 快捷键说明

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