X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fcm_mblk.c;h=02dbe20135c162cc608fce8b5d5372948070cf62;hb=3330932565e15a749fd5dd5039cdea2862ca51cc;hp=b46d8b2e19e4fc6fe694096809387d055192d66b;hpb=9c8b78da0f4ef42dae5e30a3061463b81327e7a0;p=o-du%2Fl2.git diff --git a/src/cm/cm_mblk.c b/src/cm/cm_mblk.c index b46d8b2e1..02dbe2013 100644 --- a/src/cm/cm_mblk.c +++ b/src/cm/cm_mblk.c @@ -44,10 +44,10 @@ #include "cm_mblk.x" /* Typedef 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++) \ @@ -63,7 +63,7 @@ EXTERN pthread_t tmpRegTidMap[20]; -PRIVATE Void cmAddMemNode ARGS((CmMemListCp *lCp,CmMemList *node)); +static Void cmAddMemNode ARGS((CmMemListCp *lCp,CmMemList *node)); /* @@ -83,7 +83,6 @@ PRIVATE Void cmAddMemNode ARGS((CmMemListCp *lCp,CmMemList *node)); * */ -#ifdef ANSI S16 cmAllocEvnt ( Size evntSize, /* Size of the Event structure */ @@ -91,13 +90,6 @@ Size maxBlkSize, /* Chunk Memory size */ 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 */ @@ -110,12 +102,12 @@ Ptr *ptr; /* Location to place allocated event ptr */ #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; @@ -199,26 +191,18 @@ Ptr *ptr; /* Location to place allocated event ptr */ * */ -#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 */ @@ -238,19 +222,12 @@ Mem *sMem; /* Static Memory region and pool */ * */ -#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 */ @@ -280,7 +257,7 @@ Ptr *allocPtr; /* location to place pointer */ { /* 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; @@ -356,7 +333,6 @@ Ptr *allocPtr; /* location to place pointer */ * */ -#ifdef ANSI S16 cmAllocEvntNoInit ( Size evntSize, /* Size of the Event structure */ @@ -364,13 +340,6 @@ Size maxBlkSize, /* Chunk Memory size */ 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 */ @@ -459,19 +428,12 @@ Ptr *ptr; /* Location to place allocated event ptr */ * */ -#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 */ @@ -501,11 +463,11 @@ Ptr *allocPtr; /* location to place pointer */ { /* 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; @@ -578,15 +540,10 @@ Ptr *allocPtr; /* location to place pointer */ * */ -#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 */ @@ -632,7 +589,7 @@ Ptr memPtr; /* Link List CP */ count--; } - RETVOID; + return; } /* End of cmFreeMem */ @@ -650,17 +607,11 @@ Ptr memPtr; /* Link List CP */ * 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++; @@ -672,11 +623,11 @@ CmMemList *node; /* node to be added */ if (!node->prev) { lCp->first = node; - RETVOID; + return; } node->prev->next = node; - RETVOID; + return; } /* end of cmAddMemNode */ @@ -697,17 +648,11 @@ CmMemList *node; /* node to be added */ * */ -#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 */ @@ -722,7 +667,7 @@ CmMemStatus *status; /* memory region,pool and status */ status->maxBlkSize = memCp->memCb.maxSize; status->memAllocated = memCp->memCb.memAllocated; - RETVOID; + return; } /* End of cmGetMemStatus */