Good day to all,
I'm currently trying out the IPC MessageQ sample project, and as i am looking through the code, i'm filled with questions as i don't really understand how this works.
DSP: TMDXEVM6678LE
CCS: v5.5
Proj: IPC Single Image MessageQ sample project
"MessageQ_put(remoteQueueID, msg)" puts the msg in queue, and "MessageQ_get(messageQ, &msg, MessageQ_FOREVER)" gets the message from the queue? But then again, what exactly is the 'message' being passed? I understand 'msg' is actually a struct(below), but then all i see being passed are IDs etc, so what is the 'message' being passed? So if i want CORE0 to send the text "Hello World" to CORE1, how is this actually done?
typedef struct {
Bits 32 msgSize
Bits 32 flags
Bits 32 msgId
Bits 16 dstId
Bits 16 dstProc
Bits 16 replyId
Bits 16 replyProc
Bits 16 srsProc
Bits 16 heapId
Bits 16 seqNum
Bits 16 reserved
}MessageQ_MsgHeader;
------------------------------------------------------------------------------------------------------------------------
Also, which exactly is the code that calls the next core to print? There is a message "System_printf("Sending a message #%d to %s\n", MessageQ_getMsgId(msg), nextQueueName);" which prints as shown:
[C66xx_0] Sending a message #1 to CORE1
[C66xx_1] Sending a message #1 to CORE2
And in main, "nextProcId = (multiProc_Seld() + 1) % MultiProc_getNumProcessors();" tells, for example core0, that its next core is 1, but if i modify the code to "nextProcId = (multiProc_Seld() + 2) % MultiProc_getNumProcessors();", the output changes to:
[C66xx_0] Sending a message #1 to CORE2
[C66xx_2] Sending a message #1 to CORE4
From this i understand that core0 now knows its next processor is core 2, but which is the code in the sample proj which actually 'calls' CORE2? I understand 'why' its core2, but i don't understand 'how' core2 is being called to print instead of core 1. What is the code that actually says "Hey core2, you're my next processors, time for u to take over!"?
Thank you so much for your precious time and patience.
[Edit] I think I understand the second part of my ans. Correct me if I'm wrong. Its not that core0 is 'calling' core1 to print, but instead all the core are actively listening to message received.. MessageQ_get waits forever till message received end, only then will the code following the get be RU. Thus printing the following messages.