Add boot namespace and adjust names

This commit is contained in:
Jaby
2023-01-12 22:02:11 +01:00
committed by Jaby
parent 954f660929
commit 25fc43064a
9 changed files with 199 additions and 175 deletions

View File

@@ -9,28 +9,37 @@
namespace JabyEngine {
namespace Timer {
extern InterrupCallback IRQCallback;
void setup() {
using namespace Timer_IO;
}
static constexpr auto Mode = CounterMode::with(CounterMode::FreeRun, Counter2::SyncMode::Freerun, CounterMode::ResetAfterTarget, CounterMode::IRQAtTarget, CounterMode::IRQEveryTime, CounterMode::IRQPulse, Counter2::Source::System_Clock_Div_8);
namespace boot {
namespace Timer {
using namespace JabyEngine::Timer;
void setup() {
using namespace Timer_IO;
Interrupt::disable_irq(Interrupt::Timer2);
static constexpr auto Mode = CounterMode::with(CounterMode::FreeRun, Counter2::SyncMode::Freerun, CounterMode::ResetAfterTarget, CounterMode::IRQAtTarget, CounterMode::IRQEveryTime, CounterMode::IRQPulse, Counter2::Source::System_Clock_Div_8);
__syscall_EnterCriticalSection();
__syscall_SysEnqIntRP(Timer2Irq, &IRQCallback);
__syscall_ExitCriticalSection();
Interrupt::disable_irq(Interrupt::Timer2);
Counter2.target.write(CounterTarget::CounterTargetValue.with(HighResTime::TicksFor10ms));
Counter2.mode.write(Mode);
__syscall_EnterCriticalSection();
__syscall_SysEnqIntRP(Timer2Irq, &IRQCallback);
__syscall_ExitCriticalSection();
Interrupt::enable_irq(Interrupt::Timer2);
Counter2.target.write(CounterTarget::CounterTargetValue.with(HighResTime::TicksFor10ms));
Counter2.mode.write(Mode);
Interrupt::enable_irq(Interrupt::Timer2);
}
}
}
}
#else
namespace JabyEngine {
namespace Timer {
void setup() {
namespace boot {
namespace Timer {
void setup() {
}
}
}
}