text
stringlengths 0
234
|
|---|
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;
|
------------------
|
-- Enable_Clock --
|
------------------
|
procedure Enable_Clock (This : in out SAI_Port)
|
is
|
begin
|
if This'Address = SAI1_Base then
|
RCC_Periph.APB2ENR.SAI1EN := True;
|
elsif This'Address = SAI2_Base then
|
RCC_Periph.APB2ENR.SAI2EN := True;
|
else
|
raise Unknown_Device;
|
end if;
|
end Enable_Clock;
|
-----------
|
-- Reset --
|
-----------
|
procedure Reset (This : in out SAI_Port)
|
is
|
begin
|
if This'Address = SAI1_Base then
|
RCC_Periph.APB2RSTR.SAI1RST := True;
|
RCC_Periph.APB2RSTR.SAI1RST := False;
|
elsif This'Address = SAI2_Base then
|
RCC_Periph.APB2RSTR.SAI2RST := True;
|
RCC_Periph.APB2RSTR.SAI2RST := False;
|
else
|
raise Unknown_Device;
|
end if;
|
end Reset;
|
---------------------
|
-- Get_Input_Clock --
|
---------------------
|
function Get_Input_Clock (Periph : SAI_Port) return UInt32
|
is
|
Input_Selector : UInt2;
|
VCO_Input : UInt32;
|
SAI_First_Level : UInt32;
|
begin
|
if Periph'Address = SAI1_Base then
|
Input_Selector := RCC_Periph.DKCFGR1.SAI1SEL;
|
elsif Periph'Address = SAI2_Base then
|
Input_Selector := RCC_Periph.DKCFGR1.SAI2SEL;
|
else
|
raise Unknown_Device;
|
end if;
|
-- This driver doesn't support external source clock
|
if Input_Selector > 1 then
|
raise Constraint_Error
|
with "External PLL SAI source clock unsupported";
|
end if;
|
if not RCC_Periph.PLLCFGR.PLLSRC then
|
-- PLLSAI SRC is HSI
|
VCO_Input := HSI_VALUE / UInt32 (RCC_Periph.PLLCFGR.PLLM);
|
else
|
-- PLLSAI SRC is HSE
|
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.DKCFGR1.PLLSAIDIVQ);
|
else
|
-- PLLI2S as clock source
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.