32.210内存的知识

32.210内存的知识

210可寻址的空间是4GB大小,内存的起始地址是20000000,前面知道2440使用的内存是SDRAM,6410使用的内存是DDR,这里210使用的是DDR2.在210的地址空间中零地址处跟6410一样也是映射镜像区,例如当选择从NandFlash启动的使用,就会把IROM的空间映射到0地址处。

内存芯片连接:

在2440和6410两款芯片中,它们的数据宽度是16bits,为了得到32bits的数据宽度,采用的是两片芯片级联的方式。而210采用的数据宽度是8bits的,要扩张成32bits,所以需要4片级联。每一片的大小是128MB,有四片总大小512MB。有一些芯片是8片的,构成1GB*32的内存芯片。

芯片手册里DMC0对应的是上图中的DRAM0,DMC1对应DRAM1.

接下来就是初始化DRAM0这512MB内存。

初始化流程:

Initialization sequence for DDR2 memory type:

1. To provide stable power for controller and memory device, the controller must assert and hold CKE to a logic low level. Then apply stable clock. Note: XDDR2SEL should be High level to hold CKE to low.

2. Set the PhyControl0.ctrl_start_point and PhyControl0.ctrl_inc bit-fields to correct value according to clock frequency. Set the PhyControl0.ctrl_dll_on bit-field to ‘1‘ to turn on the PHY DLL.

3. DQS Cleaning: Set the PhyControl1.ctrl_shiftc and PhyControl1.ctrl_offsetc bit-fields to correct value according to clock frequency and memory tAC parameters.

4. Set the PhyControl0.ctrl_start bit-field to ‘1‘.

5. Set the ConControl. At this moment, an auto refresh counter should be off.

6. Set the MemControl. At this moment, all power down modes should be off.

7. Set the MemConfig0 register. If there are two external memory chips, set the MemConfig1 register.

8. Set the PrechConfig and PwrdnConfig registers.

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

10. If QoS scheme is required, set the QosControl0~15 and QosConfig0~15 registers.

11. Wait for the PhyStatus0.ctrl_locked bit-fields to change to ‘1‘. Check whether PHY DLL is locked.

12. PHY DLL compensates the changes of delay amount caused by Process, Voltage and Temperature (PVT) variation during memory operation. Therefore, PHY DLL should not be off for reliable operation. It can be off except runs at low frequency. If off mode is used, set the PhyControl0.ctrl_force bit-field to correct value according to the PhyStatus0.ctrl_lock_value[9:2] bit-field to fix delay amount. Clear the PhyControl0.ctrl_dll_on bit-field to turn off PHY DLL.

13. Confirm whether stable clock is issued minimum 200us after power on

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

15. Wait for minimum 400ns.

16. Issue a PALL command using the DirectCmd register.

17. Issue an EMRS2 command using the DirectCmd register to program the operating parameters.

18. Issue an EMRS3 command using the DirectCmd register to program the operating parameters.

19. Issue an EMRS command using the DirectCmd register to enable the memory DLLs.

20. Issue a MRS command using the DirectCmd register to reset the memory DLL.

21. Issue a PALL command using the DirectCmd register.

22. Issue two Auto Refresh commands using the DirectCmd register.

23. Issue a MRS command using the DirectCmd register to program the operating parameters without resetting the memory DLL.

24. Wait for minimum 200 clock cycles.

25. Issue an EMRS command using the DirectCmd register to program the operating parameters. If OCD calibration is not used, issue an EMRS command to set OCD Calibration Default. After that, issue an EMRS command to exit OCD Calibration Mode and to program the operating parameters.

26. If there are two external memory chips, perform steps 14~25 for chip1 memory device.

27. Set the ConControl to turn on an auto refresh counter. 28. If power down modes is required, set the MemControl registers.

先建立框架:

  1. 在原来的过程里创建一个mem.S文件:

  1. 在mem.S里声明一个全局的标号:

  1. 接着把mem.S加入到Makefile工程文件里:

4.是在start.S里加入内存初始化的标识:

5.编译一下,看看是否出错:

没有报错说明框架没问题,接下来就是mem.S的初始化代码。

1. To provide stable power for controller and memory device, the controller must assert and hold CKE to a logic low level. Then apply stable clock. Note: XDDR2SEL should be High level to hold CKE to low.

这是电源为控制器和内存设备提供稳定电压的要求,是硬件的,略过。

2. Set the PhyControl0.ctrl_start_point and PhyControl0.ctrl_inc bit-fields to correct value according to clock frequency. Set the PhyControl0.ctrl_dll_on bit-field to ‘1‘ to turn on the PHY DLL.

这里是要设置PhyControl0寄存器的ctrl_start_point位和ctrl_inc位,根据时钟频率,还有就是设置ctrl_dll_on来打开PHY DLL。

@ step 2.1

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101000

str    r1, [r0]

@ step 2.2

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101002

str    r1, [r0]

3. DQS Cleaning: Set the PhyControl1.ctrl_shiftc and PhyControl1.ctrl_offsetc bit-fields to correct value according to clock frequency and memory tAC parameters.

没有使用跳过。

4. Set the PhyControl0.ctrl_start bit-field to ‘1‘.

@ step 4

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101003

str    r1, [r0]

5. Set the ConControl. At this moment, an auto refresh counter should be off.

@ step 5

ldr    r0, =DMC_CONCONTROL

ldr    r1, =0x0FFF1350

str    r1, [r0]

6. Set the MemControl. At this moment, all power down modes should be off.

@ step 6

ldr    r0, =DMC_MEMCONTROL

ldr    r1, =DMC0_MEMCONTROL

str    r1, [r0]

7. Set the MemConfig0 register. If there are two external memory chips, set the MemConfig1 register.

@ step 7

ldr    r0, =DMC_MEMCONFIG0

ldr    r1, =DMC0_MEMCONFIG_0

str    r1, [r0]

8. Set the PrechConfig and PwrdnConfig registers.

@ step 8

ldr    r0, =DMC_PRECHCONFIG

ldr    r1, =0xFF000000

str    r1, [r0]

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

#define DMC_PHYCONTROL0 0xf0000018

#define DMC_PHYCONTROL1 0xf000001c

#define DMC_CONCONTROL 0xf0000000

#define DMC_MEMCONTROL 0xf0000004

#define DMC_MEMCONFIG0 0xf0000008

#define DMC_MEMCONFIG1 0xf000000c

#define DMC_PRECHCONFIG 0xf0000014

#define DMC_TIMINGAREF     0xf0000030

#define DMC_TIMINGROW     0xf0000034

#define DMC_TIMINGDATA     0xf0000038

#define DMC_TIMINGPOWER 0xf000003c

#define DMC_PHYSTATUS 0xf0000040

#define DMC_DIRECTCMD     0xf0000010

#define DMC_PWRDNCONFIG 0xf0000028

#define DMC0_MEMCONTROL            0x00202400

#define DMC0_MEMCONFIG_0        0x20F00313

#define DMC0_MEMCONFIG_1        0x00F00313

#define DMC0_TIMINGA_REF 0x00000618

#define DMC0_TIMING_ROW 0x2B34438A

#define DMC0_TIMING_DATA 0x24240000

#define DMC0_TIMING_PWR 0x0BDC0343

.globl mem_init

mem_init:

@ step 2.1 Set the PhyControl0.ctrl_start_point and PhyControl0.ctrl_inc

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101000

str    r1, [r0]

@ step 2.2 Set the PhyControl0.ctrl_dll_on bit-field to ‘1‘ to turn on the PHY DLL.

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101002    @是在上面的基础上修改

str    r1, [r0]

@ step 4

ldr    r0, =DMC_PHYCONTROL0

ldr    r1, =0x00101003

str    r1, [r0]

@ step 5

ldr    r0, =DMC_CONCONTROL

ldr    r1, =0x0FFF1350

str    r1, [r0]

@ step 6

ldr    r0, =DMC_MEMCONTROL

ldr    r1, =DMC0_MEMCONTROL

str    r1, [r0]

@ step 7

ldr    r0, =DMC_MEMCONFIG0

ldr    r1, =DMC0_MEMCONFIG_0

str    r1, [r0]

@ step 8

ldr    r0, =DMC_PRECHCONFIG

ldr    r1, =0xFF000000

str    r1, [r0]

@ step 9.1

ldr    r0, =DMC_TIMINGAREF

ldr    r1, =DMC0_TIMINGA_REF

str    r1, [r0]

@ step 9.2

ldr    r0, =DMC_TIMINGROW

ldr    r1, =DMC0_TIMING_ROW

str    r1, [r0]

@ step 9.3

ldr    r0, =DMC_TIMINGDATA

ldr    r1, =DMC0_TIMING_DATA

str    r1, [r0]

@ step 9.4

ldr    r0, =DMC_TIMINGPOWER

ldr    r1, =DMC0_TIMING_PWR

str    r1, [r0]

@ step 11

wait_lock:

ldr    r0, =DMC_PHYSTATUS

ldr    r1, [r0]

and    r2, r1, #0x4

cmp    r2, #0x4

bne    wait_lock

@ step 14

ldr    r0, =DMC_DIRECTCMD

ldr    r1, =0x07000000

str    r1, [r0]

@ step 16

ldr    r1, =0x01000000

str    r1, [r0]

@ step 17

ldr    r1, =0x00020000

str    r1, [r0]

@ step 18

ldr    r1, =0x00030000

str    r1, [r0]

@ step 19

ldr    r1, =0x00010400

str    r1, [r0]

@ step 20

ldr    r1, =0x00000542

str    r1, [r0]

@ step 21

ldr    r1, =0x01000000

str    r1, [r0]

@ step 22.1

ldr    r1, =0x05000000

str    r1, [r0]

@ step 22.2

ldr    r1, =0x05000000

str    r1, [r0]

@ step 23

ldr    r1, =0x00000442

str    r1, [r0]

@ step 25.1

ldr    r1, =0x00010780

str    r1, [r0]

@ step 25.2

ldr    r1, =0x00010400

str    r1, [r0]

@ step 26, repeat step14~step25

ldr    r1, =0x07100000

str    r1, [r0]

ldr    r1, =0x01100000

str    r1, [r0]

ldr    r1, =0x00120000

str    r1, [r0]

ldr    r1, =0x00130000

str    r1, [r0]

ldr    r1, =0x00110400

str    r1, [r0]

ldr    r1, =0x00100542

str    r1, [r0]

ldr    r1, =0x01100000

str    r1, [r0]

ldr    r1, =0x05100000

str    r1, [r0]

ldr    r1, =0x05100000

str    r1, [r0]

ldr    r1, =0x00100442

str    r1, [r0]

ldr    r1, =0x00110780

str    r1, [r0]

ldr    r1, =0x00110400

str    r1, [r0]

@ step 27

ldr r0, =DMC_CONCONTROL

ldr    r1, =0x0FF02030

str    r1, [r0]

ldr r0, =DMC_PWRDNCONFIG

ldr    r1, =0xFFFF00FF

str    r1, [r0]

ldr r0, =DMC_CONCONTROL

ldr    r1, =0x00202400

str    r1, [r0]

mov    pc, lr

时间: 2024-10-23 02:45:39

32.210内存的知识的相关文章

30.2440内存的知识

30.2440内存的知识 首先看2440的地址线:mini2440原理图.pdf 2440的芯片提供了27根地址线=128M. S3c2440芯片对外提供的引脚上,只给出了27根地址线addr[0:26].这27根引脚地址线,只能访问128M的外设空间. 为了扩大外设的访问范围,S3c2440芯片又提供了8个片选信号nGCS0~nGCS7.当某个片选信号nGCSx有效时,则可以通过27根地址线去访问对应这个片选的128MB空间.由于有8个片选,所以2440芯片能访问的外设空间总共为8*128MB

linux内存基础知识和相关调优方案

内存是计算机中重要的部件之一,它是与CPU进行沟通的桥梁.计算机中所有程序的运行都是在内存中进行的,因此内存的性能对计算机的影响非常大.内存作用是用于暂时存放CPU中的运算数据,以及与硬盘等外部存储器交换的数据.只要计算机在运行中,CPU就会把需要运算的数据调到内存中进行运算,当运算完成后CPU再将结果传送出来,内存的运行也决定了计算机的稳定运行.对于整个操作系统来说,内存可能是最麻烦的的设备.而其性能的好坏直接影响着整个操作系统. 我们知道CPU是不能与硬盘打交道的,只有数据被载入到内存中才可

31.6410内存的知识

31.6410内存的知识 6410的地址空间分布: S3C6410处理器拥32位地址总线,其寻址空间为.其中高为保留外设区,低2GB区域又可划分为两部分:主存储区和外设区. 外设主要是寄存器所在的地址. 主存储区分为:Boot镜像区.内部存储区.静态存储区.保留区.动态存储区: Boot镜像区:这个区域的作用正如它的名字所述,是用来启动ARM系统的.但是这个区域并没有固定的存储介质与之对应.而是通过修改启动选项,把不同的启动介质映射到该区域.比如说选择了IROM 启动方式后,就把IROM映射到该

每个Android开发者必须知道的内存管理知识

原文:每个Android开发者必须知道的内存管理知识 拷贝在此处,以备后续查看. 相信一步步走过来的Android从业者,每个人都会遇到OOM的情况.如何避免和防范OOM的出现,对于每一个程序员来说确实是一门必不可少的能力.今天我们就谈谈在Android平台下内存的管理之道,开始今天的主题之前,先再次回顾两个概念. 内存泄漏:对象在内存heap堆中中分配的空间,当不再使用或没有引用指向的情况下,仍不能被GC正常回收的情况.多数出现在不合理的编码情况下,比如在 Activity中注册了一个广播接收

SQL Server内存方面知识收集

浅谈SQL Server 对于内存的管理 http://www.cnblogs.com/CareySon/archive/2012/08/16/HowSQLServerManageMemory.html SQL Server内存方面知识收集

210内存初始化

210的地址空间,我们所能访问的内存从0x2000_0000开始 打开S5PV210的手册,像6410一样,6410有内存初始化的顺序,2410是不是也有?210用的是DDR2的内存,所以我们能在第五章节找到这个 这张图就是210内存的初始化顺序 1.是保证供电充足稳定,我们不用管这一条 2.设置PhyControl0寄存器的一些位ctrl_start_point.ctrl_inc.ctrl_dll_on ,这三个位.来找到这个寄存器 代码如下: 在前面要宏定义这个寄存器地址 #define D

转:c/c++内存释放知识总结

转自:http://www.cnblogs.com/chuncn/archive/2011/04/12/2014273.html 基础知识:五大内存分区 栈,就是那些由编译器在需要的时候分配,在不需要的时候自动清楚的变量的存储区.里面的变量通常是局部变量.函数参数等. 堆,就是那些由new分配的内存块,他们的释放编译器不去管,由我们的应用程序去控制,一般一个new就要对应一个delete.如果程序员没有释放掉,那么在程序结束后,操作系统会自动回收.(new char;  delete char;

32位汇编背景知识

目录 背景知识 GTDTR,是一个48位的寄存器, 指向的描述符表为全局描述符表GDT(Gloabl Descriptor Table) LDTR,是一个16位的寄存器,指向局部描述符表LDT(Local Descriptor Table),每个任务一个独立的LDT. 段选择器 内存分页机制 背景知识 以下说的知识皆以如非特别表明,皆说的是80386CPU 它的可寻址能力达到4GB 通过寄存器是32位 通用寄存器是32位的,2的32次方等于4GB,就可以使用一个通用寄存器来寻址,从而不必分段.虽

Linux系统基本的内存管理知识讲解

内存是Linux内核所管理的最重要的资源之一.内存管理系统是操作系统中最为重要的部分,因为系统的物理内存总是少于系统所需要的内存数量.虚拟内存就是为了克服这个矛盾而采用的策略.系统的虚拟内存通过在各个进程之间共享内存而使系统看起来有多于实际内存的内存容量.Linux支持虚拟内存, 就是使用磁盘作为RAM的扩展,使可用内存相应地有效扩大.核心把当前不用的内存块存到硬盘,腾出内存给其他目的.当原来的内容又要使用时,再读回内存. 一.内存使用情况监测 (1)实时监控内存使用情况 在命令行使用“Free