>< simplify: I2C and FM+I2C modules have their unit addresses in same package
This commit is contained in:
parent
e6d3e75332
commit
bc0483d055
|
@ -13,35 +13,36 @@ package STM32.Address_Map with Pure is
|
|||
|
||||
-- APB1
|
||||
APB1 : constant := 16#4000_0000#;
|
||||
TIM2 : constant := 16#4000_0000#;
|
||||
TIM3 : constant := 16#4000_0400#;
|
||||
TIM4 : constant := 16#4000_0800#;
|
||||
TIM5 : constant := 16#4000_0C00#;
|
||||
TIM6 : constant := 16#4000_1000#;
|
||||
TIM7 : constant := 16#4000_1400#;
|
||||
TIM12 : constant := 16#4000_1800#;
|
||||
TIM13 : constant := 16#4000_1C00#;
|
||||
TIM14 : constant := 16#4000_2000#;
|
||||
RTC_and_BKP : constant := 16#4000_2800#;
|
||||
WWDG : constant := 16#4000_2C00#;
|
||||
IWDG : constant := 16#4000_3000#;
|
||||
I2S2ext : constant := 16#4000_3400#;
|
||||
SPI2_I2S2 : constant := 16#4000_3800#;
|
||||
SPI3_I2S3 : constant := 16#4000_3C00#;
|
||||
I2S3ext : constant := 16#4000_4000#;
|
||||
USART2 : constant := 16#4000_4400#;
|
||||
USART3 : constant := 16#4000_4800#;
|
||||
UART4 : constant := 16#4000_4C00#;
|
||||
UART5 : constant := 16#4000_5000#;
|
||||
I2C1 : constant := 16#4000_5400#;
|
||||
I2C2 : constant := 16#4000_5800#;
|
||||
I2C3 : constant := 16#4000_5C00#;
|
||||
CAN1 : constant := 16#4000_6400#;
|
||||
CAN2 : constant := 16#4000_6800#;
|
||||
PWR : constant := 16#4000_7000#;
|
||||
DAC : constant := 16#4000_7400#;
|
||||
UART7 : constant := 14#4000_7800#;
|
||||
UART8 : constant := 14#4000_7C00#;
|
||||
TIM2 : constant := 16#4000_0000#;
|
||||
TIM3 : constant := 16#4000_0400#;
|
||||
TIM4 : constant := 16#4000_0800#;
|
||||
TIM5 : constant := 16#4000_0C00#;
|
||||
TIM6 : constant := 16#4000_1000#;
|
||||
TIM7 : constant := 16#4000_1400#;
|
||||
TIM12 : constant := 16#4000_1800#;
|
||||
TIM13 : constant := 16#4000_1C00#;
|
||||
TIM14 : constant := 16#4000_2000#;
|
||||
RTC_and_BKP : constant := 16#4000_2800#;
|
||||
WWDG : constant := 16#4000_2C00#;
|
||||
IWDG : constant := 16#4000_3000#;
|
||||
I2S2ext : constant := 16#4000_3400#;
|
||||
SPI2_I2S2 : constant := 16#4000_3800#;
|
||||
SPI3_I2S3 : constant := 16#4000_3C00#;
|
||||
I2S3ext : constant := 16#4000_4000#;
|
||||
USART2 : constant := 16#4000_4400#;
|
||||
USART3 : constant := 16#4000_4800#;
|
||||
UART4 : constant := 16#4000_4C00#;
|
||||
UART5 : constant := 16#4000_5000#;
|
||||
I2C1 : constant := 16#4000_5400#;
|
||||
I2C2 : constant := 16#4000_5800#;
|
||||
I2C3 : constant := 16#4000_5C00#;
|
||||
FMPI2C1 : constant := 16#4000_6000#;
|
||||
CAN1 : constant := 16#4000_6400#;
|
||||
CAN2 : constant := 16#4000_6800#;
|
||||
PWR : constant := 16#4000_7000#;
|
||||
DAC : constant := 16#4000_7400#;
|
||||
UART7 : constant := 14#4000_7800#;
|
||||
UART8 : constant := 14#4000_7C00#;
|
||||
|
||||
-- APB2
|
||||
APB2 : constant := 16#4001_0000#;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
with System.Storage_Elements;
|
||||
with STM32.Address_Map;
|
||||
with STM32.I2Cs;
|
||||
|
||||
package STM32.F429.I2Cs is
|
||||
|
||||
package I2C_Base renames STM32.I2Cs;
|
||||
|
||||
I2C1 : I2C_Base.I2C_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C1);
|
||||
|
||||
I2C2 : I2C_Base.I2C_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C2);
|
||||
|
||||
I2C3 : I2C_Base.I2C_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C3);
|
||||
|
||||
end STM32.F429.I2Cs;
|
|
@ -1,54 +1,62 @@
|
|||
package STM32.Fast_Mode_Plus_I2Cs with Pure is
|
||||
with System.Storage_Elements;
|
||||
with STM32.Address_Map;
|
||||
|
||||
-- Fast Mode+ I2C controllers
|
||||
--
|
||||
-- These units exist in models F410, F412, F413, F423 and F446.
|
||||
-- They're identical through all listed models.
|
||||
|
||||
package STM32.Fast_Mode_Plus_I2Cs is
|
||||
|
||||
-- CR1
|
||||
|
||||
type Control_Register_1 is record
|
||||
PE : Boolean := False; -- Peripheral inable
|
||||
TXIE : Boolean := False; -- Transmitter interrupt enable
|
||||
RXIE : Boolean := False; -- Receiver interrupt enable
|
||||
ADDRE : Boolean := False; -- Address match interrupt enable
|
||||
NACKIE : Boolean := False; -- Not acknowledge interrupt enable
|
||||
STOPIE : Boolean := False; -- Stop detection interrupt enable
|
||||
TCIE : Boolean := False; -- Transfer complete interrupt enable
|
||||
ERRIE : Boolean := False; -- Error detection interrupts enable
|
||||
DNF : Integer range 0 .. 15 := 0; -- Digital filter period
|
||||
ANFOFF : Boolean := False; -- Disable analog noise filter
|
||||
Reserved_13 : Integer range 0 .. 1 := 0;
|
||||
TXDMAEN : Boolean := False; -- Transmit DMA requests enable
|
||||
RXDMAEN : Boolean := False; -- Receive DMA resuqests enable
|
||||
SBC : Boolean := False; -- Slave byte control
|
||||
NOSTRETCH : Boolean := False; -- Clock stretching disable
|
||||
WUPEN : Boolean := False; -- Undocumented?
|
||||
GCEN : Boolean := False; -- General call ACK enable
|
||||
SMBHEN : Boolean := False; -- SMBus host address enable
|
||||
SMBDEN : Boolean := False; -- SMBus device default address enable
|
||||
ALERTEN : Boolean := False; -- SMBus alert enable
|
||||
PECEN : Boolean := False; -- PEC calculation enable
|
||||
Reserved_24 : Integer range 0 .. 2**8 - 1 := 0;
|
||||
PE : Boolean := False; -- Peripheral inable
|
||||
TXIE : Boolean := False; -- Transmitter interrupt enable
|
||||
RXIE : Boolean := False; -- Receiver interrupt enable
|
||||
ADDRE : Boolean := False; -- Address match interrupt enable
|
||||
NACKIE : Boolean := False; -- Not acknowledge interrupt enable
|
||||
STOPIE : Boolean := False; -- Stop detection interrupt enable
|
||||
TCIE : Boolean := False; -- Transfer complete interrupt enable
|
||||
ERRIE : Boolean := False; -- Error detection interrupts enable
|
||||
DNF : Integer range 0 .. 15 := 0; -- Digital filter period
|
||||
ANFOFF : Boolean := False; -- Disable analog noise filter
|
||||
Unused_13 : Unused_1_Bit := 0;
|
||||
TXDMAEN : Boolean := False; -- Transmit DMA requests enable
|
||||
RXDMAEN : Boolean := False; -- Receive DMA resuqests enable
|
||||
SBC : Boolean := False; -- Slave byte control
|
||||
NOSTRETCH : Boolean := False; -- Clock stretching disable
|
||||
WUPEN : Boolean := False; -- Undocumented?
|
||||
GCEN : Boolean := False; -- General call ACK enable
|
||||
SMBHEN : Boolean := False; -- SMBus host address enable
|
||||
SMBDEN : Boolean := False; -- SMBus device default address enable
|
||||
ALERTEN : Boolean := False; -- SMBus alert enable
|
||||
PECEN : Boolean := False; -- PEC calculation enable
|
||||
Unused_24 : Unused_8_Bits := 0;
|
||||
end record with Size => 32;
|
||||
for Control_Register_1 use record
|
||||
PE at 0 range 0 .. 0;
|
||||
TXIE at 0 range 1 .. 1;
|
||||
RXIE at 0 range 2 .. 2;
|
||||
ADDRE at 0 range 3 .. 3;
|
||||
NACKIE at 0 range 4 .. 4;
|
||||
STOPIE at 0 range 5 .. 5;
|
||||
TCIE at 0 range 6 .. 6;
|
||||
ERRIE at 0 range 7 .. 7;
|
||||
DNF at 0 range 8 .. 11;
|
||||
ANFOFF at 0 range 12 .. 12;
|
||||
Reserved_13 at 0 range 13 .. 13;
|
||||
TXDMAEN at 0 range 14 .. 14;
|
||||
RXDMAEN at 0 range 15 .. 15;
|
||||
SBC at 0 range 16 .. 16;
|
||||
NOSTRETCH at 0 range 17 .. 17;
|
||||
WUPEN at 0 range 18 .. 18;
|
||||
GCEN at 0 range 19 .. 19;
|
||||
SMBHEN at 0 range 20 .. 20;
|
||||
SMBDEN at 0 range 21 .. 21;
|
||||
ALERTEN at 0 range 22 .. 22;
|
||||
PECEN at 0 range 23 .. 23;
|
||||
Reserved_24 at 0 range 24 .. 31;
|
||||
for Control_Register_1 use record -- F410,F412 F4x3,F446
|
||||
PE at 0 range 0 .. 0; -- + +
|
||||
TXIE at 0 range 1 .. 1; -- + +
|
||||
RXIE at 0 range 2 .. 2; -- + +
|
||||
ADDRE at 0 range 3 .. 3; -- + +
|
||||
NACKIE at 0 range 4 .. 4; -- + +
|
||||
STOPIE at 0 range 5 .. 5; -- + +
|
||||
TCIE at 0 range 6 .. 6; -- + +
|
||||
ERRIE at 0 range 7 .. 7; -- + +
|
||||
DNF at 0 range 8 .. 11; -- + +
|
||||
ANFOFF at 0 range 12 .. 12; -- + +
|
||||
Unused_13 at 0 range 13 .. 13;
|
||||
TXDMAEN at 0 range 14 .. 14; -- + +
|
||||
RXDMAEN at 0 range 15 .. 15; -- + +
|
||||
SBC at 0 range 16 .. 16; -- + +
|
||||
NOSTRETCH at 0 range 17 .. 17; -- + +
|
||||
WUPEN at 0 range 18 .. 18; -- + -
|
||||
GCEN at 0 range 19 .. 19; -- + +
|
||||
SMBHEN at 0 range 20 .. 20; -- + +
|
||||
SMBDEN at 0 range 21 .. 21; -- + +
|
||||
ALERTEN at 0 range 22 .. 22; -- + +
|
||||
PECEN at 0 range 23 .. 23; -- + +
|
||||
Unused_24 at 0 range 24 .. 31;
|
||||
end record;
|
||||
|
||||
-- CR2
|
||||
|
@ -292,4 +300,12 @@ package STM32.Fast_Mode_Plus_I2Cs with Pure is
|
|||
TXDR at 16#28# range 0 .. 31;
|
||||
end record;
|
||||
|
||||
FMPI2C1 : aliased FMPI2C_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.FMPI2C1);
|
||||
|
||||
I2C4 : FMPI2C_Registers renames FMPI2C1;
|
||||
|
||||
-- Device user manuals use different names for these units,
|
||||
-- but they're the same.
|
||||
|
||||
end STM32.Fast_Mode_Plus_I2Cs;
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
package STM32.I2Cs with Pure is
|
||||
with System.Storage_Elements;
|
||||
with STM32.Address_Map;
|
||||
|
||||
-- Inter-Integrated Circuit Interface Controllers
|
||||
--
|
||||
-- These units are the same through the whole STM32F4 family
|
||||
-- The only difference is FLTR register is absent in some models
|
||||
|
||||
package STM32.I2Cs is
|
||||
|
||||
-- CR1
|
||||
|
||||
|
@ -241,6 +249,9 @@ package STM32.I2Cs with Pure is
|
|||
Reserved at 0 range 5 .. 15;
|
||||
end record;
|
||||
|
||||
-- note: FLTR only present in models F413, F415, F417, F42x, F43x, F44x, F469 and F479
|
||||
-- FLTR is absent in F40x, F410, F411, and F412
|
||||
|
||||
--
|
||||
|
||||
type I2C_Registers is record
|
||||
|
@ -268,4 +279,15 @@ package STM32.I2Cs with Pure is
|
|||
FLTR at 16#24# range 0 .. 15;
|
||||
end record;
|
||||
|
||||
--
|
||||
|
||||
I2C1 : aliased I2C_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C1);
|
||||
|
||||
I2C2 : aliased I2C_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C2);
|
||||
|
||||
I2C3 : aliased I2C_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.I2C3);
|
||||
|
||||
end STM32.I2Cs;
|
||||
|
|
Loading…
Reference in New Issue