Improve struct and namespace usage
This commit is contained in:
@@ -3,9 +3,7 @@
|
||||
#include "ioport.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace Timer {
|
||||
enum struct SyncMode {};
|
||||
|
||||
namespace Timer_IO {
|
||||
struct __no_align CounterMode : public ComplexBitMap<uint32_t> {
|
||||
__io_port_inherit_complex_bit_map(CounterMode);
|
||||
|
||||
@@ -31,19 +29,19 @@ namespace JabyEngine {
|
||||
static constexpr auto CounterTargetValue = BitRange<uint32_t>::from_to(0, 15);
|
||||
};
|
||||
|
||||
struct __no_align TimerInfo {
|
||||
struct __no_align Counter {
|
||||
IOPort<uint32_t> value;
|
||||
IOPort<CounterMode> mode;
|
||||
IOPort<CounterTarget> target;
|
||||
private:
|
||||
uint32_t _unused[1];
|
||||
uint32_t _unused;
|
||||
};
|
||||
|
||||
static constexpr uintptr_t counter_base_adr(size_t ID) {
|
||||
return (0x1F801100 + (ID*0x10));
|
||||
}
|
||||
|
||||
namespace Counter0 {
|
||||
struct __no_align Counter0 : public Counter {
|
||||
struct SyncMode {
|
||||
static constexpr auto Pause_During_Hblank = CounterMode::SyncMode.with(0);
|
||||
static constexpr auto Zero_At_Hblank = CounterMode::SyncMode.with(1);
|
||||
@@ -57,11 +55,9 @@ 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 {
|
||||
struct __no_align Counter1 : public Counter {
|
||||
struct SyncMode {
|
||||
static constexpr auto Pause_During_Vblank = CounterMode::SyncMode.with(0);
|
||||
static constexpr auto Zero_At_Vblank = CounterMode::SyncMode.with(1);
|
||||
@@ -75,11 +71,9 @@ 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 {
|
||||
struct __no_align Counter2 : public Counter {
|
||||
struct SyncMode {
|
||||
static constexpr auto Stop_Counter = CounterMode::SyncMode.with(0);
|
||||
static constexpr auto Freerun = CounterMode::SyncMode.with(1);
|
||||
@@ -93,9 +87,11 @@ 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_struct(TimerInfo, Timer, counter_base_adr(2));
|
||||
}
|
||||
__declare_io_port_global_struct(struct Counter0, Counter0, counter_base_adr(0));
|
||||
__declare_io_port_global_struct(struct Counter1, Counter1, counter_base_adr(1));
|
||||
__declare_io_port_global_struct(struct Counter2, Counter2, counter_base_adr(2));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user