gogo专业大尺度亚洲高清人体,美女张开双腿让男生桶,亚洲av无码一区二区三区鸳鸯影院,久久久久国产精品人妻

當(dāng)前位置:首頁(yè) > 嵌入式培訓(xùn) > 嵌入式學(xué)習(xí) > 講師博文 > exynos4412內(nèi)存分析

exynos4412內(nèi)存分析 時(shí)間:2018-08-16      來(lái)源:未知

學(xué)生在進(jìn)行開發(fā)時(shí),經(jīng)常對(duì)內(nèi)存這塊有疑問,下面將使用exynos4412芯片的華清開發(fā)板(fs4412)為例作為講解。

使用到的手冊(cè)如下:

FS4412_CoreBoard_V2.pdf

FS4412-DevBoard-V5.pdf

SEC_Exynos4412_Users Manual_Ver.1.00.00.pdf

簡(jiǎn)述

exynos4412存儲(chǔ)分下面幾塊:

iROM:?jiǎn)?dòng)鏡像區(qū),存放三星預(yù)置的程序,也叫bl0

iRAM :內(nèi)部?jī)?nèi)存區(qū),加載通過(guò)OM選擇后的啟動(dòng)程序,通常加載bl1、bl2

SMC:靜態(tài)內(nèi)存區(qū),Static Read Only Memory Controller ,通常用于映射外部總線上設(shè)備,如網(wǎng)卡等,該區(qū)域被分為4個(gè)bank,每個(gè)16M(對(duì)應(yīng)硬件手冊(cè)xm0開頭的)

SFR:特殊功能寄存器區(qū),通常用于映射SOC內(nèi)部設(shè)備,如GPIO等

DMC:動(dòng)態(tài)內(nèi)存區(qū),就是我們通常意義上的內(nèi)存。

ps:動(dòng)態(tài)內(nèi)存(由于動(dòng)態(tài)內(nèi)存本身不供電,需要不斷供電刷新,保存數(shù)據(jù),所以叫動(dòng)態(tài)內(nèi)存)(對(duì)應(yīng)硬件手冊(cè)xm1和xm2開頭的)

硬件原理(SMC)

Exynos4412中有1個(gè)獨(dú)立的SMC,分為4個(gè)bank

沒有行地址和列地址,整個(gè)芯片可用內(nèi)存大小:2^8bit=256/16=16Byte

外部設(shè)備片選時(shí),只能選0或者1.

硬件原理(DMC)

Exynos4412中有兩個(gè)獨(dú)立的DRAM控制器,分別叫DMC0和DMC1,可以接2組不同的DDR內(nèi)存。DMC0和DMC1分別支持大1.5GB的DRAM,它們都支持DDR2/DDR3和LPDDR2等,512 Mb, 1 Gb, 2 Gb, 4 Gb and 8 Gbit的內(nèi)存設(shè)備,支持16/32bit的位寬。DRAM0 對(duì)應(yīng)的地址是0x4000_0000~0xAFFF_FFF共1.5GB,DRAM1 對(duì)應(yīng)的地址是0xA000_000~0x0000_0000共1.5GB。

4412的1GB的DRAM是由4片大小為256M*16的DDR3芯片組合而成(查看芯片型號(hào)可以得到)

芯片型號(hào):K4B4G1646B-HYXX

第一位: K表示內(nèi)存

第二位:4表示falsh類型 DRAM

第三位:B表示DDR3

第4~5位. Density(注:實(shí)際單位應(yīng)該是bit,而不是Byte),我們的是4Gbit=4G/16(數(shù)據(jù)位)=256MByte

第6~7位. organization:數(shù)據(jù)線引腳個(gè)數(shù),我們的是16

分析完成,開發(fā)板上共有4片這樣的內(nèi)存芯片,總?cè)萘烤褪?56M*4=1G

這四片DDR 芯片被分成了兩兩一組,組成32位數(shù)據(jù),四片都是掛接到DMC0處

總圖如下:

分解圖如下(只列了一半):

從上兩圖可以看出,這四片DDR 芯片被分成了兩兩一組,組成32位數(shù)據(jù),四片都是掛接到DMC0處,如下:

· 左邊一片16位,右邊16位,組成32位數(shù)據(jù)

· 全部芯片片選掛到CS0:

· bank線數(shù):

3路線(BA0-BA2),有2^3組合,也就是一個(gè)芯片上,bank有8個(gè)

· 地址線

地址線數(shù):15(A0-A14)

ps:一個(gè)芯片內(nèi)存大支持:2^(bank線數(shù)+地址線)=2^33=8Gbit/16=512MByte

· 行列地址線

nRAS,nCAS:復(fù)用地址線行和列選擇,同一時(shí)刻只能有一種地址線使用(不是行就是列),我們的板子上芯片有256M(2^28),28-3(bank)-15(行地址)=10(列地址)

· 尋址流程

這個(gè)操作順序是,先片選,CS拉低,然后,當(dāng)RAS拉低時(shí),表示傳過(guò)的是行地址,是A0-A14,15位;當(dāng)CAS拉低時(shí),表示傳過(guò)來(lái)的是列地址,是A0-A9,列地址多的幾位是預(yù)留的用來(lái)擴(kuò)展內(nèi)存,一個(gè)芯片內(nèi)存多可以擴(kuò)展到512M。

內(nèi)存劃分多個(gè)bank原因

由于DDR是不自備充電電路的,所以,每隔一段時(shí)間,內(nèi)存控制器就會(huì)刷新一次電路,也就是要充一次電,如果只有一個(gè)Bank,那么結(jié)果就是在某一時(shí)刻,要么都充電,要么都不充電。

像上面這樣分成了8個(gè)Bank,當(dāng)我對(duì)000充電的時(shí)候,我還可以在010或是剩下的別的Bank中讀取數(shù)據(jù),這樣就減小了等待的時(shí)間,不用說(shuō)當(dāng)電路刷新時(shí),不能讀取數(shù)據(jù)了。

exynos板子上,每個(gè)bank大小= 256M/8=32M(1個(gè)芯片上有2^3個(gè)bank)

內(nèi)存計(jì)算方法

SDRAM容量計(jì)算

計(jì)算可尋址單元的數(shù)量(32位)

地址線數(shù)(管腳數(shù)):11(A0-A10)

bank線數(shù):2(BA0-BA1) 可以組合出2^2個(gè) bank

大行線數(shù)=211(例如地址線的編號(hào),11個(gè)管腳線,組合有211種)

大列線數(shù)=211(例如地址線的編號(hào),11個(gè)管腳線,組合有211種)

一個(gè)bank中總單元數(shù)=211x 211

芯片中總單元數(shù)=(bank個(gè)數(shù))×(一個(gè)bank中總單元數(shù))

= 22 x 211 x 211

= 224

備注:

因?yàn)樾芯與列線上傳輸?shù)臄?shù)據(jù)是經(jīng)過(guò)編碼(組合方式)的,而不是直接的行號(hào)和列號(hào),

也就是說(shuō)每個(gè)bank里有213 個(gè)行和 29 個(gè)列,并非只有13行和9列。

所以要尋址的單元在第(2行線數(shù)據(jù) )行,第( 2列線數(shù)據(jù))列。

例如bank0,行線數(shù)據(jù)是0 0000 0010 0000,列線數(shù)據(jù)是0 0000 1000,

意思是要獲取行32,列8的單元的數(shù)據(jù),而不是行5,列3的數(shù)據(jù)。

如果行線數(shù)據(jù)是 0 0010 1101 0110,列線數(shù)據(jù)是0 0011 1010,意思是獲取行726,列58的單元的數(shù)據(jù)。

例如一個(gè)32MB的SDRAM芯片中有4個(gè)Logic-bank(邏輯bank),位寬16bit(即每個(gè)單元是16bits),地址線13條,大行線數(shù)13,大列線數(shù)9。計(jì)算得:

一個(gè)bank的單元數(shù)= 213 x 29= 4194304(即4M)。

芯片總單元數(shù)=4Banks × 4M units = 16M units 。

芯片總位數(shù)=16M units × 16bits/per_unit = 256M bits 。

芯片總字節(jié)數(shù)=256M bits/8 = 32M Bytes 。

內(nèi)存初始化流程

在三星提供的數(shù)據(jù)手冊(cè)《SEC_Exynos4412_Users Manual_Ver.1.00.00》的第1046頁(yè)提供給了一段關(guān)于LPDDR2-S4的初始化步驟,LPDDR2表示低功耗DDR2,DDR3的初始化過(guò)程應(yīng)和這個(gè)一樣,我們就按這個(gè)過(guò)程來(lái)初始化DDR3

初始化流程,如手冊(cè)中 18.3.1 LPDDR2-S4 描述:

18.3.1 LPDDR2-S4

Use the sequence given here to initialize LPDDR2 devices. Unlessspecified otherwise, these steps are

mandatory. Note that the memory CK/CKn must be less than or equal to50 MHz before you initialize the

LPDDR2-S4 device.

1. DMC must assert and holdCKE to a logic low level to provide stable power for memory device and thenapply

stable clock.

2. Set thePhyControl0.ctrl_start_point and PhyControl0.ctrl_inc bit-fields to a correctvalue according to clock

frequency. Set the PhyControl0.ctrl_dll_on bit-field to"1" to activate the PHY DLL.

3. DQS cleaning: Set thePhyControl1.ctrl_shiftc and PhyControl1.ctrl_offsetc bit-fields to theappropriate value

according to clock frequency, board delay, and memory tDQSCKparameter.

4. Set thePhyControl0.ctrl_start bit-field to "1".

5. Set the ConControl. Atthis moment, an auto-refresh counter should be disabled.

6. Set the MemControl. Atthis moment, all power down modes should be disabled.

7. Set the MemConfig0register. When there are two external memory chips, set the MemConfig1register.

8. Set the PrechConfig andPwrdnConfig registers.

9. Set the TimingAref,TimingRow, TimingData, and TimingPower registers according to memory AC

parameters.

10. Set the QosControl0 to 15and QosConfig0 to 15 registers when a certain bus master requires QoS scheme.

11. Wait for thePhyStatus0.ctrl_locked bit-fields to change to "1". Verify whetherPHY DLL is locked.

PHY DLL compensates the changes of delay amount that pressure,volume, and temperature variation

causes during memory operation. Therefore, you should not power offPHY DLL for reliable operation.

It can be in power-off mode except when it runs at low frequency.When you use the power-off mode,

set the PhyControl0.ctrl_force bit-field to the correct valueaccording to the PhyStatus0.ctrl_lock_value[9:2]

bit-field for fix delay amount. Clear the PhyControl0.ctrl_dll_onbit-field to turn off PHY DLL.

12. Set thePhyControl1.fp_resync bit-field to "1" to update DLL information.

13. Confirm that Clock Enable(CKE) is in a logic low level at least 100ns after power on.

14. Issue a NOP command byusing the DirectCmd register to assert and hold CKE to a logic high level.

15. Wait for a minimum of 200ms.

16. Issue a MRS command byusing the DirectCmd register to reset memory devices and program the operating

parameters.

17. Wait for minimum of 1 μs.

18. Issue a MRR command byusing the DirectCmd register to poll the DAI bit of the MRStatus register.

This is to know whether or not Device Auto-Initialization iscomplete.

19. If there are two externalmemory chips, execute step 14 to 19 for chip1 memory device.

20. Set the ConControl toturn on an auto-refresh counter.

21. Set MemControl registerwhen you require power-down modes.

翻譯上面的步驟:

1、DMC功能必須設(shè)置,并且要保持CKE為低電平,以便可以提供穩(wěn)定的電源和時(shí)鐘給DDR

2、根據(jù)時(shí)鐘頻率設(shè)置PhyControl0.ctrl_start_point 和PhyControl0.ctrl_inc bit-fields,并且設(shè)置PhyControl0.ctrl_dll_on bit-field 為 "1" 已啟動(dòng)PHY DLL。

3、DQS 清除,根據(jù)時(shí)鐘頻率、板子延時(shí)和芯片的tDQSCK參數(shù)設(shè)置PhyControl1.ctrl_shiftc 和PhyControl1.ctrl_offsetcbit-fields。

4、設(shè)置 PhyControl0.ctrl_start bit-field 為"1"。

5、設(shè)置ConControl,此時(shí),不能使能自動(dòng)刷新計(jì)數(shù)器(auto-refresh counter )。

6. 設(shè)置MemControl,此時(shí),所有的power down模式應(yīng)關(guān)閉。

7、設(shè)置MemConfig0 寄存器,當(dāng)外面有兩片存儲(chǔ)芯片時(shí),設(shè)置MemConfig1寄存器。

8、設(shè)置 PrechConfig和 PwrdnConfig寄存器。

9、根據(jù)DDR3的 AC參數(shù)設(shè)置TimingAref, TimingRow, TimingData, 和 TimingPower寄存器。

10、當(dāng)總線主控者需要QoS時(shí)序參數(shù)時(shí),設(shè)置QosControl0 到15寄存器和QosConfig0 到 15寄存器。

11、等待 PhyStatus0.ctrl_locked bit-fields 變成 "1",以確定 PHY DLL 是否鎖定。PHY DLL 可以補(bǔ)償壓力、體積?和溫度等環(huán)境的變化,因?yàn)樵谛酒ぷ髌陂g,我們不能關(guān)閉了PHY DLL的電源,只有當(dāng)他在低的時(shí)鐘頻率時(shí)才可以切換到Power-off 模式,當(dāng)我們用power-off 模式,參考PhyStatus0.ctrl_lock_value[9:2]的延時(shí)參數(shù)來(lái)設(shè)置PhyControl0.ctrl_forcebit-field,清楚PhyControl0.ctrl_dll_on bit-field來(lái)關(guān)閉 PHY DLL。

12、設(shè)置PhyControl1.fp_resync bit-field 為 "1" 來(lái)更新 DLL的設(shè)置。

13、確保在電源上電后至少保持Clock Enable (CKE)在低電平100ns。

14、用DirectCmd 寄存器來(lái)執(zhí)行一條NOP指令且保持CKE 為高電平。

15、至少等待200us。

16、發(fā)出MRS指令來(lái)重新設(shè)置存儲(chǔ)芯片的操作參數(shù)。

17、至少等待1us。

18、用MRR指令來(lái)查詢MRStatus的寄存器的DAI位,用這們來(lái)確定自動(dòng)初始化過(guò)程是否完成。

19、如果外部有別的存儲(chǔ)芯片,重復(fù)執(zhí)行14到19步來(lái)設(shè)置芯片1。

20、設(shè)置ConControl來(lái)啟動(dòng)auto-refresh counter.

21、當(dāng)我們要進(jìn)行power-down模式,設(shè)置MemControl寄存器。

按照上邊的步驟來(lái)設(shè)置就可以完成DDR的初始化。

更多exynos4412內(nèi)存分析問題

Exynos4412特殊功能寄存器的封裝

上一篇:arm11開發(fā)板適合新手學(xué)習(xí)嗎

下一篇:Linux平臺(tái)下pci總線驅(qū)動(dòng)

熱點(diǎn)文章推薦
華清學(xué)員就業(yè)榜單
高薪學(xué)員經(jīng)驗(yàn)分享
熱點(diǎn)新聞推薦
前臺(tái)專線:010-82525158 企業(yè)培訓(xùn)洽談專線:010-82525379 院校合作洽談專線:010-82525379 Copyright © 2004-2022 北京華清遠(yuǎn)見科技集團(tuán)有限公司 版權(quán)所有 ,京ICP備16055225號(hào)-5,京公海網(wǎng)安備11010802025203號(hào)

回到頂部