📄 davincievm_arm.gel.txt
字号:
/* ------------------------------------------------------------------------ *
* *
* davincievm_arm.gel *
* Version 3.2a *
* *
* This GEL file is designed to be used in conjunction with *
* CCStudio 3.2+ and the DM6446 based EVM. *
* *
* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ *
* *
* StartUp( ) *
* Setup Memory Map *
* *
* ------------------------------------------------------------------------ */
StartUp( )
{
Setup_Memory_Map( );
}
/* ------------------------------------------------------------------------ *
* *
* OnTargetConnect( ) *
* Setup PinMux, Power, PLLs, DDR, & EMIF *
* *
* ------------------------------------------------------------------------ */
OnTargetConnect( )
{
GEL_TextOut( "\nDaVinciEVM ARM Startup Sequence\n\n" );
Setup_Pin_Mux( ); // Setup Pin Mux
Setup_Psc_All_On( ); // Setup All Power Domains
Setup_PLL1_594_MHz_OscIn( ); // Setup Pll1 [DSP @ 594 MHz, ARM @ 297 MHz][1.20V]
Setup_PLL2_DDR_162_MHz_OscIn( ); // Setup Pll2 [VPSS @ 54 MHz, DDR @ 162 MHz][1.20V]
Setup_DDR_162_MHz( ); // Setup DDR2 [162 MHz]
//Reset_EMIF_16Bit_Bus( ); // Reset Async-EMIF [16-bit bus]
Setup_EMIF_CS2_NorFlash_16Bit( ); // Setup NOR Flash
//Setup_EMIF_CS2_SRAM_16Bit( ); // Setup SRAM
//Setup_EMIF_CS2_NandFlash_8Bit( ); // Setup NAND Flash
DSP_Boot_from_L2_Sram( ); // Boot DSP from L2
GEL_TextOut( "\nStartup Complete.\n\n" );
}
menuitem "DaVinci EVM Memory Map";
/* ------------------------------------------------------------------------ *
* *
* Setup_Memory_Map( ) *
* Setup the Memory Map for ARM side only. *
* *
* ------------------------------------------------------------------------ */
hotmenu
Setup_Memory_Map( )
{
GEL_MapOn( );
GEL_MapReset( );
/* ARM RAM & ROM */
GEL_MapAddStr( 0x00000000, 0, 0x00004000, "R|W|AS4", 0 ); // ARM RAM Instruction
GEL_MapAddStr( 0x00004000, 0, 0x00004000, "R|AS4", 0 ); // ARM ROM Instruction
GEL_MapAddStr( 0x00008000, 0, 0x00004000, "R|W|AS4", 0 ); // ARM RAM Data
GEL_MapAddStr( 0x0000c000, 0, 0x00004000, "R|AS4", 0 ); // ARM ROM Data
/* Extend Trace */
GEL_MapAddStr( 0x01bc0000, 0, 0x00001900, "R|W|AS4", 0 ); // ARM ETB
/* Peripherals */
GEL_MapAddStr( 0x01c00000, 0, 0x00000644, "R|W|AS4", 0 ); // EDMA Channel Ctrl
GEL_MapAddStr( 0x01c01000, 0, 0x00000098, "R|W|AS4", 0 ); // EDMA Channel Ctrl
GEL_MapAddStr( 0x01c02000, 0, 0x00000098, "R|W|AS4", 0 ); // EDMA Channel Ctrl
GEL_MapAddStr( 0x01c02200, 0, 0x00000098, "R|W|AS4", 0 ); // EDMA Channel Ctrl
GEL_MapAddStr( 0x01c10000, 0, 0x000003d8, "R|W|AS4", 0 ); // EDMA Transfer Ctrl 0
GEL_MapAddStr( 0x01c10400, 0, 0x000003d8, "R|W|AS4", 0 ); // EDMA Transfer Ctrl 1
GEL_MapAddStr( 0x01c20000, 0, 0x00000034, "R|W|AS4", 0 ); // UART 0
GEL_MapAddStr( 0x01c20400, 0, 0x00000034, "R|W|AS4", 0 ); // UART 1
GEL_MapAddStr( 0x01c20800, 0, 0x00000034, "R|W|AS4", 0 ); // UART 2
GEL_MapAddStr( 0x01c21000, 0, 0x0000003c, "R|W|AS4", 0 ); // I2C
GEL_MapAddStr( 0x01c21400, 0, 0x00000028, "R|W|AS4", 0 ); // Timer 0
GEL_MapAddStr( 0x01c21800, 0, 0x00000028, "R|W|AS4", 0 ); // Timer 1
GEL_MapAddStr( 0x01c21c00, 0, 0x0000002c, "R|W|AS4", 0 ); // Timer 2 WDT
GEL_MapAddStr( 0x01c22000, 0, 0x0000001c, "R|W|AS4", 0 ); // PWM 0
GEL_MapAddStr( 0x01c22400, 0, 0x0000001c, "R|W|AS4", 0 ); // PWM 1
GEL_MapAddStr( 0x01c22800, 0, 0x0000001c, "R|W|AS4", 0 ); // PWM 2
GEL_MapAddStr( 0x01c40000, 0, 0x00000050, "R|W|AS4", 0 ); // System Module
GEL_MapAddStr( 0x01c40800, 0, 0x00000168, "R|W|AS4", 0 ); // PLL 1
GEL_MapAddStr( 0x01c40c00, 0, 0x00000154, "R|W|AS4", 0 ); // PLL 2
GEL_MapAddStr( 0x01c41000, 0, 0x00000518, "R|W|AS4", 0 ); // PSC Domain Control
GEL_MapAddStr( 0x01c41800, 0, 0x000000a4, "R|W|AS4", 0 ); // PSC Module Status
GEL_MapAddStr( 0x01c41a00, 0, 0x000000a4, "R|W|AS4", 0 ); // PSC Module Control
GEL_MapAddStr( 0x01c42030, 0, 0x00000004, "R|W|AS4", 0 ); // DDR2 VTP
GEL_MapAddStr( 0x01c48000, 0, 0x00000050, "R|W|AS4", 0 ); // ARM Interrupts
GEL_MapAddStr( 0x01c64000, 0, 0x00002000, "R|W|AS4", 0 ); // USB 2.0 + RAM
GEL_MapAddStr( 0x01c66000, 0, 0x00000800, "R|W|AS2", 0 ); // ATA / CF
GEL_MapAddStr( 0x01c66800, 0, 0x00000074, "R|W|AS4", 0 ); // SPI
GEL_MapAddStr( 0x01c67000, 0, 0x00000038, "R|W|AS4", 0 ); // GPIO
GEL_MapAddStr( 0x01c70000, 0, 0x00004000, "R|W|AS4", 0 ); // VPSS
GEL_MapAddStr( 0x01c80000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC Control
GEL_MapAddStr( 0x01c81000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC Module
GEL_MapAddStr( 0x01c82000, 0, 0x00002000, "R|W|AS4", 0 ); // EMAC Module RAM
GEL_MapAddStr( 0x01c84000, 0, 0x00000090, "R|W|AS4", 0 ); // MDIO
GEL_MapAddStr( 0x01cc0000, 0, 0x00020000, "R|W|AS4", 0 ); // VICP
GEL_MapAddStr( 0x01e00000, 0, 0x000000b4, "R|W|AS4", 0 ); // EMIFA Control
GEL_MapAddStr( 0x01e01000, 0, 0x00000048, "R|W|AS4", 0 ); // VLYNQ Control
GEL_MapAddStr( 0x01e02000, 0, 0x0000005c, "R|W|AS4", 0 ); // ASP
GEL_MapAddStr( 0x01e10000, 0, 0x00000078, "R|W|AS4", 0 ); // MMC / SD
/* Off-chip */
GEL_MapAddStr( 0x02000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS2
GEL_MapAddStr( 0x04000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS3
GEL_MapAddStr( 0x06000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS4
GEL_MapAddStr( 0x08000000, 0, 0x02000000, "R|W|AS4", 0 ); // AEMIF CS5
GEL_MapAddStr( 0x0c000000, 0, 0x04000000, "R|W|AS4", 0 ); // VLYNQ
/* DSP RAM */
GEL_MapAddStr( 0x11800000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP L2 Cache
GEL_MapAddStr( 0x11e08000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1P Cache
GEL_MapAddStr( 0x11f04000, 0, 0x0000c000, "R|W|AS4", 0 ); // DSP L1D RAM
GEL_MapAddStr( 0x11f10000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1D Cache
/* DDR2 */
GEL_MapAddStr( 0x20000000, 0, 0x000000f4, "R|W|AS4", 0 ); // DDR2 Control
GEL_MapAddStr( 0x80000000, 0, 0x10000000, "R|W|AS4", 0 ); // DDR2 SDRAM
}
/* ------------------------------------------------------------------------ *
* *
* Clear_Memory_Map( ) *
* Clear the Memory Map *
* *
* ------------------------------------------------------------------------ */
hotmenu
Clear_Memory_Map( )
{
GEL_MapOff( );
GEL_MapReset( );
}
menuitem "DaVinci EVM Functions";
/* ------------------------------------------------------------------------ *
* *
* Setup_Pin_Mux( ) *
* Configure Pin Multiplexing *
* *
* ------------------------------------------------------------------------ */
hotmenu
Setup_Pin_Mux( )
{
GEL_TextOut( "Setup PinMux... " );
#define PINMUX0 *( unsigned int* )( 0x01c40000 )
#define PINMUX1 *( unsigned int* )( 0x01c40004 )
#define VDD3P3V_PWDN *( unsigned int* )( 0x01c40048 )
/*
* PinMux settings for:
* [Normal Operation]
*/
PINMUX0 = 0x80000c1f;
/*| ( 1 << 31 ) // EMACEN - ON
| ( 0 << 30 ) // EN1394 - OFF
| ( 0 << 29 ) // HPIEN - OFF
| ( 0 << 27 ) // CFLDEN - OFF
| ( 0 << 26 ) // CWEN - OFF
| ( 0 << 25 ) // LFLDEN - OFF
| ( 0 << 24 ) // LOEEN - OFF
| ( 0 << 23 ) // RGB888 - OFF
| ( 0 << 22 ) // RGB666 - OFF
| ( 0 << 17 ) // ATAEN - OFF
| ( 0 << 16 ) // HDIREN - OFF
| ( 0 << 15 ) // VLYNQEN- OFF
| ( 0 << 14 ) // VLSCREN- OFF
| ( 0 << 12 ) // VLYNQWD- OFF
| ( 1 << 11 ) // AECS5 - ON
| ( 1 << 10 ) // AECS4 - ON
| ( 31 << 0 ); // AEAW - ON*/
PINMUX1 = 0x000404f1;
/*| ( 1 << 18 ) // TIMIN - ON
| ( 0 << 17 ) // CLK1 - OFF
| ( 0 << 16 ) // CLK0 - OFF
| ( 1 << 10 ) // MCBSP - ON
| ( 0 << 9 ) // MSTK - OFF
| ( 0 << 8 ) // SPI - OFF
| ( 1 << 7 ) // I2C - ON
| ( 1 << 6 ) // PWM2 - ON
| ( 1 << 5 ) // PWM1 - ON
| ( 1 << 4 ) // PWM0 - ON
| ( 0 << 3 ) // U2FLO - OFF
| ( 0 << 2 ) // UART2 - OFF
| ( 0 << 1 ) // UART1 - OFF
| ( 1 << 0 ); // UART0 - ON*/
VDD3P3V_PWDN = 0;
/*| ( 0 << 1 ) // MMC/SD I/O - Powered down
| ( 0 << 0 ); // GIOV33/EMAC I/O - Powered down*/
GEL_TextOut( "[Done]\n" );
}
/* ------------------------------------------------------------------------ *
* *
* Setup_Psc_All_On( ) *
* Enable all PSC modules on ALWAYSON and DSP power dominas. *
* *
* ------------------------------------------------------------------------ */
hotmenu
Setup_Psc_All_On( )
{
int i;
GEL_TextOut( "Setup Power Modules (All on)... " );
/*
* Enable all non-reserved power modules
* Reserved: 8, 12, 16, 29-38
*/
for ( i = 0 ; i <= 7 ; i++ )
psc_change_state( i , 3 );
for ( i = 9 ; i <= 11 ; i++ )
psc_change_state( i , 3 );
for ( i = 13 ; i <= 15 ; i++ )
psc_change_state( i , 3 );
for ( i = 17 ; i <= 28 ; i++ )
psc_change_state( i , 3 );
for ( i = 39 ; i <= 40 ; i++ )
psc_change_state( i , 3 );
GEL_TextOut( "[Done]\n" );
}
/* ------------------------------------------------------------------------ *
* *
* psc_use_interrupt( id ) *
* Determine which PSC module needs the interrupt set *
* *
* ------------------------------------------------------------------------ */
psc_use_interrupt( int id )
{
/* Interrupts: 0-1, 5-6, 9-10, 13-15, 17, 26, 40 */
if ( ( id == 0 ) || ( id == 1 ) || ( id == 5 ) || ( id == 6 )
|| ( id == 9 ) || ( id == 10 ) || ( ( id >= 13 ) && ( id <= 15 ) )
|| ( id == 17 ) || ( id == 26 ) || ( id == 40 ) )
return 1;
else
return 0;
}
/* ------------------------------------------------------------------------ *
* *
* psc_turn_on_dsp_power_domain( ) *
* Turn on DSP Power Domain *
* *
* ------------------------------------------------------------------------ */
psc_turn_on_dsp_power_domain( )
{
#define PSC_EPCPR *( unsigned int* )( 0x01c41070 )
#define PSC_PTCMD *( unsigned int* )( 0x01c41120 )
#define PSC_PTSTAT *( unsigned int* )( 0x01c41128 )
#define PSC_PDCTL1 *( unsigned int* )( 0x01c41304 )
#define PSC_MDSTAT_DSP *( unsigned int* )( 0x01c41800 + ( 4 * 39 ) )
#define PSC_MDCTL_DSP *( unsigned int* )( 0x01c41a00 + ( 4 * 39 ) )
#define PSC_MDSTAT_IMCOP *( unsigned int* )( 0x01c41800 + ( 4 * 40 ) )
#define PSC_MDCTL_IMCOP *( unsigned int* )( 0x01c41a00 + ( 4 * 40 ) )
#define CHP_SHRTSW *( unsigned int* )( 0x01c40038 )
/*
* Step 0 - Ignore if DSP power is already on
*/
if ( ( PSC_MDSTAT_DSP & 0x1f ) == 3 )
return;
/*
* Turn DSP power on ( by shorting switch )
*/
CHP_SHRTSW = 1;
/*
* Step 1 - Wait for PTSTAT.GOSTAT to clear
*/
while( PSC_PTSTAT & 2 );
/*
* Step 2 - Turn on Power to DSP domain, then Enable DSP & IMCOP
*/
PSC_PDCTL1 |= 1;
PSC_MDCTL_DSP |= 0x0003;
PSC_MDCTL_IMCOP |= 0x0203;
/*
* Step 3 - Start power transition ( set PTCMD.GO to 1 )
*/
PSC_PTCMD = 2;
/*
* Step 4 - Wait for External Power request
*/
while( ! ( PSC_EPCPR & 2 ) );
/* Step 5 - Apply Power - should already be set */
/*
* Step 6 - Indicate that power has been applied
*/
PSC_PDCTL1 |= 0x0100;
/*
* Step 5 - Wait for PTSTAT.GOSTAT to clear
*/
while( PSC_PTSTAT & 2 );
PSC_MDCTL_IMCOP &= ~0x0200;
}
/* ------------------------------------------------------------------------ *
* *
* psc_change_state( id, state ) *
* id = Domain #ID *
* state = ( ENABLE, DISABLE, SYNCRESET, RESET ) *
* ( =3 , =2 , =1 , =0 ) *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -