📄 mpmc_pl175_ddr.s_lauto.svn-base
字号:
AREA PL175_INIT, CODE, READONLY ; /*****************************************************************************; * *; * Defines for ST SDRAM delay line. *; * The register are in apb_configuration * ; * *; *****************************************************************************/;APBCfgBase EQU 0x30000400APBCfgBase EQU 0x12001000SDRAM_OUTPUT_CLOCK_DELAY EQU APBCfgBase + 0x050 ; // Base + 50SDRAM_INTPUT_CLOCK_DELAY EQU APBCfgBase + 0x054 ; // Base + 54SDRAM_FB_CLOCK_SOURCE EQU APBCfgBase + 0x058 ; // Base + 58; /*****************************************************************************; * *; * Defines for MPMC PL175. *; * *; *****************************************************************************/;MPMCBase EQU 0x2000A000MPMCBase EQU 0x1000C000MPMCControl EQU MPMCBase + 0x000 ; Control register MPMCStatus EQU MPMCBase + 0x004 ; Status register MPMCConfig EQU MPMCBase + 0x008 ; Configuration register MPMCDynamicControl EQU MPMCBase + 0x020 ; Dynamic memory control registerMPMCDynamicRefresh EQU MPMCBase + 0x024 ; Dynamic memory refresh timerMPMCDynamicReadConfig EQU MPMCBase + 0x028 ; Read Data Configuration RegisterMPMCDynamictRP EQU MPMCBase + 0x030 ; Dynamic memory precharge command period (tRP)MPMCDynamictRAS EQU MPMCBase + 0x034 ; Dynamic memory precharge period (tRAS)MPMCDynamictSREX EQU MPMCBase + 0x038 ; Dynamic memory self refresh exit time (tSREX)MPMCDynamictWR EQU MPMCBase + 0x044 ; Dynamic memory write recovery time (tWR)MPMCDynamictRC EQU MPMCBase + 0x048 ; Dynamic memory auto refresh and active command period (tRC)MPMCDynamictRFC EQU MPMCBase + 0x04c ; Dynamic memory auto refresh period, and auto refresh to active command period (tRFC)MPMCDynamictXSR EQU MPMCBase + 0x050 ; Dynamic memory exit self refresh to active command time (tXSR)MPMCDynamictRRD EQU MPMCBase + 0x054 ; Dynamic memory active bank A to active B time (tRRD)MPMCDynamictMRD EQU MPMCBase + 0x058 ; Dynamic memory load mode register to active command time (tMRD)MPMCDynamictCDLR EQU MPMCBase + 0x05c ; Dynamic memory write to read command time (tCDLR)MPMCStaticExtendedWait EQU MPMCBase + 0x080 ; Static memory extended wait; Dynamic memory bank registers MPMCDynamicConfig0 EQU MPMCBase + 0x100 ; Dynamic memory configuration registerMPMCDynamicRasCas0 EQU MPMCBase + 0x104 ; Dynamic memory RAS and CAS delayMPMCDynamicConfig1 EQU MPMCBase + 0x120 ; Dynamic memory configuration registerMPMCDynamicRasCas1 EQU MPMCBase + 0x124 ; Dynamic memory RAS and CAS delayMPMCDynamicConfig2 EQU MPMCBase + 0x140 ; Dynamic memory configuration registerMPMCDynamicRasCas2 EQU MPMCBase + 0x144 ; Dynamic memory RAS and CAS delayMPMCDynamicConfig3 EQU MPMCBase + 0x160 ; Dynamic memory configuration registerMPMCDynamicRasCas3 EQU MPMCBase + 0x164 ; Dynamic memory RAS and CAS delay ; Static memory bank registers MPMCStaticConfig0 EQU MPMCBase + 0x200 ; Static memory configuration registerMPMCStaticWaitWen0 EQU MPMCBase + 0x204 ; Static memory write enable delayMPMCStaticWaitOen0 EQU MPMCBase + 0x208 ; Static memory output enable delayMPMCStaticWaitRd0 EQU MPMCBase + 0x20c ; Static memory read delayMPMCStaticWaitPage0 EQU MPMCBase + 0x210 ; Static memory page mode read delayMPMCStaticWaitWr0 EQU MPMCBase + 0x214 ; Static memory write delayMPMCStaticWaitTurn0 EQU MPMCBase + 0x218 ; Static memory turn round delayMPMCStaticConfig1 EQU MPMCBase + 0x220 ; Static memory configuration registerMPMCStaticWaitWen1 EQU MPMCBase + 0x224 ; Static memory write enable delayMPMCStaticWaitOen1 EQU MPMCBase + 0x228 ; Static memory output enable delayMPMCStaticWaitRd1 EQU MPMCBase + 0x22c ; Static memory read delayMPMCStaticWaitPage1 EQU MPMCBase + 0x230 ; Static memory page mode read delayMPMCStaticWaitWr1 EQU MPMCBase + 0x234 ; Static memory write delayMPMCStaticWaitTurn1 EQU MPMCBase + 0x238 ; Static memory turn round delayMPMCStaticConfig2 EQU MPMCBase + 0x240 ; Static memory configuration registerMPMCStaticWaitWen2 EQU MPMCBase + 0x244 ; Static memory write enable delayMPMCStaticWaitOen2 EQU MPMCBase + 0x248 ; Static memory output enable delayMPMCStaticWaitRd2 EQU MPMCBase + 0x24c ; Static memory read delayMPMCStaticWaitPage2 EQU MPMCBase + 0x250 ; Static memory page mode read delayMPMCStaticWaitWr2 EQU MPMCBase + 0x254 ; Static memory write delayMPMCStaticWaitTurn2 EQU MPMCBase + 0x258 ; Static memory turn round delayMPMCStaticConfig3 EQU MPMCBase + 0x260 ; Static memory configuration registerMPMCStaticWaitWen3 EQU MPMCBase + 0x264 ; Static memory write enable delayMPMCStaticWaitOen3 EQU MPMCBase + 0x268 ; Static memory output enable delayMPMCStaticWaitRd3 EQU MPMCBase + 0x26c ; Static memory read delayMPMCStaticWaitPage3 EQU MPMCBase + 0x270 ; Static memory page mode read delayMPMCStaticWaitWr3 EQU MPMCBase + 0x274 ; Static memory write delayMPMCStaticWaitTurn3 EQU MPMCBase + 0x278 ; Static memory turn round delay; AHB port registers MPMCAHBControl0 EQU MPMCBase + 0x400 ; AHB control register MPMCAHBStatus0 EQU MPMCBase + 0x404 ; AHB status register MPMCAHBTimeOut0 EQU MPMCBase + 0x408 ; AHB time out register MPMCAHBControl1 EQU MPMCBase + 0x420 ; AHB control register MPMCAHBStatus1 EQU MPMCBase + 0x424 ; AHB status register MPMCAHBTimeOut1 EQU MPMCBase + 0x428 ; AHB time out register MPMCAHBControl2 EQU MPMCBase + 0x440 ; AHB control register MPMCAHBStatus2 EQU MPMCBase + 0x444 ; AHB status register MPMCAHBTimeOut2 EQU MPMCBase + 0x448 ; AHB time out register MPMCAHBControl3 EQU MPMCBase + 0x460 ; AHB control register MPMCAHBStatus3 EQU MPMCBase + 0x464 ; AHB status register MPMCAHBTimeOut3 EQU MPMCBase + 0x468 ; AHB time out register MPMCAHBControl4 EQU MPMCBase + 0x480 ; AHB control register MPMCAHBStatus4 EQU MPMCBase + 0x484 ; AHB status register MPMCAHBTimeOut4 EQU MPMCBase + 0x488 ; AHB time out register MPMCAHBControl5 EQU MPMCBase + 0x4a0 ; AHB control register MPMCAHBStatus5 EQU MPMCBase + 0x4a4 ; AHB status register MPMCAHBTimeOut5 EQU MPMCBase + 0x4a8 ; AHB time out register MPMCTestControl EQU MPMCBase + 0xf00 ; Test control registerMPMCTestInput0 EQU MPMCBase + 0xf20 ; Test input registerMPMCTestInput1 EQU MPMCBase + 0xf24 ; Test input registerMPMCTestOutput EQU MPMCBase + 0xf40 ; Test output registerMPMCPeriphID4 EQU MPMCBase + 0xfd0 ; Peripheral identification register bits [39:32]MPMCPeriphID5 EQU MPMCBase + 0xfd4 ; Reserved for peripheral identification registerMPMCPeriphID6 EQU MPMCBase + 0xfd8 ; Reserved for peripheral identification registerMPMCPeriphID7 EQU MPMCBase + 0xfdc ; Reserved for peripheral identification registerMPMCPeriphID0 EQU MPMCBase + 0xfe0 ; Peripheral identification register bits [7:0]MPMCPeriphID1 EQU MPMCBase + 0xfe4 ; Peripheral identification register bits [15:8]MPMCPeriphID2 EQU MPMCBase + 0xfe8 ; Peripheral identification register bits [23:16]MPMCPeriphID3 EQU MPMCBase + 0xfec ; Peripheral identification register bits [31:24]MPMCCellID0 EQU MPMCBase + 0xff0 ; PrimeCell identification register bits [7:0]MPMCCellID1 EQU MPMCBase + 0xff4 ; PrimeCell identification register bits [15:8]MPMCCellID2 EQU MPMCBase + 0xff8 ; PrimeCell identification register bits [23:16]MPMCCellID3 EQU MPMCBase + 0xffc ; PrimeCell identification register bits [31:24];/*; * Company: Micron Technology, Inc.; * Part Number: MT46V64M16 (16 Mb x 16 x 4 Banks); *; * tCK : TIME := 7.500 ns;; * tCH : TIME := 3.375 ns; -- 0.45*tCK; * tCL : TIME := 3.375 ns; -- 0.45*tCK; * tDH : TIME := 0.500 ns;; * tDS : TIME := 0.500 ns;; * tIH : TIME := 0.900 ns;; * tIS : TIME := 0.900 ns;; * tMRD : TIME := 15.000 ns;; * tRAS : TIME := 40.000 ns;; * tRAP : TIME := 20.000 ns;; * tRC : TIME := 65.000 ns;; * tRFC : TIME := 75.000 ns;; * tRCD : TIME := 20.000 ns;; * tRP : TIME := 20.000 ns;; * tRRD : TIME := 15.000 ns;; * tWR : TIME := 15.000 ns;; * addr_bits : INTEGER := 14;; * data_bits : INTEGER := 16;; * cols_bits : INTEGER := 10; */PL175_DYNAMIC_REFRESH_TIME_INIT EQU 50 ;160 modified by m.c.PL175_DYNAMIC_REFRESH_TIME EQU (PL175_DYNAMIC_REFRESH_TIME_INIT + 5)PL175_DYNAMIC_TRP_INIT EQU 1PL175_DYNAMIC_TRAS_INIT EQU 4PL175_DYNAMIC_TSREX_INIT EQU 6PL175_DYNAMIC_TWR_INIT EQU 2PL175_DYNAMIC_TRC_INIT EQU 5PL175_DYNAMIC_TRFC_INIT EQU 8PL175_DYNAMIC_TXSR_INIT EQU 6PL175_DYNAMIC_TRRD_INIT EQU 2PL175_DYNAMIC_TMRD_INIT EQU 2PL175_DYNAMIC_TCDLR_INIT EQU 15STATIC_EXTENDED_WAIT_INIT EQU 50STATIC_EXTENDED_WAIT EQU (STATIC_EXTENDED_WAIT_INIT + 5)PL175_RAS_CAS_LATENCY EQU 0x0202 ; RAS LAT 2clk - CAS LAT 2clk;PL175_CONFIG EQU 0x884 ; DDR_SDRAM - NOT_WRITE_PROTECTED - 512MB_13_10_RBC_16BITPL175_CONFIG EQU 0x684 ; DDR_SDRAM - NOT_WRITE_PROTECTED - 256MB_13_9_RBC_16BIT;PL175_CONFIG EQU 0x880 ; SDR_SDRAM - NOT_WRITE_PROTECTED - (32Mx16)_4bnks_16BITextPAUSE_POWER_UP_INIT EQU 100 ; unit is usecPAUSE_MEM_INIT EQU 200 ; unit is usecPAUSE_REFRESH_INIT EQU 40 ; unit is usec;PAUSE_POWER_UP_INIT EQU 0 ; TEST - do not wait;PAUSE_MEM_INIT EQU 0 ; TEST - do not wait;PAUSE_REFRESH_INIT EQU 0 ; TEST - do not waitPL175_ENDIANITY EQU 0 ; little endianPL175_DATA_STRATEGY EQU 0x1313 ; SDR : (CMD_DELAYED + CAPTURE_POSITIVE);PL175_DATA_STRATEGY EQU 0x1212 ; SDR : (CMD_DELAYED + CAPTURE_POSITIVE) ; DDR : (CMD_DELAYED + CAPTURE_POSITIVE)uSDRAMModeConfig EQU 0x00021000 ;0x10121000 ;0x00042000 ; Mode reg is 0x21uSDRAMExtModeConfig EQU 0x00000400 ;0x00002000 uDDRResetModeConfig EQU 0x00000600 EXPORT PL175_init_DDR;/*************************************************************************/;/* */;/* FUNCTION */;/* */;/* PL175_init_DDR */;/* */;/* DESCRIPTION */;/* */;/* This routine initializes the DRAM Controller. */;/* */;/* AUTHOR */;/* */;/* A. Visconti - ST Microelectronics */;/* */;/*************************************************************************/;VOID PL175_init_DDR(void);{ ; This code can be optimized using multiple store... PL175_init_DDR ROUT MOV v1, lr ; Save lr ;/* Program the delay line (2.5 ns) */ ;LDR a1, =SDRAM_INTPUT_CLOCK_DELAY ;MOV a2, #0x18 ;STR a2, [a1, #0] ;LDR a1, =SDRAM_OUTPUT_CLOCK_DELAY ;MOV a2, #0x18 ;STR a2, [a1, #0] ;/* Initial wait to ensure stable power, clock */ ;apOS_TIMER_Wait( pInitial->PausePowerUp ); LDR a1, =PAUSE_POWER_UP_INIT ; BL TimerWait ; /* Set up Normal Memory Map */ ; ((PL175_sRegisters *) eBase)->Control = ; apBIT_BUILD( PL175_CONTROL_E, apPL175_DEVICE_ENABLED ) | ; apBIT_BUILD( PL175_CONTROL_L, apPL175_OPERATE_NORMAL_MODE ); LDR a2, =0x1 LDR a1, =MPMCControl STR a2, [a1, #0] ; /* Set Dynamic memory clock enable, issue NOP command ; * and for Micron SyncFlash set the RP value HIGH ; */ ; ((PL175_sRegisters *) eBase)->DynamicControl = ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_CE, apPL175_CLK_DRIVEN_HIGH ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_CS, apPL175_CLKOUT_RUNS ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_SR, apPL175_NORMAL_MODE ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_SRMCC, apPL175_CLKOUT_SREF_RUN ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_IMCC, apPL175_NCLKOUT_ENABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_MCC, apPL175_CLKOUT_ENABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_I, apPL175_INIT_NOP ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_DC, apPL175_DLL_HANDSHAKING_DISABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_DE, apPL175_DLL_HANDSHAKING_DISABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_DP, apPL175_NORMAL_OPERATION ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_NRP, apPL175_RP_HIGH ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_RPV, apPL175_RPVHH_NORMAL ); LDR a2, =0x018b LDR a1, =MPMCDynamicControl STR a2, [a1, #0] ; /* Wait */ ; apOS_TIMER_Wait( pInitial->PauseMemInit ); LDR a1, =PAUSE_MEM_INIT ; BL TimerWait ;/* Issue PALL */ ;((PL175_sRegisters *) eBase)->DynamicControl = ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_CE, apPL175_CLK_DRIVEN_HIGH ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_CS, apPL175_CLKOUT_RUNS ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_SR, apPL175_NORMAL_MODE ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_SRMCC, apPL175_CLKOUT_SREF_RUN ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_IMCC, apPL175_NCLKOUT_ENABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_MCC, apPL175_CLKOUT_ENABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_I, apPL175_INIT_PALL ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_DC, apPL175_DLL_HANDSHAKING_DISABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_DE, apPL175_DLL_HANDSHAKING_DISABLED ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_DP, apPL175_NORMAL_OPERATION ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_NRP, apPL175_RP_HIGH ) | ; apBIT_BUILD( PL175_DYNAMIC_CONTROL_RPV, apPL175_RPVHH_NORMAL ); LDR a2, =0x010b LDR a1, =MPMCDynamicControl STR a2, [a1, #0] ; /* Set initial refresh timer value */ ; ((PL175_sRegisters *) eBase)->DynamicRefresh = PL175_REFRESH_INIT; LDR a2, =0x2 LDR a1, =MPMCDynamicRefresh STR a2, [a1, #0] ; /* Wait */ ; apOS_TIMER_Wait( pInitial->PauseRefresh ); LDR a1, =PAUSE_REFRESH_INIT; BL TimerWait ; /* Program the operational value into the refresh timer */ ; ((PL175_sRegisters *) eBase)->DynamicRefresh = pInitial->sConfig.DynamicRefreshTime; LDR a2, =PL175_DYNAMIC_REFRESH_TIME_INIT LDR a1, =MPMCDynamicRefresh STR a2, [a1, #0] ; /* Program MPMCConfig register */ ; ((PL175_sRegisters *) eBase)->Config = ; apBIT_BUILD( PL175_CONFIG_N, pInitial->sConfig.eEndianMode ); LDR a2, =PL175_ENDIANITY LDR a1, =MPMCConfig STR a2, [a1, #0] ; /* Program MPMCReadConfig register */ ; ((PL175_sRegisters *) eBase)->DynamicReadConfig = ; apBIT_BUILD( PL175_READ_DATA_SRD , pInitial->sConfig.eReadDataStrategySDR) | ; apBIT_BUILD( PL175_READ_DATA_SRP , pInitial->sConfig.eReadDataPolaritySDR) | ; apBIT_BUILD( PL175_READ_DATA_DRD , pInitial->sConfig.eReadDataStrategyDDR) | ; apBIT_BUILD( PL175_READ_DATA_DRP , pInitial->sConfig.eReadDataPolarityDDR) ; LDR a2, =PL175_DATA_STRATEGY LDR a1, =MPMCDynamicReadConfig STR a2, [a1, #0] ; /* Program MPMCDynamictRP register */ ; ((PL175_sRegisters *) eBase)->DynamictRP = pInitial->sConfig.DynamictRP; LDR a2, =PL175_DYNAMIC_TRP_INIT LDR a1, =MPMCDynamictRP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -