S3C2440启动代码分析
时间:11-21
来源:互联网
点击:
- NOINT
- orrr1,r0,#SVCMODE
- msrcpsr_cxsf,r1;SVCMode
- ldrsp,=SVCStack;SVCStack=0x33FF_5800
- ;USERmodehasnotbeinitialized.
- ;//为什么不用初始化user的stacks,系统刚启动的时候运行在哪个模式下?
- movpc,lr
- ;TheLRregisterwontbevalidifthecurrentmodeisnotSVCmode.?
- ;//系统一开始运行就是SVCmode?
- ;===========================================================
- ReadNandID
- movr7,#NFCONF
- ldrr0,[r7,#4];NFChipEn();
- bicr0,r0,#2
- strr0,[r7,#4]
- movr0,#0x90;WrNFCmd(RdIDCMD);
- strbr0,[r7,#8]
- movr4,#0;WrNFAddr(0);
- strbr4,[r7,#0xc]
- 1;while(NFIsBusy());
- ldrr0,[r7,#0x20]
- tstr0,#1
- beq%B1
- ldrbr0,[r7,#0x10];id=RdNFDat()<8;
- movr0,r0,lsl#8
- ldrbr1,[r7,#0x10];id|=RdNFDat();
- orrr5,r1,r0
- ldrr0,[r7,#4];NFChipDs();
- orrr0,r0,#2
- strr0,[r7,#4]
- movpc,lr
- ReadNandStatus
- movr7,#NFCONF
- ldrr0,[r7,#4];NFChipEn();
- bicr0,r0,#2
- strr0,[r7,#4]
- movr0,#0x70;WrNFCmd(QUERYCMD);
- strbr0,[r7,#8]
- ldrbr1,[r7,#0x10];r1=RdNFDat();
- ldrr0,[r7,#4];NFChipDs();
- orrr0,r0,#2
- strr0,[r7,#4]
- movpc,lr
- WaitNandBusy
- movr0,#0x70;WrNFCmd(QUERYCMD);
- movr1,#NFCONF
- strbr0,[r1,#8]
- 1;while(!(RdNFDat()&0x40));
- ldrbr0,[r1,#0x10]
- tstr0,#0x40
- beq%B1
- movr0,#0;WrNFCmd(READCMD0);
- strbr0,[r1,#8]
- movpc,lr
- CheckBadBlk
- movr7,lr
- movr5,#NFCONF
- bicr0,r0,#0x1f;addr&=~0x1f;
- ldrr1,[r5,#4];NFChipEn()
- bicr1,r1,#2
- strr1,[r5,#4]
- movr1,#0x50;WrNFCmd(READCMD2)
- strbr1,[r5,#8]
- movr1,#5;6;6->5
- strbr1,[r5,#0xc];WrNFAddr(5);(6)6->5
- strbr0,[r5,#0xc];WrNFAddr(addr)
- movr1,r0,lsr#8;WrNFAddr(addr>>8)
- strbr1,[r5,#0xc]
- cmpr6,#0;if(NandAddr)
- movner0,r0,lsr#16;WrNFAddr(addr>>16)
- strnebr0,[r5,#0xc]
- ;blWaitNandBusy;WaitNFBusy()
- ;donotuseWaitNandBusy,afterWaitNandBusywillreadpartA!
- movr0,#100
- 1
- subsr0,r0,#1
- bne%B1
- 2
- ldrr0,[r5,#0x20]
- tstr0,#1
- beq%B2
- ldrbr0,[r5,#0x10];RdNFDat()
- subr0,r0,#0xff
- movr1,#0;WrNFCmd(READCMD0)
- strbr1,[r5,#8]
- ldrr1,[r5,#4];NFChipDs()
- orrr1,r1,#2
- strr1,[r5,#4]
- movpc,r7
- ReadNandPage
- movr7,lr
- movr4,r1
- movr5,#NFCONF
- ldrr1,[r5,#4];NFChipEn()
- bicr1,r1,#2
- strr1,[r5,#4]
- movr1,#0;WrNFCmd(READCMD0)
- strbr1,[r5,#8]
- strbr1,[r5,#0xc];WrNFAddr(0)
- strbr0,[r5,#0xc];WrNFAddr(addr)
- movr1,r0,lsr#8;WrNFAddr(addr>>8)
- strbr1,[r5,#0xc]
- cmpr6,#0;if(NandAddr)
- movner0,r0,lsr#16;WrNFAddr(addr>>16)
- strnebr0,[r5,#0xc]
- ldrr0,[r5,#4];InitEcc()
- orrr0,r0,#0x10
- strr0,[r5,#4]
- blWaitNandBusy;WaitNFBusy()
- movr0,#0;for(i=0;i<512;i++)
- 1
- ldrbr1,[r5,#0x10];buf[i]=RdNFDat()
- strbr1,[r4,r0]
- addr0,r0,#1
- bicr0,r0,#0x10000
- cmpr0,#0x200
- bcc%B1
- ldrr0,[r5,#4];NFChipDs()
- orrr0,r0,#2
- strr0,[r5,#4]
- movpc,r7
- ;--------------------LEDtest
- EXPORTLed_Test
- Led_Test
- movr0,#0x56000000
- movr1,#0x5500
- strr1,[r0,#0x50]
- 0
- movr1,#0x50
- strr1,[r0,#0x54]
- movr2,#0x100000
- 1
- subsr2,r2,#1
- bne%B1
- movr1,#0xa0
- strr1,[r0,#0x54]
- movr2,#0x100000
- 2
- subsr2,r2,#1
- bne%B2
- b%B0
- movpc,lr
- ;===========================================================
- ;=====================================================================
- ;Clockdivisiontest
- ;Assemblecode,becauseVSYNCtimeisveryshort
- ;=====================================================================
- EXPORTCLKdiv124
- EXPORTCLKdiv144
- CLKdiv124
- ldrr0,=CLKdivN
- ldrr1,=0x3;0x3=1:2:4
- strr1,[r0]
- ;waituntilclockisstable
- nop
- nop
- nop
- nop
- nop
- ldrr0,=REFRESH
- ldrr1,[r0]
- bicr1,r1,#0xff
- bicr1,r1,#(0x7<8)
- orrr1,r1,#0x470;REFCNT135
- strr1,[r0]
- nop
- nop
- nop
- nop
- nop
- movpc,lr
- CLKdiv144
- ldrr0,=CLKdivN
- ldrr1,=0x4;0x4=1:4:4
- strr1,[r0]
- ;waituntilclockisstable
- nop
- nop
- nop
- nop
- nop
- ldrr0,=REFRESH
- ldrr1,[r0]
- bicr1,r1,#0xff
- bicr1,r1,#(0x7<8)
- orrr1,r1,#0x630;REFCNT675-1520
- strr1,[r0]
- nop
- nop
- nop
- nop
- nop
- movpc,lr
- ;存储器控制寄存器的定义区
- LTORG
- SMRDATADATA
- ;Memoryconfigurationshouldbeoptimizedforbestperformance
- ;Thefollowingparameterisnotoptimized.
- ;Memoryaccesscycleparameterstrategy
- ;1)ThememorysettingsissafeparametersevenatHCLK=75Mhz.
- ;2)SDRAMrefreshperiodisforHCLK<=75Mhz.
- DCD(0+(B1_BWSCON<4)+(B2_BWSCON<8)+(B3_BWSCON<12)+(B4_BWSCON<16)+(B5_BWSCON<20)+(B6_BWSCON<24)+(B7_BWSCON<28));各bank的buswidth;没有B0,因为由OM[1:0]pins确定
- DCD((B0_Tacs<13)+(B0_Tcos<11)+(B0_Tacc<8)+(B0_Tcoh<6)+(B0_Tah<4)+(B0_Tacp<2)+(B0_PMC));GCS0
- DCD((B1_Tacs<13)+(B1_Tcos<11)+(B1_Tacc<8)+(B1_Tcoh<6)+(B1_Tah<4)+(B1_Tacp<2)+(B1_PMC));GCS1
- DCD((B2_Tacs<13)+(B2_Tcos<11)+(B2_Tacc<8)+(B2_Tcoh<6)+(B2_Tah<4)+(B2_Tacp<2)+(B2_PMC));GCS2
- DCD((B3_Tacs<13)+(B3_Tcos<11)+(B3_Tacc<8)+(B3_Tcoh<6)+(B3_Tah<4)+(B3_Tacp<2)+(B3_PMC));GCS3
- DCD((B4_Tacs<13)+(B4_Tcos<11)+(B4_Tacc<8)+(B4_Tcoh<6)+(B4_Tah<4)+(B4_Tacp<2)+(B4_PMC));GCS4
- DCD((B5_Tacs<13)+(B5_Tcos<11)+(B5_Tacc<8)+(B5_Tcoh<6)+(B5_Tah<4)+(B5_Tacp<2)+(B5_PMC));GCS5
- DCD((B6_MT<15)+(B6_Trcd<2)+(B6_SCAN));GCS6B6_MT定义在memcfg.inc中,11-->SDRAM;B6_SCAN-非reset默认值
- DCD((B7_MT<15)+(B7_Trcd<2)+(B7_SCAN));GCS7
- DCD((REFEN<23)+(TREFMD<22)+(Trp<20)+(Trc<18)+(Tchr<16)+REFCNT);Tchr-notused
- ;DCD0x32;SCLKpowersavin
S3C2440启动代 相关文章:
- 深入分析S3C2440启动代码中大小端问题(11-22)
- S3C2440启动代码中应用程序执行环境的初始化(11-22)
- S3C2440启动代码 中断分析(11-22)
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)