X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_utils.c;h=84a2e7ef8dd80b8f591747cee3e58ba0faed6803;hb=c1e93b027631a245fc6791ea1052da5b905b4d8c;hp=34aa8461e8a3f571ce4cbd7c57fb59905d712e9c;hpb=8d2a8abdf446c7c7669f03247b4c21c99cb5cc0c;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_utils.c b/src/5gnrsch/sch_utils.c index 34aa8461e..84a2e7ef8 100644 --- a/src/5gnrsch/sch_utils.c +++ b/src/5gnrsch/sch_utils.c @@ -2005,6 +2005,74 @@ void fillCqiAggLvlMapping(SchPdcchInfo *pdcchInfo) } } +/* + * @brief Function to calculate Value Y + * + * Function: schCalY + * + * Calculates value of YpKp as per [10.1,TS38.213]. + * A0 is for first CS, A1 for second CS and A2 is for third CS + * + * @params[in]: coresetId and Previous Y + * */ +uint32_t schCalY(uint8_t csId, uint32_t prevY) +{ + uint32_t A0 = 39827, A1 = 39829, A2 = 39839; + uint32_t D = 65537; + + switch(csId % 3) + { + case 0: + { + return((A0 * prevY) % D); + } + case 1: + { + return((A1 * prevY) % D); + } + case 2: + { + return((A2 * prevY) % D); + } + default: + { + DU_LOG("\nERROR --> SCH: Issue in calculating value of Y"); + return(0); + } + } + return 0; +} + +/* + * @brief Function to calculate the value Y used for CCE Index formula + * + * Function: schUpdValY + * + * As per Spec 38.213, Sec 10.1 Formula for CCE Index contains a coefficient + * value called 'Y' and storing the same in the ueCb which will be later used + * in pdcch allocation + * + * @params[in] : SchUeCb, PdcchInfo + * + * */ +void schUpdValY(SchUeCb *ueCb, SchPdcchInfo *pdcchInfo) +{ + uint8_t slotIdx = 0; + + SCH_ALLOC(pdcchInfo->y, (sizeof(uint32_t) * ueCb->cellCb->numSlots)); + + for(slotIdx= 0 ; slotIdx < ueCb->cellCb->numSlots; slotIdx++) + { + if(slotIdx == 0) + { + pdcchInfo->y[slotIdx] = schCalY(pdcchInfo->cRSetRef->cRSetId, ueCb->crnti); + } + else + { + pdcchInfo->y[slotIdx] = schCalY(pdcchInfo->cRSetRef->cRSetId, pdcchInfo->y[slotIdx - 1]); + } + } +} /********************************************************************** End of file **********************************************************************/