共3条
1/1 1 跳转至页
about the PIP Module
实在想不明白DSP/BIOS中的PIP模块中的函数PIP_get为什么要调用notifyReader函数,还有就是PIP_alloc为什么要调用notifyWriter函数?你想啊,PIP_put函数执行后,read end肯定有一帧数据可读,同时这个函数也调用了notifyReader函数,如果我让这个函数产生一个软中断,这个软中断的任务就是把这个可读帧中的数据给读出去,里面必然要用到PIP_get函数来确定帧的起始地址和帧的长度,那么这样的话岂不是还要调用一次notifyReader函数,这不是重复了吗,都已经在读了,还通知谁去读呀,又没新的可读帧到来?我们有办法来避免这次重复,但是觉得PIP_get中调用notifyReader函数实在没有必要,其目的是什么呢?faint,实在想不明白!!!!
关键词: about Module 函数
来自TI官方网站discussion group的回答
Hi,
I see your concern but it does make sense.
Generally, PIP notification is only done in one direction. For example, if a PIP is used for input, then the notifyReader function is used and the notifyWriter function is set to nothing. For an output pip, notifyWriter is usually specified and notifyReader is left to nothing.
For example, many input data streams are interrupt driven meaning the CPU gets an interrupt when the data is ready. The interrupt service routine (ISR) will then put the data frame into the PIP via PIP_put(). PIP_put() will in turn call notifyReader to let the other end of the PIP know there is new data available. There is no need for notifyWrite because it's interrupt driven. You can apply the same logic for an output stream. The point is, you usually only use one of the notification routines. The other one is left to unused in the config tool.
So, let's consider the case of an input PIP. You assign the notifyreader function but leave the nnotifyWriter function to nothing. Input data comes in and the CPU get's an interrupt. The input ISR calls PIP_alloc() then PIP_put(). There's no notifyWriter function specified so PIP_alloc() doesn't call it. PIP_put() does call notifyReader. Since you don't want the the reader function to execute from the context of the ISR, you generally set the notifyReader function to SWI_post(). This means an SWI is posted everytime you do a PIP_put() from your ISR.
Eventually the ISR exits and the SWI executes. It's in the SWI function where you call PIP_get() to get the frame. PIP_get() will check the PIP and if more frames are still present in the PIP, it will again call notifyReader and hence call SWI_post() again. This is done to keep the pipe flowing.
Consider this, the interrupt service routine put two frames into the PIP back to back before exiting. this means notifyReader was called twice and hence, SWI_post() was called twice. There is no count on SWI posts so it can only be pending once at any given time. However, the ISR posted it twice. What happens is, when the SWI finally executes and does a PIP_get(), it gets one frame. However, PIP_get() will detect that there is still another frame in the PIP and will post the SWI again. Hence, while your SWI is executing, it was posted to run again. As soon as the SWI exits and depending on other threads, it will run again because it was posted. When it runs again it again does a PIP_get() and gets that last frame from the PIP. Now the PIP is empty and PIP_get() will not post the SWI again.
If this wasn't this way, you would have to check the PIP at the end of your SWI function and repost the SWI if the PIP wasn't empty. BIOS does this for you.
This is a long reply but hope it helps.
Regards,
-DspGuru
Hi,DspGuru. Thank you for your wonderful explanation very much.Now I have understood that why notifyReader was called in PIP_get().Let me tell you what I think.It is that the interrupt service routine(ISR) is trigerd twice or more times continuously but the software interrupt(SWI) has not enough time and priority to run.The SWI will run until the ISR finished and is not continous no longer.At this time,several frames are put at the read-end,but only one SWI is pending and the ohers are covered if notifyReader is not called in the PIP_get().So the SWI excutes only once and the several frames can not be readed in time.So notifyReader called in PIP_get() is necessary.right?:)Thank you again from my heart.
共3条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
vscode+cmake搭建雅特力AT32L021开发环境被打赏30分 | |
【换取逻辑分析仪】自制底板并驱动ArduinoNanoRP2040ConnectLCD扩展板被打赏47分 | |
【分享评测,赢取加热台】RISC-V GCC 内嵌汇编使用被打赏38分 | |
【换取逻辑分析仪】-基于ADI单片机MAX78000的简易MP3音乐播放器被打赏48分 | |
我想要一部加热台+树莓派PICO驱动AHT10被打赏38分 | |
【换取逻辑分析仪】-硬件SPI驱动OLED屏幕被打赏36分 | |
换逻辑分析仪+上下拉与多路选择器被打赏29分 | |
Let'sdo第3期任务合集被打赏50分 | |
换逻辑分析仪+Verilog三态门被打赏27分 | |
换逻辑分析仪+Verilog多输出门被打赏24分 |