From 98659d919772cdee372ab4a4d63bd68fa469174e Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sat, 24 Aug 2019 16:41:58 +0200 Subject: first: introduce wait_for_irq --- software/first/setup_timer_irq.S | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'software/first/setup_timer_irq.S') diff --git a/software/first/setup_timer_irq.S b/software/first/setup_timer_irq.S index c3e7513..bba356d 100644 --- a/software/first/setup_timer_irq.S +++ b/software/first/setup_timer_irq.S @@ -1,6 +1,7 @@ .section .text .align 2 .global setup_timer_irq +.global wait_for_irq .include "gpio.inc" .include "memory_map.inc" @@ -97,3 +98,13 @@ exit: lw a0, 4(sp) # restore first argument to function addi sp, sp, 28 # deallocate stack frame mret # exit IRQ handler + + +wait_for_irq: + csrr t0, mip + csrr t1, mcause + csrr t2, mtvec + csrr t3, mstatus + csrr t4, mie + wfi + ret -- cgit v1.2.1-18-gbd029