summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5f6e78e)
raw | patch | inline | side by side (parent: 5f6e78e)
author | Tinku Mannan <tmannan@ti.com> | |
Fri, 21 Nov 2014 19:52:10 +0000 (14:52 -0500) | ||
committer | Tinku Mannan <tmannan@ti.com> | |
Fri, 21 Nov 2014 19:52:10 +0000 (14:52 -0500) |
ti/runtime/hplib/.gitignore | [new file with mode: 0644] | patch | blob |
ti/runtime/hplib/hplib_cache.h | [changed mode: 0755->0644] | patch | blob | history |
ti/runtime/hplib/hplib_shm.h | [changed mode: 0755->0644] | patch | blob | history |
ti/runtime/hplib/hplib_vm.h | [changed mode: 0755->0644] | patch | blob | history |
ti/runtime/hplib/module/.gitignore | [new file with mode: 0644] | patch | blob |
ti/runtime/hplib/src/hplib_shm.c | [changed mode: 0755->0644] | patch | blob | history |
ti/runtime/hplib/src/hplib_util.c | [changed mode: 0755->0644] | patch | blob | history |
ti/runtime/hplib/src/osal.c | [changed mode: 0755->0644] | patch | blob | history |
ti/runtime/hplib/test/bmAllocTest.c | [changed mode: 0755->0644] | patch | blob | history |
ti/runtime/hplib/test/shmtest.c | [changed mode: 0755->0644] | patch | blob | history |
diff --git a/ti/runtime/hplib/.gitignore b/ti/runtime/hplib/.gitignore
--- /dev/null
@@ -0,0 +1,6 @@
+*.o\r
+*.a\r
+*.so\r
+*.so.*\r
+.created\r
+/bin \r
{
return hplib_FAILURE;
}
+#else
+ (void)ptr;
+ (void)size;
#endif
return hplib_OK;
}
if (ioctl(hplib_mod_fd, HPLIBMOD_IOCCACHEWBINV | HPLIBMOD_IOCMAGIC, &block) == -1) {
return hplib_FAILURE;
}
+#else
+ (void)ptr;
+ (void)size;
#endif
return hplib_OK;
}
if (ioctl(hplib_mod_fd, HPLIBMOD_IOCCACHEINV | HPLIBMOD_IOCMAGIC, &block) == -1) {
return hplib_FAILURE;
}
+#else
+ (void)ptr;
+ (void)size;
#endif
return hplib_OK;
}
* @retval
* void* base address of the shared memory segment, NULL on error
*/
-void* hplib_shmOpen();
+void* hplib_shmOpen(void);
/**
* @b Description
* @retval
* hplib_RetValue, @ref hplib_RetValue
*/
-hplib_RetValue hplib_shmDelete();
+hplib_RetValue hplib_shmDelete(void);
/**
* @b Description
*/
static inline void * hplib_mVMPhyToVirtPoolId (void *ptr, uint8_t pool_id)
{
- if (pool_id > (HPLIB_MAX_MEM_POOLS -1));
+ if (pool_id > (HPLIB_MAX_MEM_POOLS -1))
return (void *) hplib_OK;
- if (!ptr) return (void *) hplib_OK;
+ if (!ptr) return
+ (void *) hplib_OK;
if (((uint8_t *)ptr <memPoolAddr[pool_id].memStartPhy)||( (uint8_t *)ptr>memPoolAddr[pool_id].memEndPhy))
return (void *) hplib_OK;
*/
hplib_RetValue hplib_checkMallocArea(int pool_id);
+/**
+ * @b Description
+ * @n
+ * The function API is used to map the given physical address
+ * to virtual memory space.
+ * @param[in] addr
+ * Physical address pointer of memory space
+ * @param[in] size size of memory to be mapped
+ * @retval
+ * Virtual address pointer of mapped memory space
+ */
+void *hplib_VM_MemMap(void* addr, uint32_t size);
#ifdef __cplusplus
}
diff --git a/ti/runtime/hplib/module/.gitignore b/ti/runtime/hplib/module/.gitignore
--- /dev/null
@@ -0,0 +1,6 @@
+*.ko\r
+.*.cmd\r
+*.mod.c\r
+modules.order\r
+Module.symvers\r
+.tmp_versions \r
if (shm_id < 0)
{
- printf("hplib_shmCreate: shmget error\n");
+ hplib_Log("hplib_shmCreate: shmget error\n");
return NULL;
}
else
{
pBase = (hplib_shmInfo_T*)shmat(shm_id, 0,0);
if (pBase == (hplib_shmInfo_T*)-1)
- printf("hplib_shmCreate: shmat error\n");
+ hplib_Log("hplib_shmCreate: shmat error\n");
else
{
pBase->size = size;
shm_id = shmget(shm_key, 0, 0666 );
if (shm_id < 0)
{
- printf("hplib_shmOpen: shmget error\n");
+ hplib_Log("hplib_shmOpen: shmget error\n");
return NULL;
}
else
pBase = (hplib_shmInfo_T*)shmat(shm_id, 0,0);
if (pBase == (hplib_shmInfo_T*)-1)
{
- printf("hplib_shmOpen: shmat error\n");
+ hplib_Log("hplib_shmOpen: shmat error\n");
return NULL;
}
/**************************************************************************
* FUNCTION PURPOSE: Delete Shared Memory Segment
**************************************************************************/
-hplib_RetValue hplib_shmDelete()
+hplib_RetValue hplib_shmDelete(void)
{
shm_id = shmget(shm_key, 0, 0666 );
if (shm_id < 0)
{
- printf("hplib_shmOpen: shmget error\n");
+ hplib_Log("hplib_shmOpen: shmget error\n");
return hplib_FAILURE;
}
else
int err=shmctl(shm_id, IPC_RMID, 0);
if(err<0)
{
- printf("hplib_shmDelete: shmctl failed\n");
+ hplib_Log("hplib_shmDelete: shmctl failed\n");
return hplib_FAILURE;
}
}
@@ -162,7 +162,7 @@ hplib_RetValue hplib_shmAddEntry(void* base, int size, hplib_shmEntryId_E entryI
if ((pBase->free_offset + size) > pBase->size)
{
- printf("hplib_shmAddEntry: insufficient memory request, size %d\n", size);
+ hplib_Log("hplib_shmAddEntry: insufficient memory request, size %d\n", size);
return hplib_ERR_NOMEM;
}
if (hplib_mod_fd == -1)
{
- printf("hplib_utilModOpen error\n");
+ hplib_Log("hplib_utilModOpen error\n");
return -1;
}
return hplib_mod_fd;
{
hplib_utilModOpen();
}
- if (sched_setaffinity( gettid(), sizeof( cpu_set_t ), pSet ))
+ if (pSet && sched_setaffinity( gettid(), sizeof( cpu_set_t ), pSet ))
{
return hplib_FAILURE;
}
#include <stdlib.h>
#include <stdio.h>
+#include <stdint.h>
+#include <stdarg.h>
#include "hplib.h"
#include <unistd.h>
#include "hplibmod.h"
#include <ti/drv/sa/sa_osal.h>
#include <ti/runtime/pktlib/pktlib.h>
+#include <ti/drv/rm/rm_osal.h>
typedef struct osal_shm_Tag
{
hplib_spinLock_T cppi_lock;
hplib_spinLock_T sa_lock;
hplib_spinLock_T pktlib_lock;
+ hplib_spinLock_T rm_lock;
int init_done;
} osal_shm_T;
static __thread int our_core = 0;
static __thread HPLIB_SPINLOCK_IF_T* p_lock_if;
+uint32_t Osal_rm_MallocCounter = 0;
+uint32_t Osal_rm_FreeCounter = 0;
void* Osal_saGetSCPhyAddr(void* vaddr);
posalShm->cppi_lock = hplib_spinLock_UNLOCKED_INITIALIZER;
posalShm->sa_lock = hplib_spinLock_UNLOCKED_INITIALIZER;
posalShm->pktlib_lock = hplib_spinLock_UNLOCKED_INITIALIZER;
+ posalShm->rm_lock = hplib_spinLock_UNLOCKED_INITIALIZER;
posalShm->init_done = 1;
return retVal;
return;
}
+void *Osal_rmMalloc (uint32_t num_bytes)
+{
+ /* Increment the allocation counter. */
+ Osal_rm_MallocCounter++;
+
+ /* Allocate memory. */
+ return calloc(1, num_bytes);
+}
+
+void Osal_rmFree (void *ptr, uint32_t size)
+{
+ /* Increment the free counter. */
+ Osal_rm_FreeCounter++;
+ free(ptr);
+}
+
+void *Osal_rmCsEnter(void)
+{
+ return NULL;
+}
+
+void Osal_rmCsExit(void *CsHandle)
+{
+
+}
+
+void Osal_rmBeginMemAccess(void *ptr, uint32_t size)
+{
+ return;
+}
+
+void Osal_rmEndMemAccess(void *ptr, uint32_t size)
+{
+ return;
+}
+
+void *Osal_rmTaskBlockCreate(void)
+{
+ return(NULL);
+}
+
+void Osal_rmTaskBlock(void *handle)
+{
+
+}
+
+void Osal_rmTaskUnblock(void *handle)
+{
+
+}
+
+void Osal_rmTaskBlockDelete(void *handle)
+{
+
+}
+
+void Osal_rmLog (char *fmt, ... )
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+}
+
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+ return NULL;
+}
+
+
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
/* Internal Function used by hplib */
void* Osal_hplibCsEnter (void)
{
cpu_set_t cpu_set;
hplib_VirtMemPoolheader_T *poolHdr;
- pShmBase = hplib_shmOpen(SHM_SIZE);
+ pShmBase = hplib_shmOpen();
if(pShmBase == NULL)
{
printf("main: hplib_shmCreate failed\n");
break;
case(2): /* Shutdown */
- hplib_shmDelete(p);
+ hplib_shmDelete();
hplib_mod_fd=hplib_utilModOpen();
if (hplib_mod_fd == -1)
{
case(2): /* delete */
//fd = shmget(key, SHM_SIZE, 0666 );
- hplib_shmDelete(p);
+ hplib_shmDelete();
hplib_mod_fd=hplib_utilModOpen();
if (hplib_mod_fd == -1)
{