text
stringlengths
0
234
procedure Enable_Clock (This : aliased in out Digital_To_Analog_Converter)
is
pragma Unreferenced (This);
begin
RCC_Periph.APB1ENR.DACEN := True;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : aliased in out Digital_To_Analog_Converter) is
pragma Unreferenced (This);
begin
RCC_Periph.APB1RSTR.DACRST := True;
RCC_Periph.APB1RSTR.DACRST := False;
end Reset;
------------------
-- Enable_Clock --
------------------
procedure Enable_Clock (This : aliased in out USART) is
begin
if This.Periph.all'Address = USART1_Base then
RCC_Periph.APB2ENR.USART1EN := True;
elsif This.Periph.all'Address = USART2_Base then
RCC_Periph.APB1ENR.USART2EN := True;
elsif This.Periph.all'Address = USART3_Base then
RCC_Periph.APB1ENR.USART3EN := True;
elsif This.Periph.all'Address = USART6_Base then
RCC_Periph.APB2ENR.USART6EN := True;
else
raise Unknown_Device;
end if;
end Enable_Clock;
-----------
-- Reset --
-----------
procedure Reset (This : aliased in out USART) is
begin
if This.Periph.all'Address = USART1_Base then
RCC_Periph.APB2RSTR.USART1RST := True;
RCC_Periph.APB2RSTR.USART1RST := False;
elsif This.Periph.all'Address = USART2_Base then
RCC_Periph.APB1RSTR.UART2RST := True;
RCC_Periph.APB1RSTR.UART2RST := False;
elsif This.Periph.all'Address = USART3_Base then
RCC_Periph.APB1RSTR.UART3RST := True;
RCC_Periph.APB1RSTR.UART3RST := False;
elsif This.Periph.all'Address = USART6_Base then
RCC_Periph.APB2RSTR.USART6RST := True;
RCC_Periph.APB2RSTR.USART6RST := 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;