From aaf3b7b8143a8ef23884e89509855363c8c2c58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gaier?= Date: Fri, 7 Jun 2024 21:36:39 +0200 Subject: [PATCH] Reprocudeable Interrupt miss --- src/Library/internal-include/CD/cd_internal.hpp | 6 ++++-- src/Library/src/Audio/CDXA.cpp | 9 +++++---- src/Library/src/CD/cd.cpp | 16 ++++++++++++---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/Library/internal-include/CD/cd_internal.hpp b/src/Library/internal-include/CD/cd_internal.hpp index f449dc49..13196472 100644 --- a/src/Library/internal-include/CD/cd_internal.hpp +++ b/src/Library/internal-include/CD/cd_internal.hpp @@ -38,6 +38,9 @@ namespace JabyEngine { if(cur_irq == CD_IO::Interrupt::Acknowledge) { printf("Rand ACK for 0x%X\n", last_send_cmd); } + if(cur_irq == CD_IO::Interrupt::Complete) { + printf("Rand Comp for 0x%X\n", last_send_cmd); + } } while(cur_irq == CD_IO::Interrupt::None); CD_IO::Interrupt::ack_extended(CD_IO::PortIndex1::InterruptFlag); cmd_interrupt_bit = bit::set(cmd_interrupt_bit, cur_irq); @@ -57,8 +60,7 @@ namespace JabyEngine { cmd_interrupt_bit = 0; CD_IO::PortIndex0::change_to(); ((parameter_fifo.write(CD_IO::ParameterFifo{args})),...); - cmd_fifo.write(CD_IO::CommandFifo{cmd.id}); - //printf(">>> 0x%X send @%i\n", cmd.id, CD_IO::IndexStatus.read().raw&0b111); + cmd_fifo.write(CD_IO::CommandFifo{cmd.id}); rel_last_send_cmd = cmd.id; last_send_cmd = cmd.id; diff --git a/src/Library/src/Audio/CDXA.cpp b/src/Library/src/Audio/CDXA.cpp index 6beaa02e..32555860 100644 --- a/src/Library/src/Audio/CDXA.cpp +++ b/src/Library/src/Audio/CDXA.cpp @@ -14,7 +14,7 @@ namespace JabyEngine { } setting; CD::State interrupt_handler(uint8_t irq) { - switch(irq) { +/* switch(irq) { case CD_IO::Interrupt::DataReady: { // The IRQ stack is 0x1000 bytes large so this should fit CD::RawXADataSector xa_file; @@ -29,7 +29,7 @@ namespace JabyEngine { case CD_IO::Interrupt::DiskError: return CD::State::Error; - }; + };*/ return CD::State::XAMode; } @@ -37,11 +37,11 @@ namespace JabyEngine { setting.start_loc = CD::BCDTimeStamp::from(lba[rel_lba_idx].get_lba()); setting.double_speed = double_speed; - CD::current_state = CD::State::XAMode; CD::enable_CDXA(double_speed); //< Activates PortIndex0 set_channel(channel); CD::Command::send_wait(CD_IO::Command::SetLoc, setting.start_loc.min, setting.start_loc.sec, setting.start_loc.sector); CD::Command::send_wait(CD_IO::Command::ReadS); + //CD::current_state = CD::State::XAMode; } void stop() { @@ -59,15 +59,16 @@ namespace JabyEngine { void push_play() { stop(); setting.last_loc = CD::get_loc(); + CD::current_state = CD::State::Ready; } void pop_play() { - CD::current_state = CD::State::XAMode; CD::enable_CDXA(setting.double_speed); //< Activates PortIndex0 set_channel(setting.channel); CD::Command::send_wait(CD_IO::Command::SetLoc, setting.last_loc.min, setting.last_loc.sec, setting.last_loc.sector); CD::Command::send_wait(CD_IO::Command::ReadS); + //CD::current_state = CD::State::XAMode; } } } \ No newline at end of file diff --git a/src/Library/src/CD/cd.cpp b/src/Library/src/CD/cd.cpp index 49a6330b..b8824b26 100644 --- a/src/Library/src/CD/cd.cpp +++ b/src/Library/src/CD/cd.cpp @@ -116,17 +116,25 @@ namespace JabyEngine { read_sector_to0(sector->data, CD_IO::DataSector::SizeBytes); if(cur_file.done_processing()) { + printf("Pause1\n"); current_state = State::Done; Command::send_wait_irq(CD_IO::Command::Pause); + printf("Pause done!\n"); } } else { current_state = State::BufferFull; + printf("Pause2\n"); Command::send_wait_irq(CD_IO::Command::Pause); + printf("Pause done!\n"); } } break; + case CD_IO::Interrupt::Complete: { + printf("Complete for 0x%X\n", rel_last_send_cmd); + } break; + case CD_IO::Interrupt::Acknowledge: { if(last_send_cmd != 0x0) { printf("ACK 0x%X\n", last_send_cmd); @@ -169,12 +177,12 @@ namespace JabyEngine { } void read_file(AutoLBAEntry file_info, const SectorBufferAllocator& buffer_allocator) { - cur_file.set_from(file_info); - sector_allocator = buffer_allocator; + cur_file.set_from(file_info); + sector_allocator = buffer_allocator; - CD_IO::PortIndex0::change_to(); + CD_IO::PortIndex0::change_to(); Command::send_wait(CD_IO::Command::SetMode, DataSectorMode); - send_read_n0(cur_file.cur_lba); + send_read_n0(cur_file.cur_lba); } void continue_reading() {