/* ------------------------------------------------------------------------ * * * * evmam1707.gel * * Version 0.61 * * * * This GEL file is designed to be used in conjunction with * * CCStudio 3.3+ and the AM1707 based EVM. * * * * Version History: * * 0.60 Changed ARM and SDRAM frequency * * 0.61 Added UI board testing functions * * ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ * * * * StartUp( ) * * Setup Memory Map * * * * ------------------------------------------------------------------------ */ StartUp( ) { Setup_Memory_Map( ); } /* ------------------------------------------------------------------------ * * * * OnTargetConnect( ) * * Setup PinMux, Power, PLLs, SDRAM & EMIFs * * * * ------------------------------------------------------------------------ */ OnTargetConnect( ) { GEL_TextOut( "\nAM1707 EVM Startup Sequence\n\n" ); Setup_Data_Cache(); // Setup L1D to 32 KB cache Setup_System_Config( ); // Setup Pin Mux and other system module registers Setup_PLL(); // Setup PLL0 456MHz ARM, 114MHz EMIFs Setup_Psc_All_On( ); // Setup All Power Domains Setup_EMIFA(); // Async EMIF Setup_EMIFB(); // Setup SDRAM Enable_ARM(); GEL_TextOut( "\nStartup Complete.\n\n" ); } /* ------------------------------------------------------------------------ * * * * OnPreFileLoaded( ) * * This function is called automatically when the 'Load Program' * * Menu item is selected. * * * * ------------------------------------------------------------------------ */ OnPreFileLoaded( ) { /* * GEL_Reset() is used to deal with the worst case senario of * unknown target state. If for some reason a reset is not desired * upon target connection, GEL_Reset() may be removed and replaced * with something "less brutal" like a cache initialization * function. */ GEL_Reset( ); // Disable_EDMA( ); // Disable EDMA GEL_TextOut( "\n" ); } /* ------------------------------------------------------------------------ * * * * OnRestart( ) * * This function is called by CCS when you do Debug->Restart. * * The goal is to put the CPU into a known good state with respect to * * edma. * * Failure to do this can cause problems when you restart and * * run your application code multiple times. This is different * * then OnPreFileLoaded() which will do a GEL_Reset() to get the * * ARM9 into a known good state. * * * * ------------------------------------------------------------------------ */ OnRestart( int nErrorCode ) { Disable_EDMA( ); // Disable EDMA GEL_TextOut( "\n" ); } menuitem "AM1707 Memory Map"; /* ------------------------------------------------------------------------ * * * * Setup_Memory_Map( ) * * Setup the Memory Map for DSP. * * * * ------------------------------------------------------------------------ */ hotmenu Setup_Memory_Map( ) { GEL_MapOn( ); GEL_MapReset( ); /* ARM */ GEL_MapAddStr( 0xFFFD0000, 0, 0x00010000, "R|W|AS4", 0 ); // ARM Local ROM GEL_MapAddStr( 0xFFFEE000, 0, 0x00002000, "R|W|AS4", 0 ); // ARM INTC GEL_MapAddStr( 0xFFFF0000, 0, 0x00002000, "R|W|AS4", 0 ); // ARM Local RAM GEL_MapAddStr( 0x01BC0000, 0, 0x00001000, "R|W|AS4", 0 ); // ARM ETB Memory GEL_MapAddStr( 0x01BC1000, 0, 0x00000800, "R|W|AS4", 0 ); // ARM ETB Regs GEL_MapAddStr( 0x01BC1800, 0, 0x00000100, "R|W|AS4", 0 ); // ARM Ice Crusher /* DSP */ GEL_MapAddStr( 0x00700000, 0, 0x00100000, "R|W|AS4", 0 ); // DSP L2 ROM GEL_MapAddStr( 0x00800000, 0, 0x00040000, "R|W|AS4", 0 ); // DSP l2 RAM GEL_MapAddStr( 0x00E00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1P RAM GEL_MapAddStr( 0x00F00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1D RAM GEL_MapAddStr( 0x01800000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP Interrupt Controller GEL_MapAddStr( 0x01810000, 0, 0x00001000, "R|W|AS4", 0 ); // DSP Powerdown Controller GEL_MapAddStr( 0x01811000, 0, 0x00001000, "R|W|AS4", 0 ); // DSP Security ID GEL_MapAddStr( 0x01812000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP Revision ID GEL_MapAddStr( 0x01820000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP EMC GEL_MapAddStr( 0x01830000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP Internal Reserved GEL_MapAddStr( 0x01840000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP Memory System GEL_MapAddStr( 0x11700000, 0, 0x00100000, "R|W|AS4", 0 ); // DSP L2 ROM (mirror) GEL_MapAddStr( 0x11800000, 0, 0x00040000, "R|W|AS4", 0 ); // DSP l2 RAM (mirror) GEL_MapAddStr( 0x11E00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1P RAM (mirror) GEL_MapAddStr( 0x11F00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1D RAM (mirror) /* Shared RAM */ GEL_MapAddStr( 0x80000000, 0, 0x00020000, "R|W|AS4", 0 ); // Shared RAM /* EMIFA */ GEL_MapAddStr( 0x68000000, 0, 0x00008000, "R|W|AS4", 0 ); // EMIFA Control GEL_MapAddStr( 0x40000000, 0, 0x20000000, "R|W|AS4", 0 ); // EMIFA SDRAM Data GEL_MapAddStr( 0x60000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS2 GEL_MapAddStr( 0x62000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS3 GEL_MapAddStr( 0x64000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS4 GEL_MapAddStr( 0x66000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS5 /* DDR */ GEL_MapAddStr( 0xB0000000, 0, 0x00008000, "R|W|AS4", 0 ); // EMIFB Control GEL_MapAddStr( 0xC0000000, 0, 0x20000000, "R|W|AS4", 0 ); // EMIFB SDRAM Data /* Peripherals */ GEL_MapAddStr( 0x01C00000, 0, 0x00008000, "R|W|AS4", 0 ); // TPCC GEL_MapAddStr( 0x01C08000, 0, 0x00000400, "R|W|AS4", 0 ); // TPTC0 GEL_MapAddStr( 0x01C08400, 0, 0x00000400, "R|W|AS4", 0 ); // TPTC1 GEL_MapAddStr( 0x01C10000, 0, 0x00001000, "R|W|AS4", 0 ); // PSC 0 GEL_MapAddStr( 0x01C11000, 0, 0x00001000, "R|W|AS4", 0 ); // PLL Controller 0 GEL_MapAddStr( 0x01C12000, 0, 0x00001000, "R|W|AS4", 0 ); // Key Manager GEL_MapAddStr( 0x01C13000, 0, 0x00001000, "R|W|AS4", 0 ); // Security Controller GEL_MapAddStr( 0x01C14000, 0, 0x00001000, "R|W|AS4", 0 ); // BootConfig GEL_MapAddStr( 0x01C16000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 0 GEL_MapAddStr( 0x01C17000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 2 GEL_MapAddStr( 0x01C20000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer64P 0 GEL_MapAddStr( 0x01C21000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer64P 1 GEL_MapAddStr( 0x01C22000, 0, 0x00001000, "R|W|AS4", 0 ); // I2C 0 GEL_MapAddStr( 0x01C23000, 0, 0x00001000, "R|W|AS4", 0 ); // RTC GEL_MapAddStr( 0x01C24000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 1 GEL_MapAddStr( 0x01C30000, 0, 0x00000200, "R|W|AS4", 0 ); // dMax Data RAM 0 GEL_MapAddStr( 0x01C32000, 0, 0x00000200, "R|W|AS4", 0 ); // dMax Data RAM 1 GEL_MapAddStr( 0x01C34000, 0, 0x00004000, "R|W|AS4", 0 ); // dMax Control Registers GEL_MapAddStr( 0x01C38000, 0, 0x00001000, "R|W|AS4", 0 ); // dMAX MAX0 Config Memory GEL_MapAddStr( 0x01C3C000, 0, 0x00001000, "R|W|AS4", 0 ); // dMAX MAX1 Config Memory GEL_MapAddStr( 0x01C40000, 0, 0x00001000, "R|W|AS4", 0 ); // MMC/SD 0 GEL_MapAddStr( 0x01C41000, 0, 0x00001000, "R|W|AS4", 0 ); // SPI 0 GEL_MapAddStr( 0x01C42000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 0 GEL_MapAddStr( 0x01C43000, 0, 0x00001000, "R|W|AS4", 0 ); // MPU 0 GEL_MapAddStr( 0x01D00000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 0 Control GEL_MapAddStr( 0x01D01000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 0 FIFO Ctrl GEL_MapAddStr( 0x01D02000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 0 Data GEL_MapAddStr( 0x01D04000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 1 Control GEL_MapAddStr( 0x01D05000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 1 FIFO Ctrl GEL_MapAddStr( 0x01D06000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 1 Data GEL_MapAddStr( 0x01D08000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 2 Control GEL_MapAddStr( 0x01D09000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 2 FIFO Ctrl GEL_MapAddStr( 0x01D0A000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 2 Data GEL_MapAddStr( 0x01D0C000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 1 GEL_MapAddStr( 0x01D0D000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 2 GEL_MapAddStr( 0x01D0E000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 4 GEL_MapAddStr( 0x01E00000, 0, 0x00010000, "R|W|AS4", 0 ); // USB0 (USB HS) Cfg GEL_MapAddStr( 0x01E10000, 0, 0x00001000, "R|W|AS4", 0 ); // UHPI Cfg GEL_MapAddStr( 0x01E11000, 0, 0x00001000, "R|W|AS4", 0 ); // UHPI (IODFT) GEL_MapAddStr( 0x01E12000, 0, 0x00001000, "R|W|AS4", 0 ); // SPI 1 GEL_MapAddStr( 0x01E13000, 0, 0x00001000, "R|W|AS4", 0 ); // LCD Controller GEL_MapAddStr( 0x01E14000, 0, 0x00001000, "R|W|AS4", 0 ); // MPU 1 GEL_MapAddStr( 0x01E15000, 0, 0x00001000, "R|W|AS4", 0 ); // MPU 2 GEL_MapAddStr( 0x01E20000, 0, 0x00002000, "R|W|AS4", 0 ); // EMAC CPPI port GEL_MapAddStr( 0x01E22000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC CPGMACSS registers GEL_MapAddStr( 0x01E23000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC CPGMAC registers GEL_MapAddStr( 0x01E24000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC MDIO port GEL_MapAddStr( 0x01E25000, 0, 0x00001000, "R|W|AS4", 0 ); // USB1 (USB FS) GEL_MapAddStr( 0x01E26000, 0, 0x00001000, "R|W|AS4", 0 ); // GPIO GEL_MapAddStr( 0x01E27000, 0, 0x00001000, "R|W|AS4", 0 ); // PSC 1 GEL_MapAddStr( 0x01E28000, 0, 0x00001000, "R|W|AS4", 0 ); // I2C 1 GEL_MapAddStr( 0x01E29000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 3 GEL_MapAddStr( 0x01E2A000, 0, 0x00001000, "R|W|AS4", 0 ); // PBIST Controller GEL_MapAddStr( 0x01E2B000, 0, 0x00001000, "R|W|AS4", 0 ); // PBIST Combiner GEL_MapAddStr( 0x01F00000, 0, 0x00001000, "R|W|AS4", 0 ); // EPWM 0 GEL_MapAddStr( 0x01F01000, 0, 0x00001000, "R|W|AS4", 0 ); // HRPWM 0 GEL_MapAddStr( 0x01F02000, 0, 0x00001000, "R|W|AS4", 0 ); // EPWM 1 GEL_MapAddStr( 0x01F03000, 0, 0x00001000, "R|W|AS4", 0 ); // HRPWM 1 GEL_MapAddStr( 0x01F04000, 0, 0x00001000, "R|W|AS4", 0 ); // EPWM 2 GEL_MapAddStr( 0x01F05000, 0, 0x00001000, "R|W|AS4", 0 ); // HRPWM 2 GEL_MapAddStr( 0x01F06000, 0, 0x00001000, "R|W|AS4", 0 ); // ECAP 0 GEL_MapAddStr( 0x01F07000, 0, 0x00001000, "R|W|AS4", 0 ); // ECAP 1 GEL_MapAddStr( 0x01F08000, 0, 0x00001000, "R|W|AS4", 0 ); // ECAP 2 GEL_MapAddStr( 0x01F09000, 0, 0x00001000, "R|W|AS4", 0 ); // EQEP 0 GEL_MapAddStr( 0x01F0A000, 0, 0x00001000, "R|W|AS4", 0 ); // EQEP 1 GEL_MapAddStr( 0x01F0B000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 5 } /* ------------------------------------------------------------------------ * * * * Clear_Memory_Map( ) * * Clear the Memory Map * * * * ------------------------------------------------------------------------ */ hotmenu Clear_Memory_Map( ) { GEL_MapOff( ); GEL_MapReset( ); } menuitem "EVMAM1707 Functions"; _wait( int delay ) { int i; for( i = 0 ; i < delay ; i++ ){} } #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) // 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 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) /* Enable Function for PSC0 */ 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< PLL Enable(PLLEN) PLL0_PLLCTL &= 0xFFFFFDFF; // PLLCTL.EXTCLKSRC bit 9 should be left at 0 /* 3. Clear PLLRST bit to 0 -Reset the PLL */ PLL0_PLLCTL &= 0xFFFFFFF7; /* 4. Clear the PLLPWRDN bit to bring the PLL out of power-down mode */ PLL0_PLLCTL &= 0xFFFFFFFD; /* 5. Program the required multiplier value in PLLM and POSTDIV */ PLL0_PLLM = PLLM; // Multiplier value = PLLM + 1 PLL0_POSTDIV = 0x8000 | POSTDIV; // If desired to scale all the SYSCLK frequencies of a given PLLC /* 6. program PLLDIVn registers to change the SYSCLK0 to SYSCLKn divide values */ while(PLL0_PLLSTAT & 0x1==1){} // Wait for GOSTAT bit in PLLSTAT to clear to indicate no GO operation is currently in progress // Program the RATIO field in PLLDIVx with the desired divide factors. Make sure to leave the PLLDIVx.DxEN bits set so clocks are still enabled PLL0_PLLDIV3 = 0x8000 | PLLDIV3; // SYSCLK3 -> EMIFA PLL0_PLLDIV5 = 0x8000 | PLLDIV5; // SYSCLK5 -> EMIFB PLL0_PLLDIV7 = 0x8000 | PLLDIV7; // SYSCLK7 -> EMAC/MDIO PLL0_PLLCMD |= 0x1; // Set the GOSET bit in PLLCMD to 1 to initiate a new divider transition while(PLL0_PLLSTAT & 0x1==1) { } // Wait for the GOSTAT bit in PLLSTAT to clear to 0 (completion of phase alignment) /* 7. Set the PLLRST bit in PLLCTL to 1 to bring the PLL out of reset */ PLL0_PLLCTL |= 0x8; /* 8. Wait for PLL to lock. See PLL spec for PLL lock time */ for(i=0; i