xiaoxiang781216 commented on issue #5412: URL: https://github.com/apache/incubator-nuttx/issues/5412#issuecomment-1030190632
> So, I have looked into the history of changes and it turns out that between 8.2 and 10.2 the function `nxmq_send()` has been modified. In the older version, it was only executing the logic related to putting an item in the message queue, but now it has to obtain the file struct instance first, and obtaining it using regular mechanisms fails because of the fact that we are doing it from an ISR. The current call order is like this: `mq_send -> nxmq_send -> fs_getfilep -> _files_semtake -> nxsem_wait_uninterruptible -> nxsem_wait -> ASSERTION TRIGGERED` > The change of call chain is due to: https://github.com/apache/incubator-nuttx/pull/2631. The final goal is to support poll on mqueue: https://github.com/apache/incubator-nuttx/pull/2957. > So my question is, what is the correct way on NuttX 10.2 to send an item using a message queue from ISR? [The documentation doesn't say anything about it not being possible](https://cwiki.apache.org/confluence/display/NUTTX/User+Guide#Message_Queue). I was also not able to find an alternative API (some RTOSes I have worked with in the past had two separate functions for that, like for example `msgq_send()` and `msgq_send_from_isr()`) It isn't enough to just add msgq_send_from_isr because mqueue handler belong to a particular task, and it's impossible to use mqueue handler directly in the interrupt context. Instead, you need call file_mq_xxx in kernel side, but mq_xxx in user space. Please follow audio_null.c change in #2631 to adapter your driver code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
