A handle for interacting with the Core System. This includes the Clock tree, MPU, global DMA initialization, cache handling, and any other necessary global initiailzation
#include <system.h>
Classes | |
struct | BootInfo |
struct | Config |
Public Types | |
enum | MemoryRegion { INTERNAL_FLASH = 0 , ITCMRAM , DTCMRAM , SRAM_D1 , SRAM_D2 , SRAM_D3 , SDRAM , QSPI , INVALID_ADDRESS } |
enum | BootloaderMode { STM = 0 , DAISY , DAISY_SKIP_TIMEOUT , DAISY_INFINITE_TIMEOUT } |
Public Member Functions | |
System () | |
~System () | |
void | Init () |
void | Init (const Config &config) |
void | DeInit () |
void | JumpToQspi () |
const Config & | GetConfig () const |
Static Public Member Functions | |
static uint32_t | GetNow () |
static uint32_t | GetUs () |
static uint32_t | GetTick () |
static void | Delay (uint32_t delay_ms) |
static void | DelayUs (uint32_t delay_us) |
static void | DelayTicks (uint32_t delay_ticks) |
static void | ResetToBootloader (BootloaderMode mode=BootloaderMode::STM) |
static void | InitBackupSram () |
static BootInfo::Version | GetBootloaderVersion () |
static uint32_t | GetTickFreq () |
static uint32_t | GetSysClkFreq () |
static uint32_t | GetHClkFreq () |
static uint32_t | GetPClk1Freq () |
static uint32_t | GetPClk2Freq () |
static MemoryRegion | GetProgramMemoryRegion () |
static MemoryRegion | GetMemoryRegion (uint32_t address) |
Static Public Attributes | |
static constexpr uint32_t | kQspiBootloaderOffset = 0x40000U |
Specify how the Daisy should return to the bootloader
STM | return to the STM32-provided bootloader to program internal flash |
DAISY | if the Daisy bootloader is used, this will return to it |
DAISY_NO_TIMEOUT | if the Daisy bootloader is used, this will return to it and skip the timeout window |
Enumerator | |
---|---|
STM | |
DAISY | |
DAISY_SKIP_TIMEOUT | |
DAISY_INFINITE_TIMEOUT |
|
inline |
|
inline |
void daisy::System::DeInit | ( | ) |
Deinitializer Deinitializes all modules and peripherals set up with Init
.
Blocking Delay that uses the SysTick (1ms callback) to wait.
delay_ms | Time to delay in ms |
Blocking Delay using internal timer to wait
delay_ticks | Time to ddelay in microseconds |
Blocking Delay using internal timer to wait
delay_us | Time to ddelay in microseconds |
|
static |
Checks Daisy Bootloader version, if present.
Returns a const reference to the Systems Configuration struct.
Returns the frequency of the HCLK (AHB) clock. This is derived from the System clock, and used to clock the CPU, memory, and peripherals mapped on the AHB, and APB Bus.
|
static |
Returns an enum representing the the memory region that the given address belongs to.
address | The address to be checked |
Returns the frequency of the PCLK1 (APB1) clock This is used to clock various peripherals, and timers.
It's important to note that many timers run on a clock twice as fast as the peripheral clock for the timer.
Returns the frequency of the PCLK2 (APB2) clock This is used to clock various peripherals, and timers.
It's important to note that many timers run on a clock twice as fast as the peripheral clock for the timer.
|
static |
Returns an enum representing the current (primary) memory space used for executing the program.
Returns the Frequency of the system clock in Hz This is the primary system clock that is used to generate AXI Peripheral, APB, and AHB clocks.
Returns the tick rate in Hz with which GetTick() is incremented.
void daisy::System::Init | ( | ) |
Default Initializer with no input will create an internal config, and set everything to Defaults
Configurable Initializer Initializes clock tree, DMA initializaiton and any necessary global inits.
void daisy::System::JumpToQspi | ( | ) |
Jumps to the first address of the external flash chip (0x90000000) If there is no code there, the chip will likely fall through to the while() loop TODO: Documentation/Loader for using external flash coming soon.
|
static |
Triggers a reset of the seed and starts in bootloader mode to allow firmware update.
This constant indicates the Daisy bootloader's offset from the beginning of QSPI's address space. Data written within the first 256K will remain untouched by the Daisy bootloader.