Save state before change
This commit is contained in:
parent
de2ffc6b22
commit
ce4520527e
|
@ -13,6 +13,15 @@ namespace JabyEngine {
|
||||||
static constexpr T words_to_sectors(T size) {
|
static constexpr T words_to_sectors(T size) {
|
||||||
return (size + static_cast<T>(DataSector::SizeWords - 1))/static_cast<T>(DataSector::SizeWords);
|
return (size + static_cast<T>(DataSector::SizeWords - 1))/static_cast<T>(DataSector::SizeWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr size_t hash() const {
|
||||||
|
uint32_t value = 0;
|
||||||
|
|
||||||
|
for(const auto word : this->data) {
|
||||||
|
value += word;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Index {
|
enum Index {
|
||||||
|
@ -142,10 +151,10 @@ namespace JabyEngine {
|
||||||
|
|
||||||
static void ack_extended(IOPort<InterruptFlag>& port) {
|
static void ack_extended(IOPort<InterruptFlag>& port) {
|
||||||
port.write(InterruptFlag::from(InterruptFlag::InterruptTypValue.range_max<uint8_t>(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ));
|
port.write(InterruptFlag::from(InterruptFlag::InterruptTypValue.range_max<uint8_t>(), InterruptEnable::UnknownIRQ, InterruptEnable::CommandStartIRQ));
|
||||||
// *reinterpret_cast<uint32_t*>(0x0) = 0;
|
}
|
||||||
// *reinterpret_cast<uint32_t*>(0x0) = 0;
|
|
||||||
// *reinterpret_cast<uint32_t*>(0x0) = 0;
|
static void reset_parameter_fifo(IOPort<InterruptFlag>& port) {
|
||||||
// *reinterpret_cast<uint32_t*>(0x0) = 0;
|
port.write(InterruptFlag{0x40});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace CD {
|
namespace CD {
|
||||||
|
extern volatile uint8_t zero;
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
enum struct State {
|
enum struct State {
|
||||||
Ready = 0,
|
Ready = 0,
|
||||||
|
@ -84,6 +86,7 @@ namespace JabyEngine {
|
||||||
void continue_reading();
|
void continue_reading();
|
||||||
|
|
||||||
BCDTimeStamp get_loc();
|
BCDTimeStamp get_loc();
|
||||||
|
BCDTimeStamp get_locL();
|
||||||
|
|
||||||
void enable_CD();
|
void enable_CD();
|
||||||
void enable_CDDA();
|
void enable_CDDA();
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace JabyEngine {
|
||||||
setting.get_loc_functional = !CD::get_loc().is_zero();
|
setting.get_loc_functional = !CD::get_loc().is_zero();
|
||||||
|
|
||||||
CD::enable_CDXA(double_speed); //< Activates PortIndex0
|
CD::enable_CDXA(double_speed); //< Activates PortIndex0
|
||||||
set_channel(channel);
|
set_channel(channel);printf("!!0-%X %X %X\n", setting.start_loc.min, setting.start_loc.sec, setting.start_loc.sector);
|
||||||
CD::NewCommand::send(CD_IO::Command::SetLoc, setting.start_loc.min, setting.start_loc.sec, setting.start_loc.sector);
|
CD::NewCommand::send(CD_IO::Command::SetLoc, setting.start_loc.min, setting.start_loc.sec, setting.start_loc.sector);
|
||||||
CD::NewCommand::send(CD_IO::Command::ReadS);
|
CD::NewCommand::send(CD_IO::Command::ReadS);
|
||||||
}
|
}
|
||||||
|
@ -75,8 +75,8 @@ namespace JabyEngine {
|
||||||
void pop_play() {
|
void pop_play() {
|
||||||
CD::enable_CDXA(setting.double_speed); //< Activates PortIndex0
|
CD::enable_CDXA(setting.double_speed); //< Activates PortIndex0
|
||||||
|
|
||||||
set_channel(setting.channel);
|
set_channel(setting.channel);printf("!!1-%X %X %X\n", setting.last_loc.min, setting.last_loc.sec, setting.last_loc.sector);
|
||||||
CD::NewCommand::send(CD_IO::Command::SetLoc, setting.last_loc.min, setting.last_loc.sec, setting.last_loc.sector);
|
CD::NewCommand::send_wait_response(CD_IO::Command::SetLoc, setting.last_loc.min, setting.last_loc.sec, setting.last_loc.sector);
|
||||||
CD::NewCommand::send(CD_IO::Command::ReadS);
|
CD::NewCommand::send(CD_IO::Command::ReadS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,8 @@ namespace JabyEngine {
|
||||||
return self.circular_buffer.allocate();
|
return self.circular_buffer.allocate();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
printf(">>> 0x%p\n", this->jobs.files);
|
//printf(">>> 0x%p\n", this->jobs.files);
|
||||||
printf(">>> %i.) CD needs to load LBA: %i -> %i (is LZ4: [%s])\n", cur_job.rel_lba_idx, cur_lba.get_lba(), cur_lba.get_size_in_sectors(), cur_lba.is_lz4() ? "Yes" : "No");
|
//printf(">>> %i.) CD needs to load LBA: %i -> %i (is LZ4: [%s])\n", cur_job.rel_lba_idx, cur_lba.get_lba(), cur_lba.get_size_in_sectors(), cur_lba.is_lz4() ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDFileProcessor :: process_data() {
|
bool CDFileProcessor :: process_data() {
|
||||||
|
|
|
@ -32,7 +32,9 @@ namespace JabyEngine {
|
||||||
|
|
||||||
void routine(uint32_t irq) {
|
void routine(uint32_t irq) {
|
||||||
while(true) {
|
while(true) {
|
||||||
|
const auto old_status = CD_IO::IndexStatus.read();
|
||||||
CD_IRQ::process(irq);
|
CD_IRQ::process(irq);
|
||||||
|
CD_IO::IndexStatus.write(old_status);
|
||||||
irq = Callback::internal::CD::resume();
|
irq = Callback::internal::CD::resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue