Embedded Artistry Framework
Embedded Systems C++ Framework
Classes | Typedefs | Functions | Variables
embutil Namespace Reference

Embedded framework utility functions and classes. More...

Classes

class  activeObject
 
struct  countbits
 Template struct for counting set bits and significant bits at compile-time. More...
 
class  DispatchQueue_Base
 Base class for dispatch queues. More...
 
class  FuncOp
 Base Class for storing functions. More...
 
class  FuncOpBound
 Represents a bound function object. More...
 
struct  InstanceElem
 Helper struct which is used to store Key/Value pairs in the InstanceList. More...
 
class  InstanceList
 Generic InstanceList template container. More...
 
class  InterruptCondition
 Generic interrupt condition concept. More...
 
class  InterruptLock
 BasicLockable class which disables/enables interrupts. More...
 
struct  InterruptLockPolicyExample
 
class  InterruptQueue
 IRQ safe dispatch queue (For running application-level (bottom-half) interrupt handlers) More...
 
class  nop_lock
 Use this lock class to disable locking behavior at compile-time. More...
 
struct  ro
 Read-only access permission tag. More...
 
struct  rw
 Register access permissions. More...
 
class  ScopeGuard
 Provides a scope guard idiom to enable custom SBRM behaviors. More...
 
class  sfr
 
class  sfr< TPerm, T, TAddr, typename std::enable_if< TAddr==0 >::type >
 SFR Class which supports address assignment with a constructor. More...
 
class  sfr< TPerm, T, TAddr, typename std::enable_if_t< TAddr !=0, void > >
 This variant of the SFR class is used when the address is known at compile-time. More...
 
class  StaticFunctionQueue
 Static-memory function queue that accepts functors of multiple sizes. More...
 
struct  wo
 Write-only access permission tag. More...
 

Typedefs

template<typename TType >
using unique_ptr_aligned = std::unique_ptr< TType, decltype(&aligned_free)>
 Unique pointer alias for aligned memory (calls aligned_free()). More...
 
template<typename TFunc = std::function<void()>, typename TLock = std::mutex, typename TCond = std::condition_variable>
using DynamicDispatchQueue = DispatchQueue_Base< 0, 0, TFunc, TLock, TCond >
 Dispatch queue class supporting dynamic sizes and dynamic memory allocation. More...
 
template<const size_t TSize, const size_t TThreadCount = 1, typename TFunc = stdext::inplace_function<void()>, typename TLock = std::mutex, typename TCond = std::condition_variable>
using StaticDispatchQueue = DispatchQueue_Base< TSize, TThreadCount, TFunc, TLock, TCond >
 Dispatch queue specializatoin using only static memory allocation. More...
 
using IRQBottomHalfOp_t = stdext::inplace_function< void(), 96 >
 
using IRQDispatcherFunc_t = stdext::inplace_function< void(const IRQBottomHalfOp_t &)>
 
template<class TTrackedClass , typename TKey = const char*, class TContainer = std::list<InstanceElem<TTrackedClass, TKey>>>
using DynamicInstanceList = InstanceList< TTrackedClass, TKey, TContainer >
 Template class to track instances of class-type things (dynamic memory variant) More...
 
template<class TTrackedClass , const size_t TSize = 32, typename TKey = const char*, class TContainer = etl::list<InstanceElem<TTrackedClass, TKey>, TSize>>
using StaticInstanceList = InstanceList< TTrackedClass, TKey, TContainer, TSize >
 Template class to track instances of class-type things (static memory variant) More...
 

Functions

template<typename TType >
unique_ptr_aligned< TType > aligned_uptr (size_t align, size_t size) noexcept
 Create a unique pointer to aligned memory. More...
 
template<typename TType >
std::shared_ptr< TType > aligned_sptr (size_t align, size_t size) noexcept
 Create a shared pointer to aligned memory. More...
 
template<class TClass , class Method , Method m, class... Params>
static auto bounce (void *priv, Params... params) noexcept -> decltype(((*reinterpret_cast< TClass * >(priv)).*m)(params...))
 Enable a C++ member function to work with a C-style callback interface. More...
 
template<class T >
constexpr std::enable_if< std::is_unsigned< T >::value, T >::type byteswap (T i, T j=0u, std::size_t n=0u) noexcept
 Recursive constexpr byteswap implementation without C++17 fold expressions. More...
 
template<typename T >
void SwapEndian (T &val, typename std::enable_if< std::is_arithmetic< T >::value, std::nullptr_t >::type unused=nullptr) noexcept
 Non-constexpr Robust Endian Swap. More...
 
template<typename T >
void SwapEndian_UB (T &val) noexcept
 Endian swap using undefined behavior. More...
 
template<typename T , typename AcquisitionFunc , typename ReleaseFunc , typename... Args>
std::unique_ptr< T, ReleaseFunc > unique_resource (AcquisitionFunc acquire, ReleaseFunc release, Args &&... args) noexcept
 Enable Scope-Bound Resource Management (SBRM) for C-style resources (std::unique_ptr variant). More...
 
template<typename T , typename AcquisitionFunc , typename ReleaseFunc , typename... Args>
std::shared_ptr< Tshared_resource (AcquisitionFunc acquire, ReleaseFunc release, Args &&... args) noexcept
 Enable Scope-Bound Resource Management (SBRM) for C-style resources (std::shared_ptr variant). More...
 
template<typename TType >
constexpr TType volatile_load (const TType *target) noexcept
 Read from a volatile variable. More...
 
template<typename TType >
constexpr TType volatile_load (volatile const TType *target) noexcept
 Read from a volatile memory location. More...
 
template<typename TType >
void volatile_store (TType *target, TType value) noexcept
 Write to a volatile variable. More...
 
template<typename TType >
void volatile_store (volatile TType *target, TType value) noexcept
 Write to a volatile memory location. More...
 
Alignment Functions
template<typename TIntegralType >
constexpr bool is_power_2 (TIntegralType val) noexcept
 Check if a number is a power of 2. More...
 
template<typename TType >
constexpr bool is_aligned (const TType val, const size_t align) noexcept
 Checks if a value meets a specified alignment. More...
 
Bitfield Functions
template<typename TIntegralType , typename... Args>
constexpr TIntegralType bitmask (Args &&... args) noexcept
 A C++ 17 bitmask generator. More...
 
Time Conversion Functions

Convert between C and C++ time representations.

constexpr std::chrono::nanoseconds timespecToDuration (const timespec ts) noexcept
 Convert from struct timespec to std::chrono::duration. More...
 
constexpr std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > timespecToTimePoint (const timespec ts) noexcept
 Convert from struct timespec to std::chrono::time_point. More...
 
constexpr timespec durationToTimespec (std::chrono::nanoseconds dur) noexcept
 Convert from std::chrono::duration to struct timespec. More...
 
constexpr timespec timepointToTimespec (std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > tp) noexcept
 Convert from std::chrono::time_point to struct timespec. More...
 

Variables

constexpr size_t DefaultStaticQueueLargestSize = 128
 

Detailed Description

Embedded framework utility functions and classes.

Framework utilites are not tied to a platform implementation. They can be used in any framework layer.

Variable Documentation

◆ DefaultStaticQueueLargestSize

constexpr size_t embutil::DefaultStaticQueueLargestSize = 128
inline