<div dir="ltr">Hello all,<div>I worked with local interrupts last few days and found some strange behavior:</div><div><p style="margin-top:0px;font-family:Roboto;font-size:14px"><br></p><p style="margin-top:0px;font-family:Roboto;font-size:14px">I am trying to handle local interrupts.<br>That's what I do, in my handler for timer interrupts:<br>* disable timer interrupts in mie<br>* read a current value from mtime<br>* copy it to mtimecmp (both are 64bit width types)<br>* add some big value to mtimecmp<br>* enable timer interrupts in mie.</p><p style="font-family:Roboto;font-size:14px">And I have two boards and the problem is that on one of them interrupts are permanently generated because mip register is always 1 in mtip position, though mtimecmp is greater than mtime, and are not generated at all on the other.</p><p style="font-family:Roboto;font-size:14px">In this piece of code, I turn on interrupts:<br>la t0, RISCV_Exception_default<br>csrs mtvec, t0<br>li t0, 0x88<br>csrs mie, t0<br>csrsi mstatus, 0x8</p><p><font face="Roboto"><span style="font-size:14px">My start file:</span></font><br><a href="https://github.com/embeddedden/rtems-riscv/blob/hifive1/c/src/lib/libbsp/riscv32/hifive1/start/start.S">https://github.com/embeddedden/rtems-riscv/blob/hifive1/c/src/lib/libbsp/riscv32/hifive1/start/start.S</a><br></p><p><font face="Roboto"><span style="font-size:14px">and ISR:</span></font><br><a href="https://github.com/embeddedden/rtems-riscv/blob/hifive1/c/src/lib/libbsp/riscv32/hifive1/irq/irq.c">https://github.com/embeddedden/rtems-riscv/blob/hifive1/c/src/lib/libbsp/riscv32/hifive1/irq/irq.c</a><br></p><p><br></p><p>I also posted this question here:</p><p><a href="https://forums.sifive.com/t/how-to-deal-with-local-interrupts-in-hifive1/632">https://forums.sifive.com/t/how-to-deal-with-local-interrupts-in-hifive1/632</a><br></p><div><br></div>-- <br><div class="gmail_signature">Regards, Denis Obrezkov</div>
</div></div>