Setup Cody Git server and successfully pause after 1 sector

This commit is contained in:
Jaby
2023-02-27 18:14:04 +01:00
parent c23cde9e1f
commit ae7edb5692
5 changed files with 62 additions and 10 deletions

View File

@@ -21,11 +21,21 @@ namespace JabyEngine {
cmd_fifo.write(cmd.id);
}
template<typename T, typename...ARGS>
static void send(CD_IO::Command::Info cmd, ARGS...args) {
send(T::CommandFifo, T::ParameterFifo, cmd, args...);
}
template<typename...ARGS>
static void send_wait(CD_IO::CommandFifo_t& cmd_fifo, CD_IO::ParameterFifo_t& parameter_fifo, CD_IO::Command::Info cmd, ARGS...args) {
send(cmd_fifo, parameter_fifo, cmd, args...);
wait_until(cmd.complete_irq);
}
template<typename T, typename...ARGS>
static void send_wait(CD_IO::Command::Info cmd, ARGS...args) {
send_wait(T::CommandFifo, T::ParameterFifo, cmd, args...);
}
};
State read_file(FileInfo file_info, const SectorBufferAllocator& buffer_allocator);

View File

@@ -30,14 +30,17 @@ namespace JabyEngine {
CD_IO::PortIndex1::change_to();
const auto cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlagRegister);
if(cur_irq == CD_IO::Interrupt::DataReady) {
printf("CDDrive: Got data!\n");
}
last_interrupt.write(cur_irq);
CD_IO::Interrupt::ack(CD_IO::PortIndex1::InterruptFlagRegister);
if(cur_irq == CD_IO::Interrupt::DataReady) {
sectors_left--;
if(sectors_left == 0) {
CD_IO::PortIndex0::change_to();
Command::send<CD_IO::PortIndex0>(CD_IO::Command::Pause);
}
}
CD_IO::IndexStatus.write({old_idx});
return InterruptVerifierResult::ExecuteHandler;
}
@@ -64,11 +67,11 @@ namespace JabyEngine {
sectors_left = file_info.sectors;
CD_IO::PortIndex0::change_to();
Command::send_wait(CD_IO::PortIndex0::CommandFifo, CD_IO::PortIndex0::ParameterFifo, CD_IO::Command::SetMode, DataSectorMode);
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetMode, DataSectorMode);
const auto loc = CDTimeStamp::from(file_info);
Command::send_wait(CD_IO::PortIndex0::CommandFifo, CD_IO::PortIndex0::ParameterFifo, CD_IO::Command::SetLoc, loc.get_min_cd(), loc.get_sec_cd(), loc.get_sector_cd());
Command::send_wait(CD_IO::PortIndex0::CommandFifo, CD_IO::PortIndex0::ParameterFifo, CD_IO::Command::ReadN);
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetLoc, loc.get_min_cd(), loc.get_sec_cd(), loc.get_sector_cd());
Command::send<CD_IO::PortIndex0>(CD_IO::Command::ReadN);
printf("Now reading: %i\n", file_info.lba);
printf("I'm not fully implemented! %s\n", __FUNCTION__);