Closed archaro closed 1 year ago
Ah, the wisdom of the rubber duck.
In handle_interrupt(), I had:
switch (irq) {
case (SYSTEM_TIMER_IRQ_1):
handle_timer_irq();
put32(GICC_EOIR, irq_ack_reg);
break;
and what I actually needed was:
switch (irq) {
case (SYSTEM_TIMER_IRQ_1):
put32(GICC_EOIR, irq_ack_reg);
handle_timer_irq();
break;
Order matters!
I followed the advice given in issue #237 and was able to get my project behaving properly on a pi4, with the timer ticking nicely.
However, I've run into an odd problem with the scheduler. Using most of the code from Lesson04 I have built a primitive scheduler in my project, and things are now behaving strangely. Here is some output with helpful debugging printf()s:
As you can see, everything is just peachy until timer_tick() is called by the interrupt handler. Thereafter, it seems that even though interrupts are re-enabled, the interrupt handler never gets called again. My handle_irq() function is using the fix described by @maxstreitberger in issue #237, and my timer_tick() function and enable_irq() assembler function are identical to those in Lesson04.
I'm very confused!