text
stringlengths
0
234
-- elsif This'Address = USART6_Base then
-- RCC_Periph.APB2RSTR.USART6RST := True;
-- RCC_Periph.APB2RSTR.USART6RST := False;
-- elsif This'Address = UART7_Base then
-- RCC_Periph.APB1RSTR.UART7RST := True;
-- RCC_Periph.APB1RSTR.UART7RST := False;
-- elsif This'Address = UART8_Base then
-- RCC_Periph.APB1RSTR.UART8RST := True;
-- RCC_Periph.APB1RSTR.UART8RST := False;
-- else
-- raise Unknown_Device;
-- end if;
-- end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out DMA_Controller) is
begin
if This'Address = STM32_SVD.DMA1_Base then
RCC_Periph.AHB1ENR.DMA1EN := True;
elsif This'Address = STM32_SVD.DMA2_Base then
RCC_Periph.AHB1ENR.DMA2EN := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : aliased in out DMA_Controller) is
begin
if This'Address = STM32_SVD.DMA1_Base then
RCC_Periph.AHB1RSTR.DMA1RST := True;
RCC_Periph.AHB1RSTR.DMA1RST := False;
elsif This'Address = STM32_SVD.DMA2_Base then
RCC_Periph.AHB1RSTR.DMA2RST := True;
RCC_Periph.AHB1RSTR.DMA2RST := False;
else
raise Unknown_Device;
end if;
end Reset;
----------------
-- As_Port_Id --
----------------
function As_Port_Id (Port : I2C_Port'Class) return I2C_Port_Id is
begin
if Port.Periph.all'Address = I2C1_Base then
return I2C_Id_1;
elsif Port.Periph.all'Address = I2C2_Base then
return I2C_Id_2;
elsif Port.Periph.all'Address = I2C3_Base then
return I2C_Id_3;
elsif Port.Periph.all'Address = I2C4_Base then
return I2C_Id_4;
else
raise Unknown_Device;
end if;
end As_Port_Id;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : I2C_Port'Class) is
begin
Enable_Clock (As_Port_Id (This));
end Enable_Clock;
------------------
-- Enable_Clock --
------------------
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;
when I2C_Id_4 =>
RCC_Periph.APB1ENR.I2C4EN := True;
end case;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : I2C_Port'Class) is
begin
Reset (As_Port_Id (This));
end Reset;