<div dir="auto">Yeah!! <div dir="auto"><br></div><div dir="auto">Does this mean you have a ticker variant working now? With polled console IO?</div><div dir="auto"><br></div><div dir="auto">I ask because that is a nice capability merge point. When merged, you move from a large submission to review to smaller more incremental ones. Easier to review, etc.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Jul 8, 2017 7:30 PM, "Denis Obrezkov" <<a href="mailto:denisobrezkov@gmail.com">denisobrezkov@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I found the problem, I made a mistake in my code, instead of:<div><span class="m_8105947015472162706gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">if</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap"> ((cause & MCAUSE_MTIME) == MCAUSE_MTIME) {</span><br></div><div><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">I have written:</span></div><div><span class="m_8105947015472162706gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">if</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap"> (cause & MCAUSE_MTIME) {</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap">now local interrupts work.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-07-08 19:18 GMT+02:00 Denis Obrezkov <span dir="ltr"><<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>2017-07-08 18:05 GMT+02:00 Joel Sherrill <span dir="ltr"><<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="m_8105947015472162706m_-3048997720925703658gmail-"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Jul 8, 2017 10:09 AM, "Denis Obrezkov" <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_8105947015472162706m_-3048997720925703658gmail-m_-5744152555478909875quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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></div></div></blockquote></div></div></div></span><div dir="auto">Is there a procedure for clearing the interrupt? </div></div></blockquote></span><div>Yes, it is written that external interrupts are cleared by PLIC (external interrupt controller), </div><div>software interrupts are cleared I think by the main thread (I didn't find it in docs), and timer</div><div>interrupts are cleared by writing the value in mtimecmp memory-mapped register greater</div><div>than in mtime (memory mapped register too.) [2, p.28] </div><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="m_8105947015472162706m_-3048997720925703658gmail-"><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_8105947015472162706m_-3048997720925703658gmail-m_-5744152555478909875quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><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></div></div></blockquote></div></div></div><div dir="auto"><br></div></span><div dir="auto">Can you point us to the documentation and section where this timer behavior is defined? Sometimes having someone else read it can provide a different interpretation.</div><div dir="auto"><br></div><div dir="auto">And is there other code like Linux which deals with this timer? There may be a magic sequence you are missing </div></div></blockquote><div><br></div></span><div>I wasn't able to find a magic sequence and didn't look at Linux code, but I initialized it like in hifive1 example provided with FreedomStudio (IDE for HiFive1).:</div><div><a href="https://github.com/sifive/freedom-e-sdk/tree/master/bsp" target="_blank">https://github.com/sifive/free<wbr>dom-e-sdk/tree/master/bsp</a><br></div><div><br></div><div>But these are the docs:</div><div>Description of mstatus register, which contains mie field for global interrupt enabling (Ch 3.1.6):</div><div>[1] <a href="https://riscv.org/specifications/privileged-isa/" target="_blank">https://riscv.org/specificatio<wbr>ns/privileged-isa/</a></div><div>Description of the core, on which SoC is based (Ch 6 is about interrupts):</div><div>[2] <a href="https://www.sifive.com/documentation/coreplex/e31-coreplex-manual/" target="_blank">https://www.sifive.com/documen<wbr>tation/coreplex/e31-coreplex-<wbr>manual/</a><br></div><div><br></div><div>There are also description of the SoC:</div><div><a href="https://www.sifive.com/documentation/freedom-soc/freedom-e300-platform-reference-manual/" target="_blank">https://www.sifive.com/documen<wbr>tation/freedom-soc/freedom-<wbr>e300-platform-reference-<wbr>manual/</a><br></div><div>and description of the chip:</div><div><a href="https://www.sifive.com/documentation/chips/freedom-e310-g000-manual/" target="_blank">https://www.sifive.com/documen<wbr>tation/chips/freedom-e310-<wbr>g000-manual/</a><span class="m_8105947015472162706HOEnZb"><font color="#888888"><br></font></span></div><span class="m_8105947015472162706HOEnZb"><font color="#888888"><div> </div></font></span></div><span class="m_8105947015472162706HOEnZb"><font color="#888888">-- <br><div class="m_8105947015472162706m_-3048997720925703658gmail_signature">Regards, Denis Obrezkov</div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_8105947015472162706gmail_signature" data-smartmail="gmail_signature">Regards, Denis Obrezkov</div>
</div>
</blockquote></div></div>