This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MessageQ_put calles from multiple tasks

Hi,

We're working on Concerto controller and we ould like to use IPC communication.

We've implemented two functions for sending a IPc messages to C28:

 

void IPCInterface::IPCSendData( Uint16 uiMessageType, char uiFCid, Uint16 uiDataSize, char *pDataBuff )
{
 MY_M3_C28_Msg  *mySendMessage;
 Uint16    loop, BufLoop;

 // Allocate the message
 mySendMessage = IPC_allocMsg ();
    if (mySendMessage == NULL) {
     System_printf("IPC alloc message failed\n");
    }
    mySendMessage->MsgType = uiMessageType;
    mySendMessage->Data[0] = uiFCid;
  for (loop = 1, BufLoop = 0; (loop < uiDataSize); loop++, BufLoop++)
 {
  mySendMessage->Data[loop] = pDataBuff[BufLoop];
 }
 // send the message
 IPC_sendMsg(mySendMessage);
}

 

void IPC_sendMsg ( MY_M3_C28_Msg *Message )
{
 Int              status;

    // Increment the msgID and set it
    msgId++;
    MessageQ_setMsgId(Message, msgId);

    System_printf("Sending a message #%d to %s\n", msgId, remoteQueueName);

    // send the message to the remote processor
    status = MessageQ_put(remoteQueueId, (MessageQ_Msg)Message);
    if (status < 0) {
         System_abort("MessageQ_put had a failure/error\n");
    }

}

 /******************************************************************************************************************************/

On M3 side I have two communications CAN and Ethernet, and I would like to transfer messages from Ethernet_receiveTsk and CAN_receiveTk via IPC to C28.

Shall I use " lock"  before calling MessageQ_put. How can I be sure that messages are not got lost? How shall I manage it correctly?

 

thank you

Alla

  • Alla,

    So if I understand you correctly, you have some messages from CAN and Ethernet and you want to pass these messages to C28 via IPC correct?  When I first read your post, I thought you wanted to pass messages via CAN and Ethernet through MessageQ but I don't think that's what you meant.

    You do not have to "lock" before calling MessageQ_put.  What you can do to verify that messages are not lost is you can give the messages an Id and then check it on the C28 to make sure you get every message.

    Judah

  • Hi Judah,

     

    Thank you for fast reply....

    My problem is that M3 core is used as communications engine (Ethernet, CAN, Uart)...the application is running on DSP.

    Messages are continually send forward and backward from M3 <-> C28.

    I'm receiving  data every 50ms via CAN on M3 and shall pass it to DSP side via IPC. In parallel M3 receives messages via Ethernet also every 100ms and shall be send also  via IPC the same for the third UArt interface.  So basically I have 3  Tasks for Messages Receive (Uart, Etherent, CAN) and from each I have to resend the message to DSP side.  So I thought  how better to manage it (performance and reliability reasons)  maybe I'll use 3 different MessageQ of IPC object (each for interface).

     

    Please advise how to manage it properly

    thank you,

    Alla

  • Alla,

    Yes, I would recommend having three different MessageQs and a Task for Each on the C28 that processes the message.

    Judah