Setup Cody Git server and successfully pause after 1 sector
This commit is contained in:
parent
8858e17792
commit
03e932bfc9
|
@ -1,2 +1,5 @@
|
|||
[lfs]
|
||||
url = "http://localhost:8080/api/PSX/JabyEngine"
|
||||
#Comment in for Codys repo
|
||||
url = "https://git.william.zone/jaby/jabyengine/info/lfs"
|
||||
#Comment in for USB repo
|
||||
#url = "http://localhost:8080/api/PSX/JabyEngine"
|
|
@ -110,6 +110,7 @@ namespace JabyEngine {
|
|||
static constexpr Info GetStat{0x01, Interrupt::Type::Acknowledge};
|
||||
static constexpr Info SetLoc{0x02, Interrupt::Type::Acknowledge};
|
||||
static constexpr Info ReadN{0x06, Interrupt::Type::DataReady};
|
||||
static constexpr Info Pause{0x09, Interrupt::Type::Complete};
|
||||
static constexpr Info Init{0x0A, Interrupt::Type::Complete};
|
||||
static constexpr Info SetMode{0x0E, Interrupt::Type::Acknowledge};
|
||||
};
|
||||
|
|
|
@ -124,11 +124,46 @@ static __always_inline uint32_t __syscall_EnterCriticalSection() {
|
|||
}
|
||||
|
||||
static __always_inline void __syscall_ExitCriticalSection() {
|
||||
register uint32_t FuncID asm("a0") = 0x2;
|
||||
register uint32_t FuncID asm("a0") = 0x02;
|
||||
|
||||
__asm__ volatile("syscall" : "=r"(FuncID) : "r"(FuncID) : "at", "v0", "v1", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "memory");
|
||||
}
|
||||
|
||||
static __always_inline void __syscall__DeliverEvent(uint32_t classId, uint32_t spec) {
|
||||
register uint32_t FuncID asm("t1") = 0x07;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
__syscall_function_cast(__syscall_Table_B, void (*)(uint32_t, uint32_t))(classId, spec);
|
||||
}
|
||||
|
||||
static __always_inline uint32_t __syscall_OpenEvent(uint32_t classId, uint32_t spec, uint32_t mode, void (*handler)()) {
|
||||
register uint32_t FuncID asm("t1") = 0x08;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(__syscall_Table_B, uint32_t(*)(uint32_t, uint32_t, uint32_t, void(*)()))(classId, spec, mode, handler);
|
||||
}
|
||||
|
||||
static __always_inline int __syscall_CloseEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x09;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(__syscall_Table_B, uint32_t(*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
static __always_inline int __syscall_TestEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x0B;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(__syscall_Table_B, int (*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
static __always_inline int __syscall_EnableEvent(uint32_t event) {
|
||||
register uint32_t FuncID asm("t1") = 0x0C;
|
||||
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
return __syscall_function_cast(__syscall_Table_B, int (*)(uint32_t))(event);
|
||||
}
|
||||
|
||||
void __syscall_printf(const char* txt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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__);
|
||||
|
|
Loading…
Reference in New Issue