libDaisy
Hardware Library for Daisy
daisy::System Class Reference

Detailed Description

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

Author
shensley

#include <system.h>

Classes

struct  Config
 

Public Types

enum  MemoryRegion {
  INTERNAL_FLASH = 0 , ITCMRAM , DTCMRAM , SRAM_D1 ,
  SRAM_D2 , SRAM_D3 , SDRAM , QSPI ,
  INVALID_ADDRESS
}
 

Public Member Functions

 System ()
 
 ~System ()
 
void Init ()
 
void Init (const Config &config)
 
void DeInit ()
 
void JumpToQspi ()
 
const ConfigGetConfig () 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 ()
 
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
 

Member Enumeration Documentation

◆ MemoryRegion

Describes the different regions of memory available to the Daisy

Enumerator
INTERNAL_FLASH 
ITCMRAM 
DTCMRAM 
SRAM_D1 
SRAM_D2 
SRAM_D3 
SDRAM 
QSPI 
INVALID_ADDRESS 

Constructor & Destructor Documentation

◆ System()

daisy::System::System ( )
inline

◆ ~System()

daisy::System::~System ( )
inline

Member Function Documentation

◆ DeInit()

void daisy::System::DeInit ( )

Deinitializer Deinitializes all modules and peripherals set up with Init.

◆ Delay()

static void daisy::System::Delay ( uint32_t  delay_ms)
static

Blocking Delay that uses the SysTick (1ms callback) to wait.

Parameters
delay_msTime to delay in ms

◆ DelayTicks()

static void daisy::System::DelayTicks ( uint32_t  delay_ticks)
static

Blocking Delay using internal timer to wait

Parameters
delay_ticksTime to ddelay in microseconds

◆ DelayUs()

static void daisy::System::DelayUs ( uint32_t  delay_us)
static

Blocking Delay using internal timer to wait

Parameters
delay_usTime to ddelay in microseconds

◆ GetConfig()

const Config & daisy::System::GetConfig ( ) const
inline

Returns a const reference to the Systems Configuration struct.

◆ GetHClkFreq()

static uint32_t daisy::System::GetHClkFreq ( )
static

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.

◆ GetMemoryRegion()

static MemoryRegion daisy::System::GetMemoryRegion ( uint32_t  address)
static

Returns an enum representing the the memory region that the given address belongs to.

Parameters
addressThe address to be checked

◆ GetNow()

static uint32_t daisy::System::GetNow ( )
static
Returns
a uint32_t value of milliseconds since the SysTick started

◆ GetPClk1Freq()

static uint32_t daisy::System::GetPClk1Freq ( )
static

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.

◆ GetPClk2Freq()

static uint32_t daisy::System::GetPClk2Freq ( )
static

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.

◆ GetProgramMemoryRegion()

static MemoryRegion daisy::System::GetProgramMemoryRegion ( )
static

Returns an enum representing the current (primary) memory space used for executing the program.

◆ GetSysClkFreq()

static uint32_t daisy::System::GetSysClkFreq ( )
static

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.

◆ GetTick()

static uint32_t daisy::System::GetTick ( )
static
Returns
a uint32_t of ticks at (PCLk1 * 2)Hz Useful for measuring the number of CPU ticks something is taking.

◆ GetTickFreq()

static uint32_t daisy::System::GetTickFreq ( )
static

Returns the tick rate in Hz with which GetTick() is incremented.

◆ GetUs()

static uint32_t daisy::System::GetUs ( )
static
Returns
a uint32_t of microseconds within the internal timer.

◆ Init() [1/2]

void daisy::System::Init ( )

Default Initializer with no input will create an internal config, and set everything to Defaults

◆ Init() [2/2]

void daisy::System::Init ( const Config config)

Configurable Initializer Initializes clock tree, DMA initializaiton and any necessary global inits.

◆ JumpToQspi()

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.

◆ ResetToBootloader()

static void daisy::System::ResetToBootloader ( )
static

Triggers a reset of the seed and starts in bootloarder mode to allow firmware update.

Member Data Documentation

◆ kQspiBootloaderOffset

constexpr uint32_t daisy::System::kQspiBootloaderOffset = 0x40000U
staticconstexpr

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.


The documentation for this class was generated from the following file: