summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87dccad)
raw | patch | inline | side by side (parent: 87dccad)
author | Prasad Konnur <prasadkonnur@ti.com> | |
Tue, 15 Sep 2020 06:56:18 +0000 (12:26 +0530) | ||
committer | Sivaraj R <a0393606@ti.com> | |
Wed, 16 Sep 2020 06:05:31 +0000 (01:05 -0500) |
- Fixed multi channel.
- Updated example for multi channel test
Signed-off-by: Prasad Konnur <prasadkonnur@ti.com>
- Updated example for multi channel test
Signed-off-by: Prasad Konnur <prasadkonnur@ti.com>
packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_dss.c | [changed mode: 0644->0755] | patch | blob | history |
packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_mss.c | [changed mode: 0644->0755] | patch | blob | history |
packages/ti/drv/mailbox/soc/tpr12/mailbox_soc.c | [changed mode: 0644->0755] | patch | blob | history |
diff --git a/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_dss.c b/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_dss.c
/* Function Declarations */
/* ========================================================================== */
static void Test_appCallbackFunction(Mbox_Handle handle, Mailbox_Instance remoteEndpoint);
+void multiChannelTest (void);
/* ========================================================================== */
/* Structure Declarations */
uint32_t volatile gTestFailFlag = 0;
volatile uint32_t testAppCallbackFlag=0;
+
+/*Global array to keep handles of channels between mss and dss*/
+Mbox_Handle handleArray[MAILBOX_CH_ID_MAX + 1];
/* ========================================================================== */
/* Function Definitions */
/* ========================================================================== */
/* Initialize the Mailbox */
Mailbox_init(&initParam);
+ multiChannelTest();
+
/* Setup the default Mailbox open Parameters */
Mailbox_openParams_init(&openParam);
openParam.remoteEndpoint = MAILBOX_INST_MSS_CR5A;
@@ -333,3 +339,290 @@ static void Test_appCallbackFunction(Mbox_Handle handle, Mailbox_Instance remote
{
testAppCallbackFlag=1;
}
+
+volatile uint32_t testAppCallbackFlag1=0;
+static void Test_appCallbackFunction1(Mbox_Handle handleDss, Mailbox_Instance remoteEndpoint)
+{
+ testAppCallbackFlag1=1;
+}
+
+volatile uint32_t testAppCallbackFlag3=0;
+static void Test_appCallbackFunction3(Mbox_Handle handleDss, Mailbox_Instance remoteEndpoint)
+{
+ testAppCallbackFlag3=1;
+}
+
+void Test_channel1Task(UArg arg0, UArg arg1)
+{
+ uint32_t bufferRx;
+ uint32_t size;
+
+ while(1)
+ {
+ while (testAppCallbackFlag1 == 0)
+ {
+ Task_sleep(1);
+ Task_yield();
+ }
+ testAppCallbackFlag1 = 0;
+ System_printf("DSS: Channel 1 received message.\n");
+
+ /*read first word*/
+ bufferRx = 0;
+ size = Mailbox_read(handleArray[1], (uint8_t *)&bufferRx, 4);
+ System_printf("DSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_1)
+ {
+ System_printf("DSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[1]);
+ }
+
+}
+
+void Test_channel3Task(UArg arg0, UArg arg1)
+{
+ uint32_t bufferRx;
+ uint32_t size;
+
+ while(1)
+ {
+ while (testAppCallbackFlag3 == 0)
+ {
+ Task_sleep(1);
+ Task_yield();
+ }
+ testAppCallbackFlag3 = 0;
+ System_printf("DSS: Channel 3 received message.\n");
+
+ /*read first word*/
+ bufferRx = 0;
+ size = Mailbox_read(handleArray[3], (uint8_t *)&bufferRx, 4);
+ System_printf("DSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_3)
+ {
+ System_printf("DSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[3]);
+ }
+
+}
+
+void Test_channel4Task(UArg arg0, UArg arg1)
+{
+ uint32_t bufferRx;
+ uint32_t size;
+
+ while(1)
+ {
+ size = Mailbox_read(handleArray[4], (uint8_t *)&bufferRx, 4);
+ System_printf("DSS: Channel 4 received message.\n");
+ System_printf("DSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_2)
+ {
+ System_printf("DSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[4]);
+ }
+
+}
+Task_Handle multiChTaskHandle[MAILBOX_CH_ID_MAX];
+
+void multiChannelTest (void)
+{
+ int32_t errCode;
+ int32_t size,i;
+ Task_Params taskParams;
+ uint32_t bufferRx;
+ Mailbox_openParams openParam;
+
+
+ System_printf("*************************************************\n");
+ System_printf("\nDSS: Starting Multichannel Test.\n");
+
+ /****** ch 1 *********************************************/
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_MSS_CR5A;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_1;
+ openParam.cfg.readMode = MAILBOX_MODE_CALLBACK;
+ openParam.cfg.readCallback = Test_appCallbackFunction1;
+ openParam.cfg.writeMode = MAILBOX_MODE_POLLING;
+
+ handleArray[1] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[1] == NULL)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ System_printf("DSS: Mailbox Instance to MSS %p has been opened successfully\n", handleArray[1]);
+
+ /****** ch 3 *********************************************/
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_MSS_CR5A;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_3;
+ openParam.cfg.readMode = MAILBOX_MODE_CALLBACK;
+ openParam.cfg.readCallback = Test_appCallbackFunction3;
+ openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
+
+ handleArray[3] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[3] == NULL)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ System_printf("DSS: Mailbox Instance to MSS %p has been opened successfully\n", handleArray[3]);
+
+ /****** ch 4 *********************************************/
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_MSS_CR5A;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_4;
+ openParam.cfg.readMode = MAILBOX_MODE_BLOCKING;
+ openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
+
+ handleArray[4] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[4] == NULL)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ System_printf("DSS: Mailbox Instance to MSS %p has been opened successfully\n", handleArray[4]);
+
+ /****** ch 7 *********************************************/
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_MSS_CR5A;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_7;
+ openParam.cfg.readMode = MAILBOX_MODE_BLOCKING;
+ openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
+
+ handleArray[7] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[7] == NULL)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ System_printf("DSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ System_printf("DSS: Mailbox Instance to DSS %p has been opened successfully\n", handleArray[7]);
+
+ /***************************************************/
+ /*start tasks used for the multichannel test*/
+ Task_Params_init(&taskParams);
+ taskParams.stackSize = 2*1024;
+ multiChTaskHandle[1] = Task_create(Test_channel1Task, &taskParams, NULL);
+
+ Task_Params_init(&taskParams);
+ taskParams.stackSize = 2*1024;
+ multiChTaskHandle[3] = Task_create(Test_channel3Task, &taskParams, NULL);
+
+ Task_Params_init(&taskParams);
+ taskParams.stackSize = 2*1024;
+ multiChTaskHandle[4] = Task_create(Test_channel4Task, &taskParams, NULL);
+
+ /*give time for remote endpoint to open channels*/
+ Task_sleep(4);
+
+ for(i=0;i<3;i++)
+ {
+ /* channels 3 and 4 are write blocking so can write back to back*/
+ System_printf("DSS: ************ Writing a message in CHANNEL 3 to MSS ****************\n");
+ size = Mailbox_write(handleArray[3], (uint8_t*)&gTestPatternWordSend_3, sizeof(gTestPatternWordSend_3));
+ if(size != sizeof(gTestPatternWordSend_3))
+ {
+ System_printf("DSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ System_printf("DSS: ************ Writing a message in CHANNEL 4 to MSS ****************\n");
+ size = Mailbox_write(handleArray[4], (uint8_t*)&gTestPatternWordSend_2, sizeof(gTestPatternWordSend_2));
+ if(size != sizeof(gTestPatternWordSend_2))
+ {
+ System_printf("DSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ }
+
+ System_printf("DSS: ************ Writing a message in CHANNEL 1 to MSS ****************\n");
+ size = Mailbox_write(handleArray[1], (uint8_t*)&gTestPatternWordSend_1, sizeof(gTestPatternWordSend_1));
+ if(size != sizeof(gTestPatternWordSend_1))
+ {
+ System_printf("DSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ /* Multichannel test end once a message is received in channel 7 which is readBlocking*/
+ size = Mailbox_read(handleArray[7], (uint8_t *)&bufferRx, 4);
+ System_printf("DSS: Channel 7 received message.\n");
+ System_printf("DSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_0)
+ {
+ System_printf("DSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[7]);
+
+ System_printf("DSS: ************ Writing a message in CHANNEL 7 to MSS ****************\n");
+ size = Mailbox_write(handleArray[7], (uint8_t*)&gTestPatternWordSend_0, sizeof(gTestPatternWordSend_0));
+ if(size != sizeof(gTestPatternWordSend_0))
+ {
+ System_printf("DSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ /*close all channels*/
+ for(i=0;i<=MAILBOX_CH_ID_MAX;i++)
+ {
+ if((i==1) || (i==3) || (i==4) || (i==7))
+ {
+ if (Mailbox_close(handleArray[i]) != 0)
+ {
+ System_printf("DSS: Error: Failed to close instance %d\n",i);
+ gTestFailFlag = 1;
+ }
+ System_printf("Debug: closed instance %d\n",i);
+ }
+ }
+
+ /*close auxiliary tasks*/
+ Task_delete(&multiChTaskHandle[1]);
+ Task_delete(&multiChTaskHandle[3]);
+ Task_delete(&multiChTaskHandle[4]);
+
+}
diff --git a/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_mss.c b/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_mss.c
/* ========================================================================== */
static void Test_appCallbackFunction(Mbox_Handle handle, Mailbox_Instance remoteEndpoint);
+void multiChannelTest (void);
/* ========================================================================== */
/* Structure Declarations */
volatile uint32_t testAppCallbackFlag=0;
+/*Global array to keep handles of channels between mss and dss*/
+Mbox_Handle handleArray[MAILBOX_CH_ID_MAX + 1];
+
/* ========================================================================== */
/* Function Definitions */
/* ========================================================================== */
/* Initialize the Mailbox */
Mailbox_init(&initParam);
+ multiChannelTest();
+
/* Setup the default Mailbox open Parameters */
Mailbox_openParams_init(&openParam);
openParam.remoteEndpoint = MAILBOX_INST_DSP;
@@ -318,3 +324,302 @@ static void Test_appCallbackFunction(Mbox_Handle handle, Mailbox_Instance remote
{
testAppCallbackFlag=1;
}
+
+volatile uint32_t testAppCallbackFlag1=0;
+static void Test_appCallbackFunction1(Mbox_Handle handle, Mailbox_Instance remoteEndpoint)
+{
+ testAppCallbackFlag1=1;
+}
+volatile uint32_t testAppCallbackFlag3=0;
+static void Test_appCallbackFunction3(Mbox_Handle handle, Mailbox_Instance remoteEndpoint)
+{
+ testAppCallbackFlag3=1;
+}
+
+void Test_channel1Task(UArg arg0, UArg arg1)
+{
+ uint32_t bufferRx;
+ uint32_t size;
+
+ while(1)
+ {
+ while (testAppCallbackFlag1 == 0)
+ {
+ Task_sleep(1);
+ Task_yield();
+ }
+ testAppCallbackFlag1 = 0;
+ printf("MSS: Channel 1 received message.\n");
+
+ /*read first word*/
+ bufferRx = 0;
+ size = Mailbox_read(handleArray[1], (uint8_t *)&bufferRx, 4);
+ printf("MSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_1)
+ {
+ printf("MSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[1]);
+ }
+
+}
+
+void Test_channel3Task(UArg arg0, UArg arg1)
+{
+ uint32_t bufferRx;
+ uint32_t size;
+
+ while(1)
+ {
+ while (testAppCallbackFlag3 == 0)
+ {
+ Task_sleep(1);
+ Task_yield();
+ }
+ testAppCallbackFlag3 = 0;
+ printf("MSS: Channel 3 received message.\n");
+
+ /*read first word*/
+ bufferRx = 0;
+ size = Mailbox_read(handleArray[3], (uint8_t *)&bufferRx, 4);
+ printf("MSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_3)
+ {
+ printf("MSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[3]);
+ }
+
+}
+
+void Test_channel4Task(UArg arg0, UArg arg1)
+{
+ uint32_t bufferRx;
+ uint32_t size;
+
+ while(1)
+ {
+ size = Mailbox_read(handleArray[4], (uint8_t *)&bufferRx, 4);
+ printf("MSS: Channel 4 received message.\n");
+ printf("MSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_2)
+ {
+ printf("MSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[4]);
+ }
+
+}
+
+extern Mailbox_MCB gMailboxMCB;
+
+Task_Handle multiChTaskHandle[MAILBOX_CH_ID_MAX];
+void multiChannelTest (void)
+{
+ int32_t errCode,i,size;
+ Task_Params taskParams;
+ uint32_t bufferRx;
+ Mailbox_openParams openParam;
+
+ printf("*************************************************\n");
+ printf("\nMSS: Starting Multichannel Test.\n");
+
+ /****** ch 1 *********************************************/
+ /* Setup the default Mailbox open Parameters */
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_DSP;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_1;
+ openParam.cfg.readMode = MAILBOX_MODE_CALLBACK;
+ openParam.cfg.readCallback = Test_appCallbackFunction1;
+ openParam.cfg.writeMode = MAILBOX_MODE_POLLING;
+
+ handleArray[1] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[1] == NULL)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleArray[1]);
+
+ /****** ch 3 *********************************************/
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_DSP;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_3;
+ openParam.cfg.readMode = MAILBOX_MODE_CALLBACK;
+ openParam.cfg.readCallback = Test_appCallbackFunction3;
+ openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
+
+ handleArray[3] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[3] == NULL)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleArray[3]);
+
+ /****** ch 4 *********************************************/
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_DSP;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_4;
+ openParam.cfg.readMode = MAILBOX_MODE_BLOCKING;
+ openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
+
+ handleArray[4] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[4] == NULL)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleArray[4]);
+
+ /****** ch 7 *********************************************/
+ Mailbox_openParams_init(&openParam);
+ openParam.remoteEndpoint = MAILBOX_INST_DSP;
+ openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
+ openParam.cfg.chId = MAILBOX_CH_ID_7;
+ openParam.cfg.readMode = MAILBOX_MODE_BLOCKING;
+ openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
+
+ handleArray[7] = Mailbox_open(&openParam, &errCode);
+ if (handleArray[7] == NULL)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ if (errCode != 0)
+ {
+ printf("MSS: Error: Unable to open the Mailbox Instance. Error=%d\n",errCode);
+ gTestFailFlag = 1;
+ return;
+ }
+ printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleArray[7]);
+
+ /***************************************************/
+
+ Task_Params_init(&taskParams);
+ taskParams.stackSize = 2*1024;
+ multiChTaskHandle[1] = Task_create(Test_channel1Task, &taskParams, NULL);
+
+ Task_Params_init(&taskParams);
+ taskParams.stackSize = 2*1024;
+ multiChTaskHandle[3] = Task_create(Test_channel3Task, &taskParams, NULL);
+
+ Task_Params_init(&taskParams);
+ taskParams.stackSize = 2*1024;
+ multiChTaskHandle[4] = Task_create(Test_channel4Task, &taskParams, NULL);
+
+ /*give time for remote endpoint to open channels*/
+ Task_sleep(4);
+
+
+ for(i=0;i<3;i++)
+ {
+ /* channels 3 and 4 are write blocking so can write back to back*/
+ printf("MSS: ************ Writing a message in CHANNEL 3 to DSS ****************\n");
+ size = Mailbox_write(handleArray[3], (uint8_t*)&gTestPatternWordSend_3, sizeof(gTestPatternWordSend_3));
+ if(size != sizeof(gTestPatternWordSend_3))
+ {
+ printf("MSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ printf("MSS: ************ Writing a message in CHANNEL 4 to DSS ****************\n");
+ size = Mailbox_write(handleArray[4], (uint8_t*)&gTestPatternWordSend_2, sizeof(gTestPatternWordSend_2));
+ if(size != sizeof(gTestPatternWordSend_2))
+ {
+ printf("MSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ }
+
+ printf("MSS: ************ Writing a message in CHANNEL 1 to DSS ****************\n");
+ size = Mailbox_write(handleArray[1], (uint8_t*)&gTestPatternWordSend_1, sizeof(gTestPatternWordSend_1));
+ if(size != sizeof(gTestPatternWordSend_1))
+ {
+ printf("MSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ printf("MSS: ************ Writing a message in CHANNEL 7 to DSS ****************\n");
+ MULTI_CH7_WRITE:
+ size = Mailbox_write(handleArray[7], (uint8_t*)&gTestPatternWordSend_0, sizeof(gTestPatternWordSend_0));
+ if (size == MAILBOX_ECHINUSE)
+ {
+ /* Previous write is in polling mode and did not get the Ack.
+ * Try write after some time.
+ */
+ Task_sleep(1);
+ goto MULTI_CH7_WRITE;
+ }
+ if(size != sizeof(gTestPatternWordSend_0))
+ {
+ printf("MSS: Error. Write failed. Error=%d\n",size);
+ gTestFailFlag = 1;
+ }
+
+ /* Multichannel test end once a message is received in channel 7 which is readBlocking*/
+ size = Mailbox_read(handleArray[7], (uint8_t *)&bufferRx, 4);
+ printf("MSS: Channel 7 received message.\n");
+ printf("MSS: Read %d bytes. Val=0x%x \n",size, bufferRx);
+ if (bufferRx != gTestPatternWordReceive_0)
+ {
+ printf("MSS: Error. Pattern mismatch.\n");
+ gTestFailFlag = 1;
+ return;
+ }
+ Mailbox_readFlush(handleArray[7]);
+
+ /*close all channels*/
+ for(i=0;i<=MAILBOX_CH_ID_MAX;i++)
+ {
+ /* Open the Instance */
+ if((i==1) || (i==3) || (i==4) || (i==7))
+ {
+ if (Mailbox_close(handleArray[i]) != 0)
+ {
+ printf("MSS: Error: Failed to close instance %d\n",i);
+ gTestFailFlag = 1;
+ }
+ printf("Debug: closed instance %d\n",i);
+ }
+ }
+
+ /*close auxiliary tasks*/
+ Task_delete(&multiChTaskHandle[1]);
+ Task_delete(&multiChTaskHandle[3]);
+ Task_delete(&multiChTaskHandle[4]);
+
+
+}
diff --git a/packages/ti/drv/mailbox/soc/tpr12/mailbox_soc.c b/packages/ti/drv/mailbox/soc/tpr12/mailbox_soc.c
@@ -250,7 +250,7 @@ int32_t Mailbox_isMultiChannelSupported(Mailbox_Instance localEndpoint, Mailbox_
/* Multichannel supported only between DSS and MSS. */
if ((localEndpoint == MAILBOX_INST_DSP) && (remoteEndpoint == MAILBOX_INST_MSS_CR5A))
{
- retVal = MAILBOX_EINVAL;
+ retVal = MAILBOX_SOK;
}
#else
/* Currently not supported for other cores. */
}
else
{
- Mailbox_boxFullISRProcessing((Mailbox_Driver*) remoteCfg->handleArray[id]);
+ Mailbox_Driver* driver = remoteCfg->handleArray[id];
+ driver->remoteCfgPtr->readChIDInUse = driver->cfg.chId;
+ Mailbox_boxFullISRProcessing(driver);
}
}
}