PRSDK-415 Address review comments.
authorSinthu Raja M <x0257345@ti.com>
Thu, 22 Feb 2018 11:57:37 +0000 (17:27 +0530)
committerPratap Reddy <x0257344@ti.com>
Thu, 22 Feb 2018 12:11:20 +0000 (17:41 +0530)
 - Removed global variable which is used to get PaRAM ID.
 - Updated EDMA3_DRV_getAllocatedPARAMId() function to return paRAM
 id from the EDMA3 driver global variable.
 - Updated makefile to receive EDMA3_RES_USER_REQ macro as a flag
 through command line interface.

Signed-off-by: Pratap Reddy <x0257344@ti.com>
examples/edma3_driver/evmAM335x_A8/makefile
examples/edma3_driver/src/dma_poll_test.c
packages/makefile
packages/ti/sdo/edma3/drv/edma3_drv.h
packages/ti/sdo/edma3/drv/src/edma3_drv_basic.c

index 02bc4bb74762c29fe2f3d012adc6684a86118631..5844f8e5e8683779408a817ce3abbe40e4ebbcfe 100644 (file)
@@ -19,7 +19,7 @@ XDC_CFG_FILE_a8host = rtsc_config/edma3_drv_bios6_am335x_a8_st_sample.cfg
 SRCS_COMMON = common.c dma_misc_test.c dma_test.c qdma_test.c dma_chain_test.c \
               dma_ping_pong_test.c main.c dma_link_test.c dma_poll_test.c      \
               qdma_link_test.c
-CFLAGS_LOCAL_COMMON = -DSOC_AM335x
+CFLAGS_LOCAL_COMMON += -DSOC_AM335x
 
 # Core/SoC/platform specific source files and CFLAGS
 # Example:
index de65801baea7882656f693877b604cfa15c681bd..b531919766b8de7e0468436901eea2bbb80554e4 100644 (file)
@@ -79,6 +79,9 @@ EDMA3_DRV_Result edma3_test_poll_mode(
     uint32_t BRCnt = 0;
     int srcbidx = 0, desbidx = 0;
     int srccidx = 0, descidx = 0;
+#ifdef EDMA3_RES_USER_REQ
+    uint32_t paRAMId = 0;
+#endif
 
 
     srcBuff1 = (signed char*) GLOBAL_ADDR(_srcBuff1);
@@ -152,14 +155,18 @@ EDMA3_DRV_Result edma3_test_poll_mode(
             (EDMA3_RM_EventQueue)0,
             NULL, NULL);
 #ifdef EDMA3_RES_USER_REQ
-        printf("\nReserved Channel ID Test\n");
-        printf ("The Requested Channel ID: %d \nThe allocated PARAM Id:%d\n",chId,EDMA3_DRV_getAllocatedPARAMId());
-
-        if (chId == EDMA3_DRV_getAllocatedPARAMId())
+        result = EDMA3_DRV_getAllocatedPARAMId(hEdma, chId, &paRAMId);
+        if(result == EDMA3_DRV_SOK)
         {
-            printf("The Requested Param ID is allocated for the given Channel\n");
+            printf("\nReserved Channel ID Test\n");
+            printf ("The Requested Channel ID: %d \nThe allocated PARAM Id:%d\n",chId,paRAMId);
+
+            if (chId == paRAMId)
+            {
+                printf("The Requested Param ID is allocated for the given Channel\n");
+            }
+            printf("\n");
         }
-        printf("\n");
 #endif
     }
 
index b10c8a9a02cfbcda92529416216da2f5565b669b..49556ee97490c4fea8a0e3fc7518d434ba02d59a 100755 (executable)
@@ -57,6 +57,14 @@ cleanexamples: $(CLEANALL_EXAMPLES)
 #=======================================================================================================================================
 
 #=======================================================================================================================================
+
+#To Build Library and example with specific CFLAGS
+#through command line.
+ifneq ($(FLAGS),)
+  CFLAGS_LOCAL_COMMON = $(FLAGS)
+  export CFLAGS_LOCAL_COMMON
+endif
+
 ifeq (,$($(PLATFORM)_$(TARGET)_profiles))
 ifeq (,$($(PLATFORM)_profiles))
 $(PLATFORM)_$(TARGET)_profiles = debug release
