From d75d1b078091768f45b83f2a745a25917e03b39d Mon Sep 17 00:00:00 2001 From: "lal.harshita" Date: Fri, 19 Mar 2021 18:05:44 +0530 Subject: [PATCH] Enabled timer at MAC and SCH [Issue-ID: ODUHIGH-283] Change-Id: Iaa82fe3cecf7c8a0e755ffc6c5ceba400ecf6bc4 Signed-off-by: lal.harshita --- src/5gnrmac/mac.h | 7 +++++ src/5gnrmac/mac_tmr.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ src/5gnrmac/rg_lmm.c | 43 ++++++-------------------- src/5gnrsch/rg_sch_lmm.c | 29 ------------------ src/5gnrsch/sch.c | 8 ++--- src/5gnrsch/sch.h | 8 +++-- src/5gnrsch/sch_tmr.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 179 insertions(+), 69 deletions(-) create mode 100644 src/5gnrmac/mac_tmr.c create mode 100644 src/5gnrsch/sch_tmr.c diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index 6c27527b6..e04e13afe 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -25,6 +25,8 @@ #define MAX_NUM_HARQ_PROC 16 #define MAX_SLOT_SUPPORTED 10 /* numerology 0 15Khz */ #define MAX_ZERO_CORR_CFG_IDX 16 /* max zero correlation config index */ +#define MAC_TQ_SIZE 10 /* Timing Queue Size */ +#define MAX_NUM_TIMER 1 /* MAX number of MAC timers */ #define DEFAULT_CELLS 1 #define SI_RNTI 0xFFFF @@ -193,6 +195,10 @@ typedef struct macCb { Inst macInst; ProcId procId; + uint8_t tmrRes; /*!< Timer resolution */ + CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */ + CmTqType tmrTq[MAC_TQ_SIZE]; /*!< Timer Task Queue */ + CmTimer tmrBlk[MAX_NUM_TIMER]; /*!< Timer Block */ MacCellCb *macCell[MAX_NUM_CELL]; }MacCb; @@ -200,6 +206,7 @@ typedef struct macCb MacCb macCb; /* Function declarations */ +short int macActvTmr(Ent ent,Inst inst); void fillRarPdu(RarInfo *rarInfo); void createMacRaCb(RachIndInfo *rachIndInfo); void fillMsg4DlData(MacDlData *dlData, uint16_t msg4PduLen, uint8_t *msg4Pdu); diff --git a/src/5gnrmac/mac_tmr.c b/src/5gnrmac/mac_tmr.c new file mode 100644 index 000000000..652e0196d --- /dev/null +++ b/src/5gnrmac/mac_tmr.c @@ -0,0 +1,74 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +#include "common_def.h" +#include "lrg.h" /* Layer manager interface includes*/ +#include "lrg.x" /* layer management typedefs for MAC */ +#include "du_app_mac_inf.h" +#include "mac_sch_interface.h" +#include "lwr_mac_upr_inf.h" +#include "mac.h" + +/** + * @brief Timer Expiry handler. + * + * @details + * + * Function : macTmrExpiry + * + * This is a callback function used as an input parameter to cmPrcTmr() + * to check expiry of any timer. In this function, the only concern is + * about tmrEvnt=Bind timer. + * + * @param[in] PTR cb, Entry for which Timer expired + * @param[in] S16 tmrEvnt, the Timer Event + * @return uint8_t + * -# ROK + **/ +uint8_t macTmrExpiry(PTR cb, uint8_t tmrEvnt) +{ + /* TODO : Handling of any timer event expiry */ + return ROK; +} + +/** + * @brief MAC timer call back function registered with System services + * + * @details + * + * Function : macActvTmr + * + * This function is invoked for every timer activation + * period expiry. + * + * @return S16 + * -# ROK + **/ +short int macActvTmr(Ent ent,Inst inst) +{ + /* Check if any MAC timer has expired */ + cmPrcTmr(&macCb.tmrTqCp, macCb.tmrTq, (PFV) macTmrExpiry); + + return ROK; + +} /* end of rgActvTmr */ + +/********************************************************************** + + End of file +**********************************************************************/ diff --git a/src/5gnrmac/rg_lmm.c b/src/5gnrmac/rg_lmm.c index 186599df7..1f22ac366 100755 --- a/src/5gnrmac/rg_lmm.c +++ b/src/5gnrmac/rg_lmm.c @@ -848,6 +848,7 @@ RgCfg *cfg /* Configuaration information */ rgCb[inst].rgInit.pool = cfg->s.genCfg.mem.pool; rgCb[inst].genCfg.tmrRes = cfg->s.genCfg.tmrRes; + macCb.tmrRes = cfg->s.genCfg.tmrRes; macCb.macInst = rgCb[inst].rgInit.inst; macCb.procId = rgCb[inst].rgInit.procId; @@ -878,16 +879,15 @@ RgCfg *cfg /* Configuaration information */ } rgCb[inst].tfuSap.sapSta.sapState = LRG_NOT_CFG; /* Initialize the timer blocks */ - cmInitTimers(rgCb[inst].tmrBlk, RG_MAX_TIMER); + cmInitTimers(macCb.tmrBlk, MAX_NUM_TIMER); /* Initialzie the timer queue */ - memset(&rgCb[inst].tmrTq, 0, sizeof(CmTqType)*RG_TQ_SIZE); + memset(&macCb.tmrTq, 0, sizeof(CmTqType) * MAC_TQ_SIZE); /* Initialize the timer control point */ - memset(&rgCb[inst].tmrTqCp, 0, sizeof(CmTqCp)); - rgCb[inst].tmrTqCp.tmrLen = RG_TQ_SIZE; -#if 0 + memset(&macCb.tmrTqCp, 0, sizeof(CmTqCp)); + macCb.tmrTqCp.tmrLen = MAC_TQ_SIZE; + /* Timer Registration request to SSI */ - if (SRegTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst, - (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr) != ROK) + if(ODU_REG_TMR_MT(ENTMAC, macCb.macInst, macCb.tmrRes, macActvTmr) != ROK) { DU_LOG("\nERROR --> MAC : Failed to register timer"); @@ -899,7 +899,7 @@ RgCfg *cfg /* Configuaration information */ return (LCM_REASON_MEM_NOAVAIL); } -#endif + /* Set Config done in TskInit */ rgCb[inst].rgInit.cfgDone = TRUE; @@ -968,7 +968,7 @@ static Void rgLMMShutdown(Inst inst) /* De-register the Timer Service */ (Void) SDeregTmrMt(rgCb[inst].rgInit.ent, rgCb[inst].rgInit.inst, - (S16)rgCb[inst].genCfg.tmrRes, rgActvTmr); + (S16)rgCb[inst].genCfg.tmrRes, macActvTmr); /* call back the task initialization function to intialize * the global RgCb Struct */ @@ -1756,31 +1756,6 @@ uint8_t status /* Status */ return (ret); } - -/** - * @brief LTE MAC timer call back function registered with SSI. - * - * @details - * - * Function : rgActvTmr - * - * This function is invoked by SSI for every timer activation - * period expiry. - * - * @return S16 - * -# ROK - **/ -S16 rgActvTmr(Ent ent,Inst inst) -{ - Inst macInst = (inst - RG_INST_START); - - /* Check if any MAC timer has expired */ - cmPrcTmr(&rgCb[macInst].tmrTqCp, rgCb[macInst].tmrTq, (PFV) rgLMMTmrExpiry); - - return ROK; - -} /* end of rgActvTmr */ - /********************************************************************** End of file diff --git a/src/5gnrsch/rg_sch_lmm.c b/src/5gnrsch/rg_sch_lmm.c index b5afd680a..783459bf5 100755 --- a/src/5gnrsch/rg_sch_lmm.c +++ b/src/5gnrsch/rg_sch_lmm.c @@ -1063,35 +1063,6 @@ RgUstaDgn *dgn } -/** - * @brief Scheduler instance timer call back function registered with SSI. - * - * @details - * - * Function : schActvTmr - * - * This function is invoked by SSI for every timer activation - * period expiry. Note that SS_MT_TMR flag needs to be enabled for this - * as isntId is needed.As part of SRegTmr call for scheduler instance - * SS_MT_TMR flag needs to be enabled and schActvTmr needs to be given as - * callback function - * - * @return S16 - * -# ROK - **/ -S16 schActvTmr(Ent ent,Inst inst) -{ - Inst schInst = (inst - SCH_INST_START); - - /* Check if any timer in the scheduler instance has expired */ - cmPrcTmr(&rgSchCb[schInst].tmrTqCp, - rgSchCb[schInst].tmrTq, (PFV) rgSCHLmmTmrExpiry); - - return ROK; - -} /* end of schActvTmr */ - - /********************************************************************** End of file diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index 08f399728..9c10ceb41 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -149,15 +149,15 @@ uint8_t SchInstCfg(RgCfg *cfg, Inst dInst) schCb[inst].genCfg.isSCellActDeactAlgoEnable = cfg->s.schInstCfg.genCfg.isSCellActDeactAlgoEnable; #endif schCb[inst].genCfg.startCellId = cfg->s.schInstCfg.genCfg.startCellId; -#if 0 + /* Initialzie the timer queue */ - memset(&schCb[inst].tmrTq, 0, sizeof(CmTqType)*RGSCH_TQ_SIZE); + memset(&schCb[inst].tmrTq, 0, sizeof(CmTqType) * SCH_TQ_SIZE); /* Initialize the timer control point */ memset(&schCb[inst].tmrTqCp, 0, sizeof(CmTqCp)); schCb[inst].tmrTqCp.tmrLen = RGSCH_TQ_SIZE; /* SS_MT_TMR needs to be enabled as schActvTmr needs instance information */ - /* Timer Registration request to SSI */ + /* Timer Registration request to system services */ if (ODU_REG_TMR_MT(schCb[inst].schInit.ent, dInst, (int)schCb[inst].genCfg.tmrRes, schActvTmr) != ROK) { @@ -165,7 +165,7 @@ uint8_t SchInstCfg(RgCfg *cfg, Inst dInst) "register timer."); return (LCM_REASON_MEM_NOAVAIL); } -#endif + /* Set Config done in TskInit */ schCb[inst].schInit.cfgDone = TRUE; DU_LOG("\nINFO --> SCH : Scheduler gen config done"); diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 8cc292109..f6f58222a 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -44,6 +44,7 @@ #define NUM_DMRS_SYMBOLS 12 #define DMRS_ADDITIONAL_POS 2 #define SCH_DEFAULT_K1 1 +#define SCH_TQ_SIZE 10 #define CRC_FAILED 0 #define CRC_PASSED 1 @@ -235,8 +236,10 @@ typedef struct schCellCb */ typedef struct schCb { - TskInit schInit; /*!< Task Init info */ - SchGenCb genCfg; /*!< General Config info */ + TskInit schInit; /*!< Task Init info */ + SchGenCb genCfg; /*!< General Config info */ + CmTqCp tmrTqCp; /*!< Timer Task Queue Cntrl Point */ + CmTqType tmrTq[SCH_TQ_SIZE]; /*!< Timer Task Queue */ SchCellCb *cells[MAX_NUM_CELL]; /* Array to store cellCb ptr */ }SchCb; @@ -244,6 +247,7 @@ typedef struct schCb SchCb schCb[SCH_MAX_INST]; /* function declarations */ +short int schActvTmr(Ent ent,Inst inst); uint8_t schBroadcastAlloc(SchCellCb *cell, DlBrdcstAlloc *dlBrdcstAlloc,uint16_t slot); uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst inst); uint8_t schUlResAlloc(SchCellCb *cell, Inst schInst); diff --git a/src/5gnrsch/sch_tmr.c b/src/5gnrsch/sch_tmr.c new file mode 100644 index 000000000..e880db0ac --- /dev/null +++ b/src/5gnrsch/sch_tmr.c @@ -0,0 +1,79 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +#include "common_def.h" +#include "lrg.h" +#include "lrg.x" +#include "mac_sch_interface.h" +#include "sch.h" + +/** + * @brief Timer Expiry handler. + * + * @details + * + * Function : schTmrExpiry + * + * This is a callback function used as an input parameter to cmPrcTmr() + * to check expiry of any timer. In this function, we are only concerned + * about tmrEvnt=Bind timer. + * + * @param[in] PTR cb, Entry for which Timer expired + * @param[in] S16 tmrEvnt, the Timer Event + * @return uint8_t + * -# ROK + **/ +uint8_t schTmrExpiry(PTR cb, uint8_t tmrEvnt) +{ + /* TODO : Handling of any timer event expiry */ + return ROK; +} + +/** + * @brief Scheduler instance timer call back function registered with system services. + * + * @details + * + * Function : schActvTmr + * + * This function is invoked for every timer activation + * period expiry. Note that SS_MT_TMR flag needs to be enabled for this + * as isntId is needed.As part of SRegTmr call for scheduler instance + * SS_MT_TMR flag needs to be enabled and schActvTmr needs to be given as + * callback function + * + * @return short int + * -# ROK + **/ +short int schActvTmr(Ent ent,Inst inst) +{ + Inst schInst = (inst - SCH_INST_START); + + /* Check if any timer in the scheduler instance has expired */ + cmPrcTmr(&schCb[schInst].tmrTqCp, + schCb[schInst].tmrTq, (PFV) schTmrExpiry); + + return ROK; + +} /* end of schActvTmr */ + +/********************************************************************** + + End of file +**********************************************************************/ + -- 2.16.6