X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fmt%2Fss_gen.c;h=d7ef85650fa5d199c9410431ff3547ff4757443b;hb=22b9cbea0d857b740c9e7268e61262ac9c0c9bdc;hp=6b594bbe131346ab2f59f87c6e4d600e294a9283;hpb=5d74fef7c9fe6b65a965ceac6bfe812872dab323;p=o-du%2Fl2.git diff --git a/src/mt/ss_gen.c b/src/mt/ss_gen.c index 6b594bbe1..d7ef85650 100644 --- a/src/mt/ss_gen.c +++ b/src/mt/ss_gen.c @@ -110,41 +110,41 @@ /*ss014.301: SSI-4GMX related changes*/ #ifdef SS_4GMX_LCORE -VOLATILE SsOs osCp; /* common OS control point */ +volatile SsOs osCp; /* common OS control point */ #else SsOs osCp; /* common OS control point */ #endif -EXTERN Cntr cfgNumRegs; -EXTERN SsRegCfg cfgRegInfo[SS_MAX_REGS]; +Cntr cfgNumRegs; +SsRegCfg cfgRegInfo[SS_MAX_REGS]; /* ss029.103: modification: multiple procId related changes */ #ifdef SS_MULTIPLE_PROCS -/* PRIVATE functions */ -PRIVATE S16 SInsProcId ARGS((ProcId proc)); -PRIVATE S16 SRemProcId ARGS((ProcId proc)); -PRIVATE S16 SLockOsCp ARGS((Void)); -PRIVATE S16 SULockOsCp ARGS((Void)); +/* static functions */ +static S16 SInsProcId ARGS((ProcId proc)); +static S16 SRemProcId ARGS((ProcId proc)); +static S16 SLockOsCp ARGS((Void)); +static S16 SULockOsCp ARGS((Void)); #endif /* SS_MULTIPLE_PROCS */ #ifdef SSI_STATIC_MEM_LEAK_DETECTION -PRIVATE void InitializeForStaticMemLeak ARGS((void)); -PRIVATE void InitializeStaticMemAllocInfo ARGS((StaticMemAllocInfo* memAllocInfo)); -U32 GetNextFreeIdx ARGS((StaticMemAllocInfo * memAllocInfo)); -void FreeIdx ARGS((U8* ptr, U32 idx, StaticMemAllocInfo* memAllocInfo,U32 size, char* - file, U32 line)); +static void InitializeForStaticMemLeak ARGS((void)); +static void InitializeStaticMemAllocInfo ARGS((StaticMemAllocInfo* memAllocInfo)); +uint32_t GetNextFreeIdx ARGS((StaticMemAllocInfo * memAllocInfo)); +void FreeIdx ARGS((uint8_t* ptr, uint32_t idx, StaticMemAllocInfo* memAllocInfo,uint32_t size, char* + file, uint32_t line)); void LogForStaticMemLeak ARGS((StaticMemAllocInfo* memAllocInfo, char* file, - U32 line, U32 size, void* ptr, U32 idx)); -PRIVATE void PrintStaticMemAllocInfo ARGS((StaticMemAllocInfo* memAllocInfo, FILE + uint32_t line, uint32_t size, void* ptr, uint32_t idx)); +static void PrintStaticMemAllocInfo ARGS((StaticMemAllocInfo* memAllocInfo, FILE *opFile)); #endif /* ss001.301: additions */ void DumpSSIDemandQDebugInformation() { - U32 i,j; + uint32_t i,j; RTLIN_DUMP_DEBUG("Demand Q Information\n"); RTLIN_DUMP_DEBUG("====================\n"); for(i = 0; i < osCp.numSTsks; i++) @@ -169,7 +169,7 @@ Void mtSigSegvHndlr() { int i; - printf("Backtrace for thread Id (%lu) total threads = %d\n", (unsigned long) pthread_self(), osCp.numSTsks); + printf("\nBacktrace for thread Id (%lu) total threads = %d\n", (unsigned long) pthread_self(), osCp.numSTsks); ysPrntBkTrace(); for(i = 0; i < osCp.numSTsks; i++) { @@ -185,7 +185,7 @@ Void mtSigSegvHndlr() Void mtSigUsr2Hndlr() { - printf("Backtrace for thread Id (%lu) cause:SIGUSR2(%d)\n",(unsigned long) pthread_self(),SIGUSR2); + printf("\nBacktrace for thread Id (%lu) cause:SIGUSR2(%d)\n",(unsigned long) pthread_self(),SIGUSR2); pthread_mutex_lock(&dumpingLock); ysPrntBkTrace(); @@ -216,14 +216,7 @@ Void mtSigUsr2Hndlr() * File: ss_gen.c * */ -#ifdef ANSI -S16 SInit -( -void -) -#else -S16 SInit() -#endif +S16 SInit(void) { S16 ret; REG1 S16 i; @@ -645,7 +638,7 @@ S16 SInit() #ifdef SS_FBSED_TSK_REG /* Configure task registration based on the configuration */ /*ss013.301 : Fixed warnings for 32/64 bit compilation*/ - cmCfgrTskReg((U8 *)"task_info.t"); + cmCfgrTskReg((uint8_t *)"task_info.t"); #endif /* SS_FBSED_TSK_REG */ /*ss011.301 : RMIOS release related changes*/ @@ -743,17 +736,10 @@ cleanup0: * File: ss_gen.c * */ -#ifdef ANSI -S16 SDeInit -( -void -) -#else -S16 SDeInit() -#endif +S16 SDeInit(void) { /* ss007.301 */ - U16 regCnt; + uint16_t regCnt; ssdDeinitTmr(); @@ -805,19 +791,14 @@ S16 SDeInit() } /* ss001.301: additions */ #ifdef SS_LOGGER_SUPPORT -#ifdef ANSI S16 SWrtLogBuf ( Txt *buf /* buffer */ ) -#else -S16 SWrtLogBuf(buf) -Txt *buf; /* buffer */ -#endif { S16 bufSz; /* buffer synchronisation*/ - bufSz = cmStrlen((U8 *)buf); + bufSz = cmStrlen((uint8_t *)buf); SLock(&osCp.logger.bufLock); if(osCp.logger.started == FALSE) { @@ -866,15 +847,10 @@ Txt *buf; /* buffer */ * File: ss_gen.c * */ -#ifdef ANSI S16 SPrint ( Txt *buf /* buffer */ ) -#else -S16 SPrint(buf) -Txt *buf; /* buffer */ -#endif { /* ss001.301: additions */ @@ -903,17 +879,11 @@ Txt *buf; /* buffer */ * File: ss_gen.c * */ -#ifdef ANSI S16 SError ( Seq seq, /* sequence */ Reason reason /* reason */ ) -#else -S16 SError(seq, reason) -Seq seq; /* sequence */ -Reason reason; /* reason */ -#endif { S16 ret; DateTime dt; @@ -946,7 +916,6 @@ Reason reason; /* reason */ * File: ss_gen.c * */ -#ifdef ANSI Void SLogError ( Ent ent, /* Calling layer's entity id */ @@ -959,19 +928,6 @@ ErrCode errCode, /* layer unique error code */ ErrVal errVal, /* error value */ Txt *errDesc /* description of error */ ) -#else -Void SLogError(ent, inst, procId, file, line, - errCls, errCode, errVal, errDesc) -Ent ent; /* Calling layer's entity id */ -Inst inst; /* Calling layer's instance id */ -ProcId procId; /* Calling layer's processor id */ -Txt *file; /* file name where error occured */ -S32 line; /* line in file where error occured */ -ErrCls errCls; /* error class */ -ErrCode errCode; /* layer unique error code */ -ErrVal errVal; /* error value */ -Txt *errDesc; /* description of error */ -#endif { DateTime dt; Txt errBuf[512]; @@ -995,7 +951,7 @@ Txt *errDesc; /* description of error */ errCls, errCode, errVal, errDesc); - RETVOID; + return; } /* ss029.103: modification: @@ -1015,14 +971,7 @@ Txt *errDesc; /* description of error */ * File: ss_gen.c * */ -#ifdef ANSI -ProcId SFndProcId -( -void -) -#else -ProcId SFndProcId() -#endif +ProcId SFndProcId(void) { return (osCp.procId); @@ -1042,20 +991,12 @@ ProcId SFndProcId() * File: ss_gen.c * */ -#ifdef ANSI -Void SSetProcId -( -ProcId procId -) -#else -Void SSetProcId(procId) -ProcId procId; -#endif +Void SSetProcId(ProcId procId) { osCp.procId = procId; - RETVOID; + return; } #endif /* SS_MULTIPLE_PROCS */ @@ -1076,18 +1017,10 @@ ProcId procId; * File: ss_gen.c * */ -#ifdef ANSI -U16 SGetProcIdIdx -( -ProcId proc -) -#else -U16 SGetProcIdIdx(proc) -ProcId proc; -#endif +uint16_t SGetProcIdIdx(ProcId proc) { - U16 i; - U16 idx; + uint16_t i; + uint16_t idx; idx = SS_HASH_IDX(proc); @@ -1117,18 +1050,10 @@ ProcId proc; * File: ss_gen.c * */ -#ifdef ANSI -PRIVATE S16 SInsProcId -( -ProcId proc -) -#else -PRIVATE S16 SInsProcId(proc) -ProcId proc; -#endif +static S16 SInsProcId(ProcId proc) { - U16 i; - U16 idx; + uint16_t i; + uint16_t idx; idx = SS_HASH_IDX(proc); @@ -1167,18 +1092,10 @@ ProcId proc; * File: ss_gen.c * */ -#ifdef ANSI -PRIVATE S16 SRemProcId -( -ProcId proc -) -#else -PRIVATE S16 SRemProcId(proc) -ProcId proc; -#endif +static S16 SRemProcId(ProcId proc) { - U16 i; - U16 idx; + uint16_t i; + uint16_t idx; idx = SS_HASH_IDX(proc); @@ -1217,14 +1134,7 @@ ProcId proc; * File: ss_gen.c * */ -#ifdef ANSI -PRIVATE S16 SLockOsCp -( -Void -) -#else -PRIVATE S16 SLockOsCp(Void) -#endif +static S16 SLockOsCp(void) { S16 ret; @@ -1276,14 +1186,7 @@ PRIVATE S16 SLockOsCp(Void) * File: ss_gen.c * */ -#ifdef ANSI -PRIVATE S16 SULockOsCp -( -Void -) -#else -PRIVATE S16 SULockOsCp(Void) -#endif +static S16 SULockOsCp(Void) { /* unlock the table */ @@ -1317,19 +1220,9 @@ PRIVATE S16 SULockOsCp(Void) * File: ss_gen.c * */ -#ifdef ANSI -S16 SAddProcIdLst -( -U16 numPIds, -ProcId *pIdLst -) -#else -S16 SAddProcIdLst(numPIds, pIdLst) -U16 numPIds; -ProcId *pIdLst; -#endif +S16 SAddProcIdLst(uint16_t numPIds,ProcId *pIdLst) { - U16 i; + uint16_t i; S16 ret; @@ -1412,19 +1305,9 @@ exceeds"); * File: ss_gen.c * */ -#ifdef ANSI -S16 SRemProcIdLst -( -U16 numPIds, -ProcId *pIdLst -) -#else -S16 SRemProcIdLst(numPIds, pIdLst) -U16 numPIds; -ProcId *pIdLst; -#endif +S16 SRemProcIdLst(uint16_t numPIds,ProcId *pIdLst) { - U16 i; + uint16_t i; #if (ERRCLASS & ERRCLS_INT_PAR) @@ -1476,20 +1359,10 @@ ProcId *pIdLst; * File: ss_gen.c * */ -#ifdef ANSI -S16 SGetProcIdLst -( -U16 *numPIds, -ProcId *pIdLst -) -#else -S16 SGetProcIdLst(numPIds, pIdLst) -U16 *numPIds; -ProcId *pIdLst; -#endif +S16 SGetProcIdLst(uint16_t *numPIds,ProcId *pIdLst) { - U16 i; - U16 count = 0; + uint16_t i; + uint16_t count = 0; #if (ERRCLASS & ERRCLS_INT_PAR) @@ -1535,7 +1408,6 @@ ProcId *pIdLst; * File: ss_gen.c * */ -#ifdef ANSI S16 SGetXxCb ( ProcId proc, @@ -1543,15 +1415,8 @@ Ent ent, Inst inst, Void **xxCb ) -#else -S16 SGetXxCb(proc, ent, inst, xxCb) -ProcId proc; -Ent ent; -Inst inst; -Void **xxCb; -#endif { - U16 procIdIdx; + uint16_t procIdIdx; SsIdx idx; @@ -1612,17 +1477,10 @@ Void **xxCb; * File: ss_gen.c * */ -#ifdef ANSI -S16 SFillEntIds -( -Void -) -#else S16 SFillEntIds(Void) -#endif { - U8 entInfo[26][26] = { + uint8_t entInfo[26][26] = { /* A B C D E F G H I J K * L M N O P Q R S T U V * W X Y Z */ @@ -1783,7 +1641,7 @@ S16 SFillEntIds(Void) }; /*ss013.301 :Adding TRC MACRO*/ - memcpy((U8*)osCp.entId, (U8*)entInfo, sizeof(entInfo)); + memcpy(osCp.entId, entInfo, sizeof(entInfo)); return ROK; } /* SFillEntIds */ @@ -1804,33 +1662,23 @@ S16 SFillEntIds(Void) * * */ -#ifdef ANSI -S16 SGetEntInd -( -Ent *entId, -U8 *fileName -) -#else -S16 SGetEntInd(entId, fileName) -Ent *entId; -U8 *fileName; -#endif +S16 SGetEntInd(Ent *entId,uint8_t *fileName) { - U8 *letter = NULLP; + uint8_t *letter = NULLP; /* ss002.301 Additions */ S8 *strippedName = NULLP; - U8 count = 0; - U8 tempIdx = 0; - U8 firstIdx = 0; - U8 secondIdx = 0; + uint8_t count = 0; + uint8_t tempIdx = 0; + uint8_t firstIdx = 0; + uint8_t secondIdx = 0; /* ss002.301 Additions */ if ((strippedName = strrchr((const char *)fileName, '/'))) { - fileName = (U8 *)strippedName + 1; + fileName = (uint8_t *)strippedName + 1; } if(fileName[0] =='l' && fileName[3] == '.') @@ -1909,18 +1757,7 @@ U8 *fileName; * File: mt_ss.c * */ -#ifdef ANSI -S16 SLockNew -( -SLockInfo *lockId, -U8 lockType - -) -#else -S16 SLockNew(lockId, lockType) -SLockInfo *lockId; -U8 lockType; -#endif +S16 SLockNew(SLockInfo *lockId,uint8_t lockType) { S16 retVal = ROK; @@ -1946,17 +1783,7 @@ U8 lockType; * File: mt_ss.c * */ -#ifdef ANSI -S16 SInitLockNew -( -SLockInfo *lockId, -U8 lockType -) -#else -S16 SInitLockNew(lockId, lockType) -SLockInfo *lockId; -U8 lockType; -#endif +S16 SInitLockNew(SLockInfo *lockId,uint8_t lockType) { S16 retVal = ROK; @@ -1982,17 +1809,7 @@ U8 lockType; * File: mt_ss.c * */ -#ifdef ANSI -S16 SUnlockNew -( -SLockInfo *lockId, -U8 lockType -) -#else -S16 SUnlockNew(lockId, lockType) -SLockInfo *lockId; -U8 lockType; -#endif +S16 SUnlockNew(SLockInfo *lockId,uint8_t lockType) { S16 retVal = ROK; @@ -2018,17 +1835,7 @@ U8 lockType; * File: mt_ss.c * */ -#ifdef ANSI -S16 SDestroyLockNew -( -SLockInfo *lockId, -U8 lockType -) -#else -S16 SDestroyLockNew(lockId, lockType) -SLockInfo *lockId; -U8 lockType; -#endif +S16 SDestroyLockNew(SLockInfo *lockId,uint8_t lockType) { S16 retVal = ROK; @@ -2044,8 +1851,8 @@ U8 lockType; #ifdef SSI_STATIC_MEM_LEAK_DETECTION /* Static memory leak detection changes */ -static U32 StaticMemLeakAge; -static U32 StaticMemLeakIntCount = 1; +static uint32_t StaticMemLeakAge; +static uint32_t StaticMemLeakIntCount = 1; void PrintStaticMemAllocInfo(StaticMemAllocInfo* memAllocInfo, FILE *opFile) { @@ -2071,7 +1878,7 @@ void PrintStaticMemAllocInfo(StaticMemAllocInfo* memAllocInfo, FILE *opFile) void InitializeStaticMemAllocInfo(StaticMemAllocInfo* memAllocInfo) { - U32 i; + uint32_t i; /* index 0 is not used; nextIdx as 0 means end of list */ memAllocInfo->nextFreeIdx = 1; @@ -2085,15 +1892,15 @@ void InitializeStaticMemAllocInfo(StaticMemAllocInfo* memAllocInfo) memAllocInfo->allocations[MAX_MEM_ALLOCATIONS - 1].listInfo.nextIdx = 0; } -U32 GetNextFreeIdx(StaticMemAllocInfo * memAllocInfo) +uint32_t GetNextFreeIdx(StaticMemAllocInfo * memAllocInfo) { - U32 toBeReturned = memAllocInfo->nextFreeIdx; + uint32_t toBeReturned = memAllocInfo->nextFreeIdx; - U32 newNextFreeIdx = memAllocInfo->allocations[memAllocInfo->nextFreeIdx].listInfo.nextIdx; + uint32_t newNextFreeIdx = memAllocInfo->allocations[memAllocInfo->nextFreeIdx].listInfo.nextIdx; if(newNextFreeIdx == 0 || newNextFreeIdx >= MAX_MEM_ALLOCATIONS) { - printf("Something wrong in GetNextFreeIdx newNextIdx = %ld\n",newNextFreeIdx); + printf("\nSomething wrong in GetNextFreeIdx newNextIdx = %ld\n",newNextFreeIdx); } memAllocInfo->nextFreeIdx = newNextFreeIdx; @@ -2102,7 +1909,7 @@ U32 GetNextFreeIdx(StaticMemAllocInfo * memAllocInfo) } #define CRASH_ENB {int *p = 0; *p = 100;} -void FreeIdx(U8* ptr, U32 idx, StaticMemAllocInfo* memAllocInfo,U32 size, char* file, U32 line) +void FreeIdx(uint8_t* ptr, uint32_t idx, StaticMemAllocInfo* memAllocInfo,uint32_t size, char* file, uint32_t line) { if(idx == 0 || idx >= MAX_MEM_ALLOCATIONS) { @@ -2118,7 +1925,7 @@ void FreeIdx(U8* ptr, U32 idx, StaticMemAllocInfo* memAllocInfo,U32 size, char* CRASH_ENB #endif - printf("Freeing wrong ptr stored = %p trying to free %p freeing size (%ld)" + printf("\nFreeing wrong ptr stored = %p trying to free %p freeing size (%ld)" "allocated size(%ld) from %s:%ld\n", memAllocInfo->allocations[idx].ptr, ptr, @@ -2126,8 +1933,8 @@ CRASH_ENB memAllocInfo->allocations[idx].size, file, line); - printf("Allocation was done from %s:%ld\n",memAllocInfo->allocations[idx].file, memAllocInfo->allocations[idx].lineNo); - printf("***********************************************************\n"); + printf("\nAllocation was done from %s:%ld\n",memAllocInfo->allocations[idx].file, memAllocInfo->allocations[idx].lineNo); + printf("\n***********************************************************\n"); CRASH_ENB } @@ -2137,7 +1944,7 @@ CRASH_ENB } -void LogForStaticMemLeak(StaticMemAllocInfo* memAllocInfo, char* file, U32 line, U32 size, void* ptr, U32 idx) +void LogForStaticMemLeak(StaticMemAllocInfo* memAllocInfo, char* file, uint32_t line, uint32_t size, void* ptr, uint32_t idx) { memAllocInfo->allocations[idx].file = file; @@ -2167,7 +1974,7 @@ void InitializeForStaticMemLeak() StaticMemLeakFileArr[3] == NULL) { int *p = 0; - printf("Could not open files for Static Mem Leak detection logging :( crashing...\n"); + printf("\nCould not open files for Static Mem Leak detection logging :( crashing...\n"); *p = 100; } @@ -2203,16 +2010,9 @@ void DumpStaticMemLeakFiles() * File: mt_ss.c * */ -#ifdef ANSI -S16 SReInitTmr -( -void -) -#else -S16 SReInitTmr() -#endif +S16 SReInitTmr(void) { - U8 ret = ROK; + uint8_t ret = ROK; Txt prntBuf[PRNTSZE]; sprintf(prntBuf, "\n SReInitTmr(): ReStarting the Tmr\n");