[DSS M2M APP]Added sample application for DSS M2M Driver
authorVivek Dhande <a0132295@ti.com>
Wed, 10 Mar 2021 13:26:23 +0000 (18:56 +0530)
committerAnkur <ankurbaranwal@ti.com>
Thu, 11 Mar 2021 07:17:46 +0000 (01:17 -0600)
Signed-off-by: Vivek Dhande <a0132295@ti.com>
packages/ti/drv/dss/dss_component.mk
packages/ti/drv/dss/examples/dss_m2m_test/dss_m2m_test.c [new file with mode: 0755]
packages/ti/drv/dss/examples/dss_m2m_test/dss_m2m_test_cfg.h [new file with mode: 0755]
packages/ti/drv/dss/examples/dss_m2m_test/main_tirtos.c [new file with mode: 0755]
packages/ti/drv/dss/examples/dss_m2m_test/makefile [new file with mode: 0755]
packages/ti/drv/dss/examples/dss_m2m_test/makefile.mk [new file with mode: 0755]

index aa84533b10a516e54755faad82ff5e56277d2afe..51f8b9cf44312c269b521efecfa91656531bde16 100755 (executable)
@@ -209,6 +209,29 @@ dss_baremetal_display_testapp_SBL_APPIMAGEGEN = yes
 export dss_baremetal_display_testapp_SBL_APPIMAGEGEN
 endif
 
+# DSS display M2M test app
+dss_m2m_testapp_COMP_LIST = dss_m2m_testapp
+dss_m2m_testapp_RELPATH = ti/drv/dss/examples/dss_m2m_test
+dss_m2m_testapp_PATH = $(PDK_DSS_COMP_PATH)/examples/dss_m2m_test
+dss_m2m_testapp_BOARD_DEPENDENCY = yes
+dss_m2m_testapp_CORE_DEPENDENCY = yes
+dss_m2m_testapp_XDC_CONFIGURO = yes
+export dss_m2m_testapp_COMP_LIST
+export dss_m2m_testapp_BOARD_DEPENDENCY
+export dss_m2m_testapp_CORE_DEPENDENCY
+export dss_m2m_testapp_XDC_CONFIGURO
+dss_m2m_testapp_PKG_LIST = dss_m2m_testapp
+dss_m2m_testapp_INCLUDE = $(dss_m2m_testapp_PATH)
+dss_m2m_testapp_BOARDLIST = j721e_evm
+export dss_m2m_testapp_BOARDLIST
+dss_m2m_testapp_$(SOC)_CORELIST = $(drvdss_$(SOC)_CORELIST)
+export dss_m2m_testapp_$(SOC)_CORELIST
+dss_EXAMPLE_LIST += dss_m2m_testapp
+ifeq ($(SOC),$(filter $(SOC), j721e))
+dss_m2m_testapp_SBL_APPIMAGEGEN = yes
+export dss_m2m_testapp_SBL_APPIMAGEGEN
+endif
+
 export dss_LIB_LIST
 export dss_APP_LIB_LIST
 export dss_EXAMPLE_LIST
