>< FMC > Flexible_Memory_Controller, FSMC > Flexible_Static_Memory_Controller

This commit is contained in:
Vovanium 2024-01-19 21:05:39 +03:00
parent b473a6e937
commit 54d35ea285
8 changed files with 43 additions and 42 deletions

View File

@ -1,4 +1,5 @@
with Chip.FMC; use Chip.FMC, Chip.FMC.Base;
with Chip.Flexible_Memory_Controller;
use Chip.Flexible_Memory_Controller, Chip.Flexible_Memory_Controller.FMC_Base;
-- with STM32.RCC; use STM32.RCC;
-- with STM32.GPIO; use STM32.GPIO;
with Ada.Real_Time; use Ada.Real_Time;
@ -7,8 +8,8 @@ package body Board.Memory is
procedure Send_Command (R : SDRAM.Command_Mode_Register) is
begin
FMC_HW.SDCMR := R;
while FMC_HW.SDSR.BUSY loop
FMC.SDCMR := R;
while FMC.SDSR.BUSY loop
null;
end loop;
end;
@ -149,17 +150,17 @@ package body Board.Memory is
-- 1. SDCRx Registers
declare
R : SDRAM.Control_Register := FMC_HW.SDCR1;
R : SDRAM.Control_Register := FMC.SDCR1;
begin
R.SDCLK := SDRAM.Period_2_HCLK;
R.RBURST := False;
R.RPIPE := 1;
FMC_HW.SDCR1 := R;
FMC.SDCR1 := R;
end;
declare
R : SDRAM.Control_Register := FMC_HW.SDCR2;
R : SDRAM.Control_Register := FMC.SDCR2;
begin
R.NC := SDRAM.Column_8_Bits;
R.NR := SDRAM.Row_12_Bits;
@ -168,22 +169,22 @@ package body Board.Memory is
R.CAS := 3;
R.WP := False;
FMC_HW.SDCR2 := R;
FMC.SDCR2 := R;
end;
-- 2. SDTRx Registers
declare
R : SDRAM.Timing_Register := FMC_HW.SDTR1;
R : SDRAM.Timing_Register := FMC.SDTR1;
begin
R.TRC := 7 - 1;
R.TRP := 2 - 1;
FMC_HW.SDTR1 := R;
FMC.SDTR1 := R;
end;
declare
R : SDRAM.Timing_Register := FMC_HW.SDTR2;
R : SDRAM.Timing_Register := FMC.SDTR2;
begin
R.TMRD := 2 - 1;
R.TXSR := 7 - 1;
@ -191,7 +192,7 @@ package body Board.Memory is
R.TWR := 2 - 1;
R.TRCD := 2 - 1;
FMC_HW.SDTR2 := R;
FMC.SDTR2 := R;
end;
-- 3. Set MODE to 001 and Target Bank Bits
@ -246,10 +247,10 @@ package body Board.Memory is
-- 8. Program refresh rate
declare
R : SDRAM.Refresh_Timer_Register := FMC_HW.SDRTR;
R : SDRAM.Refresh_Timer_Register := FMC.SDRTR;
begin
R.COUNT := 16#056A#;
FMC_HW.SDRTR := R;
FMC.SDRTR := R;
end;
-- 9. Mobile SDRAM configure Extended mode register

View File

@ -0,0 +1,12 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.Flexible_Static_Memory_Controller;
package STM32.F407.Flexible_Static_Memory_Controller is
package FSMC_Base renames STM32.Flexible_Static_Memory_Controller;
FSMC : FSMC_Base.FSMC_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.FMC_FSMC);
end STM32.F407.Flexible_Static_Memory_Controller;

View File

@ -1,12 +0,0 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.FSMC;
package STM32.F407.FSMC is
package Base renames STM32.FSMC;
FSMC_HW : Base.FSMC_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.FMC_FSMC);
end STM32.F407.FSMC;

View File

@ -0,0 +1,12 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.Flexible_Memory_Controller;
package STM32.F429.Flexible_Memory_Controller is
package FMC_Base renames STM32.Flexible_Memory_Controller;
FMC : FMC_Base.FMC_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.FMC_FSMC);
end STM32.F429.Flexible_Memory_Controller;

View File

@ -1,12 +0,0 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.FMC;
package STM32.F429.FMC is
package Base renames STM32.FMC;
FMC_HW : Base.FMC_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.FMC_FSMC);
end STM32.F429.FMC;

View File

@ -1,4 +1,4 @@
package STM32.FMC with Pure is
package STM32.Flexible_Memory_Controller with Pure is
type Memory_Width is (
Memory_8_Bits,
@ -155,7 +155,7 @@ package STM32.FMC with Pure is
NAND_Flash => 1
);
subtype Memory_Width is FMC.Memory_Width range Memory_8_Bits .. Memory_16_Bits;
subtype Memory_Width is Flexible_Memory_Controller.Memory_Width range Memory_8_Bits .. Memory_16_Bits;
type ECC_Page_Size is (
ECC_Page_256_Bytes,
@ -548,4 +548,4 @@ package STM32.FMC with Pure is
SDSR at 16#0158# range 0 .. 31;
end record;
end STM32.FMC;
end STM32.Flexible_Memory_Controller;

View File

@ -0,0 +1,2 @@
with STM32.Flexible_Memory_Controller;
package STM32.Flexible_Static_Memory_Controller renames STM32.Flexible_Memory_Controller;

View File

@ -1,2 +0,0 @@
with STM32.FMC;
package STM32.FSMC renames STM32.FMC;