Finish clean-up
This commit is contained in:
@@ -31,7 +31,7 @@ namespace JabyEngine {
|
||||
static constexpr uint8_t Max = 0xFF;
|
||||
};
|
||||
|
||||
__new_declare_io_value(Mode, uint8_t) {
|
||||
__declare_io_value(Mode, uint8_t) {
|
||||
static constexpr auto DoubleSpeed = Bit(7);
|
||||
static constexpr auto SingleSpeed = !DoubleSpeed;
|
||||
static constexpr auto XADPCM = Bit(6);
|
||||
@@ -47,7 +47,7 @@ namespace JabyEngine {
|
||||
}
|
||||
};
|
||||
|
||||
__new_declare_io_value(IndexStatus, uint8_t) {
|
||||
__declare_io_value(IndexStatus, uint8_t) {
|
||||
static constexpr auto PortIndex = BitRange::from_to(0, 1);
|
||||
static constexpr auto HasXAFifoData = Bit(2);
|
||||
static constexpr auto IsParameterFifoEmpty = Bit(3);
|
||||
@@ -57,16 +57,16 @@ namespace JabyEngine {
|
||||
static constexpr auto IsTransmissionBusy = Bit(7);
|
||||
};
|
||||
|
||||
__new_declare_io_value(InterruptEnable, uint8_t) {
|
||||
__declare_io_value(InterruptEnable, uint8_t) {
|
||||
static constexpr auto InterruptTypValue = BitRange::from_to(0, 2);
|
||||
static constexpr auto InterruptExtended = BitRange::from_to(0, 4);
|
||||
static constexpr auto UnknownIRQ = Bit(3);
|
||||
static constexpr auto CommandStartIRQ = Bit(4);
|
||||
};
|
||||
using InterruptFlag = InterruptEnable;
|
||||
typedef InterruptEnable InterruptFlag;
|
||||
|
||||
|
||||
__new_declare_io_value(Request, uint8_t) {
|
||||
__declare_io_value(Request, uint8_t) {
|
||||
static constexpr auto WantCommandStartIRQ = Bit(5);
|
||||
static constexpr auto WantData = Bit(7);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace JabyEngine {
|
||||
}
|
||||
};
|
||||
|
||||
__new_declare_io_value(SoundMapCoding, uint8_t) {
|
||||
__declare_io_value(SoundMapCoding, uint8_t) {
|
||||
static constexpr auto Stereo = Bit(0);
|
||||
static constexpr auto Mono = !Stereo;
|
||||
static constexpr auto SampleRate_18900hz = Bit(2);
|
||||
@@ -89,30 +89,30 @@ namespace JabyEngine {
|
||||
static constexpr auto Emphasis = Bit(6);
|
||||
};
|
||||
|
||||
__new_declare_io_value(AudioVolumeApply, uint8_t) {
|
||||
__declare_io_value(AudioVolumeApply, uint8_t) {
|
||||
static constexpr auto Mute = Bit(0);
|
||||
static constexpr auto ApplyChanges = Bit(5);
|
||||
};
|
||||
|
||||
__new_declare_io_value(ResponseFifo, uint8_t) {
|
||||
__declare_io_value(ResponseFifo, uint8_t) {
|
||||
};
|
||||
__new_declare_io_value(CommandFifo, uint8_t) {
|
||||
__declare_io_value(CommandFifo, uint8_t) {
|
||||
};
|
||||
__new_declare_io_value(DataFifo, uint8_t) {
|
||||
__declare_io_value(DataFifo, uint8_t) {
|
||||
};
|
||||
__new_declare_io_value(DataFifo16, uint16_t) {
|
||||
__declare_io_value(DataFifo16, uint16_t) {
|
||||
};
|
||||
__new_declare_io_value(ParameterFifo, uint8_t) {
|
||||
__declare_io_value(ParameterFifo, uint8_t) {
|
||||
};
|
||||
__new_declare_io_value(SoundMapDataOut, uint8_t) {
|
||||
__declare_io_value(SoundMapDataOut, uint8_t) {
|
||||
};
|
||||
__new_declare_io_value(LeftCD2LeftSPU, CDDAVolume::Type) {
|
||||
__declare_io_value(LeftCD2LeftSPU, CDDAVolume::Type) {
|
||||
};
|
||||
__new_declare_io_value(LeftCD2RightSPU, CDDAVolume::Type) {
|
||||
__declare_io_value(LeftCD2RightSPU, CDDAVolume::Type) {
|
||||
};
|
||||
__new_declare_io_value(RightCD2RightSPU, CDDAVolume::Type) {
|
||||
__declare_io_value(RightCD2RightSPU, CDDAVolume::Type) {
|
||||
};
|
||||
__new_declare_io_value(RightCD2LeftSPU, CDDAVolume::Type) {
|
||||
__declare_io_value(RightCD2LeftSPU, CDDAVolume::Type) {
|
||||
};
|
||||
|
||||
struct Interrupt {
|
||||
@@ -125,23 +125,23 @@ namespace JabyEngine {
|
||||
DiskError = 5
|
||||
};
|
||||
|
||||
static void enable(New::IOPort<InterruptEnable>& port) {
|
||||
static void enable(IOPort<InterruptEnable>& port) {
|
||||
port.write(port.read().set2(InterruptEnable::InterruptTypValue.range_max<uint8_t>()));
|
||||
}
|
||||
|
||||
static void enable_extended(New::IOPort<InterruptEnable>& port) {
|
||||
static void enable_extended(IOPort<InterruptEnable>& port) {
|
||||
port.write(InterruptEnable::from(InterruptEnable::InterruptTypValue.range_max<uint8_t>(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ));
|
||||
}
|
||||
|
||||
static Type get_type(const New::IOPort<InterruptFlag>& port) {
|
||||
static Type get_type(const IOPort<InterruptFlag>& port) {
|
||||
return static_cast<Type>(port.read().get2(InterruptFlag::InterruptTypValue));
|
||||
}
|
||||
|
||||
static void ack(New::IOPort<InterruptFlag>& port) {
|
||||
static void ack(IOPort<InterruptFlag>& port) {
|
||||
port.write(port.read().set2(InterruptFlag::InterruptTypValue.range_max<uint8_t>()));
|
||||
}
|
||||
|
||||
static void ack_extended(New::IOPort<InterruptFlag>& port) {
|
||||
static void ack_extended(IOPort<InterruptFlag>& port) {
|
||||
port.write(InterruptFlag::from(InterruptFlag::InterruptTypValue.range_max<uint8_t>(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ));
|
||||
}
|
||||
};
|
||||
@@ -164,21 +164,18 @@ namespace JabyEngine {
|
||||
static constexpr auto IORegister2Adr = 0x1F801802;
|
||||
static constexpr auto IORegister3Adr = 0x1F801803;
|
||||
|
||||
__new_declare_io_port(, IndexStatus, 0x1F801800);
|
||||
|
||||
//#define __declare_index_io_port(type, name, adr) __cast_io_adr_with_type(inline, type, name, adr)
|
||||
//#define __declare_index_io_port_const(type, name, adr) __cast_io_adr_with_type(const inline, type, name, adr)
|
||||
__declare_io_port(, IndexStatus, 0x1F801800);
|
||||
|
||||
struct PortIndex0 {
|
||||
__new_declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__new_declare_io_port(inline, CommandFifo, IORegister1Adr);
|
||||
__declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__declare_io_port(inline, CommandFifo, IORegister1Adr);
|
||||
|
||||
__new_declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__new_declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__new_declare_io_port(inline, ParameterFifo, IORegister2Adr);
|
||||
__declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__declare_io_port(inline, ParameterFifo, IORegister2Adr);
|
||||
|
||||
__new_declare_io_port(inline const, InterruptEnable, IORegister3Adr);
|
||||
__new_declare_io_port(inline, Request, IORegister3Adr);
|
||||
__declare_io_port(inline const, InterruptEnable, IORegister3Adr);
|
||||
__declare_io_port(inline, Request, IORegister3Adr);
|
||||
|
||||
static void change_to() {
|
||||
IndexStatus.write({Index::Index0});
|
||||
@@ -186,14 +183,14 @@ namespace JabyEngine {
|
||||
};
|
||||
|
||||
struct PortIndex1 {
|
||||
__new_declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__new_declare_io_port(inline, SoundMapDataOut, IORegister1Adr);
|
||||
__declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__declare_io_port(inline, SoundMapDataOut, IORegister1Adr);
|
||||
|
||||
__new_declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__new_declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__new_declare_io_port(inline, InterruptEnable, IORegister2Adr);
|
||||
__declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__declare_io_port(inline, InterruptEnable, IORegister2Adr);
|
||||
|
||||
__new_declare_io_port_w_type(inline, struct InterruptEnable, InterruptFlag, IORegister3Adr);
|
||||
__declare_io_port_w_type(inline, struct InterruptEnable, InterruptFlag, IORegister3Adr);
|
||||
|
||||
static void change_to() {
|
||||
IndexStatus.write({Index::Index1});
|
||||
@@ -201,15 +198,15 @@ namespace JabyEngine {
|
||||
};
|
||||
|
||||
struct PortIndex2 {
|
||||
__new_declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__new_declare_io_port(inline, SoundMapCoding, IORegister1Adr);
|
||||
__declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__declare_io_port(inline, SoundMapCoding, IORegister1Adr);
|
||||
|
||||
__new_declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__new_declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__new_declare_io_port(inline, LeftCD2LeftSPU, IORegister2Adr);
|
||||
__declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__declare_io_port(inline, LeftCD2LeftSPU, IORegister2Adr);
|
||||
|
||||
__new_declare_io_port(inline const, InterruptEnable, IORegister3Adr);
|
||||
__new_declare_io_port(inline, LeftCD2RightSPU, IORegister3Adr);
|
||||
__declare_io_port(inline const, InterruptEnable, IORegister3Adr);
|
||||
__declare_io_port(inline, LeftCD2RightSPU, IORegister3Adr);
|
||||
|
||||
static void change_to() {
|
||||
IndexStatus.write({Index::Index2});
|
||||
@@ -217,15 +214,15 @@ namespace JabyEngine {
|
||||
};
|
||||
|
||||
struct PortIndex3 {
|
||||
__new_declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__new_declare_io_port(inline, RightCD2RightSPU, IORegister1Adr);
|
||||
__declare_io_port(inline const, ResponseFifo, IORegister1Adr);
|
||||
__declare_io_port(inline, RightCD2RightSPU, IORegister1Adr);
|
||||
|
||||
__new_declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__new_declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__new_declare_io_port(inline, RightCD2LeftSPU, IORegister1Adr);
|
||||
__declare_io_port(inline const, DataFifo, IORegister2Adr);
|
||||
__declare_io_port(inline const, DataFifo16, IORegister2Adr);
|
||||
__declare_io_port(inline, RightCD2LeftSPU, IORegister1Adr);
|
||||
|
||||
__new_declare_io_port_w_type(inline const, struct InterruptEnable, InterruptFlag, IORegister3Adr);
|
||||
__new_declare_io_port(inline, AudioVolumeApply, IORegister3Adr);
|
||||
__declare_io_port_w_type(inline const, struct InterruptEnable, InterruptFlag, IORegister3Adr);
|
||||
__declare_io_port( inline, AudioVolumeApply, IORegister3Adr);
|
||||
|
||||
static void change_to() {
|
||||
IndexStatus.write({Index::Index3});
|
||||
|
Reference in New Issue
Block a user