Overview
I've been doing a little research with respect to the communication mechanisms between the DSS and MSS. For example, sending messages from the DSS, to be read and processed by the MSS.
There's many examples, either within the toolbox, or even in the OOB, which demonstrates this type of communication. However for this specific use case, efficiency is crucial, so I would like to get it right from the get-go.
Based on this research, I see a few different methods used, some of which come along as part of SYS/BIOS, and others that live within the mmWave SDK. The breakdown can be seen below:
SYS/BIOS API's
API | Description |
Event_post() | Used to signal events. If a task is waiting for the event and the event conditions are met, post() unblocks the task. If no tasks are waiting, post() simply registers the event with the event object and returns. |
Event_pend() | Used to wait for events. The and Mask and or Mask determine which event(s) must occur before returning from pend() |
Mailbox_post() | Checks to see if there are any free message slots before copying msg into the mailbox. Mailbox_post readies the first task(if any) waiting on the mailbox. If the mailbox is full and a timeout is specified the task remains suspended until Mailbox_pend is called or the timeout expires. |
Mailbox_pend() | If the mailbox is not empty, Mailbox_pend copies the first message into msg and returns TRUE. Otherwise, Mailbox_pend suspends the execution of the current task until Mailbox_post is called or the timeout expires. |
mmWave API's
API | Description |
Mailbox_read() | Reads data from a Mailbox. A Mailbox can only read one message at a time from a remote endpoint. Multiple Mailbox_read() calls can be done for the same message in the mailbox. |
Mailbox_write() |
Writes data to a Mailbox. A Mailbox can only send one message at a time to a remote endpoint. After data is copied to mailbox buffer, driver triggers interrupt to remote endpoint. This means that a call to the Mailbox_write() is always a complete mailbox transaction. A new message can only be sent after the previous message has been acknowledged by the remote endpoint |
Background
In some examples, I have seen the DSS communicate with the MSS via Event_Post()/Event_Pend(), and in others I have seen mmWave Mailbox_Read()/Mailbox_Write(). After looking at the source for both, I'm a little confused on which one is ideal for my specific scenario (DSS->MSS).
For example, the mmWave Mailbox API's internally leverages Semaphore's and interrupts to copy message to and from, which is slightly different from how the SYS/BIOS API works. In the latter, SYS/BIOS uses Semaphore's as well for Mailbox_Post()/Mailbox_Pend(), and also uses Hwi's in conjunction with a thread safe Queue construct to read/write.
In terms of the Event API's from SYS/BIOS, those do not appear to use Semaphore's, and instead uses a combination of Clocks, Hwi's, Scheduler Control (Task_Disable()/Task_Restore(), and thread safe Queue's to facilitate the requests.
Lastly, within the SYS/BIOS User Guide, there's also mention of using the Mailbox API, in conjunction with Events. For example, calling Event_Pend() while waiting for a Mailbox message with a wait period of BIOS_NO_WAIT. My assumption being, since the Event_Pend() is blocking, if there is an event to unblock, you wouldn't need to wait before reading the Mailbox.
Question
Based on these findings above, there's a few different ways to communicate between the two sub-systems, but when it comes to efficiency, I'm sure there's a recommended approach based on a given scenario.
In this case, the scenario is, the DSS is in charge of running the Radar, as well as a significant portion of Signal Processing. However, it also needs to communicate with the MSS frequently (anywhere from ~100-500ms, interval is random), without stealing cycles from higher priority operations.
So the question is, what is the preferred approach when frequently sending messages from the DSS to the MSS, and are there any enhancements that can be made, for example using Events, along with a Mailbox, to increase efficiency.
Similarly, am I shooting myself in the foot by using any of the Messaging mechanism above who rely on Hwi's since they have a higher priority than Tasks. i.e would I end up blocking a critical task, such as Signal Processing or Radar Control, by using Hwi's.