Current progress
This commit is contained in:
parent
e3499dcd1e
commit
c1f86c11c3
|
@ -49,6 +49,10 @@ namespace JabyEngine {
|
|||
constexpr BitRangeValue<T> with(T value) const {
|
||||
return {value, this->begin, this->length};
|
||||
}
|
||||
|
||||
constexpr BitRangeValue<T> max() const {
|
||||
return BitRange<T>::with((1 << this->length) - 1);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -23,23 +23,63 @@ namespace JabyEngine {
|
|||
static constexpr auto IsTransmissionBusy = Bit<uint8_t>(7);
|
||||
};
|
||||
|
||||
struct __no_align InterruptEnable : public ComplexBitMap<uint8_t> {
|
||||
__io_port_inherit_complex_bit_map(InterruptEnable);
|
||||
|
||||
static constexpr auto InterruptTypValue = BitRange<uint8_t>::from_to(0, 2);
|
||||
static constexpr auto UnknownIRQ = Bit<uint8_t>(3);
|
||||
static constexpr auto CommandStartIRQ = Bit<uint8_t>(4);
|
||||
};
|
||||
typedef InterruptEnable InterruptFlag;
|
||||
|
||||
struct __no_align Request : public ComplexBitMap<uint8_t> {
|
||||
__io_port_inherit_complex_bit_map(Request);
|
||||
|
||||
static constexpr auto WantCommandStartIRQ = Bit<uint8_t>(5);
|
||||
static constexpr auto WantData = Bit<uint8_t>(7);
|
||||
};
|
||||
|
||||
struct Interrupt {
|
||||
/*static void enable_all(IOPort<InterruptEnable>& port) {
|
||||
port.write_combined(InterruptEnable::InterruptTypValue.max(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ);
|
||||
}
|
||||
|
||||
static uint8_t get_type(const IOPort<InterruptFlag>& port) {
|
||||
return port.read().get_value(InterruptFlag::InterruptTypValue);
|
||||
}
|
||||
|
||||
static void ack(IOPort<InterruptFlag>& port) {
|
||||
port.write_combined(InterruptFlag::InterruptTypValue.max());
|
||||
}*/
|
||||
};
|
||||
|
||||
typedef uint8_t ResponseFifo;
|
||||
typedef uint8_t CommandFifo;
|
||||
typedef uint8_t DataFifo;
|
||||
typedef uint16_t DataFifo16;
|
||||
typedef uint8_t ParameterFifo;
|
||||
|
||||
namespace Index0Types {
|
||||
struct __no_align IndexTriplet {
|
||||
// Replace with proper types later
|
||||
union __no_align {
|
||||
const IOPort<uint8_t> response_fifo;
|
||||
IOPort<uint8_t> command;
|
||||
const IOPort<ResponseFifo> response_fifo;
|
||||
IOPort<CommandFifo> command;
|
||||
};
|
||||
|
||||
union __no_align {
|
||||
const IOPort<uint8_t> data_fifo;
|
||||
IOPort<uint8_t> parameter_fifo;
|
||||
const IOPort<DataFifo> data_fifo;
|
||||
IOPort<ParameterFifo> parameter_fifo;
|
||||
};
|
||||
|
||||
union __no_align {
|
||||
const IOPort<uint8_t> irq_enable;
|
||||
IOPort<uint8_t> irq_request;
|
||||
const IOPort<InterruptEnable> irq_enable;
|
||||
IOPort<Request> request;
|
||||
};
|
||||
|
||||
const IOPort<uint16_t>& get_data_fifo_16() const {
|
||||
return *reinterpret_cast<const IOPort<uint16_t>*>(&this->data_fifo);
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(IndexTriplet) == 3);
|
||||
|
|
Loading…
Reference in New Issue