Equivalent function in Azure RTOS ThreadX

492 Views Asked by At

I want to switch from FreeRTOS to Azure RTOS ThreadX. In FreeRTOS there is the function xQueueSendToBackFromISR() - It is used to write data to the queue from an interrupt service routine. FreeRTOS interrupt provides an interrupt safe version of queue API to read and write data from queues using ISR. And I am looking for the equivalent function in Azure RTOS ThreadX.

I looked up the documentation on Microsoft website and went through the functions but it seems that there is no such function in Azure RTOS ThreadX? https://learn.microsoft.com/en-us/azure/rtos/threadx/chapter4

2

There are 2 best solutions below

0
On BEST ANSWER

The function you are looking for is tx_queue_send(), with TX_NO_WAIT as third parameter.

UINT tx_queue_send(
    TX_QUEUE *queue_ptr,
    VOID *source_ptr, 
    ULONG wait_option);

wait_option:

Defines how the service behaves if the message queue is full. The wait options are defined as follows:

*TX_NO_WAIT: (0x00000000) - Selecting TX_NO_WAIT results in an immediate return from this service regardless of whether or not it was successful. This is the only valid option if the service is called from a non-thread; e.g., Initialization, timer, or ISR.

0
On

I'm just a newbie with FreeRTOS and zero experience with Azure, but I'll be happy if I can help.

From the cited document you have: tx_queue_send() and tx_queue_front_send()

I guess the one you are looking for is the first one. Anyway, both show the following: Allowed From Initialization, threads, timers, and ISRs

So I guess there is no such restriction to use a special function if called from ISRs as in FreeRTOS.

Hope I helped, if not please ignore my answer. Have a nive day!