Sketch Timer and implement Interrupt support
This commit is contained in:
25
include/PSX/System/IOPorts/interrupt_io.hpp
Normal file
25
include/PSX/System/IOPorts/interrupt_io.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __JABYENGINE_INTERRUPT_IO_HPP__
|
||||
#define __JABYENGINE_INTERRUPT_IO_HPP__
|
||||
#include "ioport.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace Interrupt {
|
||||
static constexpr auto VBlank = Bit<uint32_t>(0);
|
||||
static constexpr auto GPU = Bit<uint32_t>(1);
|
||||
static constexpr auto CDROM = Bit<uint32_t>(2);
|
||||
static constexpr auto DMA = Bit<uint32_t>(3);
|
||||
static constexpr auto Timer0 = Bit<uint32_t>(4);
|
||||
static constexpr auto Timer1 = Bit<uint32_t>(5);
|
||||
static constexpr auto Timer2 = Bit<uint32_t>(6);
|
||||
static constexpr auto Periphery = Bit<uint32_t>(7);
|
||||
static constexpr auto SIO = Bit<uint32_t>(8);
|
||||
static constexpr auto SPU = Bit<uint32_t>(9);
|
||||
static constexpr auto Controller = Bit<uint32_t>(10);
|
||||
static constexpr auto LightPen = Controller;
|
||||
|
||||
__declare_io_port_global(ComplexBitMap<uint32_t>, Status, 0x1F801070);
|
||||
__declare_io_port_global(ComplexBitMap<uint32_t>, Mask, 0x1F801074);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //!__JABYENGINE_INTERRUPT_IO_HPP__
|
@@ -31,15 +31,12 @@ namespace JabyEngine {
|
||||
};
|
||||
|
||||
struct __no_align Timer {
|
||||
IOPort<CounterMode> counter_mode;
|
||||
IOPort<CounterTarget> counter_target;
|
||||
IOPort<CounterMode> mode;
|
||||
IOPort<CounterTarget> target;
|
||||
private:
|
||||
uint32_t _unused[2];
|
||||
};
|
||||
|
||||
__declare_io_port_global_array(Timer, timer, 0x1F801104, 3);
|
||||
static_assert(sizeof(Timer) == 0x10);
|
||||
|
||||
namespace Counter0 {
|
||||
struct SyncMode {
|
||||
static constexpr auto Pause_During_Hblank = CounterMode::SyncMode.with(0);
|
||||
@@ -87,6 +84,9 @@ namespace JabyEngine {
|
||||
static constexpr auto System_Clock_Div_8_Too = CounterMode::ClockSource.with(3);
|
||||
};
|
||||
}
|
||||
|
||||
__declare_io_port_global_array(Timer, Counter, 0x1F801104, 3);
|
||||
static_assert(sizeof(Timer) == 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -40,10 +40,13 @@ enum __syscall_PriorityChain {
|
||||
static __constexpr const uint32_t SkipHandler = 0;
|
||||
static __constexpr const uint32_t ExecuteHandler = 1;
|
||||
|
||||
typedef uint32_t (*InterruptVerifier)();
|
||||
typedef uint32_t (*InterruptHandler)(uint32_t);
|
||||
|
||||
struct __no_align __syscall_InterruptElement {
|
||||
struct __syscall_InterruptElement *next;
|
||||
void (*handler)(uint32_t);
|
||||
uint32_t (*verifier)();
|
||||
struct __syscall_InterruptElement* next;
|
||||
InterruptHandler handler_function;
|
||||
InterruptVerifier verifier_function;
|
||||
uint32_t notUsed;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user