[PDK-9595] UDMA UT: Added new testcase for Udma_eventEnable/Udma_eventDisable
authorDon Dominic <a0486429@ti.com>
Wed, 7 Apr 2021 10:48:44 +0000 (16:18 +0530)
committerAnkur <ankurbaranwal@ti.com>
Thu, 8 Apr 2021 06:23:33 +0000 (01:23 -0500)
- The test checks the event disable and enable for all UDMA instances.

Signed-off-by: Don Dominic <a0486429@ti.com>
packages/ti/drv/udma/unit_test/udma_ut/src/udma_test.h
packages/ti/drv/udma/unit_test/udma_ut/src/udma_test_event.c
packages/ti/drv/udma/unit_test/udma_ut/src/udma_testcases.h

index ed34518ae1990224bcf481930864da4b8a4999b9..d53f3e3827c7cc4d2cf8351669355639f20bff7b 100755 (executable)
@@ -663,6 +663,7 @@ int32_t udmaTestFlowAllocTc(UdmaTestTaskObj *taskObj);
  * UDMA event test functions
  */
 int32_t udmaTestEventOutOfRangeFlow(UdmaTestTaskObj *taskObj);
+int32_t udmaTestEventDisableEnableSanity(UdmaTestTaskObj *taskObj);
 /*
  * UDMA misc test functions
  */
index 588c4747dc71a8efcc1754c0e7406af1b818eb26..d7e2578ff492299081ec46aad236ee639948b30e 100644 (file)
 
 static int32_t udmaTestEventOutOfRangeFlowLoop(UdmaTestTaskObj *taskObj,
                                                uint32_t loopCnt);
+static int32_t udmaTestEventDisableEnableSanityLoop(UdmaTestTaskObj *taskObj,
+                                                    uint32_t loopCnt);
+static int32_t udmaTestEventDisableEnableFxns(UdmaTestTaskObj *taskObj,
+                                              Udma_EventHandle eventHandle);
 static void udmaTestEventCb(Udma_EventHandle eventHandle,
                             uint32_t eventType,
                             void *appData);
@@ -104,6 +108,33 @@ int32_t udmaTestEventOutOfRangeFlow(UdmaTestTaskObj *taskObj)
     return (retVal);
 }
 
