Cleanup code
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user