From d183ed20e55adb61a2ccd6207251367688ad6263 Mon Sep 17 00:00:00 2001 From: Tinku Mannan Date: Wed, 30 Apr 2014 13:47:37 -0400 Subject: [PATCH] HPLIB changes to support device specific libraries --- ti/runtime/hplib/build/Makefile | 3 ++- ti/runtime/hplib/hplib_vm.h | 6 +----- ti/runtime/hplib/makefile_armv7 | 14 ++++++++++++++ ti/runtime/hplib/src/hplib_loc.h | 13 +++++++++++++ ti/runtime/hplib/src/hplib_vm.c | 13 ++++++------- ti/runtime/hplib/test/bmAllocTest.c | 20 ++------------------ ti/runtime/hplib/test/build/Makefile | 14 -------------- ti/runtime/hplib/test/hplibmod_test.c | 14 -------------- ti/runtime/hplib/test/pmutest.c | 14 -------------- ti/runtime/hplib/test/shmtest.c | 13 ------------- ti/runtime/hplib/test/synchtest.c | 13 ------------- ti/runtime/hplib/test/synchtest2.c | 11 ----------- 12 files changed, 38 insertions(+), 110 deletions(-) diff --git a/ti/runtime/hplib/build/Makefile b/ti/runtime/hplib/build/Makefile index dd238de..8505310 100755 --- a/ti/runtime/hplib/build/Makefile +++ b/ti/runtime/hplib/build/Makefile @@ -71,7 +71,7 @@ COMMONSRCC = \ #COMMONSRCC += osal.c #endif -CFLAGS+= $(DEBUG_FLAG) -I. -I $(SRCDIR) -I$(PDK_INSTALL_PATH) -I$(TRANS_SDK_INSTALL_PATH) -I$(CPPI_INC_DIR) -D__LINUX_USER_SPACE -pthread -D _GNU_SOURCE -DPDK_VERSION=$(PDK_VERSION) +CFLAGS+= $(DEBUG_FLAG) $(CSL_DEVICE) -I. -I $(SRCDIR) -I$(PDK_INSTALL_PATH) -I$(TRANS_SDK_INSTALL_PATH) -I$(CPPI_INC_DIR) -D__LINUX_USER_SPACE -pthread -D _GNU_SOURCE -DPDK_VERSION=$(PDK_VERSION) # Make Rule for the COMMONSRC Files @@ -156,6 +156,7 @@ clean: rm -rf $(ARMV7OBJDIR_NO_OSAL) rm -rf $(ARMV7OBJDIR_NO_OSAL_SO) rm -f $(ARMV7LIBDIR)/libhplib_$(DEVICE).* + rm -f $(ARMV7LIBDIR)/libhplib-no-osal_$(DEVICE).* module: -@echo compiling $< ... diff --git a/ti/runtime/hplib/hplib_vm.h b/ti/runtime/hplib/hplib_vm.h index 1d8bc08..98c2a09 100755 --- a/ti/runtime/hplib/hplib_vm.h +++ b/ti/runtime/hplib/hplib_vm.h @@ -189,16 +189,12 @@ typedef struct hplib_memPoolAttr_Tag * number of memory pools being initialized * @param[in] mempool_attr * @ref HPLIB_MemPool_Attr_T - * @param[in] p_device_cfg - * @ref hplib_globalDeviceConfigParams_t * @retval * 1 == Success, -1== Failure. */ int hplib_vmInit(hplib_virtualAddrInfo_T *hplib_vmaddr, int num_pools, - hplib_memPoolAttr_T *mempool_attr, - hplib_globalDeviceConfigParams_t *p_device_cfg); - + hplib_memPoolAttr_T *mempool_attr); /** * @b Description * @n diff --git a/ti/runtime/hplib/makefile_armv7 b/ti/runtime/hplib/makefile_armv7 index 4a795f0..3b0ee35 100755 --- a/ti/runtime/hplib/makefile_armv7 +++ b/ti/runtime/hplib/makefile_armv7 @@ -54,6 +54,20 @@ ifndef MAKE export MAKE = make endif + +ifeq ($(DEVICE), k2h) +export CSL_DEVICE = -DDEVICE_K2H +endif +ifeq ($(DEVICE), k2k) +export CSL_DEVICE = -DDEVICE_K2K +endif +ifeq ($(DEVICE), k2l) +export CSL_DEVICE = -DDEVICE_K2L +endif +ifeq ($(DEVICE), k2e) +export CSL_DEVICE = -DDEVICE_K2E +endif + # PHONY Targets .PHONY: all clean lib tests examples install installbin diff --git a/ti/runtime/hplib/src/hplib_loc.h b/ti/runtime/hplib/src/hplib_loc.h index eaba036..38981ad 100755 --- a/ti/runtime/hplib/src/hplib_loc.h +++ b/ti/runtime/hplib/src/hplib_loc.h @@ -67,8 +67,21 @@ extern "C" { #define NETCP_CFG_BASE_ADDR CSL_PA_SS_CFG_REGS #define PASS_CFG_BLK_SZ (1*1024*1024) #define SRIO_CFG_BLK_SZ (132*1024) +#else + +#if defined(DEVICE_K2E) || defined(DEVICE_K2L) +#define QMSS_CFG_BLK_SZ (0x00200000) +#define PASS_CFG_BLK_SZ (16*1024*1024) +#define QMSS_DATA_BLK_SZ (0x00100000) +#else +#define QMSS_CFG_BLK_SZ (1*1024*1024) +#define PASS_CFG_BLK_SZ (1*1024*1024) +#define QMSS_DATA_BLK_SZ (0x60000) #endif +#endif + + typedef uint16_t HPLIB_BOOL_T; #define HPLIB_TRUE 1 diff --git a/ti/runtime/hplib/src/hplib_vm.c b/ti/runtime/hplib/src/hplib_vm.c index d77a502..68fb396 100755 --- a/ti/runtime/hplib/src/hplib_vm.c +++ b/ti/runtime/hplib/src/hplib_vm.c @@ -382,8 +382,7 @@ hplib_RetValue hplib_initMallocArea(int pool_id) ********************************************************************/ hplib_RetValue hplib_vmInit(hplib_virtualAddrInfo_T *hplib_vmaddr, int num_pools, - hplib_memPoolAttr_T *mempool_attr, - hplib_globalDeviceConfigParams_t *p_device_cfg) + hplib_memPoolAttr_T *mempool_attr) { int i; @@ -440,8 +439,7 @@ hplib_RetValue hplib_vmInit(hplib_virtualAddrInfo_T *hplib_vmaddr, /* Create virtual memory maps for peripherals */ /* QMSS CFG Regs */ hplib_vmaddr->qmssCfgVaddr = - hplib_VM_MemMap((void*)p_device_cfg->cslQmssCfgBase, - p_device_cfg->qmssCfgBlkSz); + hplib_VM_MemMap((void*)CSL_QMSS_CFG_BASE, QMSS_CFG_BLK_SZ); if (!hplib_vmaddr->qmssCfgVaddr) { hplib_Log("hplib_vmInit: Failed to map QMSS CFG registers\n"); @@ -451,7 +449,7 @@ hplib_RetValue hplib_vmInit(hplib_virtualAddrInfo_T *hplib_vmaddr, /*QMSS DATA Regs */ hplib_vmaddr->qmssDataVaddr = (void *) hplib_utilGetVaOfBufferArea(HPLIBMOD_MMAP_QM_DATA_REG_MEM_OFFSET, - p_device_cfg->qmssDataBlkSz); + QMSS_DATA_BLK_SZ); if (!hplib_vmaddr->qmssDataVaddr) { @@ -462,8 +460,9 @@ hplib_RetValue hplib_vmInit(hplib_virtualAddrInfo_T *hplib_vmaddr, /* PASS CFG Regs */ hplib_vmaddr->passCfgVaddr = - hplib_VM_MemMap((void*)p_device_cfg->cslNetCpCfgRegs, - p_device_cfg->netcpCfgBlkSz); + hplib_VM_MemMap((void*)CSL_NETCP_CFG_REGS, + //p_device_cfg->netcpCfgBlkSz + PASS_CFG_BLK_SZ); if (!hplib_vmaddr->passCfgVaddr) { diff --git a/ti/runtime/hplib/test/bmAllocTest.c b/ti/runtime/hplib/test/bmAllocTest.c index 2b242ff..0ec6eaa 100755 --- a/ti/runtime/hplib/test/bmAllocTest.c +++ b/ti/runtime/hplib/test/bmAllocTest.c @@ -47,19 +47,6 @@ #include #include - -#if defined(DEVICE_K2H) -#include -#elif defined (DEVICE_K2K) -#include -#elif defined (DEVICE_K2L) -#include -#elif defined (DEVICE_K2E) -#include -#else /*Default */ -#include -#endif /* Device */ - hplib_memPoolAttr_T netapi_VM_MempoolAttr[HPLIB_MAX_MEM_POOLS]; hplib_virtualAddrInfo_T netapi_VM_VirtAddr[HPLIB_MAX_MEM_POOLS]; @@ -93,8 +80,7 @@ static void* thread_routineM(void* arg) hplib_vmInit(&netapi_VM_VirtAddr[0], 1, - &netapi_VM_MempoolAttr[0], - &hplibDeviceGblCfgParam); + &netapi_VM_MempoolAttr[0]); hplib_initMallocArea(0); poolHdr = (hplib_VirtMemPoolheader_T*) memPoolAddr[0].memStart; for (i=0;i < MAX_ALLOCS;i ++) @@ -146,9 +132,7 @@ static void* thread_routineP(void* arg) hplib_vmInit(&netapi_VM_VirtAddr[0], 1, - &netapi_VM_MempoolAttr[0], - &hplibDeviceGblCfgParam); - + &netapi_VM_MempoolAttr[0]); printf("awake now: doing allocs\n"); poolHdr = (hplib_VirtMemPoolheader_T*) memPoolAddr[0].memStart; printf("MapInfo: after allocs, totalAllocatedBytes: %d\n", diff --git a/ti/runtime/hplib/test/build/Makefile b/ti/runtime/hplib/test/build/Makefile index 64cc589..2be8c84 100755 --- a/ti/runtime/hplib/test/build/Makefile +++ b/ti/runtime/hplib/test/build/Makefile @@ -41,20 +41,6 @@ ifdef CROSS_TOOL_INSTALL_PATH endif -ifeq ($(DEVICE), k2h) -CSL_DEVICE = -DDEVICE_K2H -endif -ifeq ($(DEVICE), k2k) -CSL_DEVICE = -DDEVICE_K2K -endif -ifeq ($(DEVICE), k2l) -CSL_DEVICE = -DDEVICE_K2L -endif -ifeq ($(DEVICE), k2e) -CSL_DEVICE = -DDEVICE_K2E -endif - - CFLAGS+= $(DEBUG_FLAG) -I../ -I. -I$(PDK_INSTALL_PATH) -I$(TRANS_SDK_INSTALL_PATH) -I$(QMSS_INC_DIR) -I$(CPPI_INC_DIR) $(CSL_DEVICE) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD -pthread -D _GNU_SOURCE # Linker options, commenting out INTERNALLINKDEFS diff --git a/ti/runtime/hplib/test/hplibmod_test.c b/ti/runtime/hplib/test/hplibmod_test.c index 9e55601..b04632f 100755 --- a/ti/runtime/hplib/test/hplibmod_test.c +++ b/ti/runtime/hplib/test/hplibmod_test.c @@ -11,21 +11,7 @@ #include "hplibmod.h" #include "hplib_util.h" -#if defined(DEVICE_K2H) -#include -#elif defined (DEVICE_K2K) -#include -#elif defined (DEVICE_K2L) -#include -#elif defined (DEVICE_K2E) -#include -#else /*Default */ -#include -#endif /* Device */ - - #define timing_start hplib_mUtilGetPmuCCNT - #define timing_stop hplib_mUtilGetPmuCCNT //#define AVOID_MMAP diff --git a/ti/runtime/hplib/test/pmutest.c b/ti/runtime/hplib/test/pmutest.c index 7542376..c84347e 100755 --- a/ti/runtime/hplib/test/pmutest.c +++ b/ti/runtime/hplib/test/pmutest.c @@ -51,20 +51,6 @@ #include #include "hplib.h" -#if defined(DEVICE_K2H) -#include -#elif defined (DEVICE_K2K) -#include -#elif defined (DEVICE_K2L) -#include -#elif defined (DEVICE_K2E) -#include -#else /*Default */ -#include -#endif /* Device */ - - - //usefull events #define PMU_IFR 0x1 //instruction fetch causing refill of I cache #define PMU_IFT 0x2 //instruction fetch causing refill of TLB diff --git a/ti/runtime/hplib/test/shmtest.c b/ti/runtime/hplib/test/shmtest.c index d30b86a..e4e5adb 100755 --- a/ti/runtime/hplib/test/shmtest.c +++ b/ti/runtime/hplib/test/shmtest.c @@ -43,19 +43,6 @@ #include #include "hplib.h" -#if defined(DEVICE_K2H) -#include -#elif defined (DEVICE_K2K) -#include -#elif defined (DEVICE_K2L) -#include -#elif defined (DEVICE_K2E) -#include -#else /*Default */ -#include -#endif /* Device */ - - #define SHM_SIZE 65536 char * p= NULL; int * pi=NULL; diff --git a/ti/runtime/hplib/test/synchtest.c b/ti/runtime/hplib/test/synchtest.c index dfff945..95ff080 100755 --- a/ti/runtime/hplib/test/synchtest.c +++ b/ti/runtime/hplib/test/synchtest.c @@ -51,19 +51,6 @@ #include #include "hplib.h" -#if defined(DEVICE_K2H) -#include -#elif defined (DEVICE_K2K) -#include -#elif defined (DEVICE_K2L) -#include -#elif defined (DEVICE_K2E) -#include -#else /*Default */ -#include -#endif /* Device */ - - #define timing_start hplib_mUtilGetPmuCCNT #define timing_stop hplib_mUtilGetPmuCCNT diff --git a/ti/runtime/hplib/test/synchtest2.c b/ti/runtime/hplib/test/synchtest2.c index 5e5ed6e..02fb0de 100755 --- a/ti/runtime/hplib/test/synchtest2.c +++ b/ti/runtime/hplib/test/synchtest2.c @@ -50,17 +50,6 @@ #include #include "hplib.h" -#if defined(DEVICE_K2H) -#include -#elif defined (DEVICE_K2K) -#include -#elif defined (DEVICE_K2L) -#include -#elif defined (DEVICE_K2E) -#include -#else /*Default */ -#include -#endif /* Device */ //#define INC_TO 1000000 // one million. #define INC_TO 10000 // one million... -- 2.39.2