#pragma once #include "../ioport.hpp" namespace JabyEngine { namespace SPU_IO_Values { namespace internal { template struct AliasUbus32IOPort : public IOPort { T read() const { return T{IOPort::read()}; } void write(T value) { IOPort::write(value.raw); } }; #define alias_ioport_ubus32(type) \ template<> \ struct IOPort : public SPU_IO_Values::internal::AliasUbus32IOPort {} } __declare_io_value(ControlRegister, uint16_t) { enum RAMTransferMode { Stop = 0, ManualWrite = 1, DMAWrite = 2, DMARead = 3 }; static constexpr auto Enable = Bit(15); static constexpr auto Unmute = Bit(14); static constexpr auto NoiseFrequcenyShift = BitRange::from_to(10, 13); static constexpr auto NoiseFrequcenyStep = BitRange::from_to(8, 9); static constexpr auto ReverbMasterEnable = Bit(7); static constexpr auto IRQ9Enable = Bit(6); static constexpr auto TransferMode = BitRange::from_to(4, 5); static constexpr auto ExternalAudioReverb = Bit(3); static constexpr auto CDAudioReverb = Bit(2); static constexpr auto ExternalAudioEnable = Bit(1); 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) static constexpr auto TransferBusy = Bit(10); static constexpr auto IsDMARead = Bit(9); static constexpr auto isDMAWrite = Bit(8); static constexpr auto isDMA = Bit(7); static constexpr auto isIRQ = Bit(6); // Copies of ControlRegister static constexpr auto TransferMode = BitRange::from_to(4, 5); static constexpr auto ExternalAudioReverb = Bit(3); static constexpr auto CDAudioReverb = Bit(2); static constexpr auto ExternalAudioEnable = Bit(1); static constexpr auto CDAudioEnable = Bit(0); }; } alias_ioport_ubus32(SPU_IO_Values::Echo); }