X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fcm%2Fcommon_def.c;h=70c35ad84160d3178a240caaacb30f6a0bffc6e7;hb=694adde1a08c393a8443fd5bbd4f036f5cf85403;hp=978d0e76a4adbd89ad4598442e42d35f3abf9ce3;hpb=6b44407d464a5a4e060999255233a7cfe78bb0fa;p=o-du%2Fl2.git diff --git a/src/cm/common_def.c b/src/cm/common_def.c index 978d0e76a..70c35ad84 100644 --- a/src/cm/common_def.c +++ b/src/cm/common_def.c @@ -75,6 +75,38 @@ void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqD } } +/******************************************************************* + * + * @brief Reverse and copy fixed buffer to mBuf + * + * @details + * + * Function : oduCpyFixBufToMsg + * + * Functionality: Reverse and copy fixed buffer to mBuf + * + * @params[in] Fixed buffer, msg buffer, length of message + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len) +{ + uint8_t idx, revIdx, temp; + uint16_t copyLen; + + /* ODU_COPY_FIX_BUF_TO_MSG copies fixed buffer in reverse order. \ + * Hence reversing the fixed buffer before copying in order to \ + * maintain the actual order*/ + for(idx = 0, revIdx = len-1; idx < len/2; idx++, revIdx--) + { + temp = fixBuf[idx]; + fixBuf[idx] = fixBuf[revIdx]; + fixBuf[revIdx] = temp; + } + ODU_COPY_FIX_BUF_TO_MSG(fixBuf, mBuf, 0, len, (MsgLen *)©Len); +} + /**********************************************************************