+int32_t udmaTestEventDisableEnableSanity(UdmaTestTaskObj *taskObj)
+{
+    int32_t     retVal = UDMA_SOK;
+    uint32_t    loopCnt = 0U;
+
+    GT_1trace(taskObj->traceMask, GT_INFO1,
+              " |TEST INFO|:: Task:%d: Event Disable and Enable Sanity check Testcase ::\r\n", taskObj->taskId);
+    GT_2trace(taskObj->traceMask, GT_INFO1,
+              " |TEST INFO|:: Task:%d: Loop count           : %d ::\r\n", taskObj->taskId, taskObj->loopCnt);
+
+    gUdmaTestEventResult = UDMA_SOK;
+    while(loopCnt < taskObj->loopCnt)
+    {
+        retVal = udmaTestEventDisableEnableSanityLoop(taskObj, loopCnt);
+        if(UDMA_SOK != retVal)
+        {
+            break;
+        }
+
+        loopCnt++;
+    }
+
+    retVal += gUdmaTestEventResult;
+
+    return (retVal);
+}
+
 static int32_t udmaTestEventOutOfRangeFlowLoop(UdmaTestTaskObj *taskObj,
                                                uint32_t loopCnt)
 {
@@ -182,6 +213,116 @@ static int32_t udmaTestEventOutOfRangeFlowLoop(UdmaTestTaskObj *taskObj,
     return (retVal);
 }
 
+static int32_t udmaTestEventDisableEnableSanityLoop(UdmaTestTaskObj *taskObj,
+                                                    uint32_t loopCnt)
+{
+    int32_t                     retVal = UDMA_SOK;
+    uint32_t                    instId;
+    Udma_DrvHandle              drvHandle;
+    Udma_EventPrms              eventPrms;
+    struct Udma_EventObj        eventObj;
+    Udma_EventHandle            eventHandle = NULL;
+    char                       *instanceIdStr[] = {"MAIN", "MCU", "BCDMA", "PKTDMA"};
+
+    for(instId = UDMA_INST_ID_START; instId <= UDMA_INST_ID_MAX; instId++)
+    {
+        if(0U == loopCnt)
+        {
+            GT_1trace(taskObj->traceMask, GT_INFO1,
+                      " Testing for NAVSS Inst: %s ...\r\n", instanceIdStr[instId]);
+        }
+
+        drvHandle = &taskObj->testObj->drvObj[instId];
+
+        eventHandle = &eventObj;
+
+        /* Exclusive Event Enable/Disable Test */
+        UdmaEventPrms_init(&eventPrms);
+        eventPrms.eventType         = UDMA_EVENT_TYPE_ERR_OUT_OF_RANGE_FLOW;
+        eventPrms.eventMode         = UDMA_EVENT_MODE_EXCLUSIVE;
+        eventPrms.masterEventHandle = NULL;
+        eventPrms.eventCb           = &udmaTestEventCb;
+        retVal = Udma_eventRegister(drvHandle, eventHandle, &eventPrms);
+        if(UDMA_SOK != retVal)
+        {
+            GT_0trace(taskObj->traceMask, GT_ERR,
+                " UDMA exclusive event register failed!!\n");
+        }
+        
+        retVal += udmaTestEventDisableEnableFxns(taskObj, eventHandle);
+        if(UDMA_SOK == retVal)
+        {
+            GT_0trace(taskObj->traceMask, GT_ERR, " Exclusive Event Disable/Enable passed!!\n");
+        }
+
+        retVal += Udma_eventUnRegister(eventHandle);
+        if(UDMA_SOK != retVal)
+        {
+            GT_0trace(taskObj->traceMask, GT_ERR, " Exclusive Event unregister failed!!\n");
+        }
+
+        /* Shared Event Enable/Disable Test */
+        UdmaEventPrms_init(&eventPrms);
+        eventPrms.eventType         = UDMA_EVENT_TYPE_ERR_OUT_OF_RANGE_FLOW;
+        eventPrms.eventMode         = UDMA_EVENT_MODE_SHARED;
+        eventPrms.masterEventHandle = Udma_eventGetGlobalHandle(drvHandle);
+        eventPrms.eventCb           = &udmaTestEventCb;
+        retVal += Udma_eventRegister(drvHandle, eventHandle, &eventPrms);
+        if(UDMA_SOK != retVal)
+        {
+            GT_0trace(taskObj->traceMask, GT_ERR,
+                " UDMA shared event register failed!!\n");
+        }
+
+        retVal += udmaTestEventDisableEnableFxns(taskObj, eventHandle);
+        if(UDMA_SOK == retVal)
+        {
+            GT_0trace(taskObj->traceMask, GT_ERR, " Shared Event Disable/Enable passed!!\n");
+        }
+
+        retVal += Udma_eventUnRegister(eventHandle);
+        if(UDMA_SOK != retVal)
+        {
+            GT_0trace(taskObj->traceMask, GT_ERR, " Shared Event unregister failed!!\n");
+        }
+        
+
+        if(0U == loopCnt)
+        {
+            GT_1trace(taskObj->traceMask, GT_INFO1,
+                      " Testing for NAVSS Inst: %s passed!!\r\n", instanceIdStr[instId]);
+        }
+    }
+
+    return (retVal);
+}
+
+static int32_t udmaTestEventDisableEnableFxns(UdmaTestTaskObj *taskObj,
+                                              Udma_EventHandle eventHandle)
+{
+    int32_t                     retVal = UDMA_SOK;
+
+    /* Note: This sanity just checks event disable and enable API's.
+     * This test doesn't wait for the event to happen.
+     */
+
+    /* Just check API sanity */
+    retVal = Udma_eventDisable(eventHandle);
+    if(UDMA_SOK != retVal)
+    {
+        GT_0trace(taskObj->traceMask, GT_ERR,
+            " UDMA event disable failed!!\n");
+    }
+    retVal += Udma_eventEnable(eventHandle);
+    if(UDMA_SOK != retVal)
+    {
+        GT_0trace(taskObj->traceMask, GT_ERR,
+            " UDMA event enable failed!!\n");
+    }
+
+    return (retVal);
+}
+
 static void udmaTestEventCb(Udma_EventHandle eventHandle,
                             uint32_t eventType,
                             void *appData)
index 4dd2ebb60ea47f6f06fa81700607f9f9ebfa7c0e..65ab3b6d02b5fab90a9f2169c2f0d77a4c65f388 100755 (executable)
@@ -2550,6 +2550,44 @@ static UdmaTestParams gUdmaTestCases[] =
         .runFlag    = (UDMA_TEST_RF_SOC_ALL | UDMA_TEST_RF_CORE_ALL | UDMA_TEST_RF_CFG_DEF),
         .ringPrmId  = UDMA_TEST_RING_PRMID_INVALID,
     },
+    {
+        .enableTest = TEST_ENABLE,
+        .tcId       = 9595U,
+        .tcName     = "Event Disable and Enable Sanity Check Testcase",
+        .disableInfo= NULL,
+        .printEnable= PRINT_ENABLE,
+        .prfEnable  = PRF_DISABLE,
+        .tcType     = (UDMA_TCT_SANITY | UDMA_TCT_FUNCTIONAL),
+        .dcEnable   = DATA_CHECK_ENABLE,
+        .loopCnt    = 1U,
+        .numTasks   = 1U,
+        .testType   = {UDMA_TT_MISC},
+        .testFxnPtr = {&udmaTestEventDisableEnableSanity},
+        /* All other below parameters not used in this testcase */
+        .pacingTime = {PACING_NONE},
+        .numCh      = {1U},
+        .instId     = {UDMA_TEST_DEFAULT_UDMA_INST},
+        .chPrmId    = {UDMA_TEST_CH_PRMID_DEF},
+        .qdepth     = {USE_DEF_QDEPTH},
+        .icnt       = {
+                        {UDMA_TEST_DEF_ICNT0, 1U, 1U, 1U}
+                      },
+        .dicnt      = {
+                        {UDMA_TEST_DEF_DICNT0, 1U, 1U, 1U}
+                      },
+        .dim        = {
+                        {0U, 0U, 0U}
+                      },
+        .ddim       = {
+                        {0U, 0U, 0U}
+                      },
+        .heapIdSrc  = {DEF_HEAP_ID},
+        .heapIdDest = {DEF_HEAP_ID},
+        .srcBufSize = {UDMA_TEST_DEF_ICNT0},
+        .destBufSize= {UDMA_TEST_DEF_DICNT0},
+        .runFlag    = (UDMA_TEST_RF_SOC_ALL | UDMA_TEST_RF_CORE_ALL | UDMA_TEST_RF_CFG_DEF | UDMA_TEST_RF_CFG_DYN),
+        .ringPrmId  = UDMA_TEST_RING_PRMID_EVENT_NONE,
+    },
 #if (UDMA_SOC_CFG_RA_NORMAL_PRESENT == 1)
     {
         .enableTest = TEST_ENABLE,