text
stringlengths 0
234
|
|---|
else
|
raise Unknown_Device;
|
end if;
|
end Enable_Clock;
|
-----------
|
-- Reset --
|
-----------
|
procedure Reset (This : in out Timer) is
|
begin
|
if This'Address = TIM1_Base then
|
RCC_Periph.APB2RSTR.TIM1RST := True;
|
RCC_Periph.APB2RSTR.TIM1RST := False;
|
elsif This'Address = TIM2_Base then
|
RCC_Periph.APB1RSTR.TIM2RST := True;
|
RCC_Periph.APB1RSTR.TIM2RST := False;
|
elsif This'Address = TIM3_Base then
|
RCC_Periph.APB1RSTR.TIM3RST := True;
|
RCC_Periph.APB1RSTR.TIM3RST := False;
|
elsif This'Address = TIM4_Base then
|
RCC_Periph.APB1RSTR.TIM4RST := True;
|
RCC_Periph.APB1RSTR.TIM4RST := False;
|
elsif This'Address = TIM5_Base then
|
RCC_Periph.APB1RSTR.TIM5RST := True;
|
RCC_Periph.APB1RSTR.TIM5RST := False;
|
elsif This'Address = TIM6_Base then
|
RCC_Periph.APB1RSTR.TIM6RST := True;
|
RCC_Periph.APB1RSTR.TIM6RST := False;
|
elsif This'Address = TIM7_Base then
|
RCC_Periph.APB1RSTR.TIM7RST := True;
|
RCC_Periph.APB1RSTR.TIM7RST := False;
|
elsif This'Address = TIM8_Base then
|
RCC_Periph.APB2RSTR.TIM8RST := True;
|
RCC_Periph.APB2RSTR.TIM8RST := False;
|
elsif This'Address = TIM9_Base then
|
RCC_Periph.APB2RSTR.TIM9RST := True;
|
RCC_Periph.APB2RSTR.TIM9RST := False;
|
elsif This'Address = TIM10_Base then
|
RCC_Periph.APB2RSTR.TIM10RST := True;
|
RCC_Periph.APB2RSTR.TIM10RST := False;
|
elsif This'Address = TIM11_Base then
|
RCC_Periph.APB2RSTR.TIM11RST := True;
|
RCC_Periph.APB2RSTR.TIM11RST := False;
|
elsif This'Address = TIM12_Base then
|
RCC_Periph.APB1RSTR.TIM12RST := True;
|
RCC_Periph.APB1RSTR.TIM12RST := False;
|
elsif This'Address = TIM13_Base then
|
RCC_Periph.APB1RSTR.TIM13RST := True;
|
RCC_Periph.APB1RSTR.TIM13RST := False;
|
elsif This'Address = TIM14_Base then
|
RCC_Periph.APB1RSTR.TIM14RST := True;
|
RCC_Periph.APB1RSTR.TIM14RST := False;
|
else
|
raise Unknown_Device;
|
end if;
|
end Reset;
|
------------------------------
|
-- 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
|
declare
|
HSE_Source : constant Boolean := RCC_Periph.PLLCFGR.PLLSRC;
|
Pllm : constant UInt32 :=
|
UInt32 (RCC_Periph.PLLCFGR.PLLM);
|
Plln : constant
|
UInt32 :=
|
UInt32 (RCC_Periph.PLLCFGR.PLLN);
|
Pllp : constant
|
UInt32 :=
|
(UInt32 (RCC_Periph.PLLCFGR.PLLP) + 1) * 2;
|
Pllvco : UInt32;
|
begin
|
if not HSE_Source then
|
Pllvco := HSI_VALUE;
|
else
|
Pllvco := HSE_VALUE;
|
end if;
|
Pllvco := Pllvco / Pllm;
|
Result.I2SCLK := Pllvco;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.