daisy::System¶
#include <system.h>
Public Classes¶
Name | |
---|---|
struct | BootInfo |
struct | Config |
Public Types¶
Name | |
---|---|
enum | MemoryRegion |
enum | BootloaderMode |
Public Functions¶
Name | |
---|---|
System() | |
~System() | |
void | Init() |
void | Init(const Config & config) |
void | DeInit() |
void | JumpToQspi() |
const Config & | GetConfig() const |
uint32_t | GetNow() |
uint32_t | GetUs() |
uint32_t | GetTick() |
void | Delay(uint32_t delay_ms) |
void | DelayUs(uint32_t delay_us) |
void | DelayTicks(uint32_t delay_ticks) |
void | ResetToBootloader(BootloaderMode mode =BootloaderMode::STM) |
void | InitBackupSram() |
BootInfo::Version | GetBootloaderVersion() |
uint32_t | GetTickFreq() |
uint32_t | GetSysClkFreq() |
uint32_t | GetHClkFreq() |
uint32_t | GetPClk1Freq() |
uint32_t | GetPClk2Freq() |
MemoryRegion | GetProgramMemoryRegion() |
MemoryRegion | GetMemoryRegion(uint32_t address) |
Public Attributes¶
Name | |
---|---|
constexpr uint32_t | kQspiBootloaderOffset |
Detailed Description¶
Author: shensley
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
Public Types Documentation¶
enum MemoryRegion¶
Enumerator | Value | Description |
---|---|---|
INTERNAL_FLASH | 0 | |
ITCMRAM | ||
DTCMRAM | ||
SRAM_D1 | ||
SRAM_D2 | ||
SRAM_D3 | ||
SDRAM | ||
QSPI | ||
INVALID_ADDRESS |
Describes the different regions of memory available to the Daisy
enum BootloaderMode¶
Enumerator | Value | Description |
---|---|---|
STM | 0 | |
DAISY | ||
DAISY_SKIP_TIMEOUT | ||
DAISY_INFINITE_TIMEOUT |
Parameters:
- 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
Specify how the Daisy should return to the bootloader
Public Functions Documentation¶
function System¶
function ~System¶
function Init¶
Default Initializer with no input will create an internal config, and set everything to Defaults
function Init¶
Configurable Initializer Initializes clock tree, DMA initializaiton and any necessary global inits.
function DeInit¶
Deinitializer Deinitializes all modules and peripherals set up with Init
.
function 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.
function GetConfig¶
Returns a const reference to the Systems Configuration struct.
function GetNow¶
Return: a uint32_t value of milliseconds since the SysTick started
function GetUs¶
Return: a uint32_t of microseconds within the internal timer.
function GetTick¶
Return: a uint32_t of ticks at (PCLk1 * 2)Hz Useful for measuring the number of CPU ticks something is taking.
function Delay¶
Parameters:
- delay_ms Time to delay in ms
Blocking Delay that uses the SysTick (1ms callback) to wait.
function DelayUs¶
Parameters:
- delay_us Time to ddelay in microseconds
Blocking Delay using internal timer to wait
function DelayTicks¶
Parameters:
- delay_ticks Time to ddelay in microseconds
Blocking Delay using internal timer to wait
function ResetToBootloader¶
Triggers a reset of the seed and starts in bootloader mode to allow firmware update.
function InitBackupSram¶
Initializes the backup SRAM
function GetBootloaderVersion¶
Checks Daisy Bootloader version, if present.
function GetTickFreq¶
Returns the tick rate in Hz with which GetTick() is incremented.
function GetSysClkFreq¶
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.
function GetHClkFreq¶
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.
function GetPClk1Freq¶
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.
function GetPClk2Freq¶
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.
function GetProgramMemoryRegion¶
Returns an enum representing the current (primary) memory space used for executing the program.
function GetMemoryRegion¶
Parameters:
- address The address to be checked
Returns an enum representing the the memory region that the given address belongs to.
Public Attributes Documentation¶
variable kQspiBootloaderOffset¶
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.
Updated on 2024-01-03 at 19:41:01 +0000