Clear voices

This commit is contained in:
Jaby
2022-09-02 13:04:24 +02:00
committed by Jaby
parent 593d02016a
commit fb26b959d1
3 changed files with 29 additions and 2 deletions

View File

@@ -138,6 +138,10 @@ public:
const_cast<volatile IOPort<T>*>(this)->value = value;
}
constexpr volatile T& ref() {
return const_cast<volatile IOPort<T>*>(this)->value;
}
//For raw access
constexpr operator T() const {
return this->value;
@@ -204,7 +208,8 @@ struct __no_align ubus32_t {
static constexpr uintptr_t IO_Base_Mask = 0xF0000000;
static constexpr uintptr_t IO_Base_Adr = 0x10000000;
#define __declare_io_port_global(type, name, adr) static __always_inline auto& name = *reinterpret_cast<IOPort<type>*>((IO_Base_Adr + (adr & ~IO_Base_Mask)))
#define __declare_io_port_global(type, name, adr) static __always_inline auto& name = *reinterpret_cast<IOPort<type>*>((IO_Base_Adr + (adr & ~IO_Base_Mask)))
#define __declare_io_port_global_array(type, name, adr, size) static __always_inline auto& name = reinterpret_cast<type(&)[size]>(*reinterpret_cast<type*>((IO_Base_Adr + (adr & ~IO_Base_Mask))));
#define __io_port_inherit(name) \
using IOPort::operator=; \
constexpr name() = default; \