/* ------------------------------------------------------------------------ * * * * evmam1808.gel * * Version 0.02 * * * * This GEL file is designed to be used in conjunction with * * CCStudio 3.3+ and the omap-l138 based EVM. * * * * Version History: * * 0.01 Initial Release * * 0.02 Fixed RMII Hot Menu Item * * ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ * * * * StartUp( ) * * Setup Memory Map * * * * ------------------------------------------------------------------------ */ StartUp( ) { Setup_Memory_Map( ); } /* ------------------------------------------------------------------------ * * * * OnTargetConnect( ) * * Setup PinMux, Power, PLLs, SDRAM & EMIFs * * * * ------------------------------------------------------------------------ */ OnTargetConnect( ) { GEL_TextOut( "\nAM1808 ARM Startup Sequence\n\n" ); Setup_System_Config( ); // Setup Pin Mux and other system module registers Setup_Psc_All_On( ); // Setup All Power Domains Setup_PLL0(); // Setup PLL0 (300MHZ ARM, 300MHz DSP, 133MHz EMIFs Setup_EMIFA(); // Async EMIF Setup_PLL1(); // PLL for DDR Clock DDRConfig(132); // Setup DDR 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 "AM1808 Memory Map"; /* ------------------------------------------------------------------------ * * * * Setup_Memory_Map( ) * * Setup the Memory Map for DSP. * * * * ------------------------------------------------------------------------ */ hotmenu Setup_Memory_Map( ) { GEL_MapOn( ); GEL_MapReset( ); /* 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 ); // On-chip 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 CS0 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 ); // EDMA3 CC GEL_MapAddStr( 0x01C08000, 0, 0x00000400, "R|W|AS4", 0 ); // EDMA3 TC0 GEL_MapAddStr( 0x01C08400, 0, 0x00000400, "R|W|AS4", 0 ); // EDMA3 TC1 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( 0x01C14000, 0, 0x00001000, "R|W|AS4", 0 ); // SYSCFG0 GEL_MapAddStr( 0x01C20000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer 0 GEL_MapAddStr( 0x01C21000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer 1 GEL_MapAddStr( 0x01C22000, 0, 0x00001000, "R|W|AS4", 0 ); // I2C 0 GEL_MapAddStr( 0x01C23000, 0, 0x00001000, "R|W|AS4", 0 ); // RTC 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( 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( 0x01D0C000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 1 GEL_MapAddStr( 0x01D0D000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 2 GEL_MapAddStr( 0x01D10000, 0, 0x00000800, "R|W|AS4", 0 ); // McBSP0 GEL_MapAddStr( 0x01D10800, 0, 0x00000800, "R|W|AS4", 0 ); // McBSP0 FIFO Ctrl GEL_MapAddStr( 0x01D11000, 0, 0x00000800, "R|W|AS4", 0 ); // McBSP1 GEL_MapAddStr( 0x01D11800, 0, 0x00000800, "R|W|AS4", 0 ); // McBSP1 FIFO Ctrl GEL_MapAddStr( 0x01E00000, 0, 0x00010000, "R|W|AS4", 0 ); // USB0 GEL_MapAddStr( 0x01E10000, 0, 0x00001000, "R|W|AS4", 0 ); // UHPI 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( 0x01E16000, 0, 0x00001000, "R|W|AS4", 0 ); // UPP GEL_MapAddStr( 0x01E17000, 0, 0x00001000, "R|W|AS4", 0 ); // VPIF GEL_MapAddStr( 0x01E18000, 0, 0x00002000, "R|W|AS4", 0 ); // SATA GEL_MapAddStr( 0x01E1A000, 0, 0x00001000, "R|W|AS4", 0 ); // PLL Controller 1 GEL_MapAddStr( 0x01E1B000, 0, 0x00001000, "R|W|AS4", 0 ); // MMCSD1 GEL_MapAddStr( 0x01E20000, 0, 0x00002000, "R|W|AS4", 0 ); // EMAC Control Module RAM GEL_MapAddStr( 0x01E22000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC Control Module Registers GEL_MapAddStr( 0x01E23000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC Control Registers GEL_MapAddStr( 0x01E24000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC MDIO port GEL_MapAddStr( 0x01E25000, 0, 0x00001000, "R|W|AS4", 0 ); // USB1 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( 0x01E2C000, 0, 0x00001000, "R|W|AS4", 0 ); // System Config 1 GEL_MapAddStr( 0x01E30000, 0, 0x00008000, "R|W|AS4", 0 ); // EDMA3 CC1 GEL_MapAddStr( 0x01E38000, 0, 0x00000400, "R|W|AS4", 0 ); // EDMA3 TC2 GEL_MapAddStr( 0x01F00000, 0, 0x00001000, "R|W|AS4", 0 ); // eHRPWM 0 GEL_MapAddStr( 0x01F01000, 0, 0x00001000, "R|W|AS4", 0 ); // HRPWM 0 GEL_MapAddStr( 0x01F02000, 0, 0x00001000, "R|W|AS4", 0 ); // eHRPWM 1 GEL_MapAddStr( 0x01F03000, 0, 0x00001000, "R|W|AS4", 0 ); // HRPWM 1 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( 0x01F0C000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer2 GEL_MapAddStr( 0x01F0D000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer3 GEL_MapAddStr( 0x01F0E000, 0, 0x00001000, "R|W|AS4", 0 ); // SPI1 GEL_MapAddStr( 0x01F10000, 0, 0x00001000, "R|W|AS4", 0 ); // McBSP0 FIFO Data GEL_MapAddStr( 0x01F11000, 0, 0x00001000, "R|W|AS4", 0 ); // McBSP1 FIFO Data } /* ------------------------------------------------------------------------ * * * * Clear_Memory_Map( ) * * Clear the Memory Map * * * * ------------------------------------------------------------------------ */ hotmenu Clear_Memory_Map( ) { GEL_MapOff( ); GEL_MapReset( ); } menuitem "EVMAM1808 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 BOOTCFG *(unsigned int*)(SYS_BASE + 0x020) #define KICK0R *(unsigned int*)(SYS_BASE + 0x038) #define KICK1R *(unsigned int*)(SYS_BASE + 0x03c) #define HOST0CFG *(unsigned int*)(SYS_BASE + 0x040) #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_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_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_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_EMUCNT0 *(unsigned int*) (PLL0_BASE + 0x1F0) // EMUCNT0 #define PLL0_EMUCNT1 *(unsigned int*) (PLL0_BASE + 0x1F4) // EMUCNT1 #define PLLEN_MUX_SWITCH 4 #define PLL_LOCK_TIME_CNT 2400 #define PLL1_BASE 0x01E1A000 // SYSTEM PLL1 BASE ADDRESS #define PLL1_PID *(unsigned int*) (PLL1_BASE + 0x00) /*PID*/ #define PLL1_PLLCTL *(unsigned int*) (PLL1_BASE + 0x100) /*PLL Control Register*/ #define PLL1_OCSEL *(unsigned int*) (PLL1_BASE + 0x104) /*OBSCLK Select Register*/ #define PLL1_PLLM *(unsigned int*) (PLL1_BASE + 0x110) /*PLL Multiplier*/ #define PLL1_PREDIV *(unsigned int*) (PLL1_BASE + 0x114) /*Pre divider*/ #define PLL1_PLLDIV1 *(unsigned int*) (PLL1_BASE + 0x118) /*Divider-1*/ #define PLL1_PLLDIV2 *(unsigned int*) (PLL1_BASE + 0x11C) /*Divider-2*/ #define PLL1_PLLDIV3 *(unsigned int*) (PLL1_BASE + 0x120) /*Divider-3*/ #define PLL1_OSCDIV1 *(unsigned int*) (PLL1_BASE + 0x124) /*Oscilator Divider*/ #define PLL1_POSTDIV *(unsigned int*) (PLL1_BASE + 0x128) /*Post Divider*/ #define PLL1_PLLCMD *(unsigned int*) (PLL1_BASE + 0x138) /*Command Reg*/ #define PLL1_PLLSTAT *(unsigned int*) (PLL1_BASE + 0x13C) /*Status Reg*/ #define PLL1_ALNCTL *(unsigned int*) (PLL1_BASE + 0x140) /*Clock Align Control Reg*/ #define PLL1_DCHANGE *(unsigned int*) (PLL1_BASE + 0x144) /*PLLDIV Ratio Chnage status*/ #define PLL1_SYSTAT *(unsigned int*) (PLL1_BASE + 0x150) /*Sysclk status reg*/ #define PLL1_EMUCNT0 *(unsigned int*) (PLL1_BASE + 0x1F0) /*EMUCNT0*/ #define PLL1_EMUCNT1 *(unsigned int*) (PLL1_BASE + 0x1F4) /*EMUCNT1*/ #define PLL_STABILIZATION_TIME 2000 #define PLL_RESET_TIME_CNT 200 /*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< T_XP = tcke - 1 = 2 |( 0 << 23 ) // T_ODT not supported |(18 << 16 ) // (137.5ns / 7.58ns) - 1 = T_XSNR |(199<< 8 ) // 200 - 1 = T_XSRD |( 1 << 5 ) // ( 7.5ns / 7.58ns) - 1 = T_RTP |( 2 << 0 ); // tcke - 1 = 2 DDRCTL_SDCR &= ~0x00008000; // Clear TIMUNLOCK DDRCTL_SDCR2 = 0x00000000; // IBANK_POS set to 0 so this register does not apply DDRCTL_SDRCR = 0 |(1 << 31 ) // LPMODEN - Enable low-power mode |(1 << 30 ) // MCLKSTOPEN - Enables MCLK stopping |(0 << 23 ) // SR_PD - self-refresh mode |(1030<< 0 ); // RR - SDRAM frequency/SDRAM refresh rate = 132M / (1 / 7.8u) // SyncReset the Clock to DDRCTL SDRAM PSC1_LPSC_SyncReset(PD0, LPSC_DDR); // Enable the Clock to DDRCTL SDRAM PSC1_LPSC_enable(PD0, LPSC_DDR); DDRCTL_SDRCR &= ~0xC0000000; // Disable self-refresh } menuitem "Test_setup" hotmenu Ethernet_MII_setup() { GEL_TextOut( "Setup PINMUX Registers for Ethernet_MII" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX2 = 0x88888880; // MII PINMUX3 = 0x88888888; // MII PINMUX6 = 0x00000080; // MII MDIO enable (BUFF_ENn) CFGCHIP3 &= ~0x00000100; // MII KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu Ethernet_RMII_setup() { GEL_TextOut( "Setup PINMUX Registers for Ethernet_RMII" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX14 = 0x88888800; // RMII PINMUX15 = 0x00000080; // RMII CFGCHIP3 |= 0x00000100; // RMII KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu LCD_setup() { GEL_TextOut( "Setup PINMUX Registers for LCD" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX16 = 0x22222200; // LCDIO PINMUX17 = 0x22222222; // LCDIO PINMUX18 = 0x00000022; // LCDIO PINMUX18 |= 0x22000000; // LCD_MCLK, LCD_PCLK PINMUX19 = 0x02000022; // LCD_AC_ENB_CS, LCD_VSYNC, LCD_HSYNC PINMUX5 = 0x00000008; // GP2[15] PINMUX5 |= 0x80000000; // GP2[8] PINMUX6 = 0x00080080; // BUFF_ENn, Touch INT KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu CHAR_Display_setup() { GEL_TextOut( "Setup PINMUX Registers for Character Display" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX16 = 0x22222200; // LCDIO PINMUX17 = 0x22222222; // LCDIO PINMUX18 = 0x00000022; // LCDIO PINMUX18 |= 0x22000000; // LCD_MCLK, LCD_PCLK PINMUX19 = 0x02000022; // LCD_AC_ENB_CS, LCD_VSYNC, LCD_HSYNC PINMUX5 = 0x00000008; // GP2[15] PINMUX5 |= 0x80000000; // GP2[8] PINMUX6 = 0x00000080; // BUFF_ENn KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu UART_setup() { GEL_TextOut( "Setup PINMUX Registers for UART" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX0 = 0x44000000; PINMUX4 = 0x00220000; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu SD_setup() { GEL_TextOut( "Setup PINMUX Registers for SD card" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX10 = 0x88222222; PINMUX11 = 0x00000022; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu SPI_setup() { GEL_TextOut( "Setup PINMUX Registers for SPI" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX5 = 0x00111110; // SPI pins PINMUX6 = 0x00000080; // BUFF_ENn KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } #define PWRDN *(unsigned int*) 0x01E2C018 hotmenu SATA_setup() { GEL_TextOut( "Setup PINMUX Registers for SATA" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PWRDN = 0x00; // Enables SATA clock receiver KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu MCASP_AUDIO_setup() { GEL_TextOut( "Setup PINMUX Registers for MCASP" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX0 = 0x00111111; PINMUX1 = 0x00011000; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu NAND_setup() { GEL_TextOut( "Setup PINMUX Registers for NAND" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX7 = 0x00110110; PINMUX9 = 0x11111111; PINMUX12 = 0x01100000; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu NOR_setup() { GEL_TextOut( "Setup PINMUX Registers for NOR" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX5 = 0x11000000; PINMUX6 = 0x01000001; PINMUX7 = 0x00110001; PINMUX8 = 0x11111111; PINMUX9 = 0x11111111; PINMUX10 = 0x11111111; PINMUX11 = 0x11111111; PINMUX12 = 0x11111111; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu Video_setup() { GEL_TextOut( "Setup PINMUX Registers for Video" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX14 = 0x11111111; PINMUX15 = 0x11111111; PINMUX16 = 0x11111111; PINMUX17 = 0x11111111; PINMUX18 = 0x00000011; PINMUX19 = 0x00111100; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu ADC_DAC_setup() { GEL_TextOut( "Setup PINMUX Registers for Video" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX13 = 0x48440000; PINMUX14 = 0x44444400; PINMUX15 = 0x44444444; PINMUX16 = 0x44444444; PINMUX17 = 0x44444444; PINMUX18 = 0x00444444; PINMUX19 = 0x00010000; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu USB_POWER_setup() { GEL_TextOut( "Setup PINMUX Registers for USB Power Test" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX0 = 0x00000000; PINMUX6 = 0x00008000; CFGCHIP2 = 0x00002872; KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); } hotmenu USB_TEST_setup() { int i; GEL_TextOut( "Setup PINMUX Registers for USB Test\n" ); KICK0R = 0x83e70b13; // Kick0 register + data (unlock) KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) PINMUX0 = 0x00000000; PINMUX6 = 0x00008000; /* Setup USB PHY */ CFGCHIP2 |= 0x00008000; // Hold PHY in Reset for (i=0; i<50; i++); // Drive Reset for few clock cycles CFGCHIP2 = 0x00004972; // Internal USB clock, 24MHz system clock, out of reset while( (CFGCHIP2 & 0x00020000) == 0); // Wait Until PHY Clock is Good GEL_TextOut( "USB PHY Initialized\n" ); KICK0R = 0x83e70b13; // Kick0 register + data (lock) KICK1R = 0x95a4f1e0; // Kick1 register + data (lock) GEL_TextOut( "[Done]\n" ); }