[JIRA ID: ODUHIGH-242] RB configuration for Ue Context Setup for RLC
[o-du/l2.git] / src / cm / common_def.c
index 978d0e7..867a9c4 100644 (file)
@@ -23,7 +23,7 @@
  *
  * @details
  *
- *     Function: schAllocFreqDomRscType0
+ *     Function: freqDomRscAllocType0
  *     
  *     This function does allocation in frequency domain resource.
  *     This is a bitmap defining  non-overlapping groups of 6 PRBs in ascending order.
@@ -33,7 +33,7 @@
  *  @param[in]  freqDomain - 6 bytes of info, each bit represents a group of 6 PRB.
  *  @return   void
  **/
-void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
+void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
 {
    uint8_t remBits = prbSize; /* each bit represents 6 PRBs */
    uint8_t firstByte = 1;
@@ -75,6 +75,37 @@ 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 *)&copyLen);
+}
 
 
 /**********************************************************************