Update IOPort code and prepare DMA usage - needs all testing
This commit is contained in:
@@ -74,41 +74,16 @@ namespace JabyEngine {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename S, typename T = S::UnderlyingType>
|
||||
struct IOPortX {
|
||||
using Value = S;
|
||||
|
||||
S read() const {
|
||||
return S{*const_cast<const volatile T*>(reinterpret_cast<const T*>(this))};
|
||||
}
|
||||
|
||||
void write(S value) {
|
||||
*const_cast<volatile T*>(reinterpret_cast<T*>(this)) = value.raw;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct IOPortX<T, T> {
|
||||
T read() const {
|
||||
return *const_cast<const volatile T*>(reinterpret_cast<const T*>(this));
|
||||
}
|
||||
|
||||
void write(T value) {
|
||||
*const_cast<volatile T*>(reinterpret_cast<T*>(this)) = value;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct IOPort {
|
||||
using Value = T;
|
||||
T value;
|
||||
|
||||
T read() const {
|
||||
return {const_cast<const volatile IOPort<T>*>(this)->value.raw};
|
||||
return {const_cast<const volatile Value*>(reinterpret_cast<const Value*>(this))->raw};
|
||||
}
|
||||
|
||||
void write(T value) {
|
||||
const_cast<volatile IOPort<T>*>(this)->value.raw = value.raw;
|
||||
const_cast<volatile Value*>(reinterpret_cast<Value*>(this))->raw = value.raw;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user