//#include #include #include #include #include #include #include #include #include //#include "clkcfg.h" #include "stdio.h" #define SYS_BASE 0x01C14000 #define REVID *(unsigned int*)(SYS_BASE + 0x000) #define DIEIDR0 *(unsigned int*)(SYS_BASE + 0x008) #define DIEIDR1 *(unsigned int*)(SYS_BASE + 0x00C) #define DIEIDR2 *(unsigned int*)(SYS_BASE + 0x010) #define DIEIDR3 *(unsigned int*)(SYS_BASE + 0x014) #define DEVIDR0 *(unsigned int*)(SYS_BASE + 0x018) #define DEVIDR1 *(unsigned int*)(SYS_BASE + 0x01C) #define BOOTCFG *(unsigned int*)(SYS_BASE + 0x020) #define CHIPREVIDR *(unsigned int*)(SYS_BASE + 0x024) #define KICK0R *(unsigned int*)(SYS_BASE + 0x038) #define KICK1R *(unsigned int*)(SYS_BASE + 0x03c) #define HOST0CFG *(unsigned int*)(SYS_BASE + 0x040) //ARM HOST0CFG #define HOST1CFG *(unsigned int*)(SYS_BASE + 0x044) #define IRAWSTAT *(unsigned int*)(SYS_BASE + 0x0E0) #define IENSTAT *(unsigned int*)(SYS_BASE + 0x0E4) #define IENSET *(unsigned int*)(SYS_BASE + 0x0E8) #define IENCLR *(unsigned int*)(SYS_BASE + 0x0EC) #define EOI *(unsigned int*)(SYS_BASE + 0x0F0) #define FLTADDRR *(unsigned int*)(SYS_BASE + 0x0F4) #define FLTSTAT *(unsigned int*)(SYS_BASE + 0x0F8) #define MSTPRI0 *(unsigned int*)(SYS_BASE + 0x110) #define MSTPRI1 *(unsigned int*)(SYS_BASE + 0x114) #define MSTPRI2 *(unsigned int*)(SYS_BASE + 0x118) #define PINMUX0 *(unsigned int*)(SYS_BASE + 0x120) //PINMUX0 #define PINMUX1 *(unsigned int*)(SYS_BASE + 0x124) //PINMUX1 #define PINMUX2 *(unsigned int*)(SYS_BASE + 0x128) //PINMUX2 #define PINMUX3 *(unsigned int*)(SYS_BASE + 0x12C) //PINMUX3 #define PINMUX4 *(unsigned int*)(SYS_BASE + 0x130) //PINMUX4 #define PINMUX5 *(unsigned int*)(SYS_BASE + 0x134) //PINMUX5 #define PINMUX6 *(unsigned int*)(SYS_BASE + 0x138) //PINMUX6 #define PINMUX7 *(unsigned int*)(SYS_BASE + 0x13C) //PINMUX7 #define PINMUX8 *(unsigned int*)(SYS_BASE + 0x140) //PINMUX8 #define PINMUX9 *(unsigned int*)(SYS_BASE + 0x144) //PINMUX9 #define PINMUX10 *(unsigned int*)(SYS_BASE + 0x148) //PINMUX10 #define PINMUX11 *(unsigned int*)(SYS_BASE + 0x14C) //PINMUX11 #define PINMUX12 *(unsigned int*)(SYS_BASE + 0x150) //PINMUX12 #define PINMUX13 *(unsigned int*)(SYS_BASE + 0x154) //PINMUX13 #define PINMUX14 *(unsigned int*)(SYS_BASE + 0x158) //PINMUX14 #define PINMUX15 *(unsigned int*)(SYS_BASE + 0x15C) //PINMUX15 #define PINMUX16 *(unsigned int*)(SYS_BASE + 0x160) //PINMUX16 #define PINMUX17 *(unsigned int*)(SYS_BASE + 0x164) //PINMUX17 #define PINMUX18 *(unsigned int*)(SYS_BASE + 0x168) //PINMUX18 #define PINMUX19 *(unsigned int*)(SYS_BASE + 0x16C) //PINMUX19 #define SUSPSRC *(unsigned int*)(SYS_BASE + 0x170) #define CHIPSIG *(unsigned int*)(SYS_BASE + 0x174) #define CHIPSIG_CLR *(unsigned int*)(SYS_BASE + 0x178) #define CFGCHIP0 *(unsigned int*)(SYS_BASE + 0x17C) #define CFGCHIP1 *(unsigned int*)(SYS_BASE + 0x180) #define CFGCHIP2 *(unsigned int*)(SYS_BASE + 0x184) #define CFGCHIP3 *(unsigned int*)(SYS_BASE + 0x188) #define CFGCHIP4 *(unsigned int*)(SYS_BASE + 0x18C) #define PLL0_BASE 0x01C11000 /*SYSTEM PLL BASE ADDRESS*/ #define PLL0_PID *(unsigned int*) (PLL0_BASE + 0x00) /*PID*/ #define PLL0_FUSERR *(unsigned int*) (PLL0_BASE + 0xE0) /*x*FuseFarm Error Reg*/ #define PLL0_RSTYPE *(unsigned int*) (PLL0_BASE + 0xE4) /*Reset Type status Reg*/ #define PLL0_PLLCTL *(unsigned int*) (PLL0_BASE + 0x100) /*PLL Control Register*/ #define PLL0_OCSEL *(unsigned int*) (PLL0_BASE + 0x104) /*OBSCLK Select Register*/ #define PLL0_SECCTL *(unsigned int*) (PLL0_BASE + 0x108) /*PLL Secondary Control Register*/ #define PLL0_PLLM *(unsigned int*) (PLL0_BASE + 0x110) /*PLL Multiplier*/ #define PLL0_PREDIV *(unsigned int*) (PLL0_BASE + 0x114) /*Pre divider*/ #define PLL0_PLLDIV1 *(unsigned int*) (PLL0_BASE + 0x118) /*Diveder-1*/ #define PLL0_PLLDIV2 *(unsigned int*) (PLL0_BASE + 0x11C) /*Diveder-2*/ #define PLL0_PLLDIV3 *(unsigned int*) (PLL0_BASE + 0x120) /*Diveder-3*/ #define PLL0_OSCDIV1 *(unsigned int*) (PLL0_BASE + 0x124) /*Oscilator Divider*/ #define PLL0_POSTDIV *(unsigned int*) (PLL0_BASE + 0x128) /*Post Divider*/ #define PLL0_BPDIV *(unsigned int*) (PLL0_BASE + 0x12C) /*Bypass Divider*/ #define PLL0_WAKEUP *(unsigned int*) (PLL0_BASE + 0x130) /*Wakeup Reg*/ #define PLL0_PLLCMD *(unsigned int*) (PLL0_BASE + 0x138) /*Command Reg*/ #define PLL0_PLLSTAT *(unsigned int*) (PLL0_BASE + 0x13C) /*Status Reg*/ #define PLL0_ALNCTL *(unsigned int*) (PLL0_BASE + 0x140) /*Clock Align Control Reg*/ #define PLL0_DCHANGE *(unsigned int*) (PLL0_BASE + 0x144) /*PLLDIV Ratio Chnage status*/ #define PLL0_CKEN *(unsigned int*) (PLL0_BASE + 0x148) /*Clock Enable Reg*/ #define PLL0_CKSTAT *(unsigned int*) (PLL0_BASE + 0x14C) /*Clock Status Reg*/ #define PLL0_SYSTAT *(unsigned int*) (PLL0_BASE + 0x150) /*Sysclk status reg*/ #define PLL0_PLLDIV4 *(unsigned int*) (PLL0_BASE + 0x160) /*Divider 4*/ #define PLL0_PLLDIV5 *(unsigned int*) (PLL0_BASE + 0x164) /*Divider 5*/ #define PLL0_PLLDIV6 *(unsigned int*) (PLL0_BASE + 0x168) /*Divider 6*/ #define PLL0_PLLDIV7 *(unsigned int*) (PLL0_BASE + 0x16C) /*Divider 7*/ #define PLL0_PLLDIV8 *(unsigned int*) (PLL0_BASE + 0x170) /*Divider 8*/ #define PLL0_PLLDIV9 *(unsigned int*) (PLL0_BASE + 0x174) /*Divider 9*/ #define PLL0_PLLDIV10 *(unsigned int*) (PLL0_BASE + 0x178) /*Divider 10*/ #define PLL0_PLLDIV11 *(unsigned int*) (PLL0_BASE + 0x17C) /*Divider 11*/ #define PLL0_PLLDIV12 *(unsigned int*) (PLL0_BASE + 0x180) /*Divider 12*/ #define PLL0_PLLDIV13 *(unsigned int*) (PLL0_BASE + 0x184) /*Divider 13*/ #define PLL0_PLLDIV14 *(unsigned int*) (PLL0_BASE + 0x188) /*Divider 14*/ #define PLL0_PLLDIV15 *(unsigned int*) (PLL0_BASE + 0x18C) /*Divider 15*/ #define PLL0_PLLDIV16 *(unsigned int*) (PLL0_BASE + 0x190) /*Divider 16*/ #define PLLEN_MUX_SWITCH 4 #define PLL_LOCK_TIME_CNT 2400 /*PSC Module Related Registers*/ #define PSC0_BASE 0x01C10000 #define PSC1_BASE 0x01E27000 #define PSC0_MDCTL (PSC0_BASE+0xA00) #define PSC0_MDSTAT (PSC0_BASE+0x800) #define PSC0_PTCMD *(unsigned int*) (PSC0_BASE + 0x120) #define PSC0_PTSTAT *(unsigned int*) (PSC0_BASE + 0x128) #define PSC1_MDCTL (PSC1_BASE+0xA00) #define PSC1_MDSTAT (PSC1_BASE+0x800) #define PSC1_PTCMD *(unsigned int*) (PSC1_BASE + 0x120) #define PSC1_PTSTAT *(unsigned int*) (PSC1_BASE + 0x128) #define EDMA_3CC_IECRH *( unsigned int* )( 0x01c0105c ) #define EDMA_3CC_EECRH *( unsigned int* )( 0x01c0102c ) #define EDMA_3CC_ICRH *( unsigned int* )( 0x01c01074 ) #define EDMA_3CC_ECRH *( unsigned int* )( 0x01c0100c ) #define EDMA_3CC_IECR *( unsigned int* )( 0x01c01058 ) #define EDMA_3CC_EECR *( unsigned int* )( 0x01c01028 ) #define EDMA_3CC_ICR *( unsigned int* )( 0x01c01070 ) #define EDMA_3CC_ECR *( unsigned int* )( 0x01c01008 ) #define AEMIF_AWCCR *( unsigned int* )( 0x68000004 ) #define AEMIF_A1CR *( unsigned int* )( 0x68000010 ) #define AEMIF_A2CR *( unsigned int* )( 0x68000014 ) #define AEMIF_A3CR *( unsigned int* )( 0x68000018 ) #define AEMIF_A4CR *( unsigned int* )( 0x6800001C ) #define AEMIF_NANDFCR *( unsigned int* )( 0x68000060 ) #define EMIFB_BASE 0xB0000000 #define EMIFB_SDSTAT *(unsigned int*)(EMIFB_BASE + 0x04) //SDRAM Status Register #define EMIFB_SDCFG *(unsigned int*)(EMIFB_BASE + 0x08) //SDRAM Bank Config Register #define EMIFB_SDREF *(unsigned int*)(EMIFB_BASE + 0x0C) //SDRAM Refresh Control Register #define EMIFB_SDTIM1 *(unsigned int*)(EMIFB_BASE + 0x10) //SDRAM Timing Register #define EMIFB_SDTIM2 *(unsigned int*)(EMIFB_BASE + 0x14) //SDRAM Timing Register /*Enable Function for PSC0*/ void PSC0_lPSC_enable(unsigned int PD, unsigned int LPSC_num) { *(unsigned int*) (PSC0_MDCTL+4*LPSC_num) = (*(unsigned int*) (PSC0_MDCTL+4*LPSC_num) & 0xFFFFFFE0) | 0x0003; PSC0_PTCMD = 0x1<