Embedded Artistry Framework
Embedded Systems C++ Framework
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
BlinkySimulatorHWPlatform Class Reference

#include <blinky_simulator_hw_platform.hpp>

Inheritance diagram for BlinkySimulatorHWPlatform:
Inheritance graph

Public Member Functions

 BlinkySimulatorHWPlatform () noexcept
 Default constructor. More...
 
 ~BlinkySimulatorHWPlatform () noexcept
 Default destructor. More...
 
void init_ () noexcept
 
void initProcessor_ () noexcept
 
void soft_reset_ () noexcept
 
void hard_reset_ () noexcept
 
auto allocateTimer () noexcept
 Allocate a software timer. More...
 
void startBlink () noexcept
 Start the LED timer. More...
 
constexpr const std::string_view & name () const noexcept
 Returns the Virtual HW Platform's name. More...
 
constexpr const char * name_cstr () const noexcept
 Returns the platform name as a cstring for C API compatibility. More...
 
void initProcessor () noexcept
 Initialize the processor. More...
 
void init () noexcept
 Initialize the hardware platform. More...
 
void soft_reset () noexcept
 Perform a soft reset of the system (chip reset) More...
 
void hard_reset () noexcept
 Perform a hard reset of the system (power cycle) More...
 
void shutdown () noexcept
 Shutdown the system. More...
 

Static Public Member Functions

static void earlyInitHook_ () noexcept
 
static void earlyInitHook () noexcept
 Perform any special initialization steps. More...
 

Private Types

using PlatformBase = embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >
 
using TimerManager_t = embvm::TimerManager< 0, std::mutex >
 

Private Attributes

embutil::InterruptQueue< std::mutex > irq_bottom_half_
 
embdrv::SimulatorSystemClock sysclock
 
embdrv::aardvarkAdapter aardvark {embdrv::aardvarkMode::GpioI2C}
 
embdrv::aardvarkGPIOOutput< 5 > gpio5 {aardvark}
 
embvm::led::gpioActiveHigh led0 {gpio5}
 
embdrv::SimulatorTimer timer0
 
embdrv::SimulatorTimer timer1
 
TimerManager_t tm_ {timer1}
 
TimerManager_t::TimerHandle led_sw_timer_handle
 
SimulatorProcessor processor
 

Member Typedef Documentation

◆ PlatformBase

◆ TimerManager_t

Constructor & Destructor Documentation

◆ BlinkySimulatorHWPlatform()

BlinkySimulatorHWPlatform::BlinkySimulatorHWPlatform ( )
inlinenoexcept

Default constructor.

◆ ~BlinkySimulatorHWPlatform()

BlinkySimulatorHWPlatform::~BlinkySimulatorHWPlatform ( )
noexcept

Default destructor.

Member Function Documentation

◆ allocateTimer()

auto BlinkySimulatorHWPlatform::allocateTimer ( )
inlinenoexcept

Allocate a software timer.

Allocates a software timer from the underlying timer manager. A handle is returned, which the user can use to configure the timer according to their wishes.

Returns
handle to a software timer object

References embvm::TimerManager< TMaxTimers, TLock, TTimeUnit, TTimeoutCallback, TTimerDevice >::allocate(), and tm_.

Referenced by init_().

◆ earlyInitHook()

static void embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::earlyInitHook ( )
inlinestaticnoexceptinherited

Perform any special initialization steps.

The earlyInitHook_() function must be implemented by the derived class as a static function.

These functions run before the C Run-time setup functions are called, and normal functionality (e.g. OS concepts) are not available.

Early initialization steps represent any super early code that needs to execute. For example, DRAM might need to be initialized before the boot process can relocate memory to its proper location in memory.

These functions are declared static to prevent you from easily using drivers within their confines

◆ earlyInitHook_()

static void BlinkySimulatorHWPlatform::earlyInitHook_ ( )
inlinestaticnoexcept

◆ hard_reset()

void embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::hard_reset ( )
inlinenoexceptinherited

Perform a hard reset of the system (power cycle)

The hard_reset_() function must be implemented by the derived class.

A hard reset is intended to perform a full power cycle of the system.

