Hi
I am trying to add an array to a message that is going to be passed to a queue.
I am using a template for messageQ under IPC in new->CCS Project-> IPCand I/O examples->C6678 Examples-> MesageQ
I just modified the message to pass an array of 100 elements. In core 0 I initialize the array to 1
and it suppose that in every core every element in array must be incremented by one, so I expect
at end of process to have a value of 8 in every element of the array.
I am using to define the message and allocation:
typedef struct MyMessg{
MessageQ_Msg msg;
int var[ARRAY_SIZE];
}MyMsg;
msg = (MyMessage)MessageQ_alloc(HEAPID, sizeof(MyMessage));
if (msg == NULL) {
System_abort("MessageQ_alloc failed\n" );
}
Before MessageQ_put in core 0 I modify the array as follows:
for(i=0;i<ARRAY_SIZE;i++){
(*msg).var[i]=1;
}
and in cores 1-7, just after MessageQ_get:
for(i=0;i<ARRAY_SIZE;i++){
(*msg).var[i]=(*msg).var[i] + 1;
}
the result of running this code is that some values
of (*msg).var are set to 8 , about 8 first values, but
others are set to one.
I attach the project for clarity.
1680.test_template_messageq.zip
Is this the correct way to add information to message?
Julian