<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[PLIC在写入complete寄存器后立马会触发下一次中断]]></title><description><![CDATA[<p dir="auto">如题所示<br />
按照文档说明，PLIC的处理过程应该是在CPU收到外中断后读取claim/complete 寄存器，取出中断号，随后处理中断，再向claim/complete 寄存器写入完成处理的中断号。<br />
现在我发现在从claim/complete 寄存器读出中断号后对应的pending位已经为0（正常），但将处理完成的中断号写入claim/complete 寄存器后对应中断的pending位会立刻变为1，随后PLIC发出外中断，进入了下一轮中断处理程序，虽然在这之中，外中断源并未真正发出中断信号。</p>
<p dir="auto">我主要测试了UART与RTC，在QEMU中一切正常，使用D1所对应的驱动在D1上跑则会出如上问题。另：此系统为裸机程序，没有使用任何其他内核</p>
<p dir="auto">代码链接如下：<br />
<a href="https://github.com/LZU-OSLab/lzu_oslab/blob/RTC/os/lab2/trap/plic.c" target="_blank" rel="noopener noreferrer nofollow ugc">plic.c</a><br />
<a href="https://github.com/LZU-OSLab/lzu_oslab/blob/RTC/os/lab2/include/plic.h" target="_blank" rel="noopener noreferrer nofollow ugc">plic.h</a><br />
<a href="https://github.com/LZU-OSLab/lzu_oslab/blob/RTC/os/lab2/trap/rtc/rtc_sunxi.c" target="_blank" rel="noopener noreferrer nofollow ugc">sunxi-rtc.c</a><br />
<a href="https://github.com/LZU-OSLab/lzu_oslab/blob/RTC/os/lab2/include/rtc.h" target="_blank" rel="noopener noreferrer nofollow ugc">rtc.h</a><br />
<a href="https://github.com/LZU-OSLab/lzu_oslab/blob/RTC/os/lab2/trap/trap.c" target="_blank" rel="noopener noreferrer nofollow ugc">trap.c</a></p>
<p dir="auto">另：我发现D1的user manual中关于PLIC的部分寄存器位描述有许多错误，且和C906的文档不一致，倒是和F133的一致，不知是不是全志的小编抄错了</p>
]]></description><link>https://bbs.aw-ol.com/topic/709/plic在写入complete寄存器后立马会触发下一次中断</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 02:24:23 GMT</lastBuildDate><atom:link href="https://bbs.aw-ol.com/topic/709.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Dec 2021 08:26:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to PLIC在写入complete寄存器后立马会触发下一次中断 on Thu, 23 Dec 2021 07:32:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/42">@xiaowenge</a><br />
<img src="/assets/uploads/files/1640244749861-1314a13c-02b7-4bc2-a432-0cb8559d0d36-image.png" alt="1314a13c-02b7-4bc2-a432-0cb8559d0d36-image.png" class=" img-responsive img-markdown" width="1584" height="860" /><br />
P899 此处应为LSR</p>
]]></description><link>https://bbs.aw-ol.com/post/3641</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/3641</guid><dc:creator><![CDATA[ytf4425]]></dc:creator><pubDate>Thu, 23 Dec 2021 07:32:33 GMT</pubDate></item><item><title><![CDATA[Reply to PLIC在写入complete寄存器后立马会触发下一次中断 on Wed, 08 Dec 2021 08:24:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/262">@ytf4425</a> 这个问题也解决了，看起来是因为rtc是在从x秒跳到x+1秒的那一刹那才会触发设置在x秒的闹钟</p>
]]></description><link>https://bbs.aw-ol.com/post/3252</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/3252</guid><dc:creator><![CDATA[ytf4425]]></dc:creator><pubDate>Wed, 08 Dec 2021 08:24:59 GMT</pubDate></item><item><title><![CDATA[Reply to PLIC在写入complete寄存器后立马会触发下一次中断 on Wed, 08 Dec 2021 08:09:46 GMT]]></title><description><![CDATA[<p dir="auto">破案了，alarm0_irq_sta_reg=0不行，要用alarm0_irq_sta_reg=1，alarm0_irq_sta_reg寄存器是W1C，一开始不知道这是啥意思，以为是可写，去查了一下才知道是写1来清零。</p>
<p dir="auto">问题解决了一个，但是又有一个来了，alarm不按设定的时间发生中断，总是要晚一秒<br />
<img src="/assets/uploads/files/1638950983727-110ed434-94e0-47e3-84d6-7d13404dbbdf-image.png" alt="110ed434-94e0-47e3-84d6-7d13404dbbdf-image.png" class=" img-responsive img-markdown" width="484" height="534" /></p>
]]></description><link>https://bbs.aw-ol.com/post/3250</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/3250</guid><dc:creator><![CDATA[ytf4425]]></dc:creator><pubDate>Wed, 08 Dec 2021 08:09:46 GMT</pubDate></item><item><title><![CDATA[Reply to PLIC在写入complete寄存器后立马会触发下一次中断 on Mon, 06 Dec 2021 12:52:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/42">@xiaowenge</a> 还有224页底部链接的问题。其他的部分我也只看了RTC，那里没有问题</p>
]]></description><link>https://bbs.aw-ol.com/post/3156</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/3156</guid><dc:creator><![CDATA[ytf4425]]></dc:creator><pubDate>Mon, 06 Dec 2021 12:52:30 GMT</pubDate></item><item><title><![CDATA[Reply to PLIC在写入complete寄存器后立马会触发下一次中断 on Mon, 06 Dec 2021 12:24:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/262">@ytf4425</a> 我就知道 硬件肯定没有问题 <img src="https://bbs.aw-ol.com/plugins/nodebb-plugin-emoji/emoji/android/1f60a.png?v=9vrjmbh7mr2" class="not-responsive emoji emoji-android emoji--blush" title=":blush:" alt="😊" /></p>
]]></description><link>https://bbs.aw-ol.com/post/3155</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/3155</guid><dc:creator><![CDATA[qianhao]]></dc:creator><pubDate>Mon, 06 Dec 2021 12:24:14 GMT</pubDate></item><item><title><![CDATA[Reply to PLIC在写入complete寄存器后立马会触发下一次中断 on Mon, 06 Dec 2021 12:15:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://bbs.aw-ol.com/uid/262">@ytf4425</a> 还有哪些写错了？求大佬指出<br />
（这个问题我们先看下）</p>
]]></description><link>https://bbs.aw-ol.com/post/3153</link><guid isPermaLink="true">https://bbs.aw-ol.com/post/3153</guid><dc:creator><![CDATA[xiaowenge]]></dc:creator><pubDate>Mon, 06 Dec 2021 12:15:27 GMT</pubDate></item></channel></rss>