Fixup CD freeze?
This commit is contained in:
parent
271733a7fe
commit
07756fd180
|
@ -31,6 +31,7 @@ ENTRY(_ZN10JabyEngine5startEv)
|
|||
TLOAD_ADDR = DEFINED(TLOAD_ADDR) ? TLOAD_ADDR : 0x80010000;
|
||||
|
||||
MEMORY {
|
||||
zero : ORIGIN = 0x0 LENGTH = 0x100
|
||||
bios : ORIGIN = 0x100, LENGTH = 0x500
|
||||
loader : ORIGIN = (TLOAD_ADDR - 0x800), LENGTH = 2048
|
||||
ram(rwx) : ORIGIN = 0x80010000, LENGTH = 2M - 0x10000
|
||||
|
@ -53,6 +54,10 @@ __stack_start = ORIGIN(ram) + LENGTH(ram);
|
|||
|
||||
|
||||
SECTIONS {
|
||||
.zero (NOLOAD) : {
|
||||
_ZN10JabyEngine2CD4zeroE = .;
|
||||
} > zero
|
||||
|
||||
.bios (NOLOAD) : {
|
||||
_ZN10JabyEngine15table_of_tablesE = .;
|
||||
} > bios
|
||||
|
|
|
@ -40,11 +40,13 @@ namespace JabyEngine {
|
|||
static File cur_file;
|
||||
|
||||
State current_state = State::Ready;
|
||||
|
||||
auto irq_callback = SysCall::InterruptCallback::from(IRQ::verifier, IRQ::handler);
|
||||
|
||||
static BCDTimeStamp send_read_cmd0(uint32_t lba, CD_IO::Command::Desc cmd) {
|
||||
const auto loc = BCDTimeStamp::from(lba);
|
||||
|
||||
printf("!!2-%X %X %X\n", loc.min, loc.sec, loc.sector);
|
||||
NewCommand::send(CD_IO::Command::SetLoc, loc.min, loc.sec, loc.sector);
|
||||
NewCommand::send(cmd);
|
||||
return loc;
|
||||
|
@ -67,6 +69,7 @@ namespace JabyEngine {
|
|||
DMA_IO::CDROM.channel_ctrl.write(DMA_IO::CHCHR::StartCDROM());
|
||||
|
||||
DMA_IO::CDROM.wait();
|
||||
CD_IO::PortIndex0::change_to();
|
||||
|
||||
CD_IO::PortIndex0::Request.write(CD_IO::Request::reset());
|
||||
};
|
||||
|
@ -84,6 +87,7 @@ namespace JabyEngine {
|
|||
}
|
||||
|
||||
void resume_at0(const BCDTimeStamp& cd_time) {
|
||||
printf("!!3-%X %X %X\n", cd_time.min, cd_time.sec, cd_time.sector);
|
||||
NewCommand::send(CD_IO::Command::SetLoc, cd_time.min, cd_time.sec, cd_time.sector);
|
||||
}
|
||||
|
||||
|
@ -105,14 +109,19 @@ namespace JabyEngine {
|
|||
|
||||
CD_IO::PortIndex1::change_to();
|
||||
const auto cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag);
|
||||
if(cur_irq == CD_IO::Interrupt::DataReady) {
|
||||
const auto is_data_rdy = cur_irq == CD_IO::Interrupt::DataReady;
|
||||
if(is_data_rdy) {
|
||||
CD_IO::PortIndex0::change_to();
|
||||
CD_IO::PortIndex0::Request.write(CD_IO::Request::want_data());
|
||||
}
|
||||
|
||||
CD_IO::PortIndex1::change_to();
|
||||
CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag);
|
||||
CD_IO::PortIndex0::change_to();
|
||||
CD_IO::Interrupt::reset_parameter_fifo(CD_IO::PortIndex1::InterruptFlag);
|
||||
zero = 0;
|
||||
zero = 1;
|
||||
zero = 2;
|
||||
zero = 3;
|
||||
|
||||
// No masking required because we can only write bit 0 - 2
|
||||
CD_IO::IndexStatus.write(old_status);
|
||||
|
@ -129,6 +138,9 @@ namespace JabyEngine {
|
|||
//Now obtain sector
|
||||
read_sector_to0(sector->data, CD_IO::DataSector::SizeBytes);
|
||||
|
||||
const auto time = get_locL();
|
||||
printf("%X %X %X\n", time.min, time.sec, time.sector);
|
||||
|
||||
if(cur_file.done_processing()) {
|
||||
current_state = State::Done;
|
||||
NewCommand::send(CD_IO::Command::Pause);
|
||||
|
@ -194,6 +206,16 @@ namespace JabyEngine {
|
|||
return BCDTimeStamp{min, sec, sectors};
|
||||
}
|
||||
|
||||
BCDTimeStamp get_locL() {
|
||||
NewCommand::send_wait_response(CD_IO::Command::GetLocL);
|
||||
|
||||
const auto min = CD_IO::PortIndex0::ResponseFifo.read().raw;
|
||||
const auto sec = CD_IO::PortIndex0::ResponseFifo.read().raw;
|
||||
const auto sector = CD_IO::PortIndex0::ResponseFifo.read().raw;
|
||||
|
||||
return BCDTimeStamp{min, sec, sector};
|
||||
}
|
||||
|
||||
void enable_CD() {
|
||||
NewCommand::send(CD_IO::Command::SetMode, DataSectorMode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue