Setup CD drive

This commit is contained in:
2023-01-22 14:07:58 +01:00
parent 2250be6df9
commit c07556895d
4 changed files with 119 additions and 32 deletions

View File

@@ -57,34 +57,6 @@ namespace JabyEngine {
static constexpr auto ApplyChanges = Bit<uint8_t>(5);
};
struct Interrupt {
static void enable(VolatileBitMapPOD<InterruptEnable>& port) {
port.write(InterruptEnable::InterruptTypValue.max());
}
static void enable_extended(VolatileBitMapPOD<InterruptEnable>& port) {
port.write({InterruptEnable::with(InterruptEnable::InterruptTypValue.max(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ)});
}
static uint8_t get_type(const VolatileBitMapPOD<InterruptFlag>& port) {
return port.read().get_value(InterruptFlag::InterruptTypValue);
}
static void ack(VolatileBitMapPOD<InterruptFlag>& port) {
port.write(InterruptFlag::InterruptTypValue.max());
}
static void ack_extended(VolatileBitMapPOD<InterruptFlag>& port) {
port.write({InterruptFlag::with(InterruptFlag::InterruptTypValue.max(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ)});
}
};
__declare_io_port_global(IndexStatus_t, IndexStatus, 0x1F801800);
static constexpr auto IORegister1Adr = 0x1F801801;
static constexpr auto IORegister2Adr = 0x1F801802;
static constexpr auto IORegister3Adr = 0x1F801803;
typedef VolatilePOD<uint8_t> ResponseFifo_t;
typedef VolatilePOD<uint8_t> CommandFifo_t;
typedef VolatilePOD<uint8_t> DataFifo_t;
@@ -98,6 +70,53 @@ namespace JabyEngine {
typedef VolatileBitMapPOD<SoundMapCoding> SoundMapCodingInfo_t;
typedef VolatileBitMapPOD<AudioVolumeApply> AudioVolumeApplyChange_t;
struct Interrupt {
enum Type : uint8_t {
None = 0,
DataReady = 1,
Complete = 2,
Acknowledge = 3,
DataEnd = 4,
DiskError = 5
};
static void enable(InterruptEnableRegister_t& port) {
port.write(InterruptEnable::InterruptTypValue.max());
}
static void enable_extended(InterruptEnableRegister_t& port) {
port.write({InterruptEnable::with(InterruptEnable::InterruptTypValue.max(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ)});
}
static Type get_type(const InterruptFlagRegister_t& port) {
return static_cast<Type>(port.read().get_value(InterruptFlag::InterruptTypValue));
}
static void ack(InterruptFlagRegister_t& port) {
port.write(InterruptFlag::InterruptTypValue.max());
}
static void ack_extended(InterruptFlagRegister_t& port) {
port.write({InterruptFlag::with(InterruptFlag::InterruptTypValue.max(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ)});
}
};
struct Command {
struct Info {
uint8_t id;
Interrupt::Type complete_irq;
};
static constexpr Info GetStat{0x1, Interrupt::Type::Acknowledge};
static constexpr Info Init{0xA, Interrupt::Type::Complete};
};
static constexpr auto IORegister1Adr = 0x1F801801;
static constexpr auto IORegister2Adr = 0x1F801802;
static constexpr auto IORegister3Adr = 0x1F801803;
__declare_io_port_global(IndexStatus_t, 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)