First proposial for CD support

This commit is contained in:
Jaby 2023-01-12 21:51:08 +01:00
parent 600e3666fd
commit cf62ef783c
3 changed files with 70 additions and 1 deletions

View File

@ -4,7 +4,60 @@
namespace JabyEngine {
namespace CD_IO {
enum struct Index {
Index0 = 0,
Index1 = 1,
Index2 = 2,
Index3 = 3,
};
struct __no_align IndexStatus : public ComplexBitMap<uint8_t> {
__io_port_inherit_complex_bit_map(IndexStatus);
static constexpr auto PortIndex = BitRange<Index>::from_to(0, 1);
static constexpr auto HasXAFifoData = Bit<uint8_t>(2);
static constexpr auto IsParameterFifoEmpty = Bit<uint8_t>(3);
static constexpr auto HasParameterFifoSpace = Bit<uint8_t>(4);
static constexpr auto HasResponseFifoData = Bit<uint8_t>(5);
static constexpr auto HasDataFifoData = Bit<uint8_t>(6);
static constexpr auto IsTransmissionBusy = Bit<uint8_t>(7);
};
namespace Index0Types {
struct __no_align IndexTriplet {
// Replace with proper types later
union __no_align {
const IOPort<uint8_t> response_fifo;
IOPort<uint8_t> command;
};
union __no_align {
const IOPort<uint8_t> data_fifo;
IOPort<uint8_t> parameter_fifo;
};
union __no_align {
const IOPort<uint8_t> irq_enable;
IOPort<uint8_t> irq_request;
};
};
static_assert(sizeof(IndexTriplet) == 3);
}
__declare_io_port_global(struct IndexStatus, IndexStatus, 0x1F801800);
namespace Helper {
template<typename S>
static S& change_to(Index idx) {
IndexStatus.write(ComplexBitMap(static_cast<uint8_t>(idx)));
return *reinterpret_cast<S*>(0x1F801801);
}
}
static Index0Types::IndexTriplet& change_to_index0() {
return Helper::change_to<Index0Types::IndexTriplet>(Index::Index0);
}
}
}

View File

@ -3,6 +3,12 @@
#include <PSX/jabyengine.hpp>
namespace JabyEngine {
//boot namespace?
namespace CD {
void setup();
}
namespace GPU {
void display_logo();
void setup();

View File

@ -0,0 +1,10 @@
#include "../../include/BootLoader/boot_loader.hpp"
#include <PSX/System/IOPorts/cd_io.hpp>
namespace JabyEngine {
namespace CD {
void setup() {
CD_IO::change_to_index0();
}
}
}