diff --git a/packages/ti/drv/dss/examples/dss_m2m_test/dss_m2m_test.c b/packages/ti/drv/dss/examples/dss_m2m_test/dss_m2m_test.c
new file mode 100755 (executable)
index 0000000..e77f3b4
--- /dev/null
@@ -0,0 +1,639 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2021
+ *  All rights reserved.
+ *
+ *  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 dss_m2m_test.c
+ *
+ *  \brief DSS sample application that does conversion frames for two instances
+ *         of M2M Driver.
+ *         This sample application demonstrates following:
+ *              - YUV422 -> YUV420 conversion
+ *              - Single channel conversion (through single M2M DRV instance)
+ *                  - controlled through 'APP_DSS_M2M_CH_NUM'
+ *              - Runtime loading of buffers (in this case YUV422)
+ *          Refer to 'dss_m2m_test_cfg' file for more details about
+ *          reconfigurability of this application.
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdio.h>
+#include <string.h>
+#include <dss_m2m_test_cfg.h>
+
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+int32_t Dss_displayM2MTest(void);
+static int32_t App_init(M2MApp_AppObj *appObj);
+static int32_t App_deInit(M2MApp_AppObj *appObj);
+static int32_t App_create(M2MApp_AppObj *appObj);
+static int32_t App_delete(M2MApp_AppObj *appObj);
+static int32_t App_runTest(M2MApp_AppObj *appObj);
+static int32_t App_initParams(M2MApp_AppObj *appObj);
+static int32_t App_allocAndQueueFrames(M2MApp_InstParams *appObj);
+static int32_t App_pipeCbFxn(Fvid2_Handle handle, void *appData);
+
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+M2MApp_AppObj gM2MAppObj;
+uint32_t gTestStopTime, gTestStartTime;
+
+#ifdef __cplusplus
+#pragma DATA_SECTION(".data_buffer")
+#pragma DATA_ALIGN(128)
+#else
+#pragma DATA_SECTION(gOutFrms, ".data_buffer")
+#pragma DATA_ALIGN(gOutFrms, 128)
+#endif  /* #ifdef __cplusplus */
+/* This buffer will be used to store RGB or Y */
+static uint8_t gOutFrms[(APP_DSS_M2M_CH_NUM * APP_DSS_M2M_DSS_PIPE_NUM)][(APP_DSS_M2M_OUT_FRAME_PITCH * APP_DSS_M2M_OUT_FRAME_HEIGHT)] __attribute__(( aligned(128), section(".data_buffer")));
+/* This buffer will be used to store UV */
+static uint8_t gOutUVComp[(APP_DSS_M2M_CH_NUM * APP_DSS_M2M_DSS_PIPE_NUM)][(APP_DSS_M2M_OUT_FRAME_PITCH * APP_DSS_M2M_OUT_FRAME_HEIGHT)] __attribute__(( aligned(128), section(".data_buffer")));
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+int32_t Dss_displayM2MTest(void)
+{
+    int32_t retVal = FVID2_SOK;
+    M2MApp_AppObj *appObj;
+
+    appObj = &gM2MAppObj;
+    /* Initialize application object to '0' and the set only required parameters */
+    Fvid2Utils_memset(appObj, 0U, sizeof(M2MApp_AppObj));
+
+    retVal = App_initParams(appObj);
+    if (FVID2_SOK != retVal)
+    {
+        App_consolePrintf("\nERROR: App_initParams() Failed!!!\n");
+    }
+
+    if (FVID2_SOK == retVal)
+    {
+        retVal += App_init(appObj);
+        if (FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: App_init() Failed!!!\n");
+        }
+    }
+
+    if (FVID2_SOK == retVal)
+    {
+        retVal += App_create(appObj);
+        if (FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: App_create() Failed!!!\n");
+        }
+    }
+
+    if (FVID2_SOK == retVal)
+    {
+        retVal += App_runTest(appObj);
+        if (FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: App_runTest() Failed!!!\n");
+        }
+    }
+
+    if (FVID2_SOK == retVal)
+    {
+        retVal += App_delete(appObj);
+        if (FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: App_delete() Failed!!!\n");
+        }
+    }
+
+    if (FVID2_SOK == retVal)
+    {
+        retVal += App_deInit(appObj);
+        if (FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: App_deInit() Failed!!!\n");
+        }
+    }
+
+
+    return retVal;
+}
+static int32_t App_initParams(M2MApp_AppObj *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+    uint32_t loopCnt, pipeIdx, planeIdx, layerIdx;
+    M2MApp_InstParams *instObj;
+    SemaphoreP_Params semParams;
+    Dss_DispParams *dispParams;
+    CSL_DssWbPipeCfg *wbPipeCfg;
+    Dss_DctrlOverlayParams *ovrParams;
+    Dss_DctrlOverlayLayerParams *layerParams;
+
+    appObj->numInst            = APP_DSS_M2M_CH_NUM;
+    appObj->numFramesToConvert = APP_DSS_M2M_FRAMES_WB;
+    appObj->numFramesWb        = 0U;
+    for (loopCnt = 0U ; loopCnt < appObj->numInst ; loopCnt++)
+    {
+        instObj                     = &appObj->instParams[loopCnt];
+        instObj->instIdx            = loopCnt;
+        instObj->appObj             = appObj;
+        Dss_m2mCreateParamsInit(&instObj->createParams);
+        Fvid2CbParams_init(&instObj->cbParams);
+        instObj->cbParams.cbFxn         = &App_pipeCbFxn;
+        instObj->cbParams.appData       = instObj;
+        instObj->numPipe                = APP_DSS_M2M_DSS_PIPE_NUM;
+        instObj->createParams.numPipe   = APP_DSS_M2M_DSS_PIPE_NUM;
+        instObj->createParams.overlayId = APP_DSS_M2M_DSS_OVERLAY_ID;
+        /* Initialize Display pipeline parameters */
+        for (pipeIdx = 0U ; pipeIdx < APP_DSS_M2M_DSS_PIPE_NUM ; pipeIdx++)
+        {
+            instObj->createParams.pipeId[pipeIdx] = APP_DSS_M2M_DSS_PIPE_ID;
+            instObj->pipeCfg[pipeIdx].pipeId      = APP_DSS_M2M_DSS_PIPE_ID;
+            instObj->mFlagCfg[pipeIdx].pipeId     = APP_DSS_M2M_DSS_PIPE_ID;
+            instObj->cscCfg[pipeIdx].pipeId       = APP_DSS_M2M_DSS_PIPE_ID;
+            dispParams = &instObj->pipeCfg[pipeIdx].cfgParams;
+            Dss_dispParamsInit(dispParams);
+            dispParams->pipeCfg.pipeType = CSL_DSS_VID_PIPE_TYPE_VID;
+            dispParams->pipeCfg.inFmt.width = APP_DSS_M2M_IN_FRAME_WIDTH;
+            dispParams->pipeCfg.inFmt.height = APP_DSS_M2M_IN_FRAME_HEIGHT;
+            for(planeIdx = 0U ; planeIdx < FVID2_MAX_PLANES; planeIdx++)
+            {
+                dispParams->pipeCfg.inFmt.pitch[planeIdx] = APP_DSS_M2M_IN_FRAME_PITCH;
+            }
+            dispParams->pipeCfg.inFmt.dataFormat  = APP_DSS_M2M_IN_FRAME_FORMAT;
+            dispParams->pipeCfg.outWidth          = APP_DSS_M2M_IN_FRAME_WIDTH;
+            dispParams->pipeCfg.outHeight         = APP_DSS_M2M_IN_FRAME_HEIGHT;
+            dispParams->pipeCfg.scEnable          = FALSE;
+            dispParams->alphaCfg.globalAlpha      = 0xFFU;
+            dispParams->alphaCfg.preMultiplyAlpha = FALSE;
+            dispParams->layerPos.startX           = 0U;
+            dispParams->layerPos.startY           = 0U;
+
+            Dss_dispPipeMflagParamsInit(&instObj->mFlagCfg[pipeIdx].mFlagCfg);
+
+            CSL_dssCscCoeffInit(&instObj->cscCfg[pipeIdx].csc);
+        }
+        /* Initialize WB pipeline parameters */
+        Dss_m2mPipeCfgParamsInit(&instObj->wbCfg);
+        wbPipeCfg = &instObj->wbCfg.pipeCfg;
+        /* Dont' need to set dataFormat as this is fixed to 'FVID2_DF_ARGB48_12121212'
+           and is set in 'Dss_m2mPipeCfgParamsInit()' */
+        wbPipeCfg->inFmt.width      = APP_DSS_M2M_IN_FRAME_WIDTH;
+        wbPipeCfg->inFmt.height     = APP_DSS_M2M_IN_FRAME_HEIGHT;
+        wbPipeCfg->outFmt.width     = APP_DSS_M2M_OUT_FRAME_WIDTH;
+        wbPipeCfg->outFmt.height    = APP_DSS_M2M_OUT_FRAME_HEIGHT;
+        wbPipeCfg->outFmt.ccsFormat = FVID2_CCSF_BITS8_PACKED;
+        wbPipeCfg->inPos.startX     = 0U;
+        wbPipeCfg->inPos.startY     = 0U;
+        for(planeIdx = 0U ; planeIdx < FVID2_MAX_PLANES; planeIdx++)
+        {
+            wbPipeCfg->outFmt.pitch[planeIdx] = APP_DSS_M2M_OUT_FRAME_PITCH;
+        }
+        CSL_dssWbPipeDmaCfgInit(&instObj->wbDmaCfg);
+        Dss_m2mMFlagParamsInit(&instObj->wbMflagCfg);
+        CSL_dssCscCoeffInit(&instObj->wbCscCfg);
+        Dss_m2mStatusInit(&instObj->wbStatus);
+
+        /* Initialize Display overlay parameters */
+        ovrParams = &instObj->ovrCfg;
+        Dss_dctrlOverlayParamsInit(ovrParams);
+        ovrParams->overlayId = APP_DSS_M2M_DSS_OVERLAY_ID;
+        ovrParams->overlayCfg.colorKeyEnable = TRUE;
+        ovrParams->overlayCfg.colorKeySel = CSL_DSS_OVERLAY_TRANS_COLOR_DEST;
+        ovrParams->overlayCfg.backGroundColor = 0xc8c800U;
+
+        layerParams = &instObj->layerCfg;
+        Dss_dctrlOverlayLayerParamsInit(layerParams);
+        layerParams->overlayId = APP_DSS_M2M_DSS_OVERLAY_ID;
+        /* Set all layer to invalid first and then update only used ones */
+        for(layerIdx = 0U ; layerIdx < CSL_DSS_VID_PIPE_ID_MAX ; layerIdx++)
+        {
+            layerParams->pipeLayerNum[layerIdx] = CSL_DSS_OVERLAY_LAYER_INVALID;
+        }
+        layerParams->pipeLayerNum[instObj->createParams.pipeId[0U]] =
+                                                    CSL_DSS_OVERLAY_LAYER_NUM_0;
+        if(APP_DSS_M2M_DSS_PIPE_NUM > 1U)
+        {
+            for(layerIdx = 1U ; layerIdx < APP_DSS_M2M_DSS_PIPE_NUM ; layerIdx++)
+            {
+                layerParams->pipeLayerNum[instObj->createParams.pipeId[0U]] = layerIdx;
+            }
+        }
+
+        Dss_dctrlGlobalDssParamsInit(&instObj->globalParams);
+
+        /* Create sync semaphore */
+        /* Allocate instance semaphore */
+        SemaphoreP_Params_init(&semParams);
+        semParams.mode   = SemaphoreP_Mode_BINARY;
+        instObj->syncSem = SemaphoreP_create(0U, &semParams);
+        if (instObj->syncSem == NULL)
+        {
+            retVal = FVID2_EFAIL;
+            App_consolePrintf("\nERROR: Semaphore create failed!!!\n");
+        }
+    }
+
+    return retVal;
+}
+
+void App_consolePrintf(const char *pcString, ...)
+{
+    char printBuffer[APP_PRINT_BUFFER_SIZE];
+    va_list arguments;
+
+    /* Start the var args processing. */
+    va_start(arguments, pcString);
+    vsnprintf (printBuffer, sizeof(printBuffer), pcString, arguments);
+#if !defined (QT_BUILD)
+    UART_printf(printBuffer);
+#else
+    printf(printBuffer);
+#endif
+    /* End the var args processing. */
+    va_end(arguments);
+}
+
+static int32_t App_init(M2MApp_AppObj *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+    Fvid2_InitPrms  initPrms;
+
+    Fvid2InitPrms_init(&initPrms);
+    initPrms.printFxn = &App_consolePrintf;
+    retVal = Fvid2_init(&initPrms);
+    if(retVal != FVID2_SOK)
+    {
+        App_consolePrintf("\nERROR: FVID2 Init Failed!!!\r\n");
+    }
+
+    Dss_initParamsInit(&appObj->initParams);
+    appObj->initParams.socParams.irqParams.dssCommonRegionId                    = CSL_DSS_COMM_REG_ID_1;
+    appObj->initParams.socParams.irqParams.numValidIrq                          = DSS_EVT_MGR_INST_ID_MAX;
+    appObj->initParams.socParams.irqParams.irqNum[DSS_EVT_MGR_INST_ID_FUNC]     = 53U;
+    appObj->initParams.socParams.irqParams.irqNum[DSS_EVT_MGR_INST_ID_SAFETY]   = 55U;
+    appObj->initParams.socParams.irqParams.irqNum[DSS_EVT_MGR_INST_ID_SECURITY] = 57U;
+    appObj->initParams.socParams.dpInitParams.isHpdSupported                    = FALSE;
+    Dss_init(&appObj->initParams);
+
+    if (FVID2_SOK == retVal)
+    {
+        App_consolePrintf("App_init() - DONE !!!\r\n");
+    }
+
+    return retVal;
+}
+
+static int32_t App_deInit(M2MApp_AppObj *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+
+    retVal += Dss_deInit();
+    retVal += Fvid2_deInit(NULL);
+    if(retVal != FVID2_SOK)
+    {
+         App_consolePrintf("\nERROR: App_deInit failed!!!\r\n");
+    }
+    else
+    {
+         App_consolePrintf("App_deInit() - DONE !!!\r\n");
+    }
+
+    return retVal;
+}
+
+static int32_t App_create(M2MApp_AppObj *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+    uint32_t instIdx, pipeIdx;
+    M2MApp_InstParams *instObj;
+
+    /* Create DSS M2M Driver instance */
+    for (instIdx = 0U ; instIdx < appObj->numInst ; instIdx++)
+    {
+        instObj = &appObj->instParams[instIdx];
+        instObj->drvHandle = Fvid2_create(DSS_M2M_DRV_ID,
+                                             APP_DSS_M2M_INST,
+                                             &instObj->createParams,
+                                             &instObj->createStatus,
+                                             &instObj->cbParams);
+        if((NULL == instObj->drvHandle) ||
+           (instObj->createStatus.retVal != FVID2_SOK))
+        {
+            retVal = instObj->createStatus.retVal;
+            App_consolePrintf("\nERROR: Display M2M DRV Create Failed!!!\r\n");
+        }
+        /* Call Driver IOCTLs */
+        if (FVID2_SOK == retVal)
+        {
+            for (pipeIdx = 0U ;
+                 pipeIdx < instObj->createParams.numPipe ;
+                 pipeIdx++)
+            {
+                retVal += Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_M2M_SET_PIPE_PARAMS,
+                            &instObj->pipeCfg[pipeIdx],
+                            NULL);
+                retVal += Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_M2M_SET_PIPE_MFLAG_PARAMS,
+                            &instObj->mFlagCfg[pipeIdx],
+                            NULL);
+                if (FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: Display Pipe IOCTL Failed!!!\r\n");
+                    break;
+                }
+            }
+            if (FVID2_SOK == retVal)
+            {
+                retVal = Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_DCTRL_SET_OVERLAY_PARAMS,
+                            &instObj->ovrCfg,
+                            NULL);
+                if (FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: IOCTL_DSS_DCTRL_SET_OVERLAY_PARAMS Failed!!!\r\n");
+                }
+            }
+            if (FVID2_SOK == retVal)
+            {
+                retVal = Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_DCTRL_SET_LAYER_PARAMS,
+                            &instObj->layerCfg,
+                            NULL);
+                if (FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: IOCTL_DSS_DCTRL_SET_LAYER_PARAMS Failed!!!\r\n");
+                }
+            }
+            if (FVID2_SOK == retVal)
+            {
+                retVal = Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_DCTRL_SET_GLOBAL_DSS_PARAMS,
+                            &instObj->globalParams,
+                            NULL);
+                if (FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: IOCTL_DSS_DCTRL_SET_GLOBAL_DSS_PARAMS Failed!!!\r\n");
+                }
+            }
+            if (FVID2_SOK == retVal)
+            {
+                retVal = Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_M2M_SET_WB_PIPE_PARAMS,
+                            &instObj->wbCfg,
+                            NULL);
+                if (FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: IOCTL_DSS_M2M_SET_WB_PIPE_PARAMS Failed!!!\r\n");
+                }
+            }
+            if (FVID2_SOK == retVal)
+            {
+                retVal = Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_M2M_SET_WB_PIPE_MFLAG_PARAMS,
+                            &instObj->wbMflagCfg,
+                            NULL);
+                if (FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: IOCTL_DSS_M2M_SET_WB_PIPE_MFLAG_PARAMS Failed!!!\r\n");
+                }
+            }
+            if (FVID2_SOK == retVal)
+            {
+                retVal = Fvid2_control(
+                            instObj->drvHandle,
+                            IOCTL_DSS_M2M_SET_WB_PIPE_DMA_CFG,
+                            &instObj->wbDmaCfg,
+                            NULL);
+                if (FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: IOCTL_DSS_M2M_SET_WB_PIPE_DMA_CFG Failed!!!\r\n");
+                }
+            }
+        }
+    }
+
+    return retVal;
+}
+
+static int32_t App_delete(M2MApp_AppObj *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+    uint32_t instIdx;
+    Fvid2_FrameList inFrmList, outFrmList;
+    M2MApp_InstParams *instObj;
+
+    for (instIdx = 0U ; instIdx < appObj->numInst ; instIdx++)
+    {
+        instObj = &appObj->instParams[instIdx];
+        /* Dequeue all the request from the driver */
+        while (1U)
+        {
+            retVal = Fvid2_getProcessedRequest(instObj->drvHandle,
+                                               &inFrmList,
+                                               &outFrmList,
+                                               FVID2_TIMEOUT_NONE);
+            if(FVID2_SOK != retVal)
+            {
+                App_consolePrintf("\nERROR: Fvid2_getProcessedRequest Failed!!!\r\n");
+                break;
+            }
+        }
+
+        retVal = FVID2_SOK;
+
+        retVal = Fvid2_delete(instObj->drvHandle, NULL);
+        if(FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: M2M Driver Delete Failed!!!\r\n");
+            break;
+        }
+    }
+
+    return retVal;
+}
+
+static int32_t App_runTest(M2MApp_AppObj *appObj)
+{
+    int32_t retVal = FVID2_SOK;
+    uint32_t instIdx;
+    M2MApp_InstParams *instObj;
+    Fvid2_FrameList inFrmList, outFrmList;
+
+    for (instIdx = 0U ; instIdx < appObj->numInst ; instIdx++)
+    {
+        instObj = &appObj->instParams[instIdx];
+        /* Start the driver before queuing */
+        retVal = Fvid2_start(instObj->drvHandle, NULL);
+        if (FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: Fvid2_start Failed!!!\r\n");
+            break;
+        }
+
+        /* Allocate and submit frames for processing */
+        App_allocAndQueueFrames(instObj);
+    }
+
+    if (FVID2_SOK == retVal)
+    {
+        while (appObj->numFramesWb < appObj->numFramesToConvert)
+        {
+            for (instIdx = 0U ; instIdx < appObj->numInst ; instIdx++)
+            {
+                instObj = &appObj->instParams[instIdx];
+                /* Wait for Semaphore */
+                (void) SemaphoreP_post(instObj->syncSem);
+                /* Get processed frames */
+                retVal = Fvid2_processRequest(instObj->drvHandle,
+                                              &inFrmList,
+                                              &outFrmList,
+                                              FVID2_TIMEOUT_NONE);
+                if(FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: Fvid2_processRequest Failed!!!\r\n");
+                    break;
+                }
+                /* Submit back frames for processing */
+                retVal = Fvid2_processRequest(instObj->drvHandle,
+                                              &inFrmList,
+                                              &outFrmList,
+                                              FVID2_TIMEOUT_NONE);
+                if(FVID2_SOK != retVal)
+                {
+                    App_consolePrintf("\nERROR: Fvid2_processRequest Failed!!!\r\n");
+                    break;
+                }
+            }
+        }
+    }
+
+
+    for (instIdx = 0U ; instIdx < appObj->numInst ; instIdx++)
+    {
+        instObj = &appObj->instParams[instIdx];
+        /* Stop the driver before queuing */
+        retVal = Fvid2_stop(instObj->drvHandle, NULL);
+        if (FVID2_SOK != retVal)
+        {
+            App_consolePrintf("\nERROR: Fvid2_stop Failed!!!\r\n");
+            break;
+        }
+    }
+
+    return retVal;
+}
+
+static int32_t App_allocAndQueueFrames(M2MApp_InstParams *instObj)
+{
+    int32_t  retVal = FVID2_SOK;
+    uint32_t pipeIdx;
+    Fvid2_Frame *frm;
+    Fvid2_FrameList inFrmList, outFrmList;
+    char uartInput = '0';
+
+    App_consolePrintf("Load Image using loadRaw command and then press '1'\n");
+    App_consolePrintf("Command is:\n");
+    App_consolePrintf("loadRaw(0x%x, 0, \"C:\\\\display_yuyv422_prog_packed_1920_1080.tigf\", 32, false);\n",
+              APP_DSS_M2M_DDR_LOAD_ADDRESS);
+    do
+    {
+        scanf("%c", &uartInput);
+    } while ('1' != uartInput);
+
+    Fvid2FrameList_init(&inFrmList);
+    for (pipeIdx = 0U ; pipeIdx < instObj->numPipe ; pipeIdx++)
+    {
+        frm = inFrmList.frames[pipeIdx];
+        /* init Fvid2_Frame to 0's  */
+        Fvid2Frame_init(frm);
+        frm->chNum = instObj->createParams.pipeId[pipeIdx];
+        frm->addr[0U] = (uint64_t)(APP_DSS_M2M_DDR_LOAD_ADDRESS +
+               (pipeIdx * APP_DSS_M2M_IN_FRAME_PITCH * APP_DSS_M2M_IN_FRAME_HEIGHT));
+    }
+    inFrmList.numFrames = instObj->numPipe;
+    outFrmList.numFrames = 1U;
+    frm = outFrmList.frames[0U];
+    /* init Fvid2_Frame to 0's  */
+    Fvid2Frame_init(frm);
+    frm->addr[0U] = (uint64_t)&(gOutFrms[(instObj->instIdx * APP_DSS_M2M_CH_NUM)][0U]);
+    frm->addr[1U] = (uint64_t)&(gOutUVComp[(instObj->instIdx * APP_DSS_M2M_CH_NUM)][0U]);
+    retVal = Fvid2_processRequest(instObj->drvHandle,
+                                  &inFrmList,
+                                  &outFrmList,
+                                  FVID2_TIMEOUT_NONE);
+    if(FVID2_SOK != retVal)
+    {
+        App_consolePrintf("\nERROR: Fvid2_processRequest Failed!!!\r\n");
+    }
+
+    return retVal;
+}
+
+static int32_t App_pipeCbFxn(Fvid2_Handle handle, void *appData)
+{
+    int32_t retVal = FVID2_SOK;
+    M2MApp_InstParams *instObj;
+
+    GT_assert(DssTrace, (appData != NULL));
+
+    instObj = (M2MApp_InstParams *)appData;
+    instObj->appObj->numFramesWb++;
+    /* Post semaphore */
+    (void) SemaphoreP_post(instObj->syncSem);
+
+    return retVal;
+}
diff --git a/packages/ti/drv/dss/examples/dss_m2m_test/dss_m2m_test_cfg.h b/packages/ti/drv/dss/examples/dss_m2m_test/dss_m2m_test_cfg.h
new file mode 100755 (executable)
index 0000000..dbd2806
--- /dev/null
@@ -0,0 +1,229 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2021
+ *  All rights reserved.
+ *
+ *  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 dss_m2m_test_cfg.h
+ *
+ *  \brief DSS Display M2M Test Configuration Header file.
+ */
+
+#ifndef DSS_DISPLAY_TEST_CFG_H_
+#define DSS_DISPLAY_TEST_CFG_H_
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+#include <stdio.h>
+/* XDCtools Header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/System.h>
+/* BIOS Header files */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/board/board.h>
+#include <ti/drv/dss/examples/utils/app_utils.h>
+#include <ti/drv/sciclient/sciclient.h>
+#include <ti/csl/soc.h>
+#include <ti/drv/pm/pmlib.h>
+#include <ti/drv/uart/UART.h>
+#include <ti/drv/uart/UART_stdio.h>
+#include <ti/drv/dss/examples/utils/app_utils_prf.h>
+
+#include <ti/drv/dss/dss.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+/**< Application name */
+#define APP_NAME                        "DSS_M2M_APP"
+
+/**< Driver instance to use */
+#define APP_DSS_M2M_INST                ((uint32_t)DSS_M2M_WB_PIPELINE_ID_0)
+
+/**< Number of channels i.e number of driver instances to be opened */
+#define APP_DSS_M2M_CH_NUM                           ((uint32_t)1U)
+
+/**< Number of display pipelines to use */
+#define APP_DSS_M2M_DSS_PIPE_NUM                     ((uint32_t)1U)
+
+/**< ID of display pipeline to use */
+#define APP_DSS_M2M_DSS_PIPE_ID                      (CSL_DSS_VID_PIPE_ID_VID1)
+
+/**< ID of display overlay to use */
+#define APP_DSS_M2M_DSS_OVERLAY_ID                   (CSL_DSS_OVERLAY_ID_1)
+
+/**< Number of frames to convert */
+#define APP_DSS_M2M_FRAMES_WB                      ((uint32_t)1000U)
+
+/**< Buffer load address for runtime loading buffers */
+#define APP_DSS_M2M_DDR_LOAD_ADDRESS               (0x82000000U)
+
+/**< Input Frame Attribute: Format */
+#define APP_DSS_M2M_IN_FRAME_FORMAT                     (FVID2_DF_YUV422I_YUYV)
+/**< Input Frame Attribute: Width in pixels */
+#define APP_DSS_M2M_IN_FRAME_WIDTH                      ((uint32_t)1920U)
+/**< Input Frame Attribute: Height in pixels */
+#define APP_DSS_M2M_IN_FRAME_HEIGHT                     ((uint32_t)1080U)
+/**< Input Frame Attribute: Bytes per pixel */
+#define APP_DSS_M2M_IN_FRAME_BPP                        ((uint32_t)2U)
+/**< Input Frame Attribute: Pitch in bytes */
+#define APP_DSS_M2M_IN_FRAME_PITCH                      ((uint32_t)\
+                            (APP_DSS_M2M_IN_FRAME_WIDTH * APP_DSS_M2M_IN_FRAME_BPP))
+
+/**< Output Frame Attribute: Format */
+#define APP_DSS_M2M_OUT_FRAME_FORMAT                     (FVID2_DF_YUV420SP_UV)
+/**< Output Frame Attribute: Width in pixels */
+#define APP_DSS_M2M_OUT_FRAME_WIDTH                      ((uint32_t)1920U)
+/**< Output Frame Attribute: Height in pixels */
+#define APP_DSS_M2M_OUT_FRAME_HEIGHT                     ((uint32_t)1080U)
+/**< Output Frame Attribute: Bytes per pixel */
+#define APP_DSS_M2M_OUT_FRAME_BPP                        ((uint32_t)1U)
+/**< Output Frame Attribute: Pitch in bytes */
+#define APP_DSS_M2M_OUT_FRAME_PITCH                      ((uint32_t)\
+                            (APP_DSS_M2M_OUT_FRAME_WIDTH * APP_DSS_M2M_OUT_FRAME_BPP))
+
+/* Print buffer character limit for prints- UART or CCS Console */
+#define APP_PRINT_BUFFER_SIZE                   ((uint32_t)4000)
+
+/** \brief Log enable for DSS M2M Sample application */
+#define DssM2MAppTrace                       ((uint32_t) GT_INFO   |\
+                                              (uint32_t) GT_TraceState_Enable)
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+typedef struct M2MApp_AppObj_t M2MApp_AppObj;
+
+/**
+ *  \brief Display application test parameters.
+ *  The test case execution happens based on values of this structure
+ */
+typedef struct
+{
+    uint32_t instIdx;
+    /**< Instance index in application object */
+    Fvid2_Handle drvHandle;
+    /**< FVID2 display driver handle */
+    uint32_t numPipe;
+    /**< Number of Display pipe used */
+    Dss_WbCreateParams createParams;
+    /**< WB pipe create parameters */
+    Dss_WbCreateStatus createStatus;
+    /**< WB pipe create status */
+    Fvid2_CbParams cbParams;
+    /**< Callback parameters */
+    Dss_WbStatus wbStatus;
+    /**< WB pipe status */
+    SemaphoreP_Handle syncSem;
+    /**< Semaphore for ISR */
+    Dss_WbPipeCfgParams wbCfg;
+    /**< WB pipe configuration */
+    CSL_DssWbPipeDmaCfg wbDmaCfg;
+    /**< WB pipe DMA configuration */
+    Dss_WbPipeMflagParams wbMflagCfg;
+    /**< WB pipe MFlag configuration */
+    CSL_DssCscCoeff wbCscCfg;
+    /**< WB pipe CSC configuration */
+    Dss_PipeCfgParams pipeCfg[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
+    /**< Display pipe configuration */
+    Dss_PipeMflagParams mFlagCfg[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
+    /**< Display pipe MFlag configuration */
+    Dss_PipeCscParams cscCfg[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
+    /**< Display pipe CSC configuration */
+    Dss_DctrlOverlayParams ovrCfg;
+    /**< Display Overlay configuration */
+    Dss_DctrlOverlayLayerParams layerCfg;
+    /**< Display Layer configuration */
+    Dss_DctrlGlobalDssParams globalParams;
+    /**< Display Global configuration */
+   M2MApp_AppObj *appObj;
+   /**< Reference to Application Object  */
+} M2MApp_InstParams;
+
+/**
+ *  \brief Display application object.
+ *  The test case execution happens based on values of this structure
+ */
+struct M2MApp_AppObj_t
+{
+    uint32_t numInst;
+    /**< Number of driver instances to open */
+    M2MApp_InstParams instParams[APP_DSS_M2M_CH_NUM];
+    /**< Instance object */
+    Dss_InitParams initParams;
+    /**< DSS Initialization Parameters */
+    uint32_t numFramesToConvert;
+    /**< Number of frames to convert for a given configuration */
+    volatile uint32_t numFramesWb;
+   /**< Number of frames wrote-back */
+};
+/* ========================================================================== */
+/*                  Internal/Private Function Declarations                   */
+/* ========================================================================== */
+
+
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+void App_consolePrintf(const char *pcString, ...);
+
+/* ========================================================================== */
+/*                              Global Variables                              */
+/* ========================================================================== */
+
+
+/* ========================================================================== */
+/*      Internal Function Declarations (Needed for other static inlines)      */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                       Static Function Definitions                          */
+/* ========================================================================== */
+
+/* None */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* #ifndef DSS_DISPLAY_TEST_CFG_H_ */
+
+/* @} */
diff --git a/packages/ti/drv/dss/examples/dss_m2m_test/main_tirtos.c b/packages/ti/drv/dss/examples/dss_m2m_test/main_tirtos.c
new file mode 100755 (executable)
index 0000000..67059f1
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ *  Copyright (c) Texas Instruments Incorporated 2021
+ *  All rights reserved.
+ *
+ *  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 main_tirtos.c
+ *
+ *  \brief Main file for TI-RTOS build
+ */
+
+/* ========================================================================== */
+/*                             Include Files                                  */
+/* ========================================================================== */
+
+#include <stdio.h>
+/* XDCtools Header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/System.h>
+/* BIOS Header files */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/board/board.h>
+#include <ti/drv/dss/examples/utils/app_utils.h>
+#include <ti/drv/sciclient/sciclient.h>
+#include <ti/csl/soc.h>
+#include <ti/drv/pm/pmlib.h>
+#include "dss_m2m_test_cfg.h"
+
+/* ========================================================================== */
+/*                           Macros & Typedefs                                */
+/* ========================================================================== */
+
+/* Test application stack size */
+#define DISP_APP_TSK_STACK_MAIN         (10U * 1024U)
+
+/* ========================================================================== */
+/*                         Structure Declarations                             */
+/* ========================================================================== */
+
+/* None */
+
+/* ========================================================================== */
+/*                          Function Declarations                             */
+/* ========================================================================== */
+
+static Void taskFxn(UArg a0, UArg a1);
+extern int32_t Dss_displayM2MTest(void);
+static void App_clkRateSet(uint32_t moduleId,
+                           uint32_t clkId,
+                           uint64_t clkRateHz);
+/* ========================================================================== */
+/*                            Global Variables                                */
+/* ========================================================================== */
+
+/* Test application stack */
+static uint8_t gDispAppTskStackMain[DISP_APP_TSK_STACK_MAIN];
+
+/* ========================================================================== */
+/*                          Function Definitions                              */
+/* ========================================================================== */
+
+int main(void)
+{
+    Task_Handle task;
+    Error_Block eb;
+    Task_Params taskParams;
+
+    Error_init(&eb);
+
+    /* Initialize the task params */
+    Task_Params_init(&taskParams);
+    /* Set the task priority higher than the default priority (1) */
+    taskParams.priority = 2;
+    taskParams.stack = gDispAppTskStackMain;
+    taskParams.stackSize = sizeof(gDispAppTskStackMain);
+
+    task = Task_create(taskFxn, &taskParams, &eb);
+    if(NULL == task)
+    {
+        BIOS_exit(0);
+    }
+    BIOS_start();    /* does not return */
+
+    return(0);
+}
+
+static Void taskFxn(UArg a0, UArg a1)
+{
+    int32_t retVal = CSL_PASS;
+    uint64_t clkFreq = 0U;
+    Board_initCfg boardCfg;
+
+    boardCfg = BOARD_INIT_PINMUX_CONFIG |
+                BOARD_INIT_UNLOCK_MMR |
+                BOARD_INIT_UART_STDIO;
+    Board_init(boardCfg);
+
+    Sciclient_init(NULL);
+    retVal += Sciclient_pmSetModuleState(TISCI_DEV_DSS0,
+                                   TISCI_MSG_VALUE_DEVICE_SW_STATE_ON,
+                                   TISCI_MSG_FLAG_AOP,
+                                   SCICLIENT_SERVICE_WAIT_FOREVER);
+    retVal += Sciclient_pmSetModuleState(TISCI_DEV_DSS_DSI0,
+                                   TISCI_MSG_VALUE_DEVICE_SW_STATE_ON,
+                                   TISCI_MSG_FLAG_AOP,
+                                   SCICLIENT_SERVICE_WAIT_FOREVER);
+    retVal += Sciclient_pmSetModuleState(TISCI_DEV_DSS_EDP0,
+                                   TISCI_MSG_VALUE_DEVICE_SW_STATE_ON,
+                                   TISCI_MSG_FLAG_AOP,
+                                   SCICLIENT_SERVICE_WAIT_FOREVER);
+
+    /* set DSS VP4 clocks */
+    App_clkRateSet(TISCI_DEV_DSS0,
+                   TISCI_DEV_DSS0_DSS_INST0_DPI_3_IN_2X_CLK,
+                   148500000U);
+    /* Get the DSS VP4 clock frequencies */
+    retVal += PMLIBClkRateGet(TISCI_DEV_DSS0,
+                              TISCI_DEV_DSS0_DSS_INST0_DPI_0_IN_2X_CLK,
+                              &clkFreq);
+    App_consolePrintf("\n TISCI_DEV_DSS0_DSS_INST0_DPI_0_IN_2X_CLK = %lld Hz\n", clkFreq);
+    retVal += PMLIBClkRateGet(TISCI_DEV_DSS0,
+                              TISCI_DEV_DSS0_DSS_INST0_DPI_1_IN_2X_CLK,
+                              &clkFreq);
+    App_consolePrintf("\n TISCI_DEV_DSS0_DSS_INST0_DPI_1_IN_2X_CLK = %lld Hz\n", clkFreq);
+    retVal += PMLIBClkRateGet(TISCI_DEV_DSS0,
+                              TISCI_DEV_DSS0_DSS_INST0_DPI_2_IN_2X_CLK,
+                              &clkFreq);
+    App_consolePrintf("\n TISCI_DEV_DSS0_DSS_INST0_DPI_2_IN_2X_CLK = %lld Hz\n", clkFreq);
+    retVal += PMLIBClkRateGet(TISCI_DEV_DSS0,
+                              TISCI_DEV_DSS0_DSS_INST0_DPI_3_IN_2X_CLK,
+                              &clkFreq);
+    App_consolePrintf("\n TISCI_DEV_DSS0_DSS_INST0_DPI_3_IN_2X_CLK = %lld Hz\n", clkFreq);
+    if (retVal == CSL_PASS)
+    {
+        Dss_displayM2MTest();
+    }
+
+    return;
+}
+
+
+void App_wait(uint32_t wait_in_ms)
+{
+    Task_sleep(wait_in_ms);
+}
+
+static void App_clkRateSet(uint32_t moduleId,
+                           uint32_t clkId,
+                           uint64_t clkRateHz)
+{
+    int32_t status;
+    uint64_t currClkFreqHz;
+
+    status = PMLIBClkRateGet(moduleId, clkId, &currClkFreqHz);
+    if ((status == CSL_PASS) &&
+        (currClkFreqHz != clkRateHz))
+    {
+        status = PMLIBClkRateSet(moduleId, clkId, clkRateHz);
+        if (status == CSL_PASS)
+        {
+            App_consolePrintf("\nPMLIBClkRateSet Passed for clock Id = %d\n", clkId);
+        }
+        else
+        {
+            App_consolePrintf("\nPMLIBClkRateSet failed for clock Id = %d\n", clkId);
+        }
+    }
+}
diff --git a/packages/ti/drv/dss/examples/dss_m2m_test/makefile b/packages/ti/drv/dss/examples/dss_m2m_test/makefile
new file mode 100755 (executable)
index 0000000..9789549
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# This file is the makefile for building DSS display test app for TI RTOS
+#
+ifeq ($(RULES_MAKE), )
+include $(PDK_INSTALL_PATH)/ti/build/Rules.make
+else
+include $(RULES_MAKE)
+endif
+
+APP_NAME = dss_m2m_testapp
+
+include makefile.mk
diff --git a/packages/ti/drv/dss/examples/dss_m2m_test/makefile.mk b/packages/ti/drv/dss/examples/dss_m2m_test/makefile.mk
new file mode 100755 (executable)
index 0000000..91d6ffe
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# This file is the makefile for building DSS display test app for both TI RTOS
+# and baremetal
+#
+
+SRCDIR = .
+INCDIR = .
+
+# List all the external components/interfaces, whose interface header files
+#  need to be included for this component
+INCLUDE_EXTERNAL_INTERFACES = pdk
+
+  INCLUDE_EXTERNAL_INTERFACES += xdc bios
+  COMP_LIST_COMMON = $(PDK_COMMON_TIRTOS_COMP) 
+  COMP_LIST_COMMON += dss_app_utils_sysbios
+  SRCS_COMMON = main_tirtos.c
+  # Enable XDC build for application by providing XDC CFG File per core
+  XDC_CFG_FILE_$(CORE) = $(PDK_INSTALL_PATH)/ti/build/$(SOC)/sysbios_$(ISA).cfg
+  XDC_CFG_UPDATE_$(CORE) = dss_display_test_prf.cfg
+
+# List all the specific components required by the application
+COMP_LIST_COMMON += fvid2 dss
+
+# Common source files and CFLAGS across all platforms and cores
+PACKAGE_SRCS_COMMON = .
+SRCS_COMMON += dss_m2m_test.c
+CFLAGS_LOCAL_COMMON += $(PDK_CFLAGS) $(DSS_CFLAGS)
+
+# Core/SoC/platform specific source files and CFLAGS
+# Example:
+#   SRCS_<core/SoC/platform-name> =
+#   CFLAGS_LOCAL_<core/SoC/platform-name> =
+
+# Include common make files
+ifeq ($(MAKERULEDIR), )
+#Makerule path not defined, define this and assume relative path from ROOTDIR
+  MAKERULEDIR := $(ROOTDIR)/ti/build/makerules
+  export MAKERULEDIR
+endif
+include $(MAKERULEDIR)/common.mk
+
+# OBJs and libraries are built by using rule defined in rules_<target>.mk
+#     and need not be explicitly specified here
+
+# Nothing beyond this point