共3条 1/1 1 跳转至页
about the PIP Module
关键词： 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 跳转至页