rtel wrote on Thursday, September 16, 2010:
-I would like to know if we can do a task which wait for message in a queue (that is fill with the ISR, for exmple Uart Rx ISR)
with “uxQueueMessagesWaiting”. Or if I have to use a semaphore (waiting for semaphore activate in the task, and activate it in the Uart Rx ISR when i put a message in the queue?).
uxQueueMessagesWaiting() is only used to query how many messages a queue holds. You cannot use it to wait for a message. You can use xQueueReceive() to wait for a message to arrive - just specify a block time in the third parameter and you will block until either a message arrives or the block time expires.
Or if I have to use a semaphore (waiting for semaphore activate in the task, and activate it in the Uart Rx ISR when i put a message in the queue?)
That would be one way of doing it for sure, but I’m not sure it gives you any advantage over blocking on the queue itself. If you want to post a lot of data before unblocking the task using a separate semaphore would be more efficient - however I would suggest using a fast circular buffer rather than a queue to store the data otherwise use get the queue overhead without getting any benefits.
2-I fill the queue in a task, and the Uart Tx ISR take data in the queue and push them on the Tx Uart. Is it a problem if the ISR (for exemple Uart Tx ISR) is highter than configMAX_SYSCALL_INTERRUPT_PRIORITY?
Two things about this statement - first using queues in this method is not efficient. I know this is how the demo apps often do it, but they also state that they only do it as a convenient way of demonstrating how a task and queue can communication. It would be much more efficient to use a DMA or other such fast mechanism. Second - it is definitely not ok to have the interrupt above configMAX_SYSCALL_INTERRUPT_PRIORITY. This too is stated clearly, in my opinion. Please read the documentation for what this configuration parameter does.
I think yes.
I think no.
So If it yes, is it possible to change Free Rtos in order to give the mask priority for the Queue?
This last bit confuses me as I don’t know what you mean by the mask priority. You can change your version of FreeRTOS in any way you like, but if I am guessing what you mean correctly then I suspect to keep the code portable the answer would also be no as far as changing the main line code is concerned.