完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
嗨,我有一个问题要解决,当一个软件FIFO从两种不同的方法接收数据。因此,我将有一个函数,将新数据写入FIFO中,可以从两个源方法中调用任何一个。主要问题是两个来源都是ISR,但它们的优先级不同。经过一些思考,我明白了,在这种情况下,我必须与DISI指令或IPL位一起玩,以避免死锁或不想要的行为。DISI的问题是,我有更高优先级的中断被同步化的任务所使用,我不想阻塞这么长时间。这个功能的基本思想是在条目中保存IPL位,然后将它们修改到ISR的较高优先级,以使舒尔的执行不是中断。在其中任何一个,然后写FIFO和恢复IPL之前返回。我正在编程组装,FIFO Metotod自己可以处理不同的优先级在输入和输出侧,唯一的新事物是有两个输入源在不同的优先级。对我来说,但我仍然有一个奇怪的感觉,修改IPL,即使是可能的。我是不是走得太远了呢?
以上来自于百度翻译 以下为原文 Hi, I have a problem to solve, when a software FIFO receives data from two different methods. So I'm going to have a function, to write the new data into the FIFO, it can be called from any of the two source methods. The main issue is that both sources are ISRs, but their priorityes are different. After some thinking I got to the point, that in this case I have to play either with the DISI instruction or the IPL bits, to avoid deadlock or unwanted behaviours. The problem with DISI is that I have even higher priority interrupts used by syncronized tasks, I do not want to block for that long. The basic idea for the function is to save IPL bits at entry, then modify them to the higher priority level of the ISRs, to make shure the execution is not interruptible by any of them, then write the FIFO and restore the IPL before return. I am programming in assembly, and the FIFO mehtods themself can deal with different priorities at the input and output side, the only new thing is to have two input sources at different priority levels. The mehtod looks proper for me, but still I have a weird feeling about modifying the IPL, even if it is possible. Do I go too far or is it something normal to do? |
|
相关推荐
6个回答
|
|
修改IPL有效地将ISR移动到不同的优先级,为什么不改变ISR的优先级设置呢?
以上来自于百度翻译 以下为原文 Modifying IPL effectively moves the ISR to the different priority level. Why not to change the priority setting for the ISR instead? |
|
|
|
谢谢!嗯,我只是尽量多加小心。我曾经测试过极限,但我多次击中CELANG。按照不同的方式,往往会发现问题,克服它们有时是非常耗费时间的。特别是如果一个PCB围绕一个应该在理论上工作的概念建立,但实际上却不是这样。
以上来自于百度翻译 以下为原文 Thanks! Well, I just try to be more careful. I used to test the limits, but I hit the cealing many times. Following different ways than the usual ones can reveal problems, and overcoming them sometimes can be really time consuming. :) Specially if a PCB has been built around a concept which should work in theory, but it doesn't in reality. |
|
|
|
为什么不把它们放在同一个优先级,消除这个问题呢?另一种选择是禁用刚才中断的问题,只有在FIFO写。
以上来自于百度翻译 以下为原文 Why not make them the same priority and eliminate the issue. Another option would be to disable just the interrupt in question, and only during the fifo write. |
|
|
|
谢谢你,NKurzman!为你道歉,Nas家伙,看起来我很讨厌你。禁用中断是显而易见的,我不知道我是怎么错过这个想法的。中断优先级是我想要保留的,因为在爱人优先级上有很多事情发生,并且还有共享缓冲器。具有较低优先级中断的通信信道都具有分配的DMA信道。但是由于较低优先级的任务都是同步的,所以无论如何都容易处理它们。如果我把一个中断的优先级从较低级别的优先级增加,我将得到相同的问题,但是在另一个地方。
以上来自于百度翻译 以下为原文 Thank you NKurzman! And apology for you NorthGuy, it looks I misuderstand you. Disabling the interrupt is obvious, I don't know how I missed this idea. The interrupt priority levels I want to keep, because there's a lot going on on the lover priority level and there are shared buffers as well. Communication channels with lower priority interrupt all has DMA channels assigned. But since the lower priority tasks are all synchronized it's easyer to deal with them anyway. If I increase the priority of one interrupt out of the lower level ones, I will get the same issue, but at an another place. |
|
|
|
嗨,改变IPL是完全可以的(虽然它通常是更好的避免它),但是这必须仔细地做。在更改IPL并保存它之前,必须禁用所有中断,并且在恢复IPL时必须禁用相同的中断。
以上来自于百度翻译 以下为原文 Hi, It is perfectly OK to change IPL (although it is generally better to avoid it) BUT this must be done carefully. Before to change IPL and save it, you must disable all interrupts and the same when you restore IPL. Regards |
|
|
|
谢谢RISC!我才意识到,我甚至没有想过通过改变IPL的方法。禁用中断是有意义的。我不想只在必要时弄乱IPL。但是,NKurzman在FIFO写的时候,有一个问题,就是要禁用更高优先级的中断。
以上来自于百度翻译 以下为原文 Thank you RISC! I just realized that I did not even think through the method to change the IPL. Disabling the interrupts make sense. I don't really want to mess with IPL, only if it is necessary. But NKurzman had the point to disable only the higher prioroty interrupt in question, during the fifo write. |
|
|
|
只有小组成员才能发言,加入小组>>
4848 浏览 9 评论
1846 浏览 8 评论
1764 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2974 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2076 浏览 5 评论
472浏览 1评论
314浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
376浏览 0评论
270浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1823浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-5-16 01:54 , Processed in 1.038343 second(s), Total 86, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号