#include #include "hal/bios.h" #include "hal/gpio.h" #include "hal/intc.h" #include "hal/interrupts.h" #include "hal/pol0.h" #include "hal/timer.h" namespace { Gpio* leds; 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(); intc::SetIsr(TIMER0_IRQN, Timer0Isr); intc::SetIrqEnabled(TIMER0_IRQN, true); } } // namespace int main() { leds = Gpio::Instance(GPIO0_BASE); leds->data = 0xa0; SetupTimer(); intc::EnableInterrupts(); SetExternalInterruptHandler(intc::InterruptHandler); EnableExternalInterrupts(); EnableInterrupts(true); leds->data = 0xa1; BiosWozmon(); }