>< RCC renamed to Reset_and_Clock
This commit is contained in:
parent
6fb8e67ed4
commit
63e54d2753
|
@ -5,13 +5,13 @@ package Board.UART is
|
|||
TX_Bit : constant Port_Bit_Number := 9;
|
||||
RX_Bit : constant Port_Bit_Number := 10;
|
||||
|
||||
Port_RCC_EN : Boolean renames RCC_HW.AHB1ENR(Index.GPIOA);
|
||||
Port_RCC_RST : Boolean renames RCC_HW.AHB1RSTR(Index.GPIOA);
|
||||
Port_RCC_EN : Boolean renames RCC.AHB1ENR (Index.GPIOA);
|
||||
Port_RCC_RST : Boolean renames RCC.AHB1RSTR (Index.GPIOA);
|
||||
|
||||
AF : Alternate_Function renames Alternate_Functions.USART1;
|
||||
|
||||
Module : Chip.USARTs.USART_Base.USART_Registers renames Chip.USARTs.USART1;
|
||||
|
||||
RCC_EN : Boolean renames RCC_HW.APB2ENR(Index.USART1);
|
||||
RCC_RST : Boolean renames RCC_HW.APB2RSTR(Index.USART1);
|
||||
RCC_EN : Boolean renames RCC.APB2ENR (Index.USART1);
|
||||
RCC_RST : Boolean renames RCC.APB2RSTR (Index.USART1);
|
||||
end Board.UART;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
with Chip.GPIO, Chip.RCC;
|
||||
with Chip.GPIO, Chip.Reset_and_Clock;
|
||||
|
||||
package Board is
|
||||
use Chip.GPIO, Chip.GPIO.GPIO_Base, Chip.RCC;
|
||||
use Chip.GPIO, Chip.GPIO.GPIO_Base, Chip.Reset_and_Clock;
|
||||
|
||||
LED_Port : GPIO_Registers renames GPIOD;
|
||||
LED_Bit : constant Port_Bit_Number := 3;
|
||||
LED_On : constant Boolean := False;
|
||||
|
||||
LED_RCC_EN : Boolean renames RCC_HW.AHB1ENR (Index.GPIOD);
|
||||
LED_RCC_EN : Boolean renames RCC.AHB1ENR (Index.GPIOD);
|
||||
|
||||
APB2_Frequency : constant := 84_000_000; -- Set by board support
|
||||
end Board;
|
|
@ -1,8 +1,8 @@
|
|||
with Chip.RCC;
|
||||
with Chip.Reset_and_Clock;
|
||||
|
||||
with STM32.RCC.Frequencies;
|
||||
with STM32.Reset_and_Clock.Frequencies;
|
||||
|
||||
package Board.Frequencies is new STM32.RCC.Frequencies (
|
||||
package Board.Frequencies is new STM32.Reset_and_Clock.Frequencies (
|
||||
HSE_Frequency => HSE_Frequency,
|
||||
RCC => Chip.RCC.RCC_HW
|
||||
RCC => Chip.Reset_and_Clock.RCC
|
||||
);
|
|
@ -7,8 +7,8 @@ with Board.Frequencies;
|
|||
package body Board.LCD.Controller is
|
||||
procedure Initialize_Pins is
|
||||
begin
|
||||
RCC_HW.AHB1ENR (Index.GPIOA .. Index.GPIOD) := (others => True);
|
||||
RCC_HW.AHB1ENR (Index.GPIOF .. Index.GPIOG) := (others => True);
|
||||
RCC.AHB1ENR (Index.GPIOA .. Index.GPIOD) := (others => True);
|
||||
RCC.AHB1ENR (Index.GPIOF .. Index.GPIOG) := (others => True);
|
||||
|
||||
-- PA3 B5
|
||||
-- PA4 VSYNC
|
||||
|
@ -122,24 +122,24 @@ package body Board.LCD.Controller is
|
|||
procedure Initialize_Pixel_Clock is
|
||||
SAI_F : constant := 192_000_000;
|
||||
SAI_R : Natural;
|
||||
SAI_DIVR : Chip.RCC.RCC_Base.PLLSAI_Division_Factor;
|
||||
SAI_DIVR : Chip.Reset_and_Clock.RCC_Base.PLLSAI_Division_Factor;
|
||||
Pixel_F : constant := 6_000_000;
|
||||
begin
|
||||
-- Disable
|
||||
RCC_HW.CR.PLLSAION := False;
|
||||
RCC.CR.PLLSAION := False;
|
||||
-- Wait SAI disabled
|
||||
while RCC_HW.CR.PLLSAIRDY loop
|
||||
while RCC.CR.PLLSAIRDY loop
|
||||
null;
|
||||
end loop;
|
||||
-- Configure register
|
||||
RCC_HW.PLLSAICFGR.N := Board.Frequencies.PLLSAI_N (SAI_F);
|
||||
RCC.PLLSAICFGR.N := Board.Frequencies.PLLSAI_N (SAI_F);
|
||||
Board.Frequencies.LCD_R(Pixel_F, SAI_R, SAI_DIVR);
|
||||
RCC_HW.PLLSAICFGR.R := SAI_R; --4;
|
||||
RCC_HW.DCKCFGR.PLLSAIDIVR := SAI_DIVR; --PLLSAI_Div_8;
|
||||
RCC.PLLSAICFGR.R := SAI_R; --4;
|
||||
RCC.DCKCFGR.PLLSAIDIVR := SAI_DIVR; --PLLSAI_Div_8;
|
||||
-- Enable
|
||||
RCC_HW.CR.PLLSAION := True;
|
||||
RCC.CR.PLLSAION := True;
|
||||
-- Wait SAI ready
|
||||
while not RCC_HW.CR.PLLSAIRDY loop
|
||||
while not RCC.CR.PLLSAIRDY loop
|
||||
null;
|
||||
end loop;
|
||||
end;
|
||||
|
@ -186,9 +186,9 @@ package body Board.LCD.Controller is
|
|||
Initialize_Pins;
|
||||
|
||||
-- Enable LTDC clock
|
||||
RCC_HW.APB2ENR (Index.LTDC) := True;
|
||||
RCC_HW.APB2RSTR (Index.LTDC) := True;
|
||||
RCC_HW.APB2RSTR (Index.LTDC) := False;
|
||||
RCC.APB2ENR (Index.LTDC) := True;
|
||||
RCC.APB2RSTR (Index.LTDC) := True;
|
||||
RCC.APB2RSTR (Index.LTDC) := False;
|
||||
|
||||
-- Configure Pixel clock
|
||||
Initialize_Pixel_Clock;
|
||||
|
|
|
@ -53,9 +53,9 @@ package body Board.LCD.SPI_IO is
|
|||
end;
|
||||
|
||||
-- Enabling pins
|
||||
RCC_HW.AHB1ENR (Index.GPIOC) := True;
|
||||
RCC_HW.AHB1ENR (Index.GPIOD) := True;
|
||||
RCC_HW.AHB1ENR (Index.GPIOF) := True;
|
||||
RCC.AHB1ENR (Index.GPIOC) := True;
|
||||
RCC.AHB1ENR (Index.GPIOD) := True;
|
||||
RCC.AHB1ENR (Index.GPIOF) := True;
|
||||
|
||||
CSX.Set_MODER (Output_Mode);
|
||||
CSX.Set_OSPEEDR (Very_High_Speed);
|
||||
|
|
|
@ -21,7 +21,7 @@ package Board.LCD is
|
|||
SPI_Module : Chip.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_HW.APB2ENR (Index.SPI5);
|
||||
SPI_RCC_RST : Boolean renames RCC_HW.APB2RSTR (Index.SPI5);
|
||||
SPI_RCC_EN : Boolean renames RCC.APB2ENR (Index.SPI5);
|
||||
SPI_RCC_RST : Boolean renames RCC.APB2RSTR (Index.SPI5);
|
||||
|
||||
end Board.LCD;
|
|
@ -18,11 +18,11 @@ package body Board.Memory is
|
|||
begin
|
||||
-- 64 Mbit SDRAM IS42S16400J
|
||||
|
||||
RCC_HW.AHB3ENR (Index.FMC) := True;
|
||||
RCC.AHB3ENR (Index.FMC) := True;
|
||||
|
||||
-- Pins first
|
||||
|
||||
RCC_HW.AHB1ENR (Index.GPIOB .. Index.GPIOG) := (others => True);
|
||||
RCC.AHB1ENR (Index.GPIOB .. Index.GPIOG) := (others => True);
|
||||
|
||||
-- PB5 CKE1
|
||||
-- PB6 NE1
|
||||
|
|
|
@ -6,14 +6,14 @@ package Board.UART is
|
|||
TX_Bit : constant Port_Bit_Number := 9;
|
||||
RX_Bit : constant Port_Bit_Number := 10;
|
||||
|
||||
Port_RCC_EN : Boolean renames RCC_HW.AHB1ENR (Index.GPIOA);
|
||||
Port_RCC_RST : Boolean renames RCC_HW.AHB1RSTR (Index.GPIOA);
|
||||
Port_RCC_EN : Boolean renames RCC.AHB1ENR (Index.GPIOA);
|
||||
Port_RCC_RST : Boolean renames RCC.AHB1RSTR (Index.GPIOA);
|
||||
|
||||
AF : Alternate_Function renames Alternate_Functions.USART1;
|
||||
|
||||
Module : Chip.USARTs.USART_Base.USART_Registers renames Chip.USARTs.USART1;
|
||||
|
||||
RCC_EN : Boolean renames RCC_HW.APB2ENR (Index.USART1);
|
||||
RCC_RST : Boolean renames RCC_HW.APB2RSTR (Index.USART1);
|
||||
RCC_EN : Boolean renames RCC.APB2ENR (Index.USART1);
|
||||
RCC_RST : Boolean renames RCC.APB2RSTR (Index.USART1);
|
||||
|
||||
end Board.UART;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
with Chip.GPIO, Chip.RCC;
|
||||
with Chip.GPIO, Chip.Reset_and_Clock;
|
||||
|
||||
package Board is
|
||||
use Chip.GPIO, Chip.GPIO.GPIO_Base, Chip.RCC;
|
||||
use Chip.GPIO, Chip.GPIO.GPIO_Base, Chip.Reset_and_Clock;
|
||||
|
||||
-- LED
|
||||
|
||||
|
@ -9,13 +9,13 @@ package Board is
|
|||
LED_Bit : constant Port_Bit_Number := 13;
|
||||
LED_On : constant Boolean := True;
|
||||
|
||||
LED_RCC_EN : Boolean renames RCC_HW.AHB1ENR (Index.GPIOG);
|
||||
LED_RCC_EN : Boolean renames RCC.AHB1ENR (Index.GPIOG);
|
||||
|
||||
LED_2_Port : GPIO_Registers renames GPIOG;
|
||||
LED_2_Bit : constant Port_Bit_Number := 14;
|
||||
LED_2_On : constant Boolean := True;
|
||||
|
||||
LED_2_RCC_EN : Boolean renames RCC_HW.AHB1ENR (Index.GPIOG);
|
||||
LED_2_RCC_EN : Boolean renames RCC.AHB1ENR (Index.GPIOG);
|
||||
|
||||
-- More internals
|
||||
HSE_Frequency : constant := 8_000_000;
|
||||
|
|
|
@ -3,8 +3,8 @@ use Ada.Interrupts.Names;
|
|||
--with System.Storage_Elements;
|
||||
--use type System.Storage_Elements.Storage_Offset;
|
||||
|
||||
with Chip.RCC;
|
||||
use Chip.RCC;
|
||||
with Chip.Reset_and_Clock;
|
||||
use Chip.Reset_and_Clock;
|
||||
|
||||
with Chip.DMA2D;
|
||||
use Chip.DMA2D, Chip.DMA2D.Base;
|
||||
|
@ -95,9 +95,9 @@ package body Blit is
|
|||
|
||||
begin
|
||||
|
||||
RCC_HW.AHB1ENR (Index.DMA2D) := True;
|
||||
RCC_HW.AHB1RSTR (Index.DMA2D) := True;
|
||||
RCC_HW.AHB1RSTR (Index.DMA2D) := False;
|
||||
RCC.AHB1ENR (Index.DMA2D) := True;
|
||||
RCC.AHB1RSTR (Index.DMA2D) := True;
|
||||
RCC.AHB1RSTR (Index.DMA2D) := False;
|
||||
|
||||
declare
|
||||
R : Control_Register := DMA2D_HW.CR;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
with Board; use Board;
|
||||
|
||||
with STM32.RCC; use STM32.RCC;
|
||||
with STM32.GPIO; use STM32.GPIO;
|
||||
with STM32.GPIO.Ports; use STM32.GPIO.Ports;
|
||||
with Ada.Real_Time; use Ada.Real_Time;
|
||||
with STM32.Reset_and_Clock; use STM32.Reset_and_Clock;
|
||||
with STM32.GPIO; use STM32.GPIO;
|
||||
with STM32.GPIO.Ports; use STM32.GPIO.Ports;
|
||||
with Ada.Real_Time; use Ada.Real_Time;
|
||||
|
||||
procedure LED_Flasher is
|
||||
Period: constant Time_Span := Milliseconds(250);
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
with System.Storage_Elements;
|
||||
with STM32.Address_Map;
|
||||
with STM32.RCC;
|
||||
|
||||
package STM32.F407.RCC is
|
||||
|
||||
package RCC_Base renames STM32.RCC;
|
||||
|
||||
package Index renames RCC_Base.Index;
|
||||
|
||||
RCC_HW : RCC_Base.RCC_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.RCC);
|
||||
|
||||
end STM32.F407.RCC;
|
|
@ -0,0 +1,14 @@
|
|||
with System.Storage_Elements;
|
||||
with STM32.Address_Map;
|
||||
with STM32.Reset_and_Clock;
|
||||
|
||||
package STM32.F407.Reset_and_Clock is
|
||||
|
||||
package RCC_Base renames STM32.Reset_and_Clock;
|
||||
|
||||
package Index renames RCC_Base.Index;
|
||||
|
||||
RCC : RCC_Base.RCC_Registers with Volatile, Import,
|
||||
Address => System.Storage_Elements.To_Address (STM32.Address_Map.RCC);
|
||||
|
||||
end STM32.F407.Reset_and_Clock;
|
|
@ -1,4 +0,0 @@
|
|||
with STM32.F407.RCC;
|
||||
package STM32.F429.RCC renames STM32.F407.RCC;
|
||||
|
||||
-- todo: differentiate
|
|
@ -0,0 +1,4 @@
|
|||
with STM32.F407.Reset_and_Clock;
|
||||
package STM32.F429.Reset_and_Clock renames STM32.F407.Reset_and_Clock;
|
||||
|
||||
-- todo: differentiate
|
|
@ -1,5 +1,5 @@
|
|||
with STM32.Address_Map;
|
||||
package body STM32.RCC.Frequencies is
|
||||
package body STM32.Reset_and_Clock.Frequencies is
|
||||
|
||||
type Product is range 0 .. 500_000_000_000; -- Big enough
|
||||
|
||||
|
@ -154,4 +154,4 @@ package body STM32.RCC.Frequencies is
|
|||
end case;
|
||||
end;
|
||||
|
||||
end STM32.RCC.Frequencies;
|
||||
end STM32.Reset_and_Clock.Frequencies;
|
|
@ -4,7 +4,7 @@ generic
|
|||
LSE_Frequency : Natural := 32_768;
|
||||
LSI_Frequency : Natural := 32_000;
|
||||
RCC : RCC_Registers;
|
||||
package STM32.RCC.Frequencies is
|
||||
package STM32.Reset_and_Clock.Frequencies is
|
||||
function VCO_Input_Frequency return Natural;
|
||||
function PLLCLK_Frequency return Natural;
|
||||
function USB_Frequency return Natural;
|
||||
|
@ -21,4 +21,4 @@ package STM32.RCC.Frequencies is
|
|||
function PLLI2S_N (Frequency : Natural) return Natural;
|
||||
function PLLSAI_N (Frequency : Natural) return Natural;
|
||||
procedure LCD_R (Frequency : Natural; R : out Natural; DIVR : out PLLSAI_Division_Factor);
|
||||
end STM32.RCC.Frequencies;
|
||||
end STM32.Reset_and_Clock.Frequencies;
|
|
@ -1,4 +1,4 @@
|
|||
package STM32.RCC with Pure is
|
||||
package STM32.Reset_and_Clock with Pure is
|
||||
|
||||
-- CR
|
||||
HSITRIM_Default : constant Integer := 16#10#; -- This constant comes from HAL
|
||||
|
@ -675,4 +675,4 @@ package STM32.RCC with Pure is
|
|||
DCKCFGR at 16#8C# range 0 .. 31;
|
||||
end record;
|
||||
|
||||
end STM32.RCC;
|
||||
end STM32.Reset_and_Clock;
|
Loading…
Reference in New Issue