/* header include files (.h) */
-#include "envopt.h" /* environment options */
-#include "envdep.h" /* environment dependent */
-#include "envind.h" /* environment independent */
-#include "gen.h" /* general layer */
-#include "ssi.h" /* system services */
-#include "cm_mblk.h" /* Header file */
-
-/* header/extern include files (.x) */
-#include "gen.x" /* general layer */
-#include "ssi.x" /* system services */
-#include "cm_lib.x" /* Common library */
-#include "cm_mblk.x" /* Typedef file */
+#include "common_def.h" /* Header file */
#ifdef SS_LOCKLESS_MEMORY
-EXTERN pthread_t tmpRegTidMap[20];
+pthread_t tmpRegTidMap[20];
#define CM_MEM_GET_REGION(_region) \
{ \
- U8 _regCnt; \
+ uint8_t _regCnt; \
_region = 0xFF; \
\
for(_regCnt = 0; _regCnt < 12; _regCnt++) \
-PRIVATE Void cmAddMemNode ARGS((CmMemListCp *lCp,CmMemList *node));
+static Void cmAddMemNode ARGS((CmMemListCp *lCp,CmMemList *node));
\f
/*
*
*/
-#ifdef ANSI
S16 cmAllocEvnt
(
Size evntSize, /* Size of the Event structure */
Mem *sMem, /* Static memory region and pool */
Ptr *ptr /* Location to place allocated event ptr */
)
-#else
-S16 cmAllocEvnt (evntSize,maxBlkSize,sMem,ptr)
-Size evntSize; /* Size of the Event structure */
-Size maxBlkSize; /* Memory size requested */
-Mem *sMem; /* Static Memory region and pool */
-Ptr *ptr; /* Location to place allocated event ptr */
-#endif
{
Data *allocPtr; /* Allocated Memory Pointer */
#ifndef LTE_ENB_PAL
if( evntSize > maxBlkSize)
{
- printf("\nNot Allocating memory for Event\n");
+ DU_LOG("\nERROR --> Not Allocating memory for Event\n");
#ifdef ALIGN_64BIT
- printf("eventSize [%d] greater than maxBlkSize [%d]\n",
+ DU_LOG("\nERROR --> eventSize [%d] greater than maxBlkSize [%d]\n",
evntSize, maxBlkSize);
#else
- printf("eventSize [%ld] greater than maxBlkSize [%ld]\n",
+ DU_LOG("\nERROR --> eventSize [%ld] greater than maxBlkSize [%ld]\n",
evntSize, maxBlkSize);
#endif
return RFAILED;
/* Allocate memory for the first Memory Chunk */
/* Allocated memory should be maxBlkSize + sizeof(CmMemList) */
#ifdef SS_LOCKLESS_MEMORY
- if(SGetStaticBuffer(sMem->region, sMem->pool, (Data **)&allocPtr,
+ if(SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,sMem->region, sMem->pool, (Data **)&allocPtr,
(Size)(maxBlkSize + sizeof(CmMemList)), 0) != ROK)
#else
- if (SGetSBuf(sMem->region, sMem->pool,
+ if (SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,sMem->region, sMem->pool,
(Data **)&allocPtr,
(Size)(maxBlkSize + sizeof(CmMemList))) != ROK)
#endif /* SS_LOCKLESS_MEMORY */
*
*/
-#ifdef ANSI
Void cmInitMemCp
(
CmMemListCp *memCp, /* Memory control pointer */
Size maxBlkSize, /* Chunk Memory size */
Mem *sMem /* Static memory region and pool */
)
-#else
-Void cmInitMemCp (memCp,maxBlkSize,sMem)
-CmMemListCp *memCp; /* Memory control pointer */
-Size maxBlkSize; /* Memory size requested */
-Mem *sMem; /* Static Memory region and pool */
-#endif
{
-
/* Intialise Memory Control Point */
CM_INIT_MEMCP(memCp,maxBlkSize,sMem);
- RETVOID;
+ return;
} /* End of cmInitMemCp */
*
*/
-#ifdef ANSI
S16 cmGetMem
(
Ptr memPtr, /* Pointer to memCp */
Size size, /* Memory size requested */
Ptr *allocPtr /* location to place pointer */
)
-#else
-S16 cmGetMem (memPtr,size,allocPtr)
-Ptr memPtr; /* Pointer to memCp */
-Size size; /* Memory size requested */
-Ptr *allocPtr; /* location to place pointer */
-#endif
{
CmMemCb *cb; /* Pointer to Memory Control Block */
{
/* if a chunk is already there */
if( (cb->memAllocated + size) <=
- (U32)(cb->maxSize + sizeof(CmMemList)) )
+ (uint32_t)(cb->maxSize + sizeof(CmMemList)) )
{
/* Requested memory is available in present chunk */
*allocPtr = (Ptr) cb->runPtr;
/* Allocate buffer */
/* cm_mblk_c_001.101: use blkSize instead of cb->maxSize */
#ifdef SS_LOCKLESS_MEMORY
- if(SGetStaticBuffer(cb->sMem.region, cb->sMem.pool,
+ if(SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,cb->sMem.region, cb->sMem.pool,
(Data **)&(cb->initPtr),
(Size)(blkSize + sizeof(CmMemList)), 0) != ROK)
#else
- if (SGetSBuf(cb->sMem.region, cb->sMem.pool,
+ if (SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,cb->sMem.region, cb->sMem.pool,
(Data **)&(cb->initPtr),
(Size)(blkSize + sizeof(CmMemList)) ) != ROK)
#endif /* SS_LOCKLESS_MEMORY */
*
*/
-#ifdef ANSI
S16 cmAllocEvntNoInit
(
Size evntSize, /* Size of the Event structure */
Mem *sMem, /* Static memory region and pool */
Ptr *ptr /* Location to place allocated event ptr */
)
-#else
-S16 cmAllocEvntNoInit (evntSize,maxBlkSize,sMem,ptr)
-Size evntSize; /* Size of the Event structure */
-Size maxBlkSize; /* Memory size requested */
-Mem *sMem; /* Static Memory region and pool */
-Ptr *ptr; /* Location to place allocated event ptr */
-#endif
{
Data *allocPtr; /* Allocated Memory Pointer */
/* Allocate memory for the first Memory Chunk */
/* Allocated memory should be maxBlkSize + sizeof(CmMemList) */
#ifdef SS_LOCKLESS_MEMORY
- if(SGetStaticBuffer(sMem->region, sMem->pool, (Data **)&allocPtr,
+ if(SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,sMem->region, sMem->pool, (Data **)&allocPtr,
(Size)(maxBlkSize + sizeof(CmMemList)), 0) != ROK)
#else
- if (SGetSBuf(sMem->region, sMem->pool,
+ if (SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,sMem->region, sMem->pool,
(Data **)&allocPtr,
(Size)(maxBlkSize + sizeof(CmMemList))) != ROK)
#endif /* SS_LOCKLESS_MEMORY */
*
*/
-#ifdef ANSI
S16 cmGetMemNoInit
(
Ptr memPtr, /* Pointer to memCp */
Size size, /* Memory size requested */
Ptr *allocPtr /* location to place pointer */
)
-#else
-S16 cmGetMemNoInit (memPtr,size,allocPtr)
-Ptr memPtr; /* Pointer to memCp */
-Size size; /* Memory size requested */
-Ptr *allocPtr; /* location to place pointer */
-#endif
{
CmMemCb *cb; /* Pointer to Memory Control Block */
{
/* if a chunk is already there */
if( (cb->memAllocated + size) <=
- (U32)(cb->maxSize + sizeof(CmMemList)) )
+ (uint32_t)(cb->maxSize + sizeof(CmMemList)) )
{
/* Requested memory is available in present chunk */
*allocPtr = (Ptr) cb->runPtr;
- //memset(*allocPtr, (U8 )0,
+ //memset(*allocPtr, (uint8_t )0,
// (PTR)(size) );
cb->memAllocated += size;
cb->runPtr += size;
/* Allocate buffer */
/* cm_mblk_c_001.101: use blkSize instead of cb->maxSize */
#ifdef SS_LOCKLESS_MEMORY
- if(SGetStaticBuffer(cb->sMem.region, cb->sMem.pool,
+ if(SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,cb->sMem.region, cb->sMem.pool,
(Data **)&(cb->initPtr),
(Size)(blkSize + sizeof(CmMemList)), 0) != ROK)
#else
- if (SGetSBuf(cb->sMem.region, cb->sMem.pool,
+ if (SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,cb->sMem.region, cb->sMem.pool,
(Data **)&(cb->initPtr),
(Size)(blkSize + sizeof(CmMemList)) ) != ROK)
#endif /* SS_LOCKLESS_MEMORY */
*
*/
-#ifdef ANSI
Void cmFreeMem
(
Ptr memPtr /* Link List CP */
)
-#else
-Void cmFreeMem (memPtr)
-Ptr memPtr; /* Link List CP */
-#endif
{
Mem sMem; /* Static Memory region and pool */
S32 count; /* Count of linked blocks */
if( node )
{
#ifdef SS_LOCKLESS_MEMORY
- SPutStaticBuffer(sMem.region, sMem.pool,
+ SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,sMem.region, sMem.pool,
(Data *)node, (node->size + sizeof(CmMemList)), 0);
#else
- SPutSBuf(sMem.region,sMem.pool,
+ SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,sMem.region,sMem.pool,
(Data *)node, (node->size + sizeof(CmMemList)));
#endif /* SS_LOCKLESS_MEMORY */
}
count--;
}
- RETVOID;
+ return;
} /* End of cmFreeMem */
* File: cm_mblk.c
*
*/
-#ifdef ANSI
-PRIVATE Void cmAddMemNode
+static Void cmAddMemNode
(
CmMemListCp *lCp, /* list control point */
CmMemList *node /* node to be added */
)
-#else
-PRIVATE Void cmAddMemNode (lCp, node)
-CmMemListCp *lCp; /* list control point */
-CmMemList *node; /* node to be added */
-#endif
{
lCp->count++;
if (!node->prev)
{
lCp->first = node;
- RETVOID;
+ return;
}
node->prev->next = node;
- RETVOID;
+ return;
} /* end of cmAddMemNode */
*
*/
-#ifdef ANSI
Void cmGetMemStatus
(
Ptr memPtr, /* Memory control pointer */
CmMemStatus *status /* memory region,pool and status */
)
-#else
-Void cmGetMemStatus (memPtr,status)
-Ptr memPtr; /* Memory control pointer */
-CmMemStatus *status; /* memory region,pool and status */
-#endif
{
CmMemListCp *memCp; /* Memory Link List */
status->maxBlkSize = memCp->memCb.maxSize;
status->memAllocated = memCp->memCb.memAllocated;
- RETVOID;
+ return;
} /* End of cmGetMemStatus */