S3C2440启动代码分析
时间:11-21
来源:互联网
点击:
- dian指令,只是由于总线不一样而取机器码的顺序不一样
- ]
- |
- bResetHandler;我们的程序由于ENDIAN_CHANGE设成FALSE就到这儿了,转跳到复位程序入口
- ]
- bHandlerUndef;handlerforUndefinedmode;0x04
- bHandlerSWI;handlerforSWIinterrupt;0x08
- bHandlerPabort;handlerforPAbort;0x0c
- bHandlerDabort;handlerforDAbort;0x10
- b.;reserved注意小圆点;0x14
- bHandlerIRQ;handlerforIRQinterrupt;0x18
- bHandlerFIQ;handlerforFIQinterrupt;0x1c
- ;@0x20
- bEnterPWDN;Mustbe@0x20.
- ;==================================================================================
- ;下面是改变大小端的程序,这里采用直接定义机器码的方式,至说为什么这么做就得问三星了
- ;反正我们程序里这段代码也不会去执行,不用去管它
- ;==================================================================================
- ;通过设置CP15的C1的位7,设置存储格式为Bigendian,三种总线方式
- ChangeBigEndian;//hereENTRY_BUS_WIDTH=16
- ;@0x24
- [ENTRY_BUS_WIDTH=32
- DCD0xee110f10;0xee110f10=>mrcp15,0,r0,c1,c0,0
- DCD0xe3800080;0xe3800080=>orrr0,r0,#0x80;//Big-endian
- DCD0xee010f10;0xee010f10=>mcrp15,0,r0,c1,c0,0
- ;对存储器控制寄存器操作,指定内存模式为Big-endian
- ;因为刚开始CPU都是按照32位总线的指令格式运行的,如果采用其他的话,CPU别不了,必须转化
- ;但当系统初始化好以后,则CPU能自动识别
- ]
- [ENTRY_BUS_WIDTH=16
- DCD0x0f10ee11
- DCD0x0080e380
- DCD0x0f10ee01
- ;因为采用Big-endian模式,采用16位总线时,物理地址的高位和数据的地位对应
- ;所以指令的机器码也相应的高低对调
- ]
- [ENTRY_BUS_WIDTH=8
- DCD0x100f11ee
- DCD0x800080e3
- DCD0x100f01ee
- ]
- DCD0xffffffff;swinv0xffffffissimilarwithNOPandrunwellinbothendianmode.
- DCD0xffffffff
- DCD0xffffffff
- DCD0xffffffff
- DCD0xffffffff
- bResetHandler
- ;=========================================================================================
- ;Functionforenteringpowerdownmode
- ;1.SDRAMshouldbeinself-refreshmode.
- ;2.AllinterruptshouldbemakskedforSDRAM/DRAMself-refresh.
- ;3.LCDcontrollershouldbedisabledforSDRAM/DRAMself-refresh.
- ;4.TheI-cachemayhavetobeturnedon.
- ;5.Thelocationofthefollowingcodemayhavenottobechanged.
- ;voidEnterPWDN(intCLKCON);
- EnterPWDN
- movr2,r0;r2=rCLKCON保存原始数据0x4c00000c使能各模块的时钟输入
- tstr0,#0x8;测试bit[3]SLEEPmode?1=>sleep
- bneENTER_SLEEP;C=0,即TST结果非0,bit[3]=1
- ;//进入PWDN后如果不是sleep则进入stop
- ;//进入Stopmode
- ENTER_STOP
- ldrr0,=REFRESH;0x48000024DRAM/SDRAMrefreshconfig
- ldrr3,[r0];r3=rREFRESH
- movr1,r3
- orrr1,r1,#BIT_SELFREFRESH;EnableSDRAMself-refresh
- strr1,[r0];EnableSDRAMself-refresh
- movr1,#16;waituntilself-refreshisissued.maynotbeneeded.
- 0
- subsr1,r1,#1
- bne%B0
- ;//wait16fclksforself-refresh
- ldrr0,=CLKCON;enterSTOPmode.
- strr2,[r0]
- movr1,#32
- 0
- subsr1,r1,#1;1)waituntiltheSTOPmodeisineffect.
- bne%B0;2)OrwaithereuntiltheCPU&Peripheralswillbeturned-off
- ;EnteringSLEEPmode,onlytheresetbywake-upisavailable.
- ldrr0,=REFRESH;exitfromSDRAMselfrefreshmode.
- strr3,[r0]
- MOV_PC_LR;backtomainprocess
- ENTER_SLEEP
- ;NOTE.
- ;1)rGSTATUS3shouldhavethereturnaddressafterwake-upfromSLEEPmode.
- ldrr0,=REFRESH
- ldrr1,[r0];r1=rREFRESH
- orrr1,r1,#BIT_SELFREFRESH
- strr1,[r0];EnableSDRAMself-refresh
- ;//EnableSDRAMself-refresh
- movr1,#16;Waituntilself-refreshisissued,whichmaynotbeneeded.
- 0
- subsr1,r1,#1
- bne%B0
- ;//Waituntilself-refreshisissued,whichmaynotbeneeded
- ldrr1,=MISCCR;IOregister
- ldrr0,[r1]
- orrr0,r0,#(7<17);SetSCLK0=1,SCLK1=1,SCKE=1.
- strr0,[r1]
- ldrr0,=CLKCON;Entersleepmode
- strr2,[r0]
- b.;CPUwilldiehere.
- ;//进入SleepMode,1)设置SDRAM为self-refresh
- ;//2)设置MISCCRbit[17]1:sclk0=sclk0:sclk0=0
- ;//bit[18]1:sclk1=sclk0:sclk1=0
- ;//bit[19]1:Selfrefreshretainenable
- ;//0:Selfrefreshretaindisable
- ;//When1,Afterwake-upfromsleep,Theself-refreshwillberetained.
- WAKEUP_SLEEP
- ;ReleaseSCLKnafterwake-upfromtheSLEEPmode.
- ldrr1,=MISCCR
- ldrr0,[r1]
- bicr0,r0,#(7<17);SCLK0:0->SCLK,SCLK1:0->SCLK,SCKE:0->=SCKE.
- strr0,[r1]
- ;//设置MISCCR
- ;Setmemorycontrolregisters
- ;ldrr0,=SMRDATA
- adrlr0,SMRDATA
- ldrr1,=BWSCON;BWSCONAddress;//总线宽度和等待控制寄存器
- addr2
S3C2440启动代 相关文章:
- 深入分析S3C2440启动代码中大小端问题(11-22)
- S3C2440启动代码中应用程序执行环境的初始化(11-22)
- S3C2440启动代码 中断分析(11-22)
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)