New concept for IOPorts

This commit is contained in:
Jaby 2023-03-14 22:33:49 +01:00
parent b7f3d40a7c
commit 37192b537b
3 changed files with 34 additions and 5 deletions

View File

@ -3,6 +3,18 @@
#include "../../Auxiliary/complex_bitmap.hpp" #include "../../Auxiliary/complex_bitmap.hpp"
namespace JabyEngine { 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;
};
template<typename T> template<typename T>
struct VolatilePOD { struct VolatilePOD {
volatile T raw; volatile T raw;

View File

@ -4,11 +4,16 @@
namespace JabyEngine { namespace JabyEngine {
namespace Memory_IO { namespace Memory_IO {
struct COM_DELAY { template<template<typename> typename T>
typedef uint32_t Type; struct COM_DELAY_base {
T<uint32_t>::Value value;
static constexpr uint32_t SetupValue = 0x1325; void setup() {
this->value = 0x1325;
}
}; };
typedef COM_DELAY_base<VolatileValue> COM_DELAY_v;
typedef COM_DELAY_base<NormalValue> COM_DELAY_t;
struct CD_DELAY { struct CD_DELAY {
typedef uint32_t Type; typedef uint32_t Type;
@ -16,7 +21,9 @@ namespace JabyEngine {
static constexpr uint32_t SetupValue = 0x20943; static constexpr uint32_t SetupValue = 0x20943;
}; };
__declare_io_port_global_simple(COM_DELAY::Type, COM_DELAY, 0x1F801020); 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_io_port_global_simple(CD_DELAY::Type, CD_DELAY, 0x1F801018);
} }
} }

View File

@ -16,7 +16,17 @@ namespace JabyEngine {
void setup() { void setup() {
__syscall_EnterCriticalSection(); __syscall_EnterCriticalSection();
Memory_IO::COM_DELAY.write(Memory_IO::COM_DELAY::SetupValue); 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.write(Memory_IO::CD_DELAY::SetupValue);
__syscall_SysEnqIntRP(CdromIoIrq, &::JabyEngine::CD::internal::callback); __syscall_SysEnqIntRP(CdromIoIrq, &::JabyEngine::CD::internal::callback);