Save progress
This commit is contained in:
@@ -12,6 +12,7 @@ namespace JabyEngine {
|
||||
enable_DMA();
|
||||
|
||||
SPU::stop_voices();
|
||||
Timer::setup();
|
||||
|
||||
GPU::setup();
|
||||
GPU::display_logo();
|
||||
|
@@ -1,14 +1,21 @@
|
||||
#include <PSX/System/IOPorts/interrupt_io.hpp>
|
||||
#include <PSX/System/IOPorts/timer_io.hpp>
|
||||
|
||||
#include <PSX/System/syscalls.h>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace Timer {
|
||||
void setup() {
|
||||
// Just testing around
|
||||
static constexpr auto wuff = CounterMode::with(CounterMode::IRQAtMax, Counter0::SyncMode::Zero_At_Hblank);
|
||||
extern InterrupCallback IRQCallback;
|
||||
|
||||
Counter[0].mode = wuff;
|
||||
Counter[0].mode = wuff;
|
||||
Counter[0].mode = wuff;
|
||||
void setup() {
|
||||
static constexpr auto Mode = CounterMode::with(CounterMode::FreeRun, Counter2::SyncMode::Freerun, CounterMode::ResetAfterTarget, CounterMode::IRQAtTarget, CounterMode::IRQEveryTime, Counter2::Source::System_Clock_Div_8);
|
||||
static constexpr uint16_t Target = 0x1234;
|
||||
|
||||
//Counter[2].target.ref().set(CounterTarget::CounterTargetValue.with(Target));
|
||||
|
||||
__syscall_EnterCriticalSection();
|
||||
__syscall_SysEnqIntRP(Timer2Irq, &IRQCallback);
|
||||
__syscall_ExitCriticalSection();
|
||||
Interrupt::enable_irq(Interrupt::Timer2);
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,21 +8,29 @@ namespace JabyEngine {
|
||||
size_t GlobalTime :: global_counter = 0;
|
||||
|
||||
namespace Timer {
|
||||
uint32_t interrupt_verifier() {
|
||||
InterruptVerifierResult interrupt_verifier() {
|
||||
const auto irq_status = Interrupt::Status.read();
|
||||
|
||||
if(irq_status.is_bit_set(Interrupt::Timer0)) {
|
||||
return ExecuteHandler;
|
||||
if(Interrupt::is_irq(Interrupt::Timer2)) {
|
||||
return InterruptVerifierResult::ExecuteHandler;
|
||||
}
|
||||
|
||||
else {
|
||||
return SkipHandler;
|
||||
return InterruptVerifierResult::SkipHandler;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t interrupt_handler(uint32_t) {
|
||||
GlobalTime::global_counter++;
|
||||
return 0;
|
||||
|
||||
Interrupt::ack_irg(Interrupt::Timer2);
|
||||
__syscall_ReturnFromException();
|
||||
}
|
||||
|
||||
InterrupCallback IRQCallback = {
|
||||
.next = nullptr,
|
||||
.handler_function = interrupt_handler,
|
||||
.verifier_function = interrupt_verifier
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user