Refine new IO port concept
This commit is contained in:
parent
37192b537b
commit
a361f8e4a0
|
@ -6,17 +6,28 @@ namespace JabyEngine {
|
|||
template<typename T>
|
||||
struct NormalValue {
|
||||
typedef T Value;
|
||||
typedef T NakedValue;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct VolatileValue {
|
||||
typedef volatile T Value;
|
||||
typedef T NakedValue;
|
||||
};
|
||||
|
||||
#define __declare_new_io_port(name, adr) \
|
||||
typedef name##_io_base<VolatileValue> name##_v; \
|
||||
typedef name##_io_base<NormalValue> name##_t; \
|
||||
static auto& name = *reinterpret_cast<name##_v*>(adr)
|
||||
|
||||
#define __declare_io_type(name, type, ...) \
|
||||
template<template<typename> typename T> \
|
||||
struct name##_io_base { \
|
||||
T<type>::Value value; \
|
||||
\
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct VolatilePOD {
|
||||
struct __attribute__((deprecated)) VolatilePOD {
|
||||
volatile T raw;
|
||||
|
||||
constexpr T read() const {
|
||||
|
@ -30,7 +41,7 @@ namespace JabyEngine {
|
|||
|
||||
// For use with ComplexBitMaps or what else satisfies this API
|
||||
template<typename T>
|
||||
struct VolatileBitMapPOD {
|
||||
struct __attribute__((deprecated)) VolatileBitMapPOD {
|
||||
typedef typename T::UnderlyingType Raw;
|
||||
|
||||
VolatilePOD<Raw> pod;
|
||||
|
|
|
@ -4,27 +4,20 @@
|
|||
|
||||
namespace JabyEngine {
|
||||
namespace Memory_IO {
|
||||
template<template<typename> typename T>
|
||||
struct COM_DELAY_base {
|
||||
T<uint32_t>::Value value;
|
||||
|
||||
__declare_io_type(COM_DELAY, uint32_t,
|
||||
void setup() {
|
||||
this->value = 0x1325;
|
||||
}
|
||||
};
|
||||
typedef COM_DELAY_base<VolatileValue> COM_DELAY_v;
|
||||
typedef COM_DELAY_base<NormalValue> COM_DELAY_t;
|
||||
);
|
||||
|
||||
struct CD_DELAY {
|
||||
typedef uint32_t Type;
|
||||
__declare_io_type(CD_DELAY, uint32_t,
|
||||
void setup() {
|
||||
this->value = 0x20943;
|
||||
}
|
||||
);
|
||||
|
||||
static constexpr uint32_t SetupValue = 0x20943;
|
||||
};
|
||||
|
||||
static auto& COM_DELAY = *reinterpret_cast<COM_DELAY_v*>(0x1F801020);
|
||||
|
||||
//__declare_io_port_global_simple(COM_DELAY::Type, COM_DELAY, 0x1F801020);
|
||||
__declare_io_port_global_simple(CD_DELAY::Type, CD_DELAY, 0x1F801018);
|
||||
__declare_new_io_port(COM_DELAY, 0x1F801020);
|
||||
__declare_new_io_port(CD_DELAY, 0x1F801018);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,17 +17,7 @@ namespace JabyEngine {
|
|||
void setup() {
|
||||
__syscall_EnterCriticalSection();
|
||||
Memory_IO::COM_DELAY.setup();
|
||||
Memory_IO::COM_DELAY.setup();
|
||||
Memory_IO::COM_DELAY.setup();
|
||||
|
||||
Memory_IO::COM_DELAY_t b{Memory_IO::COM_DELAY.value};
|
||||
|
||||
b.setup();
|
||||
b.setup();
|
||||
b.setup();
|
||||
|
||||
//Memory_IO::COM_DELAY.write(Memory_IO::COM_DELAY::SetupValue);
|
||||
Memory_IO::CD_DELAY.write(Memory_IO::CD_DELAY::SetupValue);
|
||||
Memory_IO::CD_DELAY.setup();
|
||||
|
||||
__syscall_SysEnqIntRP(CdromIoIrq, &::JabyEngine::CD::internal::callback);
|
||||
|
||||
|
|
Loading…
Reference in New Issue