This commit is contained in:
Jaby 2024-06-01 17:11:54 +02:00
parent ee616849c0
commit d36876b17c
3 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ struct XAPlayer {
}
void change_channel(int8_t step) {
this->channel = (this->channel + step)%MaxChannels;
this->channel = static_cast<uint8_t>((this->channel + step))%MaxChannels;
CDXA::set_channel(this->channel);
}

View File

@ -15,21 +15,21 @@ namespace JabyEngine {
Error,
};
extern State current_state;
extern uint8_t cmd_interrupt_bit;
extern State current_state;
extern volatile uint8_t cmd_interrupt_bit;
struct Command {
static void wait_completed() {
while(const_cast<volatile uint8_t&>(cmd_interrupt_bit) > 0);
while(cmd_interrupt_bit > 0);
}
template<typename...ARGS>
static void send(IOPort<CD_IO::CommandFifo>& cmd_fifo, IOPort<CD_IO::ParameterFifo>& parameter_fifo, CD_IO::Command::Desc cmd, ARGS...args) {
while(CD_IO::IndexStatus.read().is_set(CD_IO::IndexStatus::IsTransmissionBusy));
cmd_interrupt_bit = bit::set(0, cmd.complete_irq);
((parameter_fifo.write(CD_IO::ParameterFifo{args})),...);
cmd_fifo.write(CD_IO::CommandFifo {cmd.id});
cmd_interrupt_bit = bit::set(0, cmd.complete_irq);
}
template<typename T, typename...ARGS>

View File

@ -38,7 +38,7 @@ namespace JabyEngine {
static SectorBufferAllocator sector_allocator;
static File cur_file;
uint8_t cmd_interrupt_bit = 0;
volatile uint8_t cmd_interrupt_bit = 0;
State current_state = State::Ready;
SysCall::InterrupCallback callback = {
.next = nullptr,