New concept for IOPorts

This commit is contained in:
2023-03-14 22:33:49 +01:00
parent d8e7772ee5
commit 46aedaa067
3 changed files with 34 additions and 5 deletions

View File

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

View File

@@ -4,11 +4,16 @@
namespace JabyEngine {
namespace Memory_IO {
struct COM_DELAY {
typedef uint32_t Type;
template<template<typename> typename T>
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 {
typedef uint32_t Type;
@@ -16,7 +21,9 @@ namespace JabyEngine {
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);
}
}