index c6cd53f908f26118ce29d56c13b816ee1cce698b..0a3f8e9979699bd71be64ef70b9644b368e8769e 100755 (executable)
@@ -3154,21 +3154,31 @@ EDMA3_DRV_Result EDMA3_DRV_initXbarEventMap (EDMA3_DRV_Handle hEdma,
 
 #ifdef EDMA3_RES_USER_REQ
 /**
- * \brief   Return the PARAM ID recently allocated for an EDMA channel
+ * \brief   Returns the PARAM ID recently allocated for an EDMA channel
  *
  * This API will return the PARAM Id recently allocated by the EDMA3
  * resource manager for a requested DMA channel
  *
- * This function will called by the application after
- * the EDMA3_DRV_requestChannel() function is invoked.
- * \param   NULL
+ * This function can be called by the application after
+ * the EDMA3_DRV_requestChannel() function is invoked to check the
+ * allocated PaRAM Id for a requested channel if needed.
  *
- * \return  uint32_t
+ * \param   hEdma              [IN]    Handle to the EDMA Driver Instance.
+ * \param   channelId          [IN]    DMA channel for which the PaRAMId
+ *                                     needs to be returned.
+ * \param   paRAMId            [OUT]   Return the paRAMId of which the
+ *                                     channel Id is mapped.
+ *
+ * \return  EDMA3_DRV_SOK or EDMA3_DRV Error Code
+ *
+ * \note    This function is used to verify the requested DMA channel
+ *          is allocated/mapped with the PaRAM Id same as DMA channel number.
+ *          This function is not necessarily be used(invoked) for
+ *          any other general functionality.
  *
- * \note    This function is used only for testing purpose to
- * check the allcoated PARAM Id.
  */
-uint32_t EDMA3_DRV_getAllocatedPARAMId();
+EDMA3_DRV_Result EDMA3_DRV_getAllocatedPARAMId(EDMA3_DRV_Handle hEdma,
+                 uint32_t channelId, uint32_t *paRAMId);
 #endif
 
 
index ddf40fcafc24cf1fe9fd39764b81d1536fd30cf7..96d9bb0937171e132a25c729d354c4c26b3e9b17 100755 (executable)
@@ -169,11 +169,6 @@ static EDMA3_DRV_Result edma3RemoveMapping (EDMA3_DRV_Handle hEdma,
 const char   edma3LldVersionStr[] = EDMA3_LLD_DRV_VERSION_STR ":" __DATE__  ":" __TIME__;
 /*---------------------------------------------------------------------------*/
 
-#ifdef EDMA3_RES_USER_REQ
-/*Global variable to hold the recently allocated PARAM ID*/
-uint32_t edma3AllocPaRAMId = 0;
-#endif
-
 EDMA3_DRV_Result EDMA3_DRV_requestChannel (EDMA3_DRV_Handle hEdma,
                                     uint32_t *pLCh,
                                     uint32_t *pTcc,
@@ -655,10 +650,6 @@ EDMA3_DRV_Result EDMA3_DRV_requestChannel (EDMA3_DRV_Handle hEdma,
                 EDMA3_DVT_dNONE));
 #endif /* EDMA3_INSTRUMENTATION_ENABLED */
 
-#ifdef EDMA3_RES_USER_REQ
-/*Assign the PaRAM Id to the gloal variable*/
-    edma3AllocPaRAMId = paRAMId;
-#endif
     return result;
 }
 
@@ -2276,9 +2267,34 @@ EDMA3_DRV_Result EDMA3_DRV_disableLogicalChannel (EDMA3_DRV_Handle hEdma,
 #ifdef EDMA3_RES_USER_REQ
 /*Only for Testing purpose*/
 /** Return the Param ID recently allocated for an EDMA request*/
-uint32_t EDMA3_DRV_getAllocatedPARAMId()
+EDMA3_DRV_Result EDMA3_DRV_getAllocatedPARAMId(EDMA3_DRV_Handle hEdma,
+                                uint32_t channelId, uint32_t *paRAMId)
 {
-    return edma3AllocPaRAMId;
+    uint32_t edma3Id = 0;
+    EDMA3_DRV_Instance *drvInst = NULL;
+    EDMA3_DRV_Object *drvObject = NULL;
+       EDMA3_DRV_Result result = EDMA3_DRV_SOK;
+
+    drvInst = (EDMA3_DRV_Instance *)hEdma;
+    drvObject = drvInst->pDrvObjectHandle;
+
+    if (drvObject == NULL)
+    {
+        result = EDMA3_DRV_E_INVALID_PARAM;
+    }
+
+    if (EDMA3_DRV_SOK == result)
+    {
+        edma3Id = drvObject->phyCtrllerInstId;
+    }
+    else
+    {
+           result = EDMA3_DRV_E_INVALID_PARAM;
+    }
+
+    *paRAMId = edma3DrvChBoundRes[edma3Id][channelId].paRAMId;
+
+       return result;
 }
 #endif