summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5340753)
raw | patch | inline | side by side (parent: 5340753)
author | Prasad Konnur <prasadkonnur@ti.com> | |
Wed, 7 Oct 2020 15:52:59 +0000 (21:22 +0530) | ||
committer | Sivaraj R <sivaraj@ti.com> | |
Sat, 31 Oct 2020 04:09:47 +0000 (23:09 -0500) |
Signed-off-by: Prasad Konnur <prasadkonnur@ti.com>
packages/ti/drv/mailbox/examples/mailbox_msg_testapp/app_sync.c | [new file with mode: 0755] | patch | blob |
packages/ti/drv/mailbox/examples/mailbox_msg_testapp/app_sync.h | [new file with mode: 0755] | patch | blob |
packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_dss.c | patch | blob | history | |
packages/ti/drv/mailbox/examples/mailbox_msg_testapp/main_mss.c | patch | blob | history | |
packages/ti/drv/mailbox/examples/mailbox_msg_testapp/makefile | [changed mode: 0644->0755] | patch | blob | history |
diff --git a/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/app_sync.c b/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/app_sync.c
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) Texas Instruments Incorporated 2020
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @file app_sync.c
+ *
+ * @brief
+ * sync code used for synchronization the execution between cores.
+ * This is implemented using the spare registers.
+ *
+ */
+
+/* ========================================================================== */
+/* Include Files */
+/* ========================================================================== */
+
+#include <stdint.h>
+#include <ti/csl/soc.h>
+#include <ti/csl/hw_types.h>
+#include "app_sync.h"
+
+/* ========================================================================== */
+/* Macros & Typedefs */
+/* ========================================================================== */
+
+/* None. */
+
+/* ========================================================================== */
+/* Function Declarations */
+/* ========================================================================== */
+
+/* None. */
+
+/* ========================================================================== */
+/* Structure Declarations */
+/* ========================================================================== */
+
+/* None. */
+
+/* ========================================================================== */
+/* Global Variables */
+/* ========================================================================== */
+
+static uint32_t dssSyncRegAddr = CSL_DSS_CTRL_U_BASE + CSL_DSS_CTRL_HW_SPARE_RW0;
+static uint32_t mssSyncRegAddr = CSL_DSS_CTRL_U_BASE + CSL_DSS_CTRL_HW_SPARE_RW1;
+
+/* ========================================================================== */
+/* Function Definitions */
+/* ========================================================================== */
+
+void App_setDssState(uint32_t state)
+{
+ HW_WR_REG32(dssSyncRegAddr, state);
+}
+
+uint32_t App_getDssState(void)
+{
+ return (HW_RD_REG32(dssSyncRegAddr));
+}
+
+void App_setMssState(uint32_t state)
+{
+ HW_WR_REG32(mssSyncRegAddr, state);
+}
+
+uint32_t App_getMssState(void)
+{
+ return (HW_RD_REG32(mssSyncRegAddr));
+}
diff --git a/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/app_sync.h b/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/app_sync.h
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) Texas Instruments Incorporated 2020
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file app_sync.h
+ *
+ * \brief APIs used for code synchronization between cores.
+ */
+
+#ifndef APP_SYNC_H_
+#define APP_SYNC_H_
+
+/* ========================================================================== */
+/* Include Files */
+/* ========================================================================== */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/* Macros & Typedefs */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/* Structure Declarations */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/* Function Declarations */
+/* ========================================================================== */
+
+void App_setDssState(uint32_t state);
+
+uint32_t App_getDssState(void);
+
+void App_setMssState(uint32_t state);
+
+uint32_t App_getMssState(void);
+
+/* ========================================================================== */
+/* Static Function Definitions */
+/* ========================================================================== */
+
+/* None */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* #ifndef APP_SYNC_H_ */
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
index df8daacfafea30217bfd3309735e80b9201c4d29..4be2e5919be8e5115205fe1f75eb024a9cb754b9 100644 (file)
#include <ti/drv/mailbox/mailbox.h>
#include <ti/drv/mailbox/src/mailbox_internal.h>
+#include "app_sync.h"
+
/* ========================================================================== */
/* Macros & Typedefs */
/* ========================================================================== */
/* ========================================================================== */
/* Function Definitions */
/* ========================================================================== */
+
int32_t Test_mailboxWrite(Mbox_Handle handle, uint8_t * buffer, uint32_t bufferSize)
{
int32_t retVal;
do {
- retVal = Mailbox_write(handle, buffer, bufferSize);
- if (retVal == MAILBOX_ETXACKTIMEDOUT)
- {
- System_printf("MSS: Error. Write timedout.Rewriting msg \n");
- }
+ retVal = Mailbox_write(handle, buffer, bufferSize);
+ if (retVal == MAILBOX_ETXACKTIMEDOUT)
+ {
+ System_printf("MSS: Error. Write timedout.Rewriting msg \n");
+ }
} while (retVal == MAILBOX_ETXACKTIMEDOUT);
- return retVal;
+ return retVal;
+}
+
+void Test_dssWaitSync(void)
+{
+ uint32_t retVal = 0;
+
+ printf("DSS: App Sync\n");
+ App_setDssState(1U);
+
+ while (retVal == 0)
+ {
+ retVal = App_getMssState();
+ Task_sleep(1);
+ }
+
+ printf("DSS: App Sync Done.\n");
+ App_setMssState (0U);
}
+
void Test_initTask(UArg arg0, UArg arg1)
{
Mailbox_initParams initParam;
}
System_printf("DSS: Mailbox Instance %p has been opened successfully\n", handle);
+ Test_dssWaitSync();
+
/**************************************************************************
* Test: Wait for message from MSS
**************************************************************************/
Task_Params taskParams;
uint32_t bufferRx;
Mailbox_openParams openParam;
- int32_t syncRetVal;
-
System_printf("*************************************************\n");
System_printf("\nDSS: Starting Multichannel Test.\n");
}
System_printf("DSS: Mailbox Instance to MSS %p has been opened successfully\n", handleArray[7]);
- /****** ch 0 for Sync ************************************/
- Mailbox_openParams_init(&openParam);
- openParam.remoteEndpoint = MAILBOX_INST_MSS_CR5A;
- openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
- openParam.cfg.chId = MAILBOX_CH_ID_0;
- openParam.cfg.readMode = MAILBOX_MODE_CALLBACK;
- openParam.cfg.readCallback = mailboxMssSyncCallback;
- openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
- openParam.cfg.writeTimeout = 5U;
-
- handleArray[0] = Mailbox_open(&openParam, &errCode);
- System_printf("DSS: Mailbox Instance to MSS %p has been opened successfully\n", handleArray[0]);
-
- do
- {
- uint32_t syncData = 0xFFFFFFFFU;
- /* Send sync data to mss core. */
- syncRetVal = Mailbox_write(handleArray[0], (uint8_t*)&syncData, sizeof(syncData));
- if (syncRetVal != MAILBOX_SOK)
- {
- System_printf("DSS: Waiting for sync msg from mss.\n");
- }
- } while (gMssSync == 0U);
+ Test_dssWaitSync();
/***************************************************/
/*start tasks used for the multichannel test*/
/*close all channels*/
for(i=0;i<=MAILBOX_CH_ID_MAX;i++)
{
- if((i==0) ||(i==1) || (i==3) || (i==4) || (i==7))
+ if((i==1) || (i==3) || (i==4) || (i==7))
{
if (Mailbox_close(handleArray[i]) != 0)
{
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
index 9aea31139508cafe48ccfe3494a8fc4968d07a12..e903068e9dbc34f662940d087d5b8118d07b672c 100644 (file)
#include <ti/drv/mailbox/mailbox.h>
#include <ti/drv/mailbox/src/mailbox_internal.h>
+#include "app_sync.h"
+
/* ========================================================================== */
/* Macros & Typedefs */
/* ========================================================================== */
@@ -122,13 +124,30 @@ int32_t Test_mailboxWrite(Mbox_Handle handle, uint8_t * buffer, uint32_t bufferS
int32_t retVal;
do {
- retVal = Mailbox_write(handle, buffer, bufferSize);
- if (retVal == MAILBOX_ETXACKTIMEDOUT)
- {
- System_printf("MSS: Error. Write timedout.Rewriting msg \n");
- }
+ retVal = Mailbox_write(handle, buffer, bufferSize);
+ if (retVal == MAILBOX_ETXACKTIMEDOUT)
+ {
+ System_printf("MSS: Error. Write timedout.Rewriting msg \n");
+ }
} while (retVal == MAILBOX_ETXACKTIMEDOUT);
- return retVal;
+ return retVal;
+}
+
+void Test_mssWaitSync(void)
+{
+ uint32_t retVal = 0;
+
+ printf("MSS: App Sync\n");
+ App_setMssState(1U);
+
+ while (retVal == 0)
+ {
+ retVal = App_getDssState();
+ Task_sleep(1);
+ }
+
+ printf("MSS: App Sync Done.\n");
+ App_setDssState (0U);
}
void Test_initTask(UArg arg0, UArg arg1)
}
System_printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleDss);
+ Test_mssWaitSync();
+
/**************************************************************************
* Test: Write message to DSS
**************************************************************************/
Task_Params taskParams;
uint32_t bufferRx;
Mailbox_openParams openParam;
- uint32_t syncData;
System_printf("*************************************************\n");
System_printf("\nMSS: Starting Multichannel Test.\n");
}
System_printf("MSS: Mailbox Instance to DSS %p has been opened successfully\n", handleArray[7]);
- /****** ch 0 for Sync ************************************/
- Mailbox_openParams_init(&openParam);
- openParam.remoteEndpoint = MAILBOX_INST_DSP;
- openParam.cfg.chType = MAILBOX_CHTYPE_MULTI;
- openParam.cfg.chId = MAILBOX_CH_ID_0;
- openParam.cfg.readMode = MAILBOX_MODE_BLOCKING;
- openParam.cfg.writeMode = MAILBOX_MODE_BLOCKING;
- openParam.cfg.writeTimeout = 1000U;
-
- handleArray[0] = Mailbox_open(&openParam, &errCode);
-
- System_printf("MSS: Waiting for sync msg from dss.\n");
-
- /* wait for Sync msg from remote core. */
- Mailbox_read(handleArray[0], (uint8_t*)&syncData, sizeof(syncData));
- Mailbox_readFlush(handleArray[0]);
-
- syncData = 0xFFFFFFFFU;
- /* Send sync data to dss core. */
- Test_mailboxWrite(handleArray[0], (uint8_t*)&syncData, sizeof(syncData));
+ Test_mssWaitSync();
/***************************************************/
-
Task_Params_init(&taskParams);
taskParams.stackSize = 2*1024;
multiChTaskHandle[1] = Task_create(Test_channel1Task, &taskParams, NULL);
for(i=0;i<=MAILBOX_CH_ID_MAX;i++)
{
/* Open the Instance */
- if((i==0) ||(i==1) || (i==3) || (i==4) || (i==7))
+ if((i==1) || (i==3) || (i==4) || (i==7))
{
if (Mailbox_close(handleArray[i]) != 0)
{
diff --git a/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/makefile b/packages/ti/drv/mailbox/examples/mailbox_msg_testapp/makefile
PACKAGE_SRCS_COMMON = .
SRCS_mcu1_0 += main_mss.c
SRCS_c66xdsp_1 += main_dss.c
+SRCS_COMMON += app_sync.c
CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS)