<> PWR to Power, SPI to SPIs, I2C to I2Cs

This commit is contained in:
Vovanium 2024-01-18 19:27:00 +03:00
parent f30bda5286
commit 60a84e01dc
15 changed files with 88 additions and 88 deletions

View File

@ -25,19 +25,19 @@ package body Board.LCD.SPI_IO is
SPI_RCC_RST := False;
declare
R : Chip.SPI.Base.Control_Register_1 := SPI_Module.CR1;
R : Chip.SPIs.SPI_Base.Control_Register_1 := SPI_Module.CR1;
begin
R.BR := Chip.SPI.Base.PCLK_DIV_16;
R.CPHA := Chip.SPI.Base.Late_Clock;
R.CPOL := Chip.SPI.Base.Positive_Clock;
R.DFF := Chip.SPI.Base.Frame_8_Bit;
R.BR := Chip.SPIs.SPI_Base.PCLK_DIV_16;
R.CPHA := Chip.SPIs.SPI_Base.Late_Clock;
R.CPOL := Chip.SPIs.SPI_Base.Positive_Clock;
R.DFF := Chip.SPIs.SPI_Base.Frame_8_Bit;
R.LSBFIRST := False;
R.SSM := True;
R.SSI := True;
R.MSTR := Chip.SPI.Base.Master;
R.MSTR := Chip.SPIs.SPI_Base.Master;
R.SPE := True;
R.RXONLY := False;
R.BIDIMODE := Chip.SPI.Base.Unidirectional;
R.BIDIMODE := Chip.SPIs.SPI_Base.Unidirectional;
R.BIDIOE := True;
R.CRCEN := False;
R.CRCNEXT := False;
@ -46,9 +46,9 @@ package body Board.LCD.SPI_IO is
end;
declare
R : Chip.SPI.Base.Control_Register_2 := SPI_Module.CR2;
R : Chip.SPIs.SPI_Base.Control_Register_2 := SPI_Module.CR2;
begin
R.FRF := Chip.SPI.Base.Motorola_Mode;
R.FRF := Chip.SPIs.SPI_Base.Motorola_Mode;
SPI_Module.CR2 := R;
end;

View File

@ -1,5 +1,5 @@
with Chip.SPI;
use Chip.SPI;
with Chip.SPIs;
use Chip.SPIs;
package Board.LCD is
@ -18,7 +18,7 @@ package Board.LCD is
SDA_Port : GPIO_Registers renames GPIOF;
SDA_Bit : constant Port_Bit_Number := 9;
SPI_Module : Chip.SPI.Base.SPI_Registers renames SPI5;
SPI_Module : Chip.SPIs.SPI_Base.SPI_Registers renames SPI5;
SPI_AF : Chip.GPIO.GPIO_Base.Alternate_Function renames Chip.GPIO.GPIO_Base.Alternate_Functions.SPI5;
SPI_RCC_EN : Boolean renames RCC.APB2ENR (Index.SPI5);

View File

@ -1,7 +1,7 @@
package body Board.SPI.IO is
procedure Transmit_Receive (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_16;
Input : out Interfaces.Unsigned_16)
is
@ -26,7 +26,7 @@ package body Board.SPI.IO is
end;
procedure Transmit (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_16)
is
pragma Warnings (Off, "variable ""X"" is assigned but never read");
@ -37,7 +37,7 @@ package body Board.SPI.IO is
end;
procedure Transmit_Receive (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_8;
Input : out Interfaces.Unsigned_8)
is
@ -48,7 +48,7 @@ package body Board.SPI.IO is
end;
procedure Transmit (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_8)
is
pragma Warnings (Off, "variable ""X"" is assigned but never read");

View File

@ -1,21 +1,21 @@
with Interfaces;
with STM32.SPI;
with STM32.SPIs;
package Board.SPI.IO is
procedure Transmit_Receive (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_16;
Input : out Interfaces.Unsigned_16);
procedure Transmit (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_16);
procedure Transmit_Receive (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_8;
Input : out Interfaces.Unsigned_8);
procedure Transmit (
Unit : in out STM32.SPI.SPI_Registers;
Unit : in out STM32.SPIs.SPI_Registers;
Output : Interfaces.Unsigned_8);
end Board.SPI.IO;

View File

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

View File

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

View File

@ -1,18 +1,18 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.SPI;
with STM32.SPIs;
package STM32.F407.SPI is
package STM32.F407.SPIs is
package Base renames STM32.SPI;
package SPI_Base renames STM32.SPIs;
SPI1 : aliased Base.SPI_Registers with Volatile, Import,
SPI1 : aliased SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI1);
SPI2 : aliased Base.SPI_Registers with Volatile, Import,
SPI2 : aliased SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI2_I2S2);
SPI3 : aliased Base.SPI_Registers with Volatile, Import,
SPI3 : aliased SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI3_I2S3);
end STM32.F407.SPI;
end STM32.F407.SPIs;

View File

@ -1,18 +1,18 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.I2C;
with STM32.I2Cs;
package STM32.F429.I2C is
package STM32.F429.I2Cs is
package Base renames STM32.I2C;
package I2C_Base renames STM32.I2Cs;
I2C1 : Base.I2C_Registers with Volatile, Import,
I2C1 : I2C_Base.I2C_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C1);
I2C2 : Base.I2C_Registers with Volatile, Import,
I2C2 : I2C_Base.I2C_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C2);
I2C3 : Base.I2C_Registers with Volatile, Import,
I2C3 : I2C_Base.I2C_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C3);
end STM32.F429.I2C;
end STM32.F429.I2Cs;

View File

@ -0,0 +1,5 @@
with STM32.F407.Power;
package STM32.F429.Power renames STM32.F407.Power;
-- todo: differentiate

View File

@ -1,5 +0,0 @@
with STM32.F407.PWR;
package STM32.F429.PWR renames STM32.F407.PWR;
-- todo: differentiate

View File

@ -1,30 +0,0 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.SPI;
package STM32.F429.SPI is
package Base renames STM32.SPI;
SPI1 : Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI1);
SPI2 : Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI2_I2S2);
SPI3 : Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI3_I2S3);
SPI4 : Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI4);
SPI5 : Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI5);
SPI6 : Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI6);
I2S2 : Base.SPI_Registers renames SPI2;
I2S3 : Base.SPI_Registers renames SPI3;
end STM32.F429.SPI;

View File

@ -0,0 +1,30 @@
with System.Storage_Elements;
with STM32.Address_Map;
with STM32.SPIs;
package STM32.F429.SPIs is
package SPI_Base renames STM32.SPIs;
SPI1 : SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI1);
SPI2 : SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI2_I2S2);
SPI3 : SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI3_I2S3);
SPI4 : SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI4);
SPI5 : SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI5);
SPI6 : SPI_Base.SPI_Registers with Volatile, Import,
Address => System.Storage_Elements.To_Address (STM32.Address_Map.SPI6);
I2S2 : SPI_Base.SPI_Registers renames SPI2;
I2S3 : SPI_Base.SPI_Registers renames SPI3;
end STM32.F429.SPIs;

View File

@ -1,4 +1,4 @@
package STM32.I2C with Pure is
package STM32.I2Cs with Pure is
-- CR1
@ -268,4 +268,4 @@ package STM32.I2C with Pure is
FLTR at 16#24# range 0 .. 15;
end record;
end STM32.I2C;
end STM32.I2Cs;

View File

@ -1,4 +1,4 @@
package STM32.PWR with Pure is
package STM32.Power with Pure is
type PVD_Level is (
PVD_2_0_V,
@ -127,4 +127,4 @@ package STM32.PWR with Pure is
CSR at 16#04# range 0 .. 31;
end record;
end STM32.PWR;
end STM32.Power;

View File

@ -1,4 +1,4 @@
package STM32.SPI with Pure is
package STM32.SPIs with Pure is
type Clock_Phase is (
Late_Clock, -- First clock transition is the first data capture edge
@ -300,4 +300,4 @@ package STM32.SPI with Pure is
I2SPR at 16#20# range 0 .. 15;
end record;
end STM32.SPI;
end STM32.SPIs;