text stringlengths 0 234 |
|---|
VCO_Input := HSE_VALUE / UInt32 (RCC_Periph.PLLCFGR.PLLM); |
end if; |
if Input_Selector = 0 then |
-- PLLSAI is the clock source |
-- VCO out = VCO in & PLLSAIN |
-- SAI firstlevel = VCO out / PLLSAIQ |
SAI_First_Level := |
VCO_Input * UInt32 (RCC_Periph.PLLSAICFGR.PLLSAIN) / |
UInt32 (RCC_Periph.PLLSAICFGR.PLLSAIQ); |
-- SAI frequency is SAI First level / PLLSAIDIVQ |
return SAI_First_Level / UInt32 (RCC_Periph.DCKCFGR.PLLSAIDIVQ); |
else |
-- PLLI2S as clock source |
SAI_First_Level := |
VCO_Input * UInt32 (RCC_Periph.PLLI2SCFGR.PLLI2SN) / |
UInt32 (RCC_Periph.PLLI2SCFGR.PLLI2SQ); |
-- SAI frequency is SAI First level / PLLI2SDIVQ |
return SAI_First_Level / UInt32 (RCC_Periph.DCKCFGR.PLLIS2DIVQ + 1); |
end if; |
end Get_Input_Clock; |
------------------ |
-- Enable_Clock -- |
------------------ |
procedure Enable_Clock (This : in out SDMMC_Controller) |
is |
begin |
if This.Periph.all'Address /= SDIO_Base then |
raise Unknown_Device; |
end if; |
RCC_Periph.APB2ENR.SDIOEN := True; |
end Enable_Clock; |
----------- |
-- Reset -- |
----------- |
procedure Reset (This : in out SDMMC_Controller) |
is |
begin |
if This.Periph.all'Address /= SDIO_Base then |
raise Unknown_Device; |
end if; |
RCC_Periph.APB2RSTR.SDIORST := True; |
RCC_Periph.APB2RSTR.SDIORST := False; |
end Reset; |
---------------------- |
-- Set_Clock_Source -- |
---------------------- |
procedure Set_Clock_Source |
(This : in out SDMMC_Controller; |
Src : SDIO_Clock_Source) |
is |
Src_Val : constant Boolean := Src = Src_Sysclk; |
begin |
if This.Periph.all'Address /= SDIO_Base then |
raise Unknown_Device; |
end if; |
RCC_Periph.DCKCFGR.SDMMCSEL := Src_Val; |
case Src is |
when Src_Sysclk => |
STM32.SDMMC.Set_Clk_Src_Speed |
(This, System_Clock_Frequencies.SYSCLK); |
when Src_48Mhz => |
STM32.SDMMC.Set_Clk_Src_Speed |
(This, 48_000_000); |
end case; |
end Set_Clock_Source; |
------------------------------ |
-- System_Clock_Frequencies -- |
------------------------------ |
function System_Clock_Frequencies return RCC_System_Clocks |
is |
Source : constant UInt2 := RCC_Periph.CFGR.SWS; |
Result : RCC_System_Clocks; |
begin |
Result.I2SCLK := 0; |
case Source is |
when 0 => |
-- HSI as source |
Result.SYSCLK := HSI_VALUE; |
when 1 => |
-- HSE as source |
Result.SYSCLK := HSE_VALUE; |
when 2 => |
-- PLL as source |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.