libyggdrasil  v1.0.0
bsp Namespace Reference

Namespaces

 asg
 
 asg_coproc
 
 core
 
 drv
 
 math
 
 mid
 
 scope_guard
 
 ygg
 

Classes

struct  BitField
 Bitfield abstraction. Provides a way to read from, write to and pass around bitfields within registers as if they were normal variables. More...
 
struct  ByteSwapped
 Helper class to store the data of a given type in reverse order. More...
 
struct  dependent_false
 Helper type trait for using static_asserts that should always trigger an error when evaluated. More...
 
struct  Register
 MMIO Register abstraction. Gives access to bitfields within the register as well as a reference to the register value itself. More...
 
struct  TypeSafe
 Helper class to create type-safe integral types. More...
 

Typedefs

template<typename T >
using IO = volatile T
 MMIO type template. More...
 

Functions

template<typename To , typename From >
To bit_cast (const From &src) noexcept
 std::bit_cast implementation for doing reinterpret_cast-style conversion without invoking undefined behaviour More...
 
template<typename T >
constexpr T byteSwap (T value)
 Swaps bytes of input value to convert between big and little endian. More...
 
template<typename T >
auto enumValue (T value)
 Casts a scoped enum type into its underlying value. More...
 
ALWAYS_INLINE void doNotOptimize (const auto &value)
 Confuses the compiler to prevent it from optimizing out a variable. Helpful for debugging. More...
 

Variables

template<typename T >
constexpr auto dependent_false_v = dependent_false<T>::value
 
using addr_t = std::uint32_t
 ARM32 specific types. More...
 
using reg_t = std::uint32_t
 
constexpr auto RegisterAlignment = alignof(reg_t)
 ARM32 specific constants. More...
 

Typedef Documentation

◆ addr_t

using bsp::addr_t = typedef std::uint32_t

ARM32 specific types.

◆ IO

template<typename T >
using bsp::IO = typedef volatile T

MMIO type template.

Template Parameters
TType to access

◆ reg_t

using bsp::reg_t = typedef std::uint32_t

Function Documentation

◆ bit_cast()

template<typename To , typename From >
To bsp::bit_cast ( const From &  src)
noexcept

std::bit_cast implementation for doing reinterpret_cast-style conversion without invoking undefined behaviour

Warning
This is a terrible bit_cast implementation! Replace this with actual std::bit_cast once the toolchain supports it (GCC 11.1+)
Template Parameters
ToType to cast to
Parameters
srcValue to bit-cast to type of To

◆ byteSwap()

template<typename T >
constexpr T bsp::byteSwap ( value)
constexpr

Swaps bytes of input value to convert between big and little endian.

Parameters
valueIntegral value to swap
Template Parameters
TType of value to swap

◆ doNotOptimize()

ALWAYS_INLINE void bsp::doNotOptimize ( const auto &  value)

Confuses the compiler to prevent it from optimizing out a variable. Helpful for debugging.

Parameters
valueVariable to prevent optimization of

◆ enumValue()

template<typename T >
auto bsp::enumValue ( value)

Casts a scoped enum type into its underlying value.

Template Parameters
TEnum type
Parameters
valueEnum value
Returns
Underlying value

Variable Documentation

◆ dependent_false_v

template<typename T >
constexpr auto bsp::dependent_false_v = dependent_false<T>::value
constexpr

◆ RegisterAlignment

constexpr auto bsp::RegisterAlignment = alignof(reg_t)
constexpr

ARM32 specific constants.