#include #include "intc.h" #include "interrupts.h" #include "pol0.h" #include "timer.h" namespace { struct Gpio { volatile uint32_t data; }; Gpio* leds = reinterpret_cast(GPIO0_BASE); Timer* timer; } void Timer0Isr() { static int counter = 0; leds->data = counter++; timer->Pet(); timer->ClearInterrupt(); } void SetupTimer() { timer = Timer::Instance(TIMER0_BASE); timer->SetupAsWdt(100'000'000); timer->EnableT1(); SetIsr(TIMER0_IRQN, Timer0Isr); SetIrqEnabled(TIMER0_IRQN, true); EnableInterrupts(); } int main() { leds->data = 0xa0; SetupTimer(); SetExternalInterruptHandler(InterruptHandler); EnableExternalInterrupts(); leds->data = 0xa1; BiosWozmon(); }