summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6073ac8)
raw | patch | inline | side by side (parent: 6073ac8)
author | Aditya Wadhwa <a0485151@ti.com> | |
Tue, 1 Dec 2020 17:19:46 +0000 (22:49 +0530) | ||
committer | Sivaraj R <sivaraj@ti.com> | |
Thu, 10 Dec 2020 05:19:47 +0000 (23:19 -0600) |
- Not all comments resolved
- Build is successfull but not tested on evm
Signed-off-by: Aditya Wadhwa <a0485151@ti.com>
- Build is successfull but not tested on evm
Signed-off-by: Aditya Wadhwa <a0485151@ti.com>
packages/ti/drv/gpmc/example/makefile | [changed mode: 0644->0755] | patch | blob | history |
packages/ti/drv/gpmc/example/src/main_gpmc_probing_example.c | [changed mode: 0644->0755] | patch | blob | history |
packages/ti/drv/gpmc/gpmc_component.mk | patch | blob | history |
include $(PDK_INSTALL_PATH)/ti/build/Rules.make
BUILD_OS_TYPE = baremetal
-CFLAGS_OS_DEFINES =
LNKFLAGS_LOCAL_mpu1_0 += --entry Entry
COMP_LIST_COMMON = $(PDK_COMMON_BAREMETAL_COMP)
EXTERNAL_INTERFACES =
# need to be included for this component
INCLUDE_EXTERNAL_INTERFACES = pdk $(EXTERNAL_INTERFACES)
-GPMC_OS_TYPE=_Baremetal
-
#Name of the directory created under packages/ti/binary/
-APP_NAME = GPMC$(GPMC_OS_TYPE)_Probing_Example
-# Name of the binary if different from the default (APP_NAME)_$(BOARD_$(CORE)_<build_profile>
-LOCAL_APP_NAME = GPMC$(GPMC_OS_TYPE)_$(BOARD)_$(CORE)Probing_Example
+APP_NAME = GPMC_Baremetal_Probing_Example
COMP_LIST_COMMON += gpmc
-CFLAGS_GPMC_DMA =
PACKAGE_SRCS_COMMON = makefile src/
-CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) $(CFLAGS_GPMC_DMA) $(CFLAGS_OS_DEFINES)
-
# Include common make files
ifeq ($(MAKERULEDIR), )
#Makerule path not defined, define this and assume relative path from ROOTDIR
diff --git a/packages/ti/drv/gpmc/example/src/main_gpmc_probing_example.c b/packages/ti/drv/gpmc/example/src/main_gpmc_probing_example.c
#include <stdio.h>
#include <string.h>
-#ifdef USE_BIOS
-/* XDCtools Header files */
-#include <xdc/std.h>
-#include <xdc/cfg/global.h>
-#include <xdc/runtime/System.h>
-#include <xdc/runtime/Error.h>
-
-#include <ti/sysbios/knl/Task.h>
-#include <ti/sysbios/BIOS.h>
-#include <ti/sysbios/utils/Load.h>
-#endif
-
/* GPMC Header files */
#include <ti/drv/gpmc/GPMC.h>
#include <ti/drv/gpmc/soc/GPMC_soc.h>
#include <ti/drv/sciclient/sciclient.h>
#include <ti/osal/TimerP.h>
-#ifdef GPMC_DMA_ENABLE
-#include <ti/osal/CacheP.h>
-#include <ti/drv/udma/udma.h>
-#endif
/**********************************************************************
************************** Macros ************************************
**********************************************************************/
-#define GPMC_PROFILE /* Enable profiling */
-
+#define GPMC_PROFILE /* Enable profiling */
+#define GPMC_APP_STATUS_SUCCESS ((int32_t)(0)) /* Succes code */
+#define GPMC_APP_STATUS_ERROR (-((int32_t)1)) /* Failure code */
/**********************************************************************
************************** Global Variables **************************
**********************************************************************/
uint8_t txBuf[TEST_DATA_LEN] __attribute__((aligned(4))) __attribute__((section(".benchmark_buffer")));
+uint8_t rxBuf[TEST_DATA_LEN] __attribute__((aligned(4))) __attribute__((section(".benchmark_buffer")));
GPMC_Transaction transaction;
}
}
-void GPMC_initConfig()
+int32_t gpmc_test()
{
- GPMC_v1_HwAttrs gpmc_cfg;
-
- /* Get the default GPMC init configurations */
- GPMC_socGetInitCfg(BOARD_GPMC_INSTANCE, &gpmc_cfg);
-
- /* Modify the default GPMC configurations */
-
- /* Set the default GPMC init configurations */
- GPMC_socSetInitCfg(BOARD_GPMC_INSTANCE, &gpmc_cfg);
-}
-
-uint32_t gpmc_test()
-{
- uint32_t testPassed = TRUE;
+ int32_t status = GPMC_APP_STATUS_SUCCESS;
uint32_t i;
GPMC_Params params;
GPMC_Handle handle;
uint32_t xferRateInt;
#endif
- GPMC_initConfig();
GPMC_Params_init(¶ms);
handle = GPMC_open(BOARD_GPMC_INSTANCE, ¶ms);
if (handle == NULL)
{
GPMC_log("\n GPMC open failed. \n");
- testPassed = FALSE;
+ status = GPMC_APP_STATUS_ERROR;
goto Err;
}
/* Generate the data */
- GeneratePattern(txBuf, NULL, TEST_DATA_LEN);
+ GeneratePattern(txBuf, rxBuf, TEST_DATA_LEN);
/* Write data */
transaction.transType = GPMC_TRANSACTION_TYPE_WRITE;
transaction.rxBuf = NULL;
transaction.arg = NULL;
- for(i=0 ; i<1000 ; i++)
- {
#ifdef GPMC_PROFILE
/* Get start time stamp for the write performance measurement */
startTime = TimerP_getTimeInUsecs();
#endif
-
- if(GPMC_transfer(handle, &transaction))
- {
- #ifdef GPMC_PROFILE
- elapsedTime = TimerP_getTimeInUsecs() - startTime;
- /* calculate the write transfer rate in MBps */
- xferRate = (float) (((float)testLen) / elapsedTime);
- xferRateInt = (uint32_t)xferRate;
- GPMC_log("\n GPMC write %d bytes at transfer rate %d MBps \n", testLen, xferRateInt);
- #endif
- }
- else
- {
- GPMC_log("\n GPMC write failed. \n");
+
+ for(i=0 ; i<1000 ; i++)
+ {
+ if(!GPMC_transfer(handle, &transaction))
+ {
+ GPMC_log("[Error] GPMC write failed. \n");
break;
}
}
+ #ifdef GPMC_PROFILE
+ elapsedTime = TimerP_getTimeInUsecs() - startTime;
+ /* calculate the write transfer rate in MBps */
+ xferRate = (float) (((float)(testLen*i)) / elapsedTime);
+ xferRateInt = (uint32_t)xferRate;
+ GPMC_log("\n GPMC write %d bytes at transfer rate %d MBps \n", testLen, xferRateInt);
+ #endif
+
Err:
if (handle != NULL)
{
GPMC_close(handle);
}
- return (testPassed);
+ return (status);
}
#if defined(SOC_AM64X)
}
#endif
-uint32_t Board_initGPMC(void)
+int32_t Board_initGPMC(void)
{
- uint32_t retVal = TRUE;
+ int32_t status = GPMC_APP_STATUS_SUCCESS;
Board_initCfg boardCfg;
Board_STATUS boardStatus;
boardStatus = Board_init(boardCfg);
if (boardStatus != BOARD_SOK)
{
- retVal = FALSE;
+ GPMC_log("[Error] Board init failed!!\n");
+ status = GPMC_APP_STATUS_ERROR;
}
#if defined(SOC_AM64X)
- if (retVal == TRUE)
+ if (status == GPMC_APP_STATUS_SUCCESS)
{
- retVal = GPMC_configClk(GPMC_MODULE_CLK_80MHZ);
+ status += GPMC_configClk(GPMC_MODULE_CLK_80MHZ);
+ if(status != GPMC_APP_STATUS_SUCCESS)
+ {
+ GPMC_log("[Error] Config clock failed!!\n");
+ }
}
#endif
- return (retVal);
+
+ GPMC_init();
+
+ return (status);
}
int main(void)
{
- uint32_t testResult = FALSE;
+ int32_t status = GPMC_APP_STATUS_SUCCESS;
+
+ status += Board_initGPMC();
- if (Board_initGPMC() == FALSE)
+ if(status != GPMC_APP_STATUS_SUCCESS)
{
- return (0);
+ GPMC_log("[Error] GPMC init failed!!\n");
+ goto testfail;
}
- GPMC_init();
-
- testResult = gpmc_test();
+ status += gpmc_test();
- if (testResult)
+testfail:
+ if (status != GPMC_APP_STATUS_SUCCESS)
{
- GPMC_log("\n GPMC Write x100 has successfully completed! \n");
- }
- else
- {
- GPMC_log("\n Test Failed! \n");
+ GPMC_log("[Error] Test Failed! \n");
}
- while (1)
- {
- }
+ return(0);
}
index 5840a93ad69cf50277ccc28789df104d29938995..ac53cfdd17423dca2dab7bb37d6ebffbc7944bda 100755 (executable)
GPMC_Baremetal_Probing_Example_RELPATH = ti/drv/gpmc/example
GPMC_Baremetal_Probing_Example_PATH = $(PDK_GPMC_COMP_PATH)/example
GPMC_Baremetal_Probing_Example_BOARD_DEPENDENCY = yes
-GPMC_Baremetal_Probing_Example_CORE_DEPENDENCY = no
+GPMC_Baremetal_Probing_Example_CORE_DEPENDENCY = yes
GPMC_Baremetal_Probing_Example_MAKEFILE = -f makefile IS_BAREMETAL=yes
export GPMC_Baremetal_Probing_Example_COMP_LIST
export GPMC_Baremetal_Probing_Example_BOARD_DEPENDENCY