[Epic-ID: ODUHIGH-461][Task-ID: ODUHIGH-468]Unused files and functions removed/disabled
[o-du/l2.git] / src / 5gnrmac / rg.x
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /**********************************************************************
20  
21     Name:   LTE MAC layer
22  
23     Type:   X include file
24  
25     Desc:   Defines required by LTE MAC
26  
27     File:  rg.x 
28  
29 **********************************************************************/
30  
31 /** @file rg.x
32 @brief This file contains basic data structures for the Mac.
33 */
34  
35 #ifndef __RGX__
36 #define __RGX__
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif /* __cplusplus */
41
42 #ifdef EMTC_ENABLE
43 #include "rg_emtc.x"            /* typedefs for MAC */
44 #endif
45
46 /** @brief Logical Channel Id */
47 typedef RgPrgLteLcgId      LteLcgId;        
48 typedef RguDDatReqInfo     RgRguDedDatReq;
49 typedef RguCDatReqInfo     RgRguCmnDatReq;
50 typedef RguDStaRspInfo     RgRguDedStaRsp;
51 typedef RguCStaRspInfo     RgRguCmnStaRsp;
52 typedef RguDStaIndInfo     RgRguDedStaInd;
53 typedef RguCStaIndInfo     RgRguCmnStaInd;
54 typedef RguDDatIndInfo     RgRguDedDatInd;
55 typedef RguCDatIndInfo     RgRguCmnDatInd;
56 typedef RguLchStaInd       RgRguLcStaInd;
57 typedef TfuPdschDciInfo    RgTfuPdschDciInfo;
58 typedef TfuDatReqInfo      RgTfuDatReqInfo;
59 typedef TfuDatReqPduInfo   RgTfuDatReqPduInfo;
60 typedef RguDDatReqPerUe    RgRguDDatReqPerUe;
61 #ifdef L2_OPTMZ
62 typedef TfuDatReqTbInfo    RgTfuDatReqTbInfo;
63 #endif
64
65 #ifdef LTE_L2_MEAS
66 typedef struct rgL2MeasCb     RgL2MeasCb;
67 typedef struct rgQciCb        RgQciCb;
68
69 typedef RguL2MUlThrpMeasReqInfo RgRguL2MUlThrpMeasReq;
70
71 #endif /* LTE_L2_MEAS */
72 /* Forward declarations for some structures */
73 typedef struct rgUeCb         RgUeCb;
74 typedef struct rgErrInfo      RgErrInfo;
75 typedef struct rgCellCb       RgCellCb;
76 typedef struct rgUlHqProcCb   RgUlHqProcCb;
77 typedef struct rgDlHqProcCb   RgDlHqProcCb;
78 typedef struct rgLcgCb        RgLcgCb;
79 typedef struct rgDlHqEnt      RgDlHqEnt;
80 typedef struct _rgCb          RgCb;
81 typedef RgPrgUlLcInfo         RgUlLcCb;
82 typedef RgPrgDlLcInfo         RgDlLcCb;
83
84
85 #ifdef LTE_L2_MEAS
86 /* @brief UE Specific Uplink allocation info needed for measurements */
87 typedef struct rgUeUlAlloc
88 {
89    CmLteRnti        rnti;      /*!< Ue Id */ 
90    uint8_t          numPrb;    /*!< Number of total PRB's allocated for this UE */
91 } RgUeUlAlloc;
92 /**
93  * @brief Structure hold uplink allocation information for sub frames.
94  * */
95 typedef struct rgUlSf
96 {
97    CmLteTimingInfo schdTime;       /*!< scheduled frame and subframe number */
98    uint8_t         numUe;          /*!< Number of UE's allocated in this uplink  subframe */
99    RgUeUlAlloc     *ueUlAllocInfo; /*!< Uplink alloc infor for this subframe */
100 } RgUlSf;
101
102 /** @brief
103  *  L2 measurement control block.
104  *  */
105 struct rgL2MeasCb
106 {
107    CmLList            measLnk;        /*!< MeasCb node */
108    RgInfL2MeasReq     measReq;        /*!< Request received for measurement */
109    CmLteTimingInfo    startTime;      /*!< Time at which measurement started */
110    uint32_t           sfnCycle;       /*!< Count of Num of SFN wraps */ 
111 };
112 /** @brief
113  *  Control block to store Logical Channels with Qci.
114  *  */
115 struct rgQciCb
116 {
117    uint8_t          qci;      /*< QCI for measurement */
118    uint32_t         prbCount; /*!< Cummulative PRB count */
119    uint8_t          mask;     /*!< Measurement Active or Not*/
120    CmLteTimingInfo  startTime;/*!< Time at which measurement started */
121 };
122 #endif /* LTE_L2_MEAS */
123 /**
124   * @brief
125   * Information about one PDCCH.
126   */
127 typedef struct rgPdcch {
128    CmLteRnti         rnti;    /*!< RNTI to who the PDCCH is allocated */
129    RgTfuPdschDciInfo dci;     /*!< PDCCH format */
130 } RgPdcch;
131
132 typedef struct rgBcchTb
133 {
134    RgPdcch        pdcch;
135    Buffer         *tb;
136    uint16_t       txPwrOffset; /*!< PDSCH Tx Pwr offset */
137 } RgBcchTb;
138
139 typedef struct rgPcchTb
140 {
141    RgPdcch        pdcch;
142    Buffer         *tb;
143    uint16_t       txPwrOffset; /*!< PDSCH Tx Pwr offset */
144 } RgPcchTb;
145
146 typedef struct rgRaRspAlloc
147 {
148    RgPdcch        pdcch;     /*!< NULLP if no Rsp allocation done for raRnti*/
149    Buffer         *rar;
150    uint16_t       txPwrOffset; /*!< PDSCH Tx Pwr offset */
151 }RgRaRspAlloc;
152
153 typedef struct rgBchTb
154 {
155    Buffer         *tb;    /*!< BCH data for this frame */
156 }RgBchTb;
157
158
159 typedef struct rgDlSf
160 {
161    CmLteTimingInfo schdTime;  /*!< scheduled frame and subframe number */
162    Bool            txDone;     /*!< Flag to indicate transmission done */
163 /* ADD Changes for Downlink UE Timing Optimization */
164 #ifdef LTEMAC_DLUE_TMGOPTMZ  
165    uint8_t         remDatReqCnt; /*!< Counter to maintain count of Ded data received.*/  
166    /* Fix [ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled 
167       RLC-MAC */
168    Bool            statIndDone; /*!< Marks sending of all status indication done */
169 #endif
170    RgBchTb         bch;        /*!< BCH data for this frame */
171    RgBcchTb        bcch;       /*!< BCCH allocation for this frame */
172 #ifdef EMTC_ENABLE
173    RgEmtcBcchTb    emtcBcch;   /*!< EMTC BCCH allocation for this frame */
174 #endif
175    RgPcchTb        pcch;       /*!< PCCH allocation for this frame */
176    CmLListCp       tbs;        /*!< TBs or DL HARQ processes */
177    uint8_t         numRaRsp;   /*!< No.of RaRsp */
178    RgRaRspAlloc    raRsp[RG_MAX_RA_RNTI]; /* Array of list of Ra Rsp 
179                                        Allocations for each rarnti */
180    uint8_t         numTbReqsSent;        /*!< Number of TB requests sent towards SMAC.
181    Total numTbReqsSent will be equal to maximum secondary cells */                               
182 } RgDlSf;
183
184 /** 
185   * @brief
186   * Logical channel control block for BCCH and PCCH channels. 
187   */
188 typedef struct rgBcchDlschLcCb
189 {
190    CmLteLcId       lcId;                     /*!< Logical channel ID */
191    Buffer          *tb;
192 } RgBcchDlschLcCb;
193
194 typedef struct rgBcchBchLcCb
195 {
196    CmLteLcId       lcId;                     /*!< Logical channel ID */
197 } RgBcchBchLcCb;
198
199 typedef struct rgPcchLcCb
200 {
201    CmLteLcId       lcId;                     /*!< Logical channel ID */
202 } RgPcchLcCb;
203
204 /** 
205   * @brief
206   * Random access information per cell. 
207   */
208 typedef struct rgRaInfoCb
209 {
210    CmLListCp       ueRachLst;                   /*!< List of RaCbs */
211 } RgRaInfoCb;
212
213 typedef struct rgSchInstMap
214 {
215    S16          cellSapId; /*!< SAP ID of the cell in scheduler instance */
216    Inst          schInst;  /*!< Scheduler instance that is serving this cell*/
217 } RgSchInstMap;
218
219 /** 
220   * @brief
221   * Configuration Information for Upper SAPs at RGU,CRG and RGR interfaces.
222   */
223 typedef struct rgUpSapCfgInfo
224 {
225    Pst  sapPst;              /*!< Post information associated with SAP */
226    SpId spId;                /*!< SpId associated with SAP */
227    SuId suId;                /*!< SuId associated with SAP */
228 }RgUpSapCfgInfo;
229
230 /** 
231   * @brief
232   * Configuration Information for Lower SAP at TFU interface
233   */
234 typedef struct rgLowSapCfgInfo
235 {
236    Pst    sapPst;            /*!< Post information associated with SAP */
237    SpId   spId;              /*!< SpId associated with SAP */
238    SuId   suId;              /*!< SuId associated with SAP */
239    TmrCfg bndTmr;            /*!< Bind Timer Value */
240 }RgLowSapCfgInfo;
241
242 /** 
243   * @brief
244   * Control Block structure for Upper SAPs at RGU,CRG and RGR interfaces.
245   */
246 typedef struct rgUpSapCb
247 {
248    RgUpSapCfgInfo sapCfg;    /*!< Configuration information */
249    RgSapSts     sapSts;      /*!< Statistics related to SAP */
250    RgSapSta     sapSta;      /*!< SAP Status */
251 }RgUpSapCb;
252
253 /** 
254   * @brief
255   * Control Block structure for Lower SAP at TFU interface.
256   */
257 typedef struct rgLowSapCb
258 {
259    RgLowSapCfgInfo sapCfg;          /*!< SAP configuration information */
260    RgSapSts        sapSts;          /*!< Statistics related to SAP */
261    RgSapSta        sapSta;          /*!< SAP Status */
262    uint8_t         numBndRetries;   /*!< Number of Bind Retries */
263 }RgLowSapCb;
264
265 /**
266   * @brief
267   * MAC sub-header control block for 5G-NR MAC
268   * sub-hdr for fixed size MAC CE - 1 octat(R/R/LCID)
269   * sub-hdr for variable size MAC CE or MAC SDU -2/3 octat(R/F/LCID/L(8/16 bits))
270   * 
271   */
272 typedef struct RgMUXSubHdr
273 {
274    uint8_t shLen;  
275    uint8_t shData[RG_MAX_SDU_SUB_HDR_LEN]; /* RRLCID/RFLCID + F-L (O) + L (O) */
276 } RgMUXSubHdr;
277
278
279 /** 
280   * @brief
281   * Cell Control block per cell 
282   */
283 struct rgCellCb
284 {
285    CmHashListEnt   cellLstEnt;       /*!< Hash list Entity for cell list */
286    RgSchInstMap    schInstMap;      /*!< Sch Inst Info */
287    CmLteCellId     cellId;           /*!< Cell ID */
288    CmLteTimingInfo crntTime;
289    uint8_t         maxDlHqProcPerUe;  /*!< Store based on FDD/TDD(UL/DL Index) */
290    CrgBwCfg        bwCfg;            /*!< Bandwidth Configuration */
291    CrgRachCfg      rachCfg;          /*!< RACH Configuration */
292
293    RgUpSapCb       *rguDlSap;            /*!< RGU SAP Control Block for RLC DL  */
294    RgUpSapCb       *rguUlSap;           /*!< RGU SAP Control Block  for RLC UL*/
295    Inst            macInst;            /*!< MAC Instance id for this cell */
296    uint8_t         cellActvState;      /*!< Bitmask indicating if cell is active:
297                                        Cell is active only after BCCH, PCCH, DL
298                                        CCCH, UL CCCH and scheduler config */
299    CmLteLcId       ulCcchId;         /*!< LcId for uplink CCCH */
300    CmLteLcId       dlCcchId;         /*!< LcId for downlink CCCH */ 
301    RgBcchBchLcCb   bcchBchInfo;      /*!< BCCH mapped on BCH 
302                                        logical channel control block */
303    RgPcchLcCb      pcchInfo;        /*!< PCCH logical channel control block */
304    uint8_t         numBcchDlschInfo;
305    RgBcchDlschLcCb bcchDlschInfo[RG_MAX_BCCH_DLSCH]; /*!< BCCH mapped on DLSCH 
306                                              logical channel control block */
307    CmHashListCp    ueLst;            /*!< Hash list of UE control 
308                                                    blocks: RgUeCb */
309    /*Added support for SPS*/
310 #ifdef LTEMAC_SPS
311    CmHashListCp    spsUeLst;         /*!< Hash list of UECbs with SPS-Rnti
312                                                   : Element is RgUeCb */
313 #endif
314    RgRaInfoCb      raInfo;           /*!< Random access related information for
315                                           cell */
316    RgDlSf          subFrms[RG_NUM_SUB_FRAMES];
317 #ifdef LTE_L2_MEAS
318    CmLListCp       l2mList;                     /*!< List of all L2M requests
319                                                      rgSchL2MeasCb */
320    RgQciCb         qciArray[LRG_MAX_QCI];       /*!< List of all qci's configured
321                                                       rgQciCb */
322    RgUlSf          ulSf[RG_NUM_UL_SUB_FRAMES];  /*!< UL Sub frame */
323    Bool            sndL2Meas;                   /*!< Send L2 Meas when No L2 Measuremnt timer is running*/
324
325    uint32_t        ttiCycle;             /*!< Count of Number of 10240 Cycles
326                                              completed */
327
328 #endif /* LTE_L2_MEAS */
329    RguFlowCntrlInd  *flowCntrlInd;        /*!<Pre Alloced buffer for flow control */
330    /* RRM_SP1_START */
331    uint32_t             qcisUlPrbCnt[RG_MAX_QCI_REPORTS];         /*!< GBR Lc PRB count */
332    /* RRM_SP1_END */
333 #ifdef LTE_ADV
334   //RgLaaTbReq  *laaCellHqPLst[RG_MAX_SCELL_PER_UE]; /*!< LAA: List containing of TBs requested per
335                                             //SCELL*/
336   Void * laaCb;
337 #endif
338 #ifdef EMTC_ENABLE
339     uint8_t               emtcEnable;
340 #endif
341 };
342
343 /**
344   * @brief
345   * Uplink HARQ entity information per UE.
346   */
347 typedef struct rgUlHqEnt
348 {
349    uint8_t           maxHqRetx;        /*!< Maximum number of harq
350                                    * re-transmissions */ 
351 } RgUlHqEnt;
352 #ifdef LTE_L2_MEAS
353
354 /**
355   * @brief Structure to hold Uplink throughtput info for L2 measurement.
356   *
357   * @details
358   *   - outStndngBs     : outstanding buffer status
359   *   - firstDatSegRcvd : first dat req seg recvd
360   *   - frstSegTimInfo  : fisrt seg time information
361   *   - nextSegTimInfo  : next seg time information
362   *   - segInd          : UL thrgouthput indication
363   *   - fSegTtiCycNum   : First Seg tti cycles
364   *   - nSegTtiCycNum   : next seg tti cycles
365   */
366 typedef struct rgL2MeasUlThrP
367
368    S32 outStndngBs;                 /*!< outstanding buffer status*/
369    Bool firstDatSegRcvd;            /*!< first dat req seg recvd*/
370    CmLteTimingInfo frstSegTimInfo;  /*!< fisrt seg time information*/
371    CmLteTimingInfo nextSegTimInfo;  /*!< next seg time information*/
372    RguL2MUlThrpSegInd segInd;       /*!< UL thrgouthput indication*/
373    uint32_t fSegTtiCycNum;               /*!< First Seg tti cycles*/
374    uint32_t nSegTtiCycNum;               /*!< next seg tti cycles*/
375 } RgL2MeasUlThrP;
376 #endif
377
378 /** 
379   * @brief
380   * Logical channel group
381   */
382 struct rgLcgCb
383 {
384    /* Right now not keeping associated logical channels, searching for
385     * associated channels needed only during config */
386    LteLcgId    lcgId;  /*!< Group ID */
387    uint8_t     lcCount;
388 #ifdef LTE_L2_MEAS
389
390    RgL2MeasUlThrP lcgBsInfo;
391
392 #endif
393    Bool        isGbr;  /*!< Indicate if LCG is GBR LCG */
394 };
395
396
397
398
399 /**
400   * @brief
401   * Uplink control block for UE specific information
402   */
403 typedef struct rgUeUlCb
404 {
405    RgUlHqEnt  hqEnt;      /*!< Uplink HARQ information for the UE */
406    RgUlLcCb   lcCb[RG_MAX_LC_PER_UE]; /*!< Dedicated Uplink logical channel 
407                                            information */
408    RgLcgCb    lcgArr[RG_MAX_LCG_PER_UE]; /*!< Logical channel groups */
409    /* Added support for SPS*/
410 #ifdef LTEMAC_SPS
411    Bool                 spsLcId[RG_MAX_LC_PER_UE];  /*!< Set to TRUE for SPS LCs */ 
412    uint8_t              implRelCntr;    /*!< Number of empty sps transmissions for
413                                     implicit(?) release */
414    uint8_t              implRelCnt; /*!< Configured value of implicitRelAfter +
415                                     RG_ADDL_SPS_OCC_FOR_EXP_REL */
416    uint8_t              explRelCntr;/*!< Counter to track explicit release */
417    uint8_t              explRelCnt; /*!< Count to trigger explicit release */
418 /*Added for explicit release - start*/
419    uint8_t              spsDatRcvd; /*!< Count to track SPS data for explicit 
420                      release*/
421    uint32_t             totSpsDatRcvd; /*!< total number of SPS data recieved
422                      from activation*/
423 #endif
424 } RgUeUlCb;
425
426 /** 
427   * @brief
428   * Logical channel data as being scheduled by the scheduler.
429   */
430 typedef struct rgLchSchdData
431 {
432    CmLteLcId       lcId;       /*!< Logical channel ID */
433    uint32_t        schdSz;   /*!< Scheduled logical channel data */
434 } RgLchSchdData;
435
436 /** 
437   * @brief
438   * Contention Resolution ID. 
439   */
440 typedef struct RgContResId
441 {
442    uint8_t        resId[RG_CRES_LEN];
443 }RgContResId;
444
445 /** 
446   * @brief
447   * Used to keep sf and SfLnk in Tb. 
448   */
449 typedef struct rgTbSfLnkInfo
450 {
451    RgDlSf          *sf;   /*!< Sf pointer to check if SfAlloc came for Tb in a SF */
452    CmLList         sfLnk; /*!< Used to queue it up on a subfrm */
453 }RgTbSfLnkInfo;
454
455 /** 
456   * @brief
457   * Transport Block Info scheduled by the scheduler.
458   */
459 typedef struct rgTbInfo{
460    uint8_t              numSchLch;
461    RgLchSchdData        schdData[RG_MAX_NUM_DED_LC];
462    TknUInt8             schdTa;  /*!< TA scheduled to be sent */
463    /* Changed as a result of CR timer implementation*/
464    uint8_t              contResCe;   /*!< Contention Resolution CE scheduled 
465                                    to be sent */
466    RgContResId          *contResId;  /*!< Contention Resolution Identity */
467 #ifndef L2_OPTMZ
468    Buffer               *tb;    /*!< Multiplexed Pdu */
469 #else
470    /* L2 Optimization for mUe/Tti:Pre-allocated MAC Hdr, MAC CEs and padding
471     * will be used to store and send to CL. These pointer will be allocated
472     * during Harq Proc creation. CL shall not free these pointers.
473     * These pointers will be freed duing harq proc deletion
474     */
475     RgTfuDatReqTbInfo     tb;   /* TB to be sent to CL/PHY*/
476 #endif
477 /* Changes for MIMO feature addition */
478 /* Removed dependency on MIMO compile-time flag */
479    uint32_t             tbSz;   /*!< TB size scheduled for the hqP */    
480    RgPdcch              pdcch;  /*!< PDCCH allocated for this HQ Proc */
481    /* Adding Array of sfLnk in case of repetitions because same lnk in mutiple
482     * list causing issues*/
483    RgTbSfLnkInfo   sfLnkInfo[2]; /*!< Used to queue it up on a subfrm */
484    RgDlSf          *sf;
485    CmLteTimingInfo timingInfo; /*!<This field holds the scheduled time */
486    TknUInt32       doa;
487    TfuTxMode       txMode;
488    Bool            puschRptUsd; /*!< True if Precoding Info in PDCCH has to be
489                                    in-accordance with the latest PUSCH report */
490    TfuDlCqiPuschInfo puschPmiInfo;/*!< PUSCH report details for explicit PMI
491                                        * information to PHY during a PDSCH */
492    /* LTE_ADV_FLAG_REMOVED_START */
493 #ifdef TFU_UPGRADE
494    uint8_t            pa;                 /* DL Power control paramter P_A
495                                      configured by higher layers
496                                      Ref: RRC 36.331, 6.3.2,
497                                      PDSCH-Config*/
498 #endif
499    uint8_t isEnbSFR;
500 #ifdef LTE_ADV
501    TknUInt8           sCellActCe;     /*!< SCell Act ce scheduled to be sent */
502 #endif
503    /* LTE_ADV_FLAG_REMOVED_END */
504 }RgTbInfo;
505
506 /** 
507   * @brief`
508   * Downlink HARQ process information per UE.
509   */
510 struct rgDlHqProcCb
511 {
512    uint8_t         procId;    /*!< HARQ process ID */
513 /* Changes for MIMO feature addition */
514 /* Removed dependency on MIMO compile-time flag */
515    uint8_t         numOfTBs;
516    RgTbInfo        tbInfo[RG_MAX_TB_PER_UE];
517    uint16_t             saveId; // laa
518 #ifdef LTE_L2_MEAS
519
520    uint32_t        tbId[RGU_MAX_TB];          /*!< RLC's internal tbId */                                    
521    uint16_t        status[RGU_MAX_TB];        /*!< Status back to RLC ACK/NACK*/
522 #endif /* LTE_L2_MEAS */
523 /* Changes for MIMO feature addition */
524 /* Removed dependency on MIMO compile-time flag */
525 };
526
527
528 /** 
529   * @brief
530   * Downlink HARQ entity information per UE.
531   */
532 struct rgDlHqEnt
533 {
534    uint8_t       numHqProcs;
535    RgDlHqProcCb  *procs[RG_MAX_DL_HARQ_NUM]; /*!< Downlink harq processes */
536    CmLListCp     savedProcLst[RG_MAX_DL_HARQ_NUM]; /*!< laa: Saved TBs for the release Hq Procs*/
537 };
538
539
540
541 /**
542   * @brief
543   * Downlink control block for UE specific information.
544   */
545 typedef struct rgUeDlCb
546 {
547    RgDlHqEnt  hqEnt;        /*!< Downlink HARQ information for the UE */          
548    RgDlLcCb   lcCb[RG_MAX_LC_PER_UE];/*!< Dedicated Downlink logical channels in
549 UE */ 
550 } RgUeDlCb;                   
551
552 #ifdef LTE_ADV
553 typedef struct rgSCellAddCfgCfmInfo
554 {
555    CrgCfgTransId   transId;   /*!< Scell add transaction id*/
556    uint8_t         numSCells; /*!< Used to check if config cfm rcvd from all Scells*/ 
557    uint8_t         cfgCfgCount; /*!< Keep count of cfg confirms recvd */
558    uint8_t         mask; /*!< Cfg cfm mask */
559 }RgSCellAddCfgCfmInfo;
560
561 typedef struct rgSCelInfo
562 {
563    Bool           isSCellAdded;     /*!< is Cell Added TRUE/FALSE */
564    Inst           macInst;          /*!< MAC Instance of that 
565                                          Cell Added */
566    CmLteCellId    sCellId;          /*!< Secondary Cell ID */
567 }RgSCelInfo;
568
569 #endif
570
571 /** 
572   * @brief
573   * UE control block for UE specific information
574   */
575 struct rgUeCb
576 {
577    CmHashListEnt     ueLstEnt;   /*!< Hash List entity for UE List */
578    /* Added suport for SPS*/
579 #ifdef LTEMAC_SPS
580    CmHashListEnt     spsUeLstEnt;/*!< Hash List entity for SPS Rnti */
581 #endif
582    CmLList           rachLstEnt; /*!< Link List entity for RACH UE List*/ 
583    CmLteRnti         ueId;       /*!< UE identifier */
584    /* Added suport for SPS*/
585 #ifdef LTEMAC_SPS
586    CmLteRnti         spsRnti;    /*!< SPS-Rnti for the UE */
587 #endif
588    RgContResId       contResId;  /*!< Contention Resolution Identity */
589    RgUeUlCb          ul;        /*!< UE Specific Uplink information */
590    RgUeDlCb          dl;        /*!< UE Specific Downlink information */
591 /* Changes for MIMO feature addition */
592 /* Removed dependency on MIMO compile-time flag */
593    CrgTxMode         txMode;      /*!< UE Transmission mode Cfg */
594    RgUpSapCb        *rguDlSap;    /*!< RGU SAP Control Block for RLC DL  */
595    RgUpSapCb        *rguUlSap;    /*!< RGU SAP Control Block  for RLC UL*/
596 #ifdef LTE_ADV
597    RgSCelInfo        sCelInfo[RG_MAX_SCELL_PER_UE]; /*!<sCell Information */
598    RgSCellAddCfgCfmInfo cfgCfmInfo; /*!< Scell add cfg cfm info*/
599 #endif /* LTE_ADV */
600 };
601
602 /** 
603   * @brief
604   * structure holding Layer Manager Response information cached from control
605   * request.
606   */
607 typedef struct rgLmResponse
608 {
609    TranId transId;           /*!< Transaction ID */
610    Resp   response;          /*!< Response */
611 }RgLmResponse;
612
613 /** 
614   * @brief
615   * Structure holding LTE MAC's General Configuration Information.
616   */
617 typedef struct rgGenCb
618 {
619    uint8_t      tmrRes;           /*!< Timer resolution */
620    RgLmResponse trcResp;          /*!< Response value for Trace Indication */
621    RgLmResponse ustaResp;         /*!< Respones value for Alarms */
622    RgLmResponse bndCfmResp;       /*!< Respones value for Bind Confirm */
623    Status       memUpperThr;      /*!< upper threshold of the memory pool */
624    Status       memLowerThr;      /*!< lower threshold of the memory pool */
625 }RgGenCb;
626
627
628
629 /** 
630   * @brief
631   * Global Control block for LTE-MAC.
632   */
633 struct _rgCb
634 {
635    TskInit      rgInit;                    /*!< Task Init information */
636    S16          trcLen;                    /*!< trace length */
637    RgGenCb      genCfg;                    /*!< General Config information */
638    uint8_t      numRguSaps;                /*!< Numb of RGU SAP Control Block */
639    RgUpSapCb    *rguSap;                     /*!< RGU SAP Control Block */
640    RgUpSapCb    crgSap;                    /*!< CRG SAP Control Block */
641    RgLowSapCb   tfuSap;                    /*!< TFU SAP Control Block */
642    RgGenSts     genSts;                    /*!< General Statistics */
643    CmTqCp       tmrTqCp;                   /*!< Timer Task Queue Cntrl Point */
644    CmTqType     tmrTq[RG_TQ_SIZE];         /*!< Timer Task Queue */
645    CmTimer      tmrBlk[RG_MAX_TIMER];      /*!< Timer Block */
646    RgCellCb *inactiveCell;                     /*!< Reference of last accessed cellCb*/
647    RgCellCb *cell;                     /*!< Reference of last accessed cellCb*/
648    RgCellCb *prevCell;                     /*!< Reference of last accessed cellCb*/
649    uint8_t bufCnt;                              /*!< Count of buffers in buffersToFree[] */
650    Buffer *bufToFree[RG_MAX_DFRD_FREE_BUFS];/*!< List of Shared Buffers to be freed */
651 };
652
653 /* Declaration for RgCb */
654 RgCb rgCb[RG_MAX_INST];
655
656 /** 
657   * @brief
658   * Subheader of MAC SDU.
659   */
660 typedef struct rgMacSdu
661 {
662    CmLList    sduLstEnt;  /*!< List entry for MAC SDU subheader */
663    CmLteLcId  lcId;       /*!< Logical channel ID */
664    uint16_t   len;        /*!< Length of the SDU */
665    Buffer     *mBuf;      /*!< SDU Buffer */
666 } RgMacSdu;
667
668 /** 
669   * @brief
670   * MAC PDU Contents.
671   */
672 typedef struct rgMacPdu
673 {
674    CmMemListCp memCp;     /*!< Memory control point */
675    CmLListCp   sduLst;    /*!< List of SDUs */
676 } RgMacPdu;
677
678 /** 
679   * @brief
680   * Carries the Error Information.
681   */
682 struct rgErrInfo
683 {
684    uint8_t    errType;    /*!< Error Type */
685    uint16_t   errCause;   /*!< Cause of Error */
686 };
687
688 /** 
689   * @brief
690   * Carries the Information to build PDU.
691   */
692 typedef struct rgBldPduInfo
693 {
694    Void           *datReq;    /*!< Common/Dedicated Dat Request */
695    uint8_t        reqType;    /*!< EVTRGUCDATREQ/EVTRGUDDATREQ */
696    MsgLen         schdTbSz;   /*!< Schedule TB size */
697    uint8_t        tbIndex;    /*!< Transport Block Index */
698    TknUInt8       ta;         /*!< Timing Advance */
699    RgContResId    *contResId; /*!< Contention Resolution ID */
700 #ifdef LTE_ADV
701    TknUInt8       sCellActCe; /*!< SCell Act CE info */
702 #endif
703 } RgBldPduInfo;
704
705
706
707 /* APIs exposed by LIM */
708
709 #ifdef LTE_L2_MEAS /*LTE_L2_MEAS_PHASE2*/
710 S16 rgAddToL2MeasPerQci ARGS ((RgCellCb  *cell,uint8_t qci));
711 #endif
712 S16 rgLIMTfuBndReq ARGS((
713          Inst                 inst,
714          SuId                 suId,
715          SpId                 spId));
716
717 S16 rgLIMTfuUbndReq ARGS((
718          Inst                 inst,
719          SuId                 suId,
720          Reason               reason));
721
722 S16 rgLIMTfuDatReq ARGS((
723          Inst          inst,
724          TfuDatReqInfo *datReq));
725 #ifdef L2_OPTMZ
726 S16 rgLIMTfuDelDatReq ARGS((
727          Inst          inst,
728          TfuDelDatReqInfo *datReq));
729 #endif /*L2_OPTMZ */
730 /* APIs exposed by TOM */
731
732 S16 rgTOMDatInd ARGS((
733          Inst          inst,
734          TfuDatIndInfo *datInd));
735
736 Void rgTOMRlsSf ARGS((Inst inst,RgDlSf *dlSf));
737
738 S16 rgSchMacSfAllocReq ARGS((Pst *pst, RgInfSfAlloc *sfInfo));
739
740 /*
741  * APIs exposed by LMM
742  */
743 S16 rgLMMStartTmr ARGS((Inst inst,S16 tmrEvnt, uint32_t tmrVal, PTR cb));
744 S16 rgLMMStopTmr ARGS((Inst inst,S16 tmrEvnt, PTR cb));
745 S16 rgLMMTmrExpiry ARGS((PTR cb, S16 tmrEvnt));
746 /* To send a Unsolicited Status Indication to Layer Manager */
747 S16 rgLMMStaInd ARGS((Inst inst,uint16_t category, uint16_t event, uint16_t cause, RgUstaDgn *dgn));
748 /* LIM uses this to forward the BndCfm to LMM. This function invokes a
749  * Control Confirmation to the LM. */
750 S16 rgActvTmr ARGS((Ent ent, Inst inst ));
751 S16 rgActvInit ARGS((Ent entity, Inst inst, Region 
752        region, Reason reason));
753 S16 rgActvTsk ARGS((Pst *pst, Buffer *mBuf));
754
755 /* APIs Exposed by UIM */
756 S16 rgUIMRguBndCfm ARGS ((Inst inst,SuId suId, uint8_t status));
757 S16 rgUIMSndDedStaInd ARGS ((Inst inst,RgUpSapCb *rguDlSap,RgRguDedStaInd  *staInd));
758 S16 rgUIMSndCmnStaInd ARGS ((Inst inst,RgUpSapCb *rguDlSap,RgRguCmnStaInd  *staInd));
759 S16 rgUIMSndDedDatInd ARGS ((Inst inst,RgUpSapCb *rguDlSap,RgRguDedDatInd  *datInd));
760 #ifdef LTE_L2_MEAS
761 S16 rgL2mCreateMeasCb ARGS((
762          RgCellCb       *cell,
763          RgInfL2MeasReq *measInfo, 
764          uint8_t         measType,
765          RgErrInfo      *err
766 ));
767  S16 rgL2mMeasReq ARGS((
768          RgCellCb       *cell,
769          RgInfL2MeasReq *measInfo,
770          RgErrInfo      *err
771 ));
772 S16 rgL2Meas ARGS ((
773          RgCellCb  *cell
774 ));
775 #endif /* LTE_L2_MEAS */
776 S16 rgUIMSndCmnDatInd ARGS ((Inst inst,RgUpSapCb *rguSap,RgRguCmnDatInd  *datInd));
777 S16 rgUIMCrgBndCfm ARGS ((Inst inst,SuId suId,uint8_t status));
778 S16 rgUIMCrgCfgCfm ARGS ((Inst inst,CrgCfgTransId transId,uint8_t status));
779
780
781 /* 
782  * APIs exposed by ROM module
783  */
784 #ifdef LTE_L2_MEAS
785
786 S16 rgROML2MUlThrpMeasReq ARGS((Inst inst,RgRguL2MUlThrpMeasReq *measReq));
787
788 #endif
789
790 /* 
791  * APIs exposed by RAM module
792  */
793 RgUeCb* rgRAMCreateUeCb ARGS((RgCellCb *cell,
794                      CmLteRnti tmpCrnti,Bool insert, RgErrInfo *err));
795 S16 rgRAMFreeCell ARGS((RgCellCb    *cell));
796 Void rgRAMFreeUeCb ARGS((Inst inst,RgUeCb *ueCb));
797 S16 rgHndlRaResp ARGS((RgCellCb *cell,CmLteTimingInfo timingInfo,
798             RgInfRarInfo  *rarInfo,RgErrInfo *err));
799 S16 rgSchMacRlsRntiReq ARGS((Pst *pst,RgInfRlsRnti* rlsRnti));
800 /* 
801  * APIs exposed by UHM module
802  */
803 Void rgUHMCrgUeCfg ARGS(( RgCellCb *cellCb, RgUeCb *ueCb, 
804                                  CrgUeCfg *ueCfg));
805 Void rgUHMCrgUeRecfg ARGS(( RgCellCb *cellCb, RgUeCb *ueCb, 
806                               CrgUeRecfg *ueRecfg));
807 /* 
808  * APIs exposed by DUX module
809  */
810 S16 rgDUXDemuxData ARGS((Inst inst,RgMacPdu *pdu, RgInfCeInfo   *ceInfo,
811                                 Buffer **mBuf, RgErrInfo *err)); 
812 S16 rgDUXExtSduLen ARGS
813 ((
814 Inst        inst,
815 Buffer      *mBuf,
816 uint16_t    *sduLen,
817 RgErrInfo   *err
818 ));
819
820 /* 
821  * APIs exposed by DBM module
822  */
823
824 S16 rgDBMInitInactvCellLst ARGS((uint16_t numBins));
825 S16 rgDBMDeInitInactvCellLst ARGS((Void));
826 S16 rgDBMInsInactvCellCb ARGS(( RgCellCb *cellCb));
827 RgCellCb* rgDBMGetInactvCellCb ARGS(( CmLteCellId cellId));
828 S16 rgDBMDelInactvCellCb ARGS(( RgCellCb *cellCb));
829 RgCellCb* rgDBMGetNextInactvCellCb ARGS((RgCellCb *cellCb));
830
831 S16 rgDBMInitCellLst ARGS(( uint16_t numBins));
832 S16 rgDBMDeInitCellLst ARGS((Void));
833 S16 rgDBMInsCellCb ARGS(( RgCellCb *cellCb));
834 RgCellCb* rgDBMGetCellCb ARGS(( CmLteCellId cellId));
835 S16 rgDBMDelCellCb ARGS(( RgCellCb *cellCb));
836 RgCellCb* rgDBMGetNextCellCb ARGS((RgCellCb *cellCb));
837 S16 rgDBMInitCell ARGS((RgCellCb *cellCb));
838
839 S16 rgDBMDeInitUeCbLst ARGS(( RgCellCb *cellCb));
840 S16 rgDBMInsUeCb ARGS(( RgCellCb *cellCb, RgUeCb *ueCb));
841 RgUeCb* rgDBMGetUeCb ARGS(( RgCellCb *cellCb, CmLteRnti ueId));
842 RgUeCb* rgDBMGetNextUeCb ( RgCellCb *cellCb, RgUeCb *ueCb);
843 S16 rgDBMDelUeCb ARGS(( RgCellCb *cellCb, RgUeCb *ueCb));
844 Void rgDBMInitUe ARGS((RgUeCb *ueCb));
845
846 #ifdef LTE_L2_MEAS
847 Void rgDBMInsUlDedLcCb ARGS((RgUeCb *ueCb, CmLteLcId idx, LteLcgId  gId,
848                         uint8_t  qci));
849 #else
850 Void rgDBMInsUlDedLcCb ARGS((RgUeCb *ueCb, 
851                   CmLteLcId idx, LteLcgId gId));
852 #endif
853 Void rgDBMUpdUlDedLcCb ARGS((RgUeCb *ueCb, 
854                RgUlLcCb *ulLcCb, LteLcgId gId));
855
856 Void rgDBMInsDlDedLcCb ARGS((RgUeCb *ueCb, CmLteLcId idx));
857 Void rgDBMDelUlDedLcCb ARGS((RgUeCb *ueCb, RgUlLcCb *ulLcCb));
858 Void rgDBMDelDlDedLcCb ARGS((RgUeCb *ueCb, RgDlLcCb *dlLcCb));
859 RgDlLcCb* rgDBMGetDlDedLcCb ARGS(( RgUeCb *ueCb, CmLteLcId idx));
860 RgUlLcCb* rgDBMGetUlDedLcCb ARGS(( RgUeCb *ueCb, CmLteLcId idx));
861 Void rgDBMFreeCmnLcLst ARGS((RgCellCb *cellCb));
862 S16 rgDBMChkCmnLcCb ARGS(( RgCellCb *cellCb, CmLteLcId lcId));
863 RgBcchBchLcCb* rgDBMGetBcchOnBch ARGS(( RgCellCb *cellCb ));
864 RgBcchDlschLcCb* rgDBMGetBcchOnDlsch ARGS(( RgCellCb *cellCb, 
865                                                    CmLteLcId lcId));
866 RgPcchLcCb* rgDBMGetPcch ARGS(( RgCellCb *cellCb));
867 Void rgDBMInsBcchOnBch ARGS(( RgCellCb *cellCb, CmLteLcId idx));
868 Void rgDBMInsBcchOnDlsch ARGS(( RgCellCb *cellCb, CmLteLcId idx));
869 Void rgDBMInsPcch ARGS(( RgCellCb *cellCb, CmLteLcId idx));
870
871 Void rgDBMInsUeCbInRachLst ARGS((RgCellCb *cellCb,RgUeCb *ueCb));
872 RgUeCb* rgDBMGetUeCbFromRachLst ARGS((RgCellCb *cellCb,CmLteRnti key));
873 RgUeCb* rgDBMGetNextUeCbFromRachLst ARGS((RgCellCb *cellCb,
874                                                       RgUeCb *ueCb));
875 Void rgDBMDelUeCbFromRachLst ARGS((RgCellCb *cellCb,RgUeCb *ueCb));
876 /* Added support for SPS*/
877 #ifdef LTEMAC_SPS
878 S16 rgDBMDeInitSpsUeCbLst ARGS((RgCellCb *cellCb));
879 S16 rgDBMInsSpsUeCb ARGS((RgCellCb *cellCb, RgUeCb *ueCb));
880 RgUeCb* rgDBMGetSpsUeCb ARGS((RgCellCb *cellCb, CmLteRnti ueId));
881 RgUeCb* rgDBMGetNextSpsUeCb ARGS((RgCellCb *cellCb, RgUeCb *ueCb));
882 S16 rgDBMDelSpsUeCb ARGS((RgCellCb *cellCb,RgUeCb *ueCb));
883 #endif /* LTEMAC_SPS */
884                         
885 /* 
886  * APIs exposed by DHM module
887  */
888 Void rgCFGFreeUeCb ARGS((RgCellCb *cell, RgUeCb *ue));
889 S16 rgDHMHqEntInit ARGS((Inst inst,RgDlHqEnt *hqE, uint8_t maxHqProcs));
890 Void rgDHMRlsHqProc ARGS((RgDlHqProcCb *hqP));
891 Void rgDHMUeReset ARGS ((RgCellCb *cell, RgDlHqEnt *hqE));
892 Void rgDHMHdlBufFree ARGS((Inst inst, Buffer **mBuf));
893 Void rgDHMFreeTbBufs ARGS((Inst inst));
894 S16 rgDHMRlsHqProcTB ARGS((RgCellCb *cell, RgDlHqProcCb *hqP,uint8_t tbIndex));
895 S16 rgDHMGetHqProcFrmId ARGS((RgUeCb *ue, uint8_t idx, RgDlHqProcCb **hqP));
896 /* Changes for MIMO feature addition */
897 /* Removed dependency on MIMO compile-time flag */
898 S16 rgDHMSndDatReq ARGS((RgCellCb *cellCb, RgDlSf *dlSf, RgTfuDatReqInfo *datInfo, 
899                                 RgDlHqProcCb *hqProc, RgErrInfo *err));
900 S16 rgDHMHndlDedDatReq ARGS((Inst inst,RgDlHqProcCb *hqProc, 
901                               RgRguDDatReqPerUe *datReq, RgDlSf *dlSf, RgErrInfo *err));
902 /* Changed for contention resolution timer implementation*/
903 S16 rgDHMHndlCmnDatReq ARGS((Inst inst,RgDlHqProcCb *hqProc, 
904                 RgRguCmnDatReq *datReq, RgErrInfo *err));
905 /* Changes for MIMO feature addition */
906 /* Removed dependency on MIMO compile-time flag */
907
908 S16 rgDHMSndConsolidatedStaInd ARGS ((RgCellCb *cell,RgInfUeInfo *ueInfo,
909       CmLteTimingInfo timingInfo, RgErrInfo *err));
910
911 Void rgDHMFreeUe ARGS((Inst inst,RgDlHqEnt *hqE));
912 S16 rgSchMacRlsHqReq ARGS((Pst *pst, RgInfRlsHqInfo *rlshqUeInfo));
913
914 /* 
915  * APIs exposed by MUX module
916  */
917 #ifdef L2_OPTMZ
918 Bool RgUtlIsTbMuxed ARGS((TfuDatReqTbInfo *tb));
919 #endif
920 S16 rgMUXBldRarPdu ARGS((RgCellCb *cell, RgInfRaRntiInfo *alloc,
921          Buffer **txPdu, RgErrInfo *err));
922
923 /*
924  * Utility APIs
925  */
926 S16  rgAllocSBuf     ARGS((Inst inst,Data **pData, Size size));
927 /*ccpu00117052 - MOD  Passing double pointer for proper NULLP
928                       assignment */
929 Void rgFreeSBuf      ARGS((Inst inst,Data **data, Size size));
930 Void rgFillDgnParams ARGS((Inst inst,RgUstaDgn *dgn,uint8_t dgnType));
931 Void rgPrintfSubFrameInfo ARGS((RgDlSf *dlSf));
932 Void printMacCellInfo ARGS((Void));
933 Void rgFreeSharableSBuf ARGS((Inst inst,Data **data, Size size)); 
934 void MacSendCellCfgCfm(uint8_t response);
935
936
937 Void rgDHMFreeAllTbBufs ARGS
938 ((
939 Inst inst
940 ));
941
942 S16 rgMUXAddPadd ARGS((
943 Inst           inst,
944 MsgLen         *schdTbSz,
945 Buffer         *sduBuf,
946 Bool           isRar,
947 RgErrInfo      *err
948 ));
949 uint16_t rgMUXCalcRiv ARGS
950 ((
951 uint8_t           bw,
952 uint8_t           rbStart,
953 uint8_t           numRb
954 ));
955
956
957
958 #ifdef __cplusplus
959 }
960 #endif /* __cplusplus */
961 #endif /* __RGX__ */
962
963
964 /**********************************************************************
965          End of file
966 **********************************************************************/