+/*******************************************************************
+ *
+ * @brief Fills Sp Cell Reconfig to be sent to scheduler
+ *
+ * @details
+ *
+ * Function : fillSpCellRecfg
+ *
+ * Functionality: Fills Sp Cell Reconfig to be sent to scheduler
+ *
+ * @params[in] macSpCellRecfg : SP cell Recfg at MAC
+ * schSpCellRecfg : SP cell Recfg to be filled
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillSpCellRecfg(SpCellRecfg macSpCellRecfg, SchSpCellRecfg *schSpCellRecfg)
+{
+ uint8_t idx;
+ SchServCellRecfgInfo *servCellRecfg;
+
+ schSpCellRecfg->servCellIdx = macSpCellRecfg.servCellIdx;
+ servCellRecfg = &schSpCellRecfg->servCellRecfg;
+
+ /* Fill initial DL BWP */
+ if(fillInitialDlBwp(macSpCellRecfg.servCellCfg.initDlBwp, \
+ &servCellRecfg->initDlBwp) != ROK )
+ {
+ DU_LOG("\nERROR --> MAC : fillInitialDlBwp() failed");
+ return RFAILED;
+ }
+
+ servCellRecfg->numDlBwpToAddOrMod = macSpCellRecfg.servCellCfg.numDlBwpToAddOrMod;
+ if(servCellRecfg->numDlBwpToAddOrMod > MAX_NUM_BWP)
+ {
+ DU_LOG("\nERROR --> MAC : Number of DL BWP to ADD/MOD [%d] exceeds max limit [%d]",\
+ servCellRecfg->numDlBwpToAddOrMod, MAX_NUM_BWP);
+ return RFAILED;
+ }
+ for(idx = 0; idx < servCellRecfg->numDlBwpToAddOrMod; idx++)
+ {
+ memcpy(&servCellRecfg->dlBwpToAddOrModList[idx], &macSpCellRecfg.servCellCfg.dlBwpToAddOrModList[idx], sizeof(DlBwpInfo));
+ }
+ servCellRecfg->numDlBwpToRel = macSpCellRecfg.servCellCfg.numDlBwpToRel;
+ if(servCellRecfg->numDlBwpToRel > MAX_NUM_BWP)
+ {
+ DU_LOG("\nERROR --> MAC : Number of DL BWP to RELEASE [%d] exceeds max limit [%d]",\
+ servCellRecfg->numDlBwpToRel, MAX_NUM_BWP);
+ return RFAILED;
+ }
+ for(idx = 0; idx < servCellRecfg->numDlBwpToRel; idx++)
+ {
+ memcpy(&servCellRecfg->dlBwpToRelList[idx], &macSpCellRecfg.servCellCfg.dlBwpToRelList[idx], sizeof(DlBwpInfo));
+ }
+ servCellRecfg->firstActvDlBwpId = macSpCellRecfg.servCellCfg.firstActvDlBwpId;
+ servCellRecfg->defaultDlBwpId = macSpCellRecfg.servCellCfg.defaultDlBwpId;
+ servCellRecfg->bwpInactivityTmr = NULL;
+ if(macSpCellRecfg.servCellCfg.bwpInactivityTmr)
+ {
+ /* TODO : This is an optional parameter, not filled currently */
+ }
+
+ /* Fill PDSCH serving cell config */
+ if(fillPdschServCellCfg(macSpCellRecfg.servCellCfg.pdschServCellCfg, \
+ &servCellRecfg->pdschServCellCfg) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : fillPdschServCellCfg() failed");
+ return RFAILED;
+ }
+
+ /* Fill Initail UL BWP */
+ if(fillInitialUlBwp(macSpCellRecfg.servCellCfg.initUlBwp, \
+ &servCellRecfg->initUlBwp) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : fillInitialUlBwp() failed");
+ return RFAILED;
+ }
+
+ servCellRecfg->numUlBwpToAddOrMod = macSpCellRecfg.servCellCfg.numUlBwpToAddOrMod;
+ if(servCellRecfg->numUlBwpToAddOrMod > MAX_NUM_BWP)
+ {
+ DU_LOG("\nERROR --> MAC : Number of UL BWP to ADD/MOD [%d] exceeds max limit [%d]",\
+ servCellRecfg->numUlBwpToAddOrMod, MAX_NUM_BWP);
+ return RFAILED;
+ }
+ for(idx = 0; idx < servCellRecfg->numUlBwpToAddOrMod; idx++)
+ {
+ memcpy(&servCellRecfg->ulBwpToAddOrModList[idx], &macSpCellRecfg.servCellCfg.ulBwpToAddOrModList[idx], sizeof(UlBwpInfo));
+ }
+ servCellRecfg->numUlBwpToRel = macSpCellRecfg.servCellCfg.numUlBwpToRel;
+ if(servCellRecfg->numUlBwpToRel > MAX_NUM_BWP)
+ {
+ DU_LOG("\nERROR --> MAC : Number of UL BWP to RELEASE [%d] exceeds max limit [%d]",\
+ servCellRecfg->numUlBwpToRel, MAX_NUM_BWP);
+ return RFAILED;
+ }
+ for(idx = 0; idx < servCellRecfg->numUlBwpToRel; idx++)
+ {
+ memcpy(&servCellRecfg->ulBwpToRelList[idx], &macSpCellRecfg.servCellCfg.ulBwpToRelList[idx], sizeof(UlBwpInfo));
+ }
+ servCellRecfg->firstActvUlBwpId = macSpCellRecfg.servCellCfg.firstActvUlBwpId;
+
+ return ROK;
+}
+