First proposial for CD support
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user