Prepare setup of CD drive
This commit is contained in:
parent
5a23249032
commit
2250be6df9
|
@ -31,6 +31,7 @@ namespace JabyEngine {
|
||||||
|
|
||||||
struct InterruptEnable : public ComplexBitMap<uint8_t> {
|
struct InterruptEnable : public ComplexBitMap<uint8_t> {
|
||||||
static constexpr auto InterruptTypValue = BitRange<uint8_t>::from_to(0, 2);
|
static constexpr auto InterruptTypValue = BitRange<uint8_t>::from_to(0, 2);
|
||||||
|
static constexpr auto InterruptExtended = BitRange<uint8_t>::from_to(0, 4);
|
||||||
static constexpr auto UnknownIRQ = Bit<uint8_t>(3);
|
static constexpr auto UnknownIRQ = Bit<uint8_t>(3);
|
||||||
static constexpr auto CommandStartIRQ = Bit<uint8_t>(4);
|
static constexpr auto CommandStartIRQ = Bit<uint8_t>(4);
|
||||||
};
|
};
|
||||||
|
@ -57,7 +58,11 @@ namespace JabyEngine {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Interrupt {
|
struct Interrupt {
|
||||||
static void enable_all(VolatileBitMapPOD<InterruptEnable>& port) {
|
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)});
|
port.write({InterruptEnable::with(InterruptEnable::InterruptTypValue.max(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +73,10 @@ namespace JabyEngine {
|
||||||
static void ack(VolatileBitMapPOD<InterruptFlag>& port) {
|
static void ack(VolatileBitMapPOD<InterruptFlag>& port) {
|
||||||
port.write(InterruptFlag::InterruptTypValue.max());
|
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);
|
__declare_io_port_global(IndexStatus_t, IndexStatus, 0x1F801800);
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef __JABYENGINE_MEMORY_IO_HPP__
|
||||||
|
#define __JABYENGINE_MEMORY_IO_HPP__
|
||||||
|
#include "ioport.hpp"
|
||||||
|
|
||||||
|
namespace JabyEngine {
|
||||||
|
namespace Memory_IO {
|
||||||
|
struct COM_DELAY {
|
||||||
|
typedef uint32_t Type;
|
||||||
|
|
||||||
|
static constexpr uint32_t SetupValue = 0x1325;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CD_DELAY {
|
||||||
|
typedef uint32_t Type;
|
||||||
|
|
||||||
|
static constexpr uint32_t SetupValue = 0x20943;
|
||||||
|
};
|
||||||
|
|
||||||
|
__declare_io_port_global_simple(COM_DELAY::Type, COM_DELAY, 0x1F801020);
|
||||||
|
__declare_io_port_global_simple(CD_DELAY::Type, CD_DELAY, 0x1F801018);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //!__JABYENGINE_MEMORY_IO_HPP__
|
|
@ -1,13 +1,26 @@
|
||||||
#include "../../include/BootLoader/boot_loader.hpp"
|
#include "../../include/BootLoader/boot_loader.hpp"
|
||||||
#include <PSX/System/IOPorts/cd_io.hpp>
|
#include <PSX/System/IOPorts/cd_io.hpp>
|
||||||
|
#include <PSX/System/IOPorts/interrupt_io.hpp>
|
||||||
|
#include <PSX/System/IOPorts/memory_io.hpp>
|
||||||
|
#include <PSX/System/syscalls.h>
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace boot {
|
namespace boot {
|
||||||
namespace CD {
|
namespace CD {
|
||||||
void setup() {
|
void setup() {
|
||||||
CD_IO::PortIndex0::change_to();
|
__syscall_EnterCriticalSection();
|
||||||
CD_IO::PortIndex0::DataFifo.read();
|
Memory_IO::COM_DELAY.write(Memory_IO::COM_DELAY::SetupValue);
|
||||||
CD_IO::PortIndex0::DataFifo16.read();
|
Memory_IO::CD_DELAY.write(Memory_IO::CD_DELAY::SetupValue);
|
||||||
|
|
||||||
|
//Equeue Callback?
|
||||||
|
|
||||||
|
CD_IO::PortIndex1::change_to();
|
||||||
|
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlagRegister);
|
||||||
|
CD_IO::Interrupt::enable(CD_IO::PortIndex1::InterruptEnableRegister);
|
||||||
|
|
||||||
|
Interrupt::ack_irq(Interrupt::CDROM);
|
||||||
|
Interrupt::enable_irq(Interrupt::CDROM);
|
||||||
|
__syscall_ExitCriticalSection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace JabyEngine {
|
||||||
enable_DMA();
|
enable_DMA();
|
||||||
|
|
||||||
SPU::stop_voices();
|
SPU::stop_voices();
|
||||||
|
|
||||||
|
CD::setup();
|
||||||
Timer::setup();
|
Timer::setup();
|
||||||
|
|
||||||
const auto start = HighResTime::get_time_stamp();
|
const auto start = HighResTime::get_time_stamp();
|
||||||
|
|
Loading…
Reference in New Issue