Cleanup code

This commit is contained in:
2023-01-08 16:39:26 +01:00
parent 7b1cefac0a
commit 297526e4d0
4 changed files with 17 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ namespace JabyEngine {
static constexpr auto CounterTargetValue = BitRange<uint32_t>::from_to(0, 15);
};
struct __no_align Timer {
struct __no_align TimerInfo {
IOPort<uint32_t> value;
IOPort<CounterMode> mode;
IOPort<CounterTarget> target;
@@ -39,6 +39,10 @@ namespace JabyEngine {
uint32_t _unused[1];
};
static constexpr uintptr_t counter_base_adr(size_t ID) {
return (0x1F801100 + (ID*0x10));
}
namespace Counter0 {
struct SyncMode {
static constexpr auto Pause_During_Hblank = CounterMode::SyncMode.with(0);
@@ -53,6 +57,8 @@ namespace JabyEngine {
static constexpr auto System_Clock_Too = CounterMode::ClockSource.with(2);
static constexpr auto Dot_Clock_Too = CounterMode::ClockSource.with(3);
};
__declare_io_port_global_struct(TimerInfo, Timer, counter_base_adr(0));
}
namespace Counter1 {
@@ -69,6 +75,8 @@ namespace JabyEngine {
static constexpr auto System_Clock_Too = CounterMode::ClockSource.with(2);
static constexpr auto Hblank_Too = CounterMode::ClockSource.with(3);
};
__declare_io_port_global_struct(TimerInfo, Timer, counter_base_adr(1));
}
namespace Counter2 {
@@ -85,10 +93,9 @@ namespace JabyEngine {
static constexpr auto System_Clock_Div_8 = CounterMode::ClockSource.with(2);
static constexpr auto System_Clock_Div_8_Too = CounterMode::ClockSource.with(3);
};
}
__declare_io_port_global_array(Timer, Counter, 0x1F801100, 3);
static_assert(sizeof(Timer) == 0x10);
__declare_io_port_global_struct(TimerInfo, Timer, counter_base_adr(2));
}
}
}

View File

@@ -94,7 +94,7 @@ static __always_inline void __syscall_ChangeClearPad(int32_t _reserved) {
__syscall_function_cast(__syscall_Table_B, void(*)(int32_t))(_reserved);
}
static __always_inline void __syscall_ReturnFromException() {
static __always_inline void [[noreturn]] __syscall_ReturnFromException() {
register uint32_t FuncID asm("t1") = 0x17;
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));