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

📄 utilities.c

📁 os源代码 os源代码 os源代码 os源代码 os源代码 os源代码
💻 C
字号:
void InterruptHandler(unsigned long);
void inithw();

//---------------------------------------------------------------------------
// INITIALIZE HARDWARE REGISTERS
// This routine is called once following RESET
void inithw(){
	unsigned long *Rptr;
	unsigned short *sRptr;
/*
@ SPR638 = 0xFFF00800	<--- see __ppc_eabi_init.c
@ SPR560 = 0x00000000

*/
	Rptr = (unsigned long *) 0x2fc300;	// TBSCRK key
	*Rptr = 0x;

	Rptr = (unsigned long *) 0x2fc000;	// SIUMCR
	*Rptr = 0x00;
	Rptr = (unsigned long *) 0x2fc004;	// SYPCR
	*Rptr = 0xFF88;

	Rptr = (unsigned long *) 0x2fc100;	// BR0
	*Rptr = 0x400003;	// 32-bit set here for BDM or external flash
//	*Rptr = 0x400803;	// 16-bit set here for EEPROM M-SEL position 1 (cs0)
//	*Rptr = 0x000003;	// 32-bit set here to use external booting with IMMR Flash disabled
	Rptr = (unsigned long *) 0x2fc104;	// OR0
	*Rptr = 0xfff80012;

	Rptr = (unsigned long *) 0x2fc108;	// BR1
	*Rptr = 0x800003;
	Rptr = (unsigned long *) 0x2fc10c;	// OR1
	*Rptr = 0xfff80002;	// no wait state

	Rptr = (unsigned long *) 0x2fc110;	// BR2
	*Rptr = 0xc00003;
	Rptr = (unsigned long *) 0x2fc114;	// OR2
	*Rptr = 0xfffe0022;

	Rptr = (unsigned long *) 0x2fc118;	// BR3
	*Rptr = 0x01000403;	// works for Keypad/LCD
	Rptr = (unsigned long *) 0x2fc11c;	// OR3
	*Rptr = 0xfffe0FF1;	// maximum wait states

	Rptr = (unsigned long *) 0x2fc140;	// DMBR
	*Rptr = 0x00;
	Rptr = (unsigned long *) 0x2fc144;	// DMOR
	*Rptr = 0x00;
	Rptr = (unsigned long *) 0x2fc280;	// SCCR
	*Rptr = 0x10000;
	Rptr = (unsigned long *) 0x2fc284;	// PLPRCR
	*Rptr = 0x400000;
//	*Rptr = 0x100000;					// external 16MHz crystal
										// result in 32MHz system clock

	sRptr = (unsigned short *) 0x300000;	// DPT
	*sRptr = 0x00;

	sRptr = (unsigned short *) 0x300004;	// RAM base addr
	*sRptr = 0xffa0;

	sRptr = (unsigned short *) 0x305014;	// PORTQS
	*sRptr = 0x00;
	sRptr = (unsigned short *) 0x305016;	// PQSPAR/DDRQS
	*sRptr = 0x00;
	sRptr = (unsigned short *) 0x306100;	// MPIOSMDR
	*sRptr = 0x00;
	sRptr = (unsigned short *) 0x306102;	// MPIOSMDDR
	*sRptr = 0x00;
	sRptr = (unsigned short *) 0x306800;	// MPIOS1TPCR
	*sRptr = 0x00;
	sRptr = (unsigned short *) 0x380000;	// SRAMMCR
	*sRptr = 0x0000;

	Rptr = (unsigned long *) 0x2fc024;	// SGPIODT1
	*Rptr = 0x0000;
	Rptr = (unsigned long *) 0x2fc028;	// SGPIODT2
	*Rptr = 0x0000;
	Rptr = (unsigned long *) 0x2fc02c;	// SGPIOCR
	*Rptr = 0x0000;
	Rptr = (unsigned long *) 0x2fc030;	// EMCR
	*Rptr = 0x0000;
	Rptr = (unsigned long *) 0x307f80;	// UMCR
	*Rptr = 0x0000;
}

void delay(uint16)
{
   a

void InterruptHandler(unsigned long exceptNumber){
	puts("\nException Interrupt");
}

⌨️ 快捷键说明

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