-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d99c713
commit 1aec542
Showing
63 changed files
with
95,638 additions
and
51 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
-- | ||
-- Copyright 2021 (C) Jeremy Grosser <[email protected]> | ||
-- | ||
-- SPDX-License-Identifier: BSD-3-Clause | ||
-- | ||
with RP2040_SVD; | ||
with RP.Timer; | ||
|
||
package body RP.Reset is | ||
|
||
type RESET_Register is array (Reset_Id) of Boolean | ||
with Component_Size => 1, | ||
Size => 32; | ||
|
||
type RESETS_Peripheral is record | ||
RESET : aliased RESET_Register; | ||
WDSEL : aliased RESET_Register; | ||
RESET_DONE : aliased RESET_Register; | ||
end record | ||
with Volatile; | ||
|
||
for RESETS_Peripheral use record | ||
RESET at 0 range 0 .. 31; | ||
WDSEL at 4 range 0 .. 31; | ||
RESET_DONE at 8 range 0 .. 31; | ||
end record; | ||
|
||
RESETS_Periph : aliased RESETS_Peripheral | ||
with Import, Address => RP2040_SVD.RESETS_Base; | ||
|
||
procedure Reset_Peripheral | ||
(Peripheral : Reset_Id) | ||
is | ||
begin | ||
RESETS_Periph.RESET (Peripheral) := True; | ||
RESETS_Periph.RESET (Peripheral) := False; | ||
while not RESETS_Periph.RESET_DONE (Peripheral) loop | ||
null; | ||
end loop; | ||
end Reset_Peripheral; | ||
|
||
procedure Reset_Peripheral | ||
(Peripheral : Reset_Id; | ||
Status : out Reset_Status; | ||
Timeout : Natural := 100) | ||
is | ||
use RP.Timer; | ||
Deadline : constant Time := Clock + Milliseconds (Timeout); | ||
begin | ||
RESETS_Periph.RESET (Peripheral) := True; | ||
RESETS_Periph.RESET (Peripheral) := False; | ||
while not RESETS_Periph.RESET_DONE (Peripheral) loop | ||
if Timeout > 0 and then Clock >= Deadline then | ||
Status := Reset_Timeout; | ||
return; | ||
end if; | ||
end loop; | ||
Status := Reset_Ok; | ||
end Reset_Peripheral; | ||
|
||
end RP.Reset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
-- | ||
-- Copyright 2021 (C) Jeremy Grosser <[email protected]> | ||
-- | ||
-- SPDX-License-Identifier: BSD-3-Clause | ||
-- | ||
package RP.Reset | ||
with Preelaborate | ||
is | ||
|
||
type Reset_Id is | ||
(Reset_ADC, | ||
Reset_BUSCTRL, | ||
Reset_DMA, | ||
Reset_HSTX, | ||
Reset_I2C0, | ||
Reset_I2C1, | ||
Reset_IO_BANK0, | ||
Reset_QSPI, | ||
Reset_JTAG, | ||
Reset_PADS_BANK0, | ||
Reset_PADS_QSPI, | ||
Reset_PIO0, | ||
Reset_PIO1, | ||
Reset_PIO2, | ||
Reset_PLL_SYS, | ||
Reset_PLL_USB, | ||
Reset_PWM, | ||
Reset_SHA256, | ||
Reset_SPI0, | ||
Reset_SPI1, | ||
Reset_SYSCFG, | ||
Reset_SYSINFO, | ||
Reset_TBMAN, | ||
Reset_TIMER0, | ||
Reset_TIMER1, | ||
Reset_TRNG, | ||
Reset_UART0, | ||
Reset_UART1, | ||
Reset_USBCTRL); | ||
|
||
type Reset_Status is | ||
(Reset_Ok, | ||
Reset_Timeout); | ||
|
||
-- This will hang if the reset fails. Most drivers use this version. | ||
procedure Reset_Peripheral | ||
(Peripheral : Reset_Id); | ||
|
||
-- Timeout is specified in Milliseconds. No peripheral should take more | ||
-- than a few cycles to reset. | ||
procedure Reset_Peripheral | ||
(Peripheral : Reset_Id; | ||
Status : out Reset_Status; | ||
Timeout : Natural := 100) | ||
with Pre => Peripheral /= Reset_TIMER0; | ||
|
||
end RP.Reset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.