And a few other nice things. The bootloader now has an embedded wozmon! If you know its offset, you can jump to it from the app.
48 lines
760 B
C++
48 lines
760 B
C++
#include <cstdint>
|
|
|
|
#include "intc.h"
|
|
#include "interrupts.h"
|
|
#include "pol0.h"
|
|
#include "timer.h"
|
|
|
|
namespace {
|
|
|
|
struct Gpio {
|
|
volatile uint32_t data;
|
|
};
|
|
|
|
Gpio* leds = reinterpret_cast<Gpio*>(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();
|
|
}
|