mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-09 20:00:40 +00:00
Updated part13-interrupts to stop the timers too
This commit is contained in:
parent
ecce209c5e
commit
3b637a7fe5
3 changed files with 28 additions and 5 deletions
|
@ -26,6 +26,10 @@ void enable_interrupt_controller() {
|
|||
REGS_IRQ->irq0_enable_0 = AUX_IRQ | SYS_TIMER_IRQ_1 | SYS_TIMER_IRQ_3;
|
||||
}
|
||||
|
||||
void disable_interrupt_controller() {
|
||||
REGS_IRQ->irq0_enable_0 = AUX_IRQ;
|
||||
}
|
||||
|
||||
void handle_irq() {
|
||||
unsigned int irq = REGS_IRQ->irq0_pending_0;
|
||||
|
||||
|
|
|
@ -30,11 +30,19 @@ void core0_main(void)
|
|||
{
|
||||
unsigned int core0_val = 0;
|
||||
|
||||
while (1) {
|
||||
while (core0_val <= 100) {
|
||||
wait_msec(0x100000);
|
||||
drawProgress(0, core0_val);
|
||||
if (core0_val < 100) core0_val++;
|
||||
core0_val++;
|
||||
}
|
||||
|
||||
debugstr("Core 0 done.");
|
||||
debugcrlf();
|
||||
|
||||
irq_disable();
|
||||
disable_interrupt_controller();
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
void core1_main(void)
|
||||
|
@ -43,11 +51,16 @@ void core1_main(void)
|
|||
|
||||
clear_core1(); // Only run once
|
||||
|
||||
while (1) {
|
||||
while (core1_val <= 100) {
|
||||
wait_msec(0x3FFFF);
|
||||
drawProgress(1, core1_val);
|
||||
if (core1_val < 100) core1_val++;
|
||||
core1_val++;
|
||||
}
|
||||
|
||||
debugstr("Core 1 done.");
|
||||
debugcrlf();
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
// TIMER FUNCTIONS
|
||||
|
@ -73,7 +86,12 @@ void handle_timer_1() {
|
|||
REGS_TIMER->control_status |= SYS_TIMER_IRQ_1;
|
||||
|
||||
unsigned int progval = timer1_val / timer1_int;
|
||||
if (progval <= 100) drawProgress(2, progval);
|
||||
if (progval <= 100) {
|
||||
drawProgress(2, progval);
|
||||
} else {
|
||||
debugstr("Timer 1 done.");
|
||||
debugcrlf();
|
||||
}
|
||||
}
|
||||
|
||||
void handle_timer_3() {
|
||||
|
|
|
@ -40,6 +40,7 @@ void irq_init_vectors();
|
|||
void irq_enable();
|
||||
void irq_disable();
|
||||
void enable_interrupt_controller();
|
||||
void disable_interrupt_controller();
|
||||
|
||||
void handle_timer_1();
|
||||
void handle_timer_3();
|
||||
|
|
Loading…
Reference in a new issue