PRSDK-415 Add support to verify allocated PaRAM Id
authorSinthu Raja M <x0257345@ti.com>
Wed, 21 Feb 2018 15:46:02 +0000 (21:16 +0530)
committerPratap Reddy <x0257344@ti.com>
Wed, 21 Feb 2018 20:16:41 +0000 (01:46 +0530)
 Add support to verify the requested DMA Channel ID gets the
 corresponding PaRAM Id.
 The test can be enabled by adding EDMA3_RES_USER_REQ macro in
 makefile of driver and AM335x example makefile.

examples/edma3_driver/evmAM335x_A8/makefile
examples/edma3_driver/evmAM335x_A8/rtsc_config/edma3_drv_bios6_am335x_a8_st_sample.cfg
examples/edma3_driver/src/dma_poll_test.c
examples/edma3_driver/src/main.c
packages/ti/sdo/edma3/drv/edma3_drv.h
packages/ti/sdo/edma3/drv/src/edma3_drv_basic.c

index 81f63e13e4bc1a896796c63b9f60e1a8136d2489..02bc4bb74762c29fe2f3d012adc6684a86118631 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 =
+CFLAGS_LOCAL_COMMON = -DSOC_AM335x
 
 # Core/SoC/platform specific source files and CFLAGS
 # Example:
index a47a1785f4d7d8e105019cd268d4cd84c350b77e..0825892880a8cba6ba09dbb5d1517ec5e282327c 100644 (file)
@@ -12,7 +12,7 @@ var SemihostSupport = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
 var Program     = xdc.useModule("xdc.cfg.Program");\r
 \r
 /* Heap used when creating semaphore's, TSK's or malloc() ... */\r
-Program.heap            = 0x1000;\r
+Program.heap            = 0x10000;\r
 \r
 /* ISR/SWI stack        */\r
 Program.stack           = 0x4000;\r
@@ -93,3 +93,12 @@ for (var i= 0x49000000; i < 0x490FFFFF; i = i + 0x100000)
     Mmu.setFirstLevelDescMeta(i, i, attrs);\r
 }\r
 \r
+/* configure the Peripheral Clock Module memory range                         */\r
+var peripheralBaseAddr = 0x44e00400;\r
+\r
+attrs.bufferable = false;\r
+attrs.cacheable = false;\r
+/* Configure the corresponding MMU page descriptor for Clock Module */\r
+Mmu.setFirstLevelDescMeta(peripheralBaseAddr,\r
+                          peripheralBaseAddr,\r
+                          attrs);\r
index 948dc1acf453385d965f1b59430ae51c79106b44..de65801baea7882656f693877b604cfa15c681bd 100644 (file)
@@ -7,7 +7,7 @@
 * to check the status of ongoing transfer. Interrupt will NOT occur in this 
 * case.
 *
-* Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
+* Copyright (C) 2009-2018 Texas Instruments Incorporated - http://www.ti.com/
 * 
 * 
 *  Redistribution and use in source and binary forms, with or without 
@@ -48,6 +48,7 @@ extern signed char   _dstBuff1[MAX_BUFFER_SIZE];
 extern signed char *srcBuff1;
 extern signed char *dstBuff1;
 
+#define EDMA3_DRV_DMA_CHANNEL_USR_REQ     (10)
 /**
 *  \brief   EDMA3 mem-to-mem data copy test case, using a DMA channel.
 *              This test case doesnot rely on the callback mechanism.
@@ -137,7 +138,11 @@ EDMA3_DRV_Result edma3_test_poll_mode(
 
     /* Setup for Channel 1*/
     tcc = EDMA3_DRV_TCC_ANY;
+#ifdef EDMA3_RES_USER_REQ
+    chId = EDMA3_DRV_DMA_CHANNEL_USR_REQ;
+#else
     chId = EDMA3_DRV_DMA_CHANNEL_ANY;
+#endif
 
 
     /* Request any DMA channel and any TCC */
@@ -146,6 +151,16 @@ EDMA3_DRV_Result edma3_test_poll_mode(
         result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
             (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())
+        {
+            printf("The Requested Param ID is allocated for the given Channel\n");
+        }
+        printf("\n");
+#endif
     }
 
     if (result == EDMA3_DRV_SOK)
index a6d37c630a6b428ba78841d032c61ed871e42af0..a8b8910756e681f6bc0cb393b9119ab6bf5e21fa 100644 (file)
@@ -4,7 +4,7 @@
 * This file contains the test / demo code to demonstrate the EDMA3 driver
 * functionality on DSP/BIOS 6.
 *
-* Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+* Copyright (C) 2009-2018 Texas Instruments Incorporated - http://www.ti.com/
 *
 *
 *  Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,19 @@ extern far const uint32_t numEdma3Instances;
 extern const uint32_t numEdma3Instances;
 #endif
 
+#ifdef SOC_AM335x
+#define WR_MEM_32(addr, data) *(unsigned int*)(addr) = (unsigned int)(data)
+
+#define PRCM_BASE_ADDR       (0x44E00000)
+#define CM_PER_TPTC0_CLKCTRL (PRCM_BASE_ADDR +0x0024)
+#define CM_PER_TPCC_CLKCTRL  (PRCM_BASE_ADDR +0x00BC)
+#define CM_PER_TPTC1_CLKCTRL (PRCM_BASE_ADDR +0x00FC)
+#define CM_PER_TPTC2_CLKCTRL (PRCM_BASE_ADDR +0x0100)
+
+/*To enable EDMA3 Clock Module */
+static void edma3PRCMEnable();
+#endif
+
 /**
 * DSP instance number on which the executable is running. Its value is
 * determined by reading the processor specific register DNUM.
@@ -161,6 +174,10 @@ void echo()
 
     memset(hEdma,0,sizeof(hEdma));
 
+#ifdef SOC_AM335x
+    edma3PRCMEnable();
+#endif
+
     /* Print the Welcome Message */
     printWelcomeBanner();
 
@@ -459,3 +476,14 @@ void tskHeartBit()
         counter++;
     }
 }
+
+#ifdef SOC_AM335x
+/*To enable EDMA3 Clock Module of AM335x*/
+static void edma3PRCMEnable()
+{
+    WR_MEM_32(CM_PER_TPCC_CLKCTRL, 2);
+    WR_MEM_32(CM_PER_TPTC0_CLKCTRL ,   2);
+    WR_MEM_32(CM_PER_TPTC1_CLKCTRL ,   2);
+    WR_MEM_32(CM_PER_TPTC2_CLKCTRL ,   2);
+}
+#endif
index 2c77bf8f2211657403fcd5e8252f35e5c0277807..c6cd53f908f26118ce29d56c13b816ee1cce698b 100755 (executable)
@@ -5,7 +5,7 @@
  * uses the EDMA3 Resource Manager internally for resource allocation, interrupt
  * handling and EDMA3 registers programming.
  *
- * Copyright (C) 2009-2013 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009-2018 Texas Instruments Incorporated - http://www.ti.com/
  *
  *
  *  Redistribution and use in source and binary forms, with or without
@@ -3152,6 +3152,25 @@ EDMA3_DRV_Result EDMA3_DRV_initXbarEventMap (EDMA3_DRV_Handle hEdma,
                  EDMA3_DRV_mapXbarEvtToChan mapXbarEvtFunc,
                  EDMA3_DRV_xbarConfigScr configXbarScr);
 
+#ifdef EDMA3_RES_USER_REQ
+/**
+ * \brief   Return 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
+ *
+ * \return  uint32_t
+ *
+ * \note    This function is used only for testing purpose to
+ * check the allcoated PARAM Id.
+ */
+uint32_t EDMA3_DRV_getAllocatedPARAMId();
+#endif
+
 
                                                 
 /**
index 2a6ab6e155c0a32f2f4645c8272e49596810e663..ddf40fcafc24cf1fe9fd39764b81d1536fd30cf7 100755 (executable)
@@ -12,7 +12,7 @@
  * beyond this and have complete control on the EDMA3 hardware are advised
  * to refer edma3_drv_adv.c source file.
  *
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright (C) 2009-2018 Texas Instruments Incorporated - http://www.ti.com/
  *
  *
  *  Redistribution and use in source and binary forms, with or without
@@ -169,6 +169,11 @@ 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,
@@ -650,6 +655,10 @@ 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;
 }
 
@@ -2264,6 +2273,15 @@ EDMA3_DRV_Result EDMA3_DRV_disableLogicalChannel (EDMA3_DRV_Handle hEdma,
     return result;
     }
 
+#ifdef EDMA3_RES_USER_REQ
+/*Only for Testing purpose*/
+/** Return the Param ID recently allocated for an EDMA request*/
+uint32_t EDMA3_DRV_getAllocatedPARAMId()
+{
+    return edma3AllocPaRAMId;
+}
+#endif
+
 /* Definitions of Local functions - Start */
 /** Remove various mappings and do cleanup for DMA/QDMA channels */
 static EDMA3_DRV_Result edma3RemoveMapping (EDMA3_DRV_Handle hEdma,