text
stringlengths
0
234
------------------
procedure Enable_Clock (This : I2C_Port_Id) is
begin
case This is
when I2C_Id_1 =>
RCC_Periph.APB1ENR.I2C1EN := True;
when I2C_Id_2 =>
RCC_Periph.APB1ENR.I2C2EN := True;
when I2C_Id_3 =>
RCC_Periph.APB1ENR.I2C3EN := True;
end case;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : I2C_Port'Class) is
begin
Reset (As_Port_Id (This));
end Reset;
-----------
-- Reset --
-----------
procedure Reset (This : I2C_Port_Id) is
begin
case This is
when I2C_Id_1 =>
RCC_Periph.APB1RSTR.I2C1RST := True;
RCC_Periph.APB1RSTR.I2C1RST := False;
when I2C_Id_2 =>
RCC_Periph.APB1RSTR.I2C2RST := True;
RCC_Periph.APB1RSTR.I2C2RST := False;
when I2C_Id_3 =>
RCC_Periph.APB1RSTR.I2C3RST := True;
RCC_Periph.APB1RSTR.I2C3RST := False;
end case;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out SPI_Port'Class) is
begin
if This'Address = SPI1_Base then
RCC_Periph.APB2ENR.SPI1EN := True;
elsif This'Address = SPI2_Base then
RCC_Periph.APB1ENR.SPI2EN := True;
elsif This'Address = SPI3_Base then
RCC_Periph.APB1ENR.SPI3EN := True;
elsif This'Address = SPI4_Base then
RCC_Periph.APB2ENR.SPI4ENR := True;
elsif This'Address = SPI5_Base then
RCC_Periph.APB2ENR.SPI5ENR := True;
elsif This'Address = SPI6_Base then
RCC_Periph.APB2ENR.SPI6ENR := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : in out SPI_Port'Class) is
begin
if This.Periph.all'Address = SPI1_Base then
RCC_Periph.APB2RSTR.SPI1RST := True;
RCC_Periph.APB2RSTR.SPI1RST := False;
elsif This.Periph.all'Address = SPI2_Base then
RCC_Periph.APB1RSTR.SPI2RST := True;
RCC_Periph.APB1RSTR.SPI2RST := False;
elsif This.Periph.all'Address = SPI3_Base then
RCC_Periph.APB1RSTR.SPI3RST := True;
RCC_Periph.APB1RSTR.SPI3RST := False;
elsif This.Periph.all'Address = SPI4_Base then
RCC_Periph.APB2RSTR.SPI4RST := True;
RCC_Periph.APB2RSTR.SPI4RST := False;
elsif This.Periph.all'Address = SPI5_Base then
RCC_Periph.APB2RSTR.SPI5RST := True;
RCC_Periph.APB2RSTR.SPI5RST := False;
elsif This.Periph.all'Address = SPI6_Base then
RCC_Periph.APB2RSTR.SPI6RST := True;
RCC_Periph.APB2RSTR.SPI6RST := False;
else
raise Unknown_Device;
end if;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : I2S_Port) is
begin