Platforms which do not support a hard reset should default to calling soft_reset().

◆ hard_reset_()

void BlinkySimulatorHWPlatform::hard_reset_ ( )
inlinenoexcept

References soft_reset_().

◆ init()

void embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::init ( )
inlinenoexceptinherited

Initialize the hardware platform.

The init_() function must be implemented by the derived class.

Perform any hardware platform initialization steps, such as preparing peripherals for use, setting up callbacks, etc.

◆ init_()

void BlinkySimulatorHWPlatform::init_ ( )
noexcept

◆ initProcessor()

void embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::initProcessor ( )
inlinenoexceptinherited

Initialize the processor.

The initProcessor_() function must be implemented by the derived class.

Perform any steps necessary for initializing the processor & processor peripheral devices for use.

Note that this is only intended to be processor initialization. Platform initialization nis handled by the init() function.

This function will likely invoke the VirtualProcessor::init() function, but the order and actual initialization process is left to the derived class.

◆ initProcessor_()

void BlinkySimulatorHWPlatform::initProcessor_ ( )
inlinenoexcept

◆ name()

constexpr const std::string_view& embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::name ( ) const
inlinenoexceptinherited

Returns the Virtual HW Platform's name.

◆ name_cstr()

constexpr const char* embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::name_cstr ( ) const
inlinenoexceptinherited

Returns the platform name as a cstring for C API compatibility.

◆ shutdown()

void embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::shutdown ( )
inlinenoexceptinherited

Shutdown the system.

The shutdown_() function must be implemented by the derived class.

If your platform supports shutdown capability, take the proper steps to initiate a shutdown.

If the platform does not support shutdown capability, implement your shutdown_() function as an assert to notify users trying to call this API. You could also leave the shutdown_() function undefined. Anyone who calls the shutdown() function on a platform with an undefined shutdown_() function will encounter a compiler error.

The shutdown function is not expected to return.

◆ soft_reset()

void embvm::VirtualHwPlatformBase< BlinkySimulatorHWPlatform >::soft_reset ( )
inlinenoexceptinherited

Perform a soft reset of the system (chip reset)

The soft_reset_() function must be implemnted by the derived class.

A soft reset is intended to reset the program to the beginning without performing a full power cycle.

A good strategy is to just call virtual processor's reset() function, if one is provided.

◆ soft_reset_()

void BlinkySimulatorHWPlatform::soft_reset_ ( )
inlinenoexcept

Referenced by hard_reset_().

◆ startBlink()

void BlinkySimulatorHWPlatform::startBlink ( )
inlinenoexcept

Start the LED timer.

References embvm::DriverBase::start(), and timer1.

Member Data Documentation

◆ aardvark

embdrv::aardvarkAdapter BlinkySimulatorHWPlatform::aardvark {embdrv::aardvarkMode::GpioI2C}
private

◆ gpio5

embdrv::aardvarkGPIOOutput<5> BlinkySimulatorHWPlatform::gpio5 {aardvark}
private

◆ irq_bottom_half_

embutil::InterruptQueue<std::mutex> BlinkySimulatorHWPlatform::irq_bottom_half_
private

Referenced by init_().

◆ led0

embvm::led::gpioActiveHigh BlinkySimulatorHWPlatform::led0 {gpio5}
private

Referenced by init_().

◆ led_sw_timer_handle

TimerManager_t::TimerHandle BlinkySimulatorHWPlatform::led_sw_timer_handle
private

Referenced by init_().

◆ processor

SimulatorProcessor BlinkySimulatorHWPlatform::processor
private

Referenced by initProcessor_().

◆ sysclock

embdrv::SimulatorSystemClock BlinkySimulatorHWPlatform::sysclock
private

◆ timer0

embdrv::SimulatorTimer BlinkySimulatorHWPlatform::timer0
private

◆ timer1

embdrv::SimulatorTimer BlinkySimulatorHWPlatform::timer1
private

Referenced by init_(), and startBlink().

◆ tm_

TimerManager_t BlinkySimulatorHWPlatform::tm_ {timer1}
private

Referenced by allocateTimer().


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