Files
moyuhai e8074162f3 V1.0
2026-06-11 13:00:46 +08:00

84 lines
1.9 KiB
INI

FUNC void InitGpio(void)
{
// Config IOMUX
/*
gpio_mux_ctl_u(33,1);//d2
gpio_mux_ctl_u(34,1);//d3
gpio_mux_ctl_u(35,2);//clk
gpio_mux_ctl_u(36,2);//cs
gpio_mux_ctl_u(37,2);//d0 rx
gpio_mux_ctl_u(38,2);//d1 tx
*/
_WDWORD(0x4000019c, 0x00002A94);
}
FUNC void InitFlash(void)
{
}
FUNC void InitXIP(void)
{
_WDWORD(0x40000104,0x040000);//reset ssi0
_WDWORD(0x40000104,0x040004);//reset ssi0
_WDWORD(0x40000050,0x110000);//close spi0 mclk
_WDWORD(0x40000070,0x1000000);//close spi0 pclk
//config fmc
_WDWORD(0x40000270, 0x0503);
_Sleep_(1);// delay about 400us
_WDWORD(0x40000270, 0x3503);
//config cache
_Sleep_(1);// delay about 400us
_WDWORD(0x52000000, 0x0);
_Sleep_(1);// delay about 400us
_WDWORD(0x52000000, 0x21);
_Sleep_(1);// delay about 400us
_Sleep_(1);// delay about 400us
_Sleep_(1);// delay about 400us
_Sleep_(1);// delay about 400us
//config xip spi
_WDWORD(0x51000008, 0); //disable spi
_WDWORD(0x5100002c,0); //close IE
_WDWORD(0x51000000,0x1F); //32bit SPI data
_WDWORD(0x51000010,0x01); //enable select slave -- SE
_WDWORD(0x51000018,0x0); //TXFTL be set 0
_WDWORD(0x5100001c,0x0); //RXFTL be set 0
_WDWORD(0x5100010c, 0x01);//enable select slave
_WDWORD(0x51000114, 0xFF);//XIP time out
_WDWORD(0x51000014, 0x2);//div 2
//quad
_WDWORD(0x51000108, (2)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0<<24)|(8<<13));
_WDWORD(0x51000100, 0x6b);//quad read cmd
_WDWORD(0x51000104, 0x6b);//quad read cmd
// //dual
// _WDWORD(0x51000108, (1)|(6<<4)|(2<<9)|(1<<22)|(1<<29)|(1<<23)|(0)|(8<<13));
// _WDWORD(0x51000100, 0x3b);//dual read cmd
// _WDWORD(0x51000104, 0x3b);//dual read cmd
_WDWORD(0x51000008, 1); //enable spi
}
FUNC void Initialization(void)
{
InitGpio();
InitFlash();
InitXIP();
SP = _RDWORD(0x11001000);
PC = _RDWORD(0x11001004);
_WDWORD(0x4000013C, 0x11001001);
}
LOAD %L INCREMENTAL
Initialization();