X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fmt%2Fss_rbuf.c;h=1da1b38c51fbdd226c69363dd98155d4096734ea;hb=65443172dd60a6ea312bd3a15959dbf54ad7f045;hp=51692915c56d87eccd20fd19e6009993767abdf9;hpb=4d45b914f9e94203603d3b9fdbcb1aad361301dd;p=o-du%2Fl2.git diff --git a/src/mt/ss_rbuf.c b/src/mt/ss_rbuf.c index 51692915c..1da1b38c5 100755 --- a/src/mt/ss_rbuf.c +++ b/src/mt/ss_rbuf.c @@ -39,19 +39,19 @@ #include "ss_rbuf.h" #include "ss_rbuf.x" -U32 ssRngBufStatus = 0; +uint32_t ssRngBufStatus = 0; /* Global Ring Loop Up Table */ SsRngBufTbl SsRngInfoTbl[SS_RNG_BUF_MAX]; -PUBLIC Void SsRngBufEnable(Void) +Void SsRngBufEnable(Void) { ssRngBufStatus = TRUE; } -PUBLIC Void SsRngBufDisable(Void) +Void SsRngBufDisable(Void) { ssRngBufStatus = FALSE; @@ -63,21 +63,21 @@ Desc: Creates Ring Buffer for the given Id. Region and Pool */ #ifdef ANSI -PUBLIC S16 SCreateSRngBuf +S16 SCreateSRngBuf ( -U32 id, +uint32_t id, Region region, Pool pool, -U32 elmSize, -U32 rngSize +uint32_t elmSize, +uint32_t rngSize ) #else -PUBLIC S16 SCreateSRngBuf (id, region, pool, elmSize, rngSize) -U32 id; +S16 SCreateSRngBuf (id, region, pool, elmSize, rngSize) +uint32_t id; Region region; Pool pool; -U32 elmSize; -U32 rngSize; +uint32_t elmSize; +uint32_t rngSize; #endif { SsRngBuf* ring; @@ -150,17 +150,17 @@ Desc: Attach the calling Entity to a ring buffer as consumer(Rx) or producer (Tx) */ #ifdef ANSI -PUBLIC S16 SAttachSRngBuf +S16 SAttachSRngBuf ( -U32 id, -U32 ent, -U32 txRx +uint32_t id, +uint32_t ent, +uint32_t txRx ) #else -PUBLIC S16 SAttachSRngBuf (id, ent, txRx) -U32 id; -U32 ent; -U32 txRx; +S16 SAttachSRngBuf (id, ent, txRx) +uint32_t id; +uint32_t ent; +uint32_t txRx; #endif { /* Retrive Buffer from Global Info Table */ @@ -204,15 +204,15 @@ Desc: Establish a pipe between producer and consumer */ #ifdef ANSI -PUBLIC S16 SConnectSRngBuf +S16 SConnectSRngBuf ( -U32 id, -U32 rxEnt +uint32_t id, +uint32_t rxEnt ) #else -PUBLIC S16 SConnectSRngBuf (id, rxEnt) -U32 id; -U32 rxEnt; +S16 SConnectSRngBuf (id, rxEnt) +uint32_t id; +uint32_t rxEnt; #endif { /* Send to Reciever ENT*/ @@ -251,7 +251,7 @@ inline static S16 IsEmpty(SsRngBuf* rBuf) return (rBuf->write == rBuf->read); } -PUBLIC S16 isRngEmpty(U32 id) +S16 isRngEmpty(uint32_t id) { return (IsEmpty(SsRngInfoTbl[id].r_addr)); } @@ -260,21 +260,21 @@ Func: SEnqSRngBuf Desc: Perform Queue operation on Ring bufer */ #ifdef ANSI -PUBLIC S16 SEnqSRngBuf +S16 SEnqSRngBuf ( -U32 id, +uint32_t id, Void* elem ) #else -PUBLIC S16 SEnqSRngBuf(id,elem) -U32 id; +S16 SEnqSRngBuf(id,elem) +uint32_t id; Void* elem; #endif { - U8* w_ptr; - U8 i=0; - U8 *element = (U8 *)elem; - U32 wrIndex; + uint8_t* w_ptr; + uint8_t i=0; + uint8_t *element = (uint8_t *)elem; + uint32_t wrIndex; /* TBD To replace id with ring addr when SAttachSRngBuf is used*/ /* Retrive Buffer from Id */ SsRngBuf* ring = SsRngInfoTbl[id].r_addr; @@ -284,13 +284,13 @@ Void* elem; return RFAILED; } /* TBD Avoid multiplication for optimisation */ - w_ptr = (U8*)ring->elem + (ring->write * ring->type); + w_ptr = (uint8_t*)ring->elem + (ring->write * ring->type); /* TBD Avoid for loop - use memcpy */ for( i=0; i < ring->type; i++) { - *(U8*)w_ptr = *(U8*)element; + *(uint8_t*)w_ptr = *(uint8_t*)element; w_ptr++; - (U8*)element++; + (uint8_t*)element++; } /* Increment write index */ wrIndex = ring->write + 1 ; @@ -301,13 +301,13 @@ Void* elem; } #ifdef ANSI -PUBLIC S16 SGetNumElemInRng +S16 SGetNumElemInRng ( -U32 id +uint32_t id ) #else -PUBLIC S16 SGetNumElemInRng (id) -U32 id; +S16 SGetNumElemInRng (id) +uint32_t id; #endif { @@ -320,21 +320,21 @@ Func: SDeqSRngBuf Desc: Perform DeQueue operation on Ring bufer */ #ifdef ANSI -PUBLIC S16 SDeqSRngBuf +S16 SDeqSRngBuf ( -U32 id, +uint32_t id, Void *elem ) #else -PUBLIC S16 SDeqSRngBuf (id,elem) -U8 id; +S16 SDeqSRngBuf (id,elem) +uint8_t id; Void *elem; #endif { - U8* r_ptr; - U8 i=0; - U8 *element = (U8 *)elem; - U32 rdIndex; + uint8_t* r_ptr; + uint8_t i=0; + uint8_t *element = (uint8_t *)elem; + uint32_t rdIndex; /* Retrive Buffer from Id*/ SsRngBuf* ring = SsRngInfoTbl[id].r_addr; if(IsEmpty(ring)) @@ -342,11 +342,11 @@ Void *elem; SsRngInfoTbl[id].nReadFail++; return RFAILED; } - r_ptr = (U8*)ring->elem + (ring->read * ring->type); + r_ptr = (uint8_t*)ring->elem + (ring->read * ring->type); for(i=0; itype; i++) { - *(U8*)element = *r_ptr; - (U8*)element++; + *(uint8_t*)element = *r_ptr; + (uint8_t*)element++; r_ptr++; } // Avoiding % operation for wrap around @@ -357,15 +357,15 @@ Void *elem; } #ifdef ANSI -PUBLIC S16 SDestroySRngBuf +S16 SDestroySRngBuf ( -U32 id, +uint32_t id, Region region, Pool pool ) #else -PUBLIC S16 SDestroySRngBuf(id, region, pool) -U32 id; +S16 SDestroySRngBuf(id, region, pool) +uint32_t id; Region region; Pool pool; #endif @@ -388,16 +388,16 @@ Pool pool; } #ifdef ANSI -PUBLIC S16 SPrintSRngStats +S16 SPrintSRngStats ( Void ) #else -PUBLIC S16 SPrintSRngStats () +S16 SPrintSRngStats () Void; #endif { -U32 i; +uint32_t i; Txt prntBuf[100]; @@ -462,13 +462,13 @@ U32 i; } #ifdef ANSI -PUBLIC Void* SRngGetWIndx +Void* SRngGetWIndx ( -U32 rngId +uint32_t rngId ) #else -PUBLIC Void* SRngGetWIndx (rngId) -U32 rngId; +Void* SRngGetWIndx (rngId) +uint32_t rngId; #endif { /* Retrive Buffer from Id*/ @@ -480,18 +480,18 @@ U32 rngId; } else { - return (((U8 *)ring->elem) + (ring->type * ring->write)); + return (((uint8_t *)ring->elem) + (ring->type * ring->write)); } } #ifdef ANSI -PUBLIC Void* SRngGetRIndx +Void* SRngGetRIndx ( -U32 rngId +uint32_t rngId ) #else -PUBLIC Void* SRngGetRIndx (rngId) -U32 rngId; +Void* SRngGetRIndx (rngId) +uint32_t rngId; #endif { /* Retrive Buffer from Id*/ @@ -503,21 +503,21 @@ U32 rngId; } else { - return (((U8 *)ring->elem) + (ring->type * ring->read)); + return (((uint8_t *)ring->elem) + (ring->type * ring->read)); } } #ifdef ANSI -PUBLIC Void SRngIncrWIndx +Void SRngIncrWIndx ( -U32 rngId +uint32_t rngId ) #else -PUBLIC Void SRngIncrWIndx (rngId) -U32 rngId; +Void SRngIncrWIndx (rngId) +uint32_t rngId; #endif { - U32 wrIndex; + uint32_t wrIndex; /* Retrive Buffer from Id*/ SsRngBuf* ring = SsRngInfoTbl[rngId].r_addr; wrIndex = ring->write + 1; @@ -527,16 +527,16 @@ U32 rngId; } #ifdef ANSI -PUBLIC Void SRngIncrRIndx +Void SRngIncrRIndx ( -U32 rngId +uint32_t rngId ) #else -PUBLIC Void SRngIncrRIndx (rngId) -U32 rngId; +Void SRngIncrRIndx (rngId) +uint32_t rngId; #endif { - U32 rdIndex; + uint32_t rdIndex; /* Retrive Buffer from Id*/ SsRngBuf* ring = SsRngInfoTbl[rngId].r_addr; rdIndex = ring->read + 1; @@ -546,7 +546,7 @@ U32 rngId; } #ifdef XEON_SPECIFIC_CHANGES #if (defined (MAC_FREE_RING_BUF) || defined (RLC_FREE_RING_BUF)) -S16 mtAddBufToRing(SsRngBufId ringId,void *bufPtr,U8 freeType) +S16 mtAddBufToRing(SsRngBufId ringId,void *bufPtr,uint8_t freeType) { S16 ret1 = ROK;