This commit is contained in:
2024-09-22 14:29:05 +02:00
parent efd887268b
commit f138ca9a9d
3 changed files with 48 additions and 13 deletions

View File

@@ -3,6 +3,23 @@
namespace JabyEngine {
namespace SPU_IO_Values {
namespace internal {
template<typename T>
struct AliasUbus32IOPort : public IOPort<ubus32_t> {
T read() const {
return T{IOPort<ubus32_t>::read()};
}
void write(T value) {
IOPort<ubus32_t>::write(value.raw);
}
};
#define alias_ioport_ubus32(type) \
template<> \
struct IOPort<type> : public SPU_IO_Values::internal::AliasUbus32IOPort<type> {}
}
__declare_io_value(ControlRegister, uint16_t) {
enum RAMTransferMode {
Stop = 0,
@@ -24,6 +41,17 @@ namespace JabyEngine {
static constexpr auto CDAudioEnable = Bit(0);
};
__declare_io_value(Echo, ubus32_t) {
static constexpr auto EchoBits = BitRange::from_to(0, 23);
static constexpr Echo AllOff() {
return Echo{0};
}
};
__declare_io_value(SRAM_Adr, uint16_t) {
};
__declare_io_value(StatusRegister, uint16_t) {
static constexpr auto Unused = BitRange::from_to(12, 15);
static constexpr auto CaputreBufferHalf = Bit(11); // TODO: Turn into enum?; Writing to First/Second half of Capture Buffers (0=First, 1=Second)
@@ -38,8 +66,7 @@ namespace JabyEngine {
static constexpr auto CDAudioReverb = Bit(2);
static constexpr auto ExternalAudioEnable = Bit(1);
static constexpr auto CDAudioEnable = Bit(0);
};
__declare_io_value(SRAM_Adr, uint16_t) {};
};
}
alias_ioport_ubus32(SPU_IO_Values::Echo);
}