9020815d47dd8452c034194319bf4828a49ff391
[o-du/l2.git] / src / cm / du_app_mac_inf.h
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 /* Defines APIs exchanged between du_app and cl module of MAC */
20 #ifndef __MACINT_H__
21 #define __MACINT_H__
22
23 #define NUM_NUMEROLOGY 5  /* Number of numerology */
24
25 #define NUM_SSB         1       /* max value is 64 */
26 #define SSB_MASK_SIZE   1       /* SSB mask size is 32bit for sub6 */
27 #define SIB1_REPETITION_PERIOD   20
28 #define CORESET_0_INDEX      0
29 #define CORESET_1_INDEX      1
30 #define CORESET_2_INDEX      2
31 #define CORESET_3_INDEX      3
32 #define CORESET_4_INDEX      4
33 #define SEARCHSPACE_0_INDEX   0
34 #define SEARCHSPACE_1_INDEX   1
35 #define SEARCHSPACE_2_INDEX   2
36 #define SEARCHSPACE_3_INDEX   3
37 #define SEARCHSPACE_4_INDEX   4
38 #define SS_MONITORING_SLOT_SL1   0 /* all slots */
39 #define SS_MONITORING_SYMBOL     0x2000; /* symbol-0, set 14th bit */
40
41 /* Macro for Ue Context */
42 #define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
43 #define MAC_NUM_TAGS 4                  /* Max number of timing advance groups */
44 #define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
45 #define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
46 #define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
47 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
48 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
49 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
50 #define MAX_NUM_SCELL  32
51
52 /* PUCCH Configuration Macro */
53 #define MAX_NUM_PUCCH_RESRC 128
54 #define MAX_NUM_PUCCH_RESRC_SET 4
55 #define MAX_NUM_PUCCH_PER_RESRC_SET 32
56 #define MAX_NUM_SPATIAL_RELATIONS 8
57 #define MAX_NUM_PUCCH_P0_PER_SET 8
58 #define MAX_NUM_PATH_LOSS_REF_RS 4
59 #define MAX_NUM_DL_DATA_TO_UL_ACK 15
60
61 /* Event IDs */
62 #define EVENT_MAC_CELL_CONFIG_REQ    200
63 #define EVENT_MAC_CELL_CONFIG_CFM    201
64 #define EVENT_MAC_CELL_START         202
65 #define EVENT_MAC_CELL_STOP          203
66 #define EVENT_MAC_CELL_UP_IND        204
67 #define EVENT_MAC_STOP_IND           205
68 #define EVENT_MAC_UL_CCCH_IND        206
69 #define EVENT_MAC_DL_CCCH_IND        207
70 #define EVENT_MAC_UE_CREATE_REQ      208
71 #define EVENT_MAC_UE_CREATE_RSP      209
72 #define EVENT_MAC_UE_RECONFIG_REQ    210
73 #define EVENT_MAC_UE_RECONFIG_RSP    211
74 #define EVENT_MAC_UE_DELETE_REQ      212
75 #define EVENT_MAC_UE_DELETE_RSP      213
76 #define EVENT_MAC_CELL_DELETE_REQ    214
77 #define EVENT_MAC_CELL_DELETE_RSP    215
78 #define EVENT_MAC_SLICE_CFG_REQ      216
79 #define EVENT_MAC_SLICE_CFG_RSP      217
80 #define EVENT_MAC_SLICE_RECFG_REQ    218
81 #define EVENT_MAC_SLICE_RECFG_RSP    219
82 #define EVENT_MAC_SLOT_IND           220
83 #define EVENT_MAC_RACH_RESOURCE_REQ  221
84 #define EVENT_MAC_RACH_RESOURCE_RSP  222
85 #define EVENT_MAC_RACH_RESOURCE_REL  223
86 #define EVENT_MAC_DL_PCCH_IND        224
87
88 #define BSR_PERIODIC_TIMER_SF_10 10
89 #define BSR_RETX_TIMER_SF_320 320
90 #define BSR_SR_DELAY_TMR_2560 2560
91
92 #define PAGING_SCHED_DELTA  4
93
94 typedef enum
95 {
96    MAC_DU_APP_RSP_NOK,
97    MAC_DU_APP_RSP_OK
98 }MacRsp;
99
100 typedef enum
101 {
102    SLICE_PRESENT,
103    SLICE_NOT_PRESENT
104 }RspReason;
105
106 typedef enum
107 {
108    DEL_SUCCESSFUL,
109    CELLID_INVALID,
110    UEID_INVALID
111 }UeDeleteStatus;
112
113 typedef enum
114 {
115    SUCCESSFUL_RSP,
116    CELL_ID_INVALID
117 }CellDeleteStatus;
118
119 typedef enum
120 {
121    DUP_MODE_FDD,
122    DUP_MODE_TDD
123 }DuplexMode;
124
125 typedef enum
126 {
127    MAC_GEN_FULL_PBCH_PAYLD,   /* MAC generated the full PBCH Payload */
128    PHY_GEN_TIMING_PBCH_BIT,   /* PHY generates the timing PBCH bits */
129    PHY_GEN_FULL_PBCH_PAYLD    /* PHY generates full PBCH payload */
130 }BchPduOpt;
131
132 typedef enum
133 {
134    LONG_SEQUENCE,
135    SHORT_SEQUENCE
136 }PrachSeqLen;
137
138 typedef enum
139 {
140    UNRESTRICTED,
141    RESTRICTED_SET_TYPE_A,
142    RESTRICTED_SET_TYPE_B
143 }RstSetCfg;
144
145 typedef enum
146 {
147    DONT_REPORT_RSSI,
148    RSSI_UNIT_DBM,
149    RSSI_UNIT_DBFS
150 }RSSIMeasUnit;
151
152 typedef enum
153 {
154    BETA_PSS_0DB,
155    BETA_PSS_1DB
156 }BetaPss;
157
158 typedef enum 
159 {
160    SSB_PRDCTY_MS_5,
161    SSB_PRDCTY_MS_10,
162    SSB_PRDCTY_MS_20,
163    SSB_PRDCTY_MS_40,
164    SSB_PRDCTY_MS_80,
165    SSB_PRDCTY_MS_160
166 }SSBPeriod;
167
168 typedef enum
169 {
170    RRC_REJECT,
171    RRC_SETUP
172 }DlCcchMsgType;
173
174 /* Enums for Ue Create Request */
175
176 /* SR PROHIBIT TIMER */
177 typedef enum
178 {
179    SR_PROHIBIT_MS_1,
180    SR_PROHIBIT_MS_2,
181    SR_PROHIBIT_MS_4,
182    SR_PROHIBIT_MS_8,
183    SR_PROHIBIT_MS_16,
184    SR_PROHIBIT_MS_32,
185    SR_PROHIBIT_MS_64,
186    SR_PROHIBIT_MS_128
187 }SrProhibitTimer;
188
189 typedef enum
190 {
191    SR_TRANS_MAX_N_4,
192    SR_TRANS_MAX_N_8,
193    SR_TRANS_MAX_N_16,
194    SR_TRANS_MAX_N_32,
195    SR_TRANS_MAX_N_64,
196    SR_TRANS_MAX_spare3,
197    SR_TRANS_MAX_spare2,
198    SR_TRANS_MAX_spare1
199 }SrTransMax;
200
201 typedef enum
202 {
203    TIME_ALIGNMENT_TIMER_MS_500,
204    TIME_ALIGNMENT_TIMER_MS_750,
205    TIME_ALIGNMENT_TIMER_MS_1280,
206    TIME_ALIGNMENT_TIMER_MS_1920,
207    TIME_ALIGNMENT_TIMER_MS_2560,
208    TIME_ALIGNMENT_TIMER_MS_5120,
209    TIME_ALIGNMENT_TIMER_MS_10240,
210    TIME_ALIGNMENT_TIMER_INFINITY
211 }TimeAlignmentTimer;
212
213 typedef enum
214 {
215    PHR_PERIODIC_TIMER_SF_10,
216    PHR_PERIODIC_TIMER_SF_20,
217    PHR_PERIODIC_TIMER_SF_50,
218    PHR_PERIODIC_TIMER_SF_100,
219    PHR_PERIODIC_TIMER_SF_200,
220    PHR_PERIODIC_TIMER_SF_500,
221    PHR_PERIODIC_TIMER_SF_1000,
222    PHR_PERIODIC_TIMER_INFINITY
223 }PhrPeriodicTimer;
224
225 typedef enum
226 {
227    PHR_PROHIBIT_TIMER_SF_0,
228    PHR_PROHIBIT_TIMER_SF_10,
229    PHR_PROHIBIT_TIMER_SF_20,
230    PHR_PROHIBIT_TIMER_SF_50,
231    PHR_PROHIBIT_TIMER_SF_100,
232    PHR_PROHIBIT_TIMER_SF_200,
233    PHR_PROHIBIT_TIMER_SF_500,
234    PHR_PROHIBIT_TIMER_SF_1000
235 }PhrProhibitTimer;
236
237 typedef enum
238 {
239    PHR_TX_PWR_FACTOR_CHANGE_DB_1,
240    PHR_TX_PWR_FACTOR_CHANGE_DB_3,
241    PHR_TX_PWR_FACTOR_CHANGE_DB_6,
242    PHR_TX_PWR_FACTOR_CHANGE_INFINITY
243 }PhrTxPwrFactorChange;
244
245 typedef enum
246 {
247    PHR_MODE_OTHER_CG_REAL,
248    PHR_MODE_OTHER_CG_VIRTUAL
249 }PhrModeOtherCG;
250
251 typedef enum
252 {
253    PDSCH_HARQ_ACK_CODEBOOK_SEMISTATIC,
254    PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC
255 }PdschHarqAckCodebook;
256
257 typedef enum
258 {
259    NUM_HARQ_PROC_FOR_PDSCH_N_2,
260    NUM_HARQ_PROC_FOR_PDSCH_N_4,
261    NUM_HARQ_PROC_FOR_PDSCH_N_6,
262    NUM_HARQ_PROC_FOR_PDSCH_N_10,
263    NUM_HARQ_PROC_FOR_PDSCH_N_16
264 }NumHarqProcForPdsch;
265
266 typedef enum
267 {
268    MAX_CODE_BLOCK_GROUP_PER_TB_N_2,
269    MAX_CODE_BLOCK_GROUP_PER_TB_N_4,
270    MAX_CODE_BLOCK_GROUP_PER_TB_N_6,
271    MAX_CODE_BLOCK_GROUP_PER_TB_N_8
272 }MaxCodeBlkGrpPerTB;
273
274 typedef enum
275 {
276    PDSCH_X_OVERHEAD_6,
277    PDSCH_X_OVERHEAD_12,
278    PDSCH_X_OVERHEAD_18
279 }PdschXOverhead;
280
281 typedef enum
282 {
283    TRANSFORM_PRECODER_ENABLED,
284    TRANSFORM_PRECODER_DISABLED
285 }TransformPrecoder;
286
287 typedef enum 
288 {
289    CCE_REG_MAPPINGTYPE_PR_INTERLEAVED = 1,
290    CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED
291 }REGMappingType;
292
293 typedef enum
294 {
295    SLOTPERIODICITYANDOFFSET_PR_SL1 = 1,
296    SLOTPERIODICITYANDOFFSET_PR_SL2,
297    SLOTPERIODICITYANDOFFSET_PR_SL4,
298    SLOTPERIODICITYANDOFFSET_PR_SL5,
299    SLOTPERIODICITYANDOFFSET_PR_SL8,
300    SLOTPERIODICITYANDOFFSET_PR_SL10,
301    SLOTPERIODICITYANDOFFSET_PR_SL16,
302    SLOTPERIODICITYANDOFFSET_PR_SL20,
303    SLOTPERIODICITYANDOFFSET_PR_SL40,
304    SLOTPERIODICITYANDOFFSET_PR_SL80,
305    SLOTPERIODICITYANDOFFSET_PR_SL160,
306    SLOTPERIODICITYANDOFFSET_PR_SL320,
307    SLOTPERIODICITYANDOFFSET_PR_SL640,
308    SLOTPERIODICITYANDOFFSET_PR_SL1280,
309    SLOTPERIODICITYANDOFFSET_PR_SL2560
310 }MSlotPeriodAndOffset;
311
312 typedef enum
313 {
314    SAMEASREG_BUNDLE,
315    ALL_CONTIGUOUS_RBS
316 }PrecoderGranul;
317
318 typedef enum
319 {
320    SEARCHSPACETYPE_PR_COMMON = 1,
321    SEARCHSPACETYPE_PR_UE_SPECIFIC
322 }SearchSpaceType;
323
324 typedef enum
325 {
326    QOS_NON_DYNAMIC = 1,
327    QOS_DYNAMIC
328 }QosType;
329
330 typedef enum
331 {
332    AGGREGATIONLEVEL_N0  = 0,  
333    AGGREGATIONLEVEL_N1  = 1,
334    AGGREGATIONLEVEL_N2  = 2,
335    AGGREGATIONLEVEL_N3  = 3,
336    AGGREGATIONLEVEL_N4  = 4,
337    AGGREGATIONLEVEL_N5  = 5,
338    AGGREGATIONLEVEL_N6  = 6,
339    AGGREGATIONLEVEL_N8  = 7
340 }AggrLevel;
341
342 typedef enum
343 {
344    ADDITIONALPOSITION_POS0,
345    ADDITIONALPOSITION_POS1,
346    ADDITIONALPOSITION_POS3
347 }AddPosType;
348
349 typedef enum
350 {
351    MAPPING_TYPEA,
352    MAPPING_TYPEB
353 }CommonMappingType;
354
355 typedef enum
356 {
357    RESOURCEALLOCATION_TYPE0,
358    RESOURCEALLOCATION_TYPE1,
359    RESOURCEALLOCATION_DYNAMICSWITCH
360 }ResAllocType;
361
362 typedef enum
363 {
364    RBG_SIZE_CONFIG1,
365    RBG_SIZE_CONFIG2
366 }RBGSize;
367
368 typedef enum
369 {
370    CODEWORDS_SCHED_BY_DCI_N1,
371    CODEWORDS_SCHED_BY_DCI_N2
372 }CodeWordsSchedDci;
373
374 typedef enum
375 {
376    TYPE_STATIC_BUNDLING = 1,
377    TYPE_DYNAMIC_BUNDLING
378 }BundlingType;
379
380 typedef enum
381 {
382    SET2_SIZE_N4,
383    SET2_SIZE_WIDEBAND
384 }BundlingSizeSet2;
385
386 typedef enum
387 {
388    SET1_SIZE_N4,
389    SET1_SIZE_WIDEBAND,
390    SET1_SIZE_N2_WIDEBAND,
391    SET1_SIZE_N4_WIDEBAND
392 }BundlingSizeSet1;
393
394 typedef enum
395 {
396    LC_PRIORITY_1 = 1,
397    LC_PRIORITY_2,
398    LC_PRIORITY_3
399 }LcPriority;
400
401 typedef enum
402 {
403   PBR_KBPS_0,
404   PBR_KBPS_8,
405   PBR_KBPS_16,
406   PBR_KBPS_32,
407   PBR_KBPS_64,
408   PBR_KBPS_128,
409   PBR_KBPS_256,
410   PBR_KBPS_512,
411   PBR_KBPS_1024,
412   PBR_KBPS_2048,
413   PBR_KBPS_4096,
414   PBR_KBPS_8192,
415   PBR_KBPS_16384,
416   PBR_KBPS_32768,
417   PBR_KBPS_65536,
418   PBR_KBPS_INFINITY
419 }PBitRate;
420
421 typedef enum
422 {
423    BSD_MS_5,
424    BSD_MS_10,
425    BSD_MS_20,
426    BSD_MS_50,
427    BSD_MS_100,
428    BSD_MS_150,
429    BSD_MS_300,
430    BSD_MS_500,
431    BSD_MS_1000,
432    BSD_SPARE_7,
433    BSD_SPARE_6,
434    BSD_SPARE_5,
435    BSD_SPARE_4,
436    BSD_SPARE_3,
437    BSD_SPARE_2,
438    BSD_SPARE_1
439
440 }BucketSizeDur;
441
442 typedef enum
443 {
444    RADIO_NW_LAYER_FAIL,
445    TRANSPORT_LAYER_FAIL,
446    PROTOCOL_FAIL,
447    MISCELLANEOUS
448 }CauseGrp;
449
450 typedef enum
451 {
452    UNSPECIFIED_RADIO_NW_CAUSE,
453    RL_FAIL_RLC,
454    UNKNOWN_GNB_CU_UE_F1AP_ID,
455    ALREADY_ALLOCATED_GNB_CU_UE_F1AP_ID,
456    UNKNOWN_GNB_DU_UE_F1AP_ID,
457    ALREADY_ALLOCATED_GNB_DU_UE_F1AP_ID,
458    UNKNOWN_UE_F1AP_ID_PAIR,
459    INCONSISTENT_UE_F1AP_ID_PAIR,
460    INTERACTION_WITH_OTHER_PROCEDURE,
461    UNSUPPORTED_QCI,
462    ACTION_REQUIRED_FOR_RADIO_REASONS,
463    RADIO_RESOURCES_UNAVAILABLE,
464    CANCELLED_PROCEDURE,
465    RELEASE_NORMAL,
466    CELL_UNAVAILABLE,
467    OTHER_RL_FAILURE,
468    UE_REJECTION,
469    RESOURCES_UNAVAILABLE_FOR_SLICE
470 }RadioNwLyrCause;
471
472 typedef enum
473 {
474    UNSPECIFIED_TRANSPORT_LAYER_CAUSE,
475    TRANSPORT_RESOURCE_UNAVAILABLE
476 }TransLyrCause;
477
478 typedef enum
479 {
480    TRANSFER_SYNTAX_ERROR,
481    ABSTRACT_SYNTAX_ERROR_REJECT,
482    ABSTRACT_SYNTAX_ERROR_IGNORE_AND_REJECT,
483    INCOMPATIBLE_MESSAGE_FOR_RECEIVER_STATE,
484    SEMANTIC_ERR,
485    ABSTRAXCT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MSG,
486    UNSPECIFIED_PROTOCOL_CAUSE
487 }ProtCause;
488
489 typedef enum
490 {
491    CONTROL_PROCESSING_OVERLOAD,
492    NOT_ENOUGH_USER,
493    PLANE_PROCESSING_RESOURCES,
494    HARDWARE_FAIL,
495    INTERVENTION_BY_O_AND_M,
496    UNSPECIFIED_MISC_CAUSE
497 }MiscFailCause;
498
499 typedef enum
500 {
501    MCS_TABLE_QAM64,
502    MCS_TABLE_QAM256,
503    MCS_TABLE_QAM64_LOW_SE
504 }McsTable;
505
506 typedef enum
507 {
508    RSRC_PRB,
509    RSRC_DRB,
510    RSRC_RRC_CONNECTED_USERS
511 }ResourceType;
512
513 typedef enum
514 {
515    TRANSMISSION_ALLOWED,
516    STOP_TRANSMISSION,
517    RESTART_TRANSMISSION
518 }DataTransmissionAction;
519
520 typedef struct failureCause
521 {
522    CauseGrp   type;
523    union
524    {
525       RadioNwLyrCause   radioNwCause;
526       TransLyrCause     transportCause;
527       ProtCause         protcolCause;
528       MiscFailCause     miscCause;
529    }u;
530 }FailureCause;
531
532 typedef struct carrierCfg
533 {
534    bool  pres;
535    uint32_t   bw;             /* DL/UL bandwidth */
536    uint32_t   freq;           /* Absolute frequency of DL/UL point A in KHz */
537    uint16_t   k0[NUM_NUMEROLOGY];          /* K0 for DL/UL */
538    uint16_t   gridSize[NUM_NUMEROLOGY];    /* DL/UL Grid size for each numerologies */
539    uint16_t   numAnt;         /* Number of Tx/Rx antennas */
540 }CarrierCfg;
541
542 typedef struct ssbCfg
543 {
544    uint32_t    ssbPbchPwr;       /* SSB block power */
545    BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
546    uint8_t     scsCmn;           /* subcarrier spacing for common */
547    uint16_t    ssbOffsetPointA;  /* SSB subcarrier offset from point A */
548    BetaPss     betaPss;
549    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
550    uint8_t     ssbScOffset;       /* Subcarrier Offset */
551    uint8_t     mibPdu[3];           /* MIB payload */
552    uint32_t    ssbMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
553    uint8_t     beamId[NUM_SSB];
554    bool        multCarrBand;     /* Multiple carriers in a band */
555    bool        multCellCarr;     /* Multiple cells in single carrier */
556 }SsbCfg;
557
558 typedef struct fdmInfo
559 {
560    uint16_t   rootSeqIdx;        /* Root sequence index */
561    uint8_t    numRootSeq;        /* Number of root sequences required for FD */
562    uint16_t   k1;                /* Frequency Offset for each FD */
563    uint8_t    zeroCorrZoneCfg;   /* Zero correlation zone cofig */
564    uint8_t    numUnusedRootSeq;  /* Number of unused root sequence */
565    uint8_t    *unsuedRootSeq;     /* Unused root sequence per FD */
566 }PrachFdmInfo;
567
568 typedef struct prachCfg
569 {
570    bool          pres;
571    uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
572    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
573    uint8_t       prachSubcSpacing;    /* Subcarrier spacing of RACH */
574    RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
575    uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
576    uint8_t       msg1Fdm;             /* PRACH FDM (1,2,4,8) */
577    uint8_t       rootSeqLen;          /* Root sequence length */
578    PrachFdmInfo  fdm[8];              /* FDM info */
579    uint8_t       totalNumRaPreamble;  /* Total number of RA preambles */
580    uint8_t       ssbPerRach;          /* SSB per RACH occassion */
581    uint8_t       numCbPreamblePerSsb; /* Number of CB preamble per SSB */
582    bool          prachMultCarrBand;   /* Multiple carriers in Band */
583    uint8_t       prachRestrictedSet; /* Support for PRACH restricted set */
584    uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
585    uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
586    uint8_t       raRspWindow;         /* RA Response Window */
587 }PrachCfg;
588
589 typedef struct schPageCfg
590 {
591   uint8_t  numPO;                    /*Derived from Ns*/
592   bool     poPresent;                /*Whether FirstPDCCH-MonitoringPO is present or not*/
593   uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
594 }SchPageCfg;
595
596 typedef struct sib1CellCfg
597 {
598    uint8_t  *sib1Pdu;
599    uint16_t sib1PduLen;
600    uint16_t sib1RepetitionPeriod;
601    uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
602    uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
603    uint16_t sib1Mcs;
604    SchPageCfg  pagingCfg;
605 } Sib1CellCfg; 
606
607 typedef struct bwpParams
608 {
609    uint16_t firstPrb;
610    uint16_t numPrb;
611    uint8_t  scs;
612    uint8_t  cyclicPrefix;
613 }BwpParams;
614
615 typedef struct candidatesInfo
616 {
617    uint8_t aggLevel1;
618    uint8_t aggLevel2;
619    uint8_t aggLevel4;
620    uint8_t aggLevel8;
621    uint8_t aggLevel16;
622 }CandidatesInfo;
623
624 typedef struct searchSpaceCfg
625 {
626    uint8_t searchSpaceId;
627    uint8_t coresetId;
628    uint16_t monitoringSlot;
629    uint16_t duration;
630    uint16_t monitoringSymbol;
631    CandidatesInfo candidate;
632 }SearchSpaceCfg;
633
634 typedef struct pdcchConfigCommon
635 {
636    /* only one search space is configured during SIB1 */
637    SearchSpaceCfg commonSearchSpace;
638    uint8_t raSearchSpaceId;
639 }PdcchConfigCommon;
640
641 typedef struct pdschCfgCommTimeDomRsrcAlloc
642 {
643    uint8_t k0;
644    uint8_t mappingType;
645    uint8_t startSymbol;
646    uint8_t lengthSymbol;
647 }PdschCfgCommTimeDomRsrcAlloc;
648
649 typedef struct pdschConfigCommon
650 {
651    uint8_t  numTimeDomAlloc;
652    /* PDSCH time domain DL resource allocation list */
653    PdschCfgCommTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_DL_ALLOC]; 
654 }PdschConfigCommon;
655
656 typedef struct pucchConfigCommon
657 {
658    uint8_t pucchResourceCommon;
659    uint8_t pucchGroupHopping;
660 }PucchConfigCommon;
661
662 /* PUSCH Time Domain Resource Allocation */
663 typedef struct puschTimeDomRsrcAlloc
664 {
665    uint8_t   k2;
666    CommonMappingType   mappingType;
667    uint8_t           startSymbol;
668    uint8_t           symbolLength;
669    uint8_t   startSymbolAndLength;
670 }PuschTimeDomRsrcAlloc;
671
672
673 typedef struct puschConfigCommon
674 {
675    /* PUSCH-TimeDomainResourceAllocation info */
676    uint8_t                 numTimeDomRsrcAlloc;
677    PuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
678 }PuschConfigCommon;
679
680 typedef struct bwpDlConfig
681 {
682    BwpParams      bwp;
683    PdcchConfigCommon pdcchCommon;
684    PdschConfigCommon pdschCommon;
685 }BwpDlConfig;
686
687 typedef struct bwpUlConfig
688 {
689    BwpParams      bwp;
690    // rach config common sent in PrachCfg
691    PucchConfigCommon pucchCommon;
692    PuschConfigCommon puschCommon;
693 }BwpUlConfig;
694
695 typedef struct plmnInfoList
696 {
697    Plmn           plmn;
698    uint8_t        numSupportedSlice; /* Total slice supporting */
699    Snssai         **snssai;         /* List of supporting snssai*/
700 }PlmnInfoList;
701
702 #ifdef NR_DRX
703 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
704 typedef struct drxOnDurationTimer
705 {
706    bool  onDurationTimerValInMs;
707    union
708    {
709       uint8_t  subMilliSeconds;
710       uint16_t milliSeconds;
711    }onDurationtimerValue;
712 }DrxOnDurationTimer;
713
714 typedef struct drxLongCycleStartOffset
715 {
716    uint16_t drxLongCycleStartOffsetChoice;
717    uint16_t drxLongCycleStartOffsetVal;
718 }DrxLongCycleStartOffset;
719
720 typedef struct shortDrx
721 {
722    uint16_t   drxShortCycle;
723    uint8_t    drxShortCycleTimer;
724 }ShortDrx;
725
726 typedef struct drxCfg
727 {
728    DrxOnDurationTimer       drxOnDurationTimer;   
729    uint16_t                 drxInactivityTimer;
730    uint8_t                  drxHarqRttTimerDl;
731    uint8_t                  drxHarqRttTimerUl;
732    uint16_t                 drxRetransmissionTimerDl;
733    uint16_t                 drxRetransmissionTimerUl;
734    DrxLongCycleStartOffset  drxLongCycleStartOffset;
735    bool                     shortDrxPres;
736    ShortDrx                 shortDrx;
737    uint8_t                  drxSlotOffset;
738 }DrxCfg;
739 #endif
740
741 typedef struct macCellCfg
742 {
743    uint16_t       cellId;           /* Cell Id */
744    uint8_t        carrierId;        /* Carrired Index */
745    uint16_t       phyCellId;        /* Physical cell id */
746    uint8_t        numerology;       /* Supported numerology */
747    DuplexMode     dupType;          /* Duplex type: TDD/FDD */
748    CarrierCfg     dlCarrCfg;        /* DL Carrier configuration */
749    CarrierCfg     ulCarrCfg;        /* UL Carrier configuration */
750    bool           freqShft;         /* Indicates presence of 7.5kHz frequency shift */
751    SsbCfg         ssbCfg;           /* SSB configuration */          
752    PrachCfg       prachCfg;         /* PRACH Configuration */
753 #ifdef NR_TDD
754    TDDCfg         tddCfg;           /* TDD periodicity and slot configuration */
755 #endif
756    RSSIMeasUnit   rssiUnit;         /* RSSI measurement unit */
757    Sib1CellCfg    sib1Cfg;          /* SIB1 config */
758    BwpDlConfig    initialDlBwp;     /* Initial DL BWP */
759    BwpUlConfig    initialUlBwp;     /* Initial UL BWP */
760    uint8_t        dmrsTypeAPos;     /* DMRS Type A position */
761    PlmnInfoList   plmnInfoList;     /* Consits of PlmnId and Snssai list */
762    //RrmPolicy      *rrmPolicy;       /* RRM policy details */ 
763 }MacCellCfg;
764
765 typedef struct macCellCfgCfm
766 {
767    uint16_t       cellId;
768    uint8_t        rsp; 
769 }MacCellCfgCfm;
770
771 typedef struct ulCcchInd
772 {
773    uint16_t cellId;
774    uint16_t crnti;
775    uint16_t ulCcchMsgLen;
776    uint8_t  *ulCcchMsg;
777 }UlCcchIndInfo;
778
779 typedef struct dlCcchInd
780 {
781    uint16_t      cellId;
782    uint16_t      crnti;
783    DlCcchMsgType msgType;
784    uint16_t      dlCcchMsgLen;
785    uint8_t       *dlCcchMsg;
786 }DlCcchIndInfo;
787
788 typedef struct bsrTmrCfg
789 {
790    uint16_t     periodicTimer;
791    uint16_t     retxTimer;
792    uint16_t     srDelayTimer;
793 }BsrTmrCfg;
794
795
796 /* Info of Scheduling Request to Add/Modify */
797 typedef struct schedReqInfo
798 {
799    uint8_t         schedReqId;
800    SrProhibitTimer srProhibitTmr;
801    SrTransMax      srTransMax;
802 }SchedReqInfo;
803
804 /* Scheduling Request Configuration */
805 typedef struct schedReqCfg
806 {
807    uint8_t       addModListCount;
808    SchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
809    uint8_t       relListCount;
810    uint8_t       relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
811 }SchedReqCfg;
812
813 typedef struct tagInfo
814 {
815    uint8_t tagId;
816    TimeAlignmentTimer timeAlignTimer;
817 }TagInfo;
818
819 typedef struct tagCfg
820 {
821    uint8_t      addModListCount;
822    TagInfo      addModList[MAC_NUM_TAGS];  /* List of Tag to Add/Modify */
823    uint8_t      relListCount;
824    uint8_t      relList[MAC_NUM_TAGS];     /* list of Tag Id to release */
825 }TagCfg;
826
827 typedef struct phrCfg
828 {
829    PhrPeriodicTimer periodicTimer;
830    PhrProhibitTimer prohibitTimer; 
831    PhrTxPwrFactorChange txPowerFactor;
832    bool     multiplePHR;       
833    bool     dummy;
834    bool     phrType2OtherCell;
835    PhrModeOtherCG phrOtherCG;
836 }PhrCfg;
837
838 typedef struct macCellGrpCfg
839 {
840    SchedReqCfg schReqCfg;
841    TagCfg      tagCfg;
842    BsrTmrCfg   bsrTmrCfg;
843    bool        phrCfgSetupPres;   /* true/false: phrCfgSetup/phrCfgRelease */
844    PhrCfg      phrCfg;
845 #ifdef NR_DRX
846    DrxCfg      drxCfg;
847 #endif
848 }MacCellGrpCfg;
849
850 typedef struct phyCellGrpCfg
851 {
852    PdschHarqAckCodebook  pdschHarqAckCodebook;
853    uint8_t    pNrFr1;
854 }PhyCellGrpCfg;
855
856 /* Control resource set info */
857 typedef struct controlRsrcSet
858 {
859    uint8_t     cRSetId;                /* Control resource set id */
860    uint8_t     freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
861    uint8_t     duration;
862    REGMappingType cceRegMappingType;
863    PrecoderGranul precoderGranularity;
864    uint16_t    dmrsScramblingId;
865 }ControlRsrcSet;
866
867 /* Search Space info */
868 typedef struct searchSpace
869 {
870    uint8_t     searchSpaceId;
871    uint8_t     cRSetId;
872    MSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
873    uint8_t     mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
874    AggrLevel   numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
875    AggrLevel   numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
876    AggrLevel   numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
877    AggrLevel   numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
878    AggrLevel   numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
879    SearchSpaceType searchSpaceType;
880    uint8_t     ueSpecificDciFormat;
881 }SearchSpace;
882
883 /* PDCCH cofniguration */
884 typedef struct pdcchConfig
885 {
886    uint8_t           numCRsetToAddMod;
887    ControlRsrcSet    cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
888    uint8_t           numCRsetToRel;
889    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
890    uint8_t           numSearchSpcToAddMod;
891    SearchSpace       searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
892    uint8_t           numSearchSpcToRel;
893    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
894 }PdcchConfig;
895
896 /* PDSCH time domain resource allocation */
897 typedef struct pdschTimeDomRsrcAlloc
898 {
899    uint8_t           *k0;
900    CommonMappingType mappingType;
901    uint8_t           startSymbol;
902    uint8_t           symbolLength;
903    uint8_t           startSymbolAndLength;
904 }PdschTimeDomRsrcAlloc;
905
906
907 typedef struct pdschBundling
908 {
909    struct staticBundling
910    {
911      BundlingSizeSet2 size;
912    }StaticBundling;
913    struct dynamicBundling
914    {
915      BundlingSizeSet1 sizeSet1;
916      BundlingSizeSet2 sizeSet2;
917    }DynamicBundling;
918 }PdschBundling;
919
920 /* DMRS downlink configuration */
921 typedef struct dmrsDlCfg
922 {
923    AddPosType  addPos;       /* DMRS additional position */
924 }DmrsDlCfg;
925
926 /* PDSCH Configuration */
927 typedef struct pdschConfig
928 {
929    DmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
930    ResAllocType            resourceAllocType;
931    uint8_t                 numTimeDomRsrcAlloc;
932    PdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
933    RBGSize                 rbgSize;
934    CodeWordsSchedDci       numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
935    BundlingType            bundlingType;
936    PdschBundling           bundlingInfo;
937 }PdschConfig;
938
939 /* Initial Downlink BWP */
940 typedef struct initialDlBwp
941 {
942    bool          pdcchPresent;
943    PdcchConfig   pdcchCfg;
944    bool          pdschPresent;
945    PdschConfig   pdschCfg;
946 }InitialDlBwp;
947
948 /* BWP Downlink common */
949 typedef struct bwpDlCommon
950 {
951 }BwpDlCommon;
952
953 /* Downlink BWP information */
954 typedef struct dlBwpInfo
955 {
956    uint8_t          bwpId;
957 }DlBwpInfo;
958
959 /* PDCCH Serving Cell configuration */
960 typedef struct pdschServCellCfg
961 {
962    uint8_t              *maxMimoLayers;           
963    NumHarqProcForPdsch  numHarqProcForPdsch;
964    MaxCodeBlkGrpPerTB   *maxCodeBlkGrpPerTb;
965    bool                 *codeBlkGrpFlushInd;
966    PdschXOverhead       *xOverhead;
967 }PdschServCellCfg;
968
969 /* PUCCH Configuration */
970
971 typedef struct pucchResrcSetInfo
972 {
973    uint8_t resrcSetId;
974    uint8_t resrcListCount;
975    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
976    uint8_t maxPayLoadSize;
977 }PucchResrcSetInfo;
978
979 typedef struct pucchResrcSetCfg
980 {
981    uint8_t resrcSetToAddModListCount;
982    PucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
983    uint8_t resrcSetToRelListCount;
984    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
985 }PucchResrcSetCfg;
986
987 typedef struct pucchFormat0
988 {
989    uint8_t initialCyclicShift;
990    uint8_t numSymbols;
991    uint8_t startSymbolIdx;
992 }PucchFormat0;
993
994 typedef struct pucchFormat1
995 {
996    uint8_t initialCyclicShift;
997    uint8_t numSymbols;
998    uint8_t startSymbolIdx;
999    uint8_t timeDomOCC;
1000 }PucchFormat1;
1001
1002 typedef struct pucchFormat2_3
1003 {
1004    uint8_t numPrbs;
1005    uint8_t numSymbols;
1006    uint8_t startSymbolIdx;
1007 }PucchFormat2_3;
1008
1009 typedef struct pucchFormat4
1010 {
1011    uint8_t numSymbols;
1012    uint8_t occLen;
1013    uint8_t occIdx;
1014    uint8_t startSymbolIdx;
1015 }PucchFormat4;
1016
1017 typedef struct pucchResrcInfo
1018 {
1019    uint8_t  resrcId;
1020    uint16_t startPrb;
1021    uint8_t  intraFreqHop;
1022    uint16_t secondPrbHop;
1023    uint8_t  pucchFormat;
1024    union
1025    {
1026       PucchFormat0   *format0; 
1027       PucchFormat1   *format1;
1028       PucchFormat2_3 *format2;
1029       PucchFormat2_3 *format3;
1030       PucchFormat4   *format4;
1031    }PucchFormat;
1032 }PucchResrcInfo;
1033
1034 typedef struct pucchResrcCfg
1035 {
1036    uint8_t resrcToAddModListCount;
1037    PucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1038    uint8_t resrcToRelListCount;
1039    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1040 }PucchResrcCfg;
1041
1042 typedef struct pucchFormatCfg
1043 {
1044    bool interSlotFreqHop;
1045    bool addDmrs;
1046    uint8_t maxCodeRate;
1047    uint8_t numSlots;
1048    bool    pi2BPSK;
1049    bool    harqAckCSI;
1050 }PucchFormatCfg;
1051
1052 typedef struct schedReqResrcInfo
1053 {
1054    uint8_t resrcId;
1055    uint8_t requestId;
1056    uint8_t periodicity;
1057    uint16_t offset;
1058    uint8_t resrc;
1059 }SchedReqResrcInfo;
1060
1061 typedef struct pucchSchedReqCfg
1062 {
1063    uint8_t           schedAddModListCount;
1064    SchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1065    uint8_t           schedRelListCount;
1066    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1067 }PucchSchedReqCfg;
1068
1069 typedef struct spatialRelationInfo
1070 {
1071    uint8_t spatialRelationId;
1072    uint8_t servCellIdx;
1073    uint8_t pathLossRefRSId;
1074    uint8_t p0PucchId;
1075    uint8_t closeLoopIdx;
1076 }SpatialRelationInfo;
1077
1078 typedef struct pucchSpatialCfg
1079 {
1080    uint8_t spatialAddModListCount;
1081    SpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1082    uint8_t spatialRelListCount;
1083    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1084 }PucchSpatialCfg;
1085
1086 typedef struct p0PucchCfg
1087 {
1088    uint8_t p0PucchId;
1089    int     p0PucchVal;
1090 }P0PucchCfg;
1091
1092 typedef struct pathLossRefRSCfg
1093 {
1094    uint8_t pathLossRefRSId;
1095 }PathLossRefRSCfg;
1096
1097 typedef struct pucchMultiCsiCfg
1098 {
1099    uint8_t  multiCsiResrcListCount;
1100    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1101 }PucchMultiCsiCfg;
1102
1103 typedef struct pucchDlDataToUlAck
1104 {
1105    uint8_t  dlDataToUlAckListCount;
1106    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1107 }PucchDlDataToUlAck;
1108
1109 typedef struct pucchPowerControl
1110 {
1111    int deltaF_Format0;
1112    int deltaF_Format1;
1113    int deltaF_Format2;
1114    int deltaF_Format3;
1115    int deltaF_Format4;
1116    uint8_t p0SetCount;
1117    P0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1118    uint8_t pathLossRefRSListCount;
1119    PathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1120 }PucchPowerControl;
1121
1122 typedef struct pucchCfg
1123 {
1124    PucchResrcSetCfg  *resrcSet;
1125    PucchResrcCfg     *resrc;
1126    PucchFormatCfg    *format1; 
1127    PucchFormatCfg    *format2; 
1128    PucchFormatCfg    *format3; 
1129    PucchFormatCfg    *format4;
1130    PucchSchedReqCfg  *schedReq;
1131    PucchMultiCsiCfg  *multiCsiCfg;
1132    PucchSpatialCfg   *spatialInfo;
1133    PucchDlDataToUlAck *dlDataToUlAck;
1134    PucchPowerControl *powerControl;
1135 }PucchCfg;
1136
1137 /* Transform precoding disabled */
1138 typedef struct transPrecodDisabled
1139 {
1140    uint16_t   scramblingId0;
1141 }TransPrecodDisabled;
1142
1143 /* DMRS Uplink configuration */
1144 typedef struct dmrsUlCfg
1145 {
1146    AddPosType            addPos;               /* DMRS additional position */
1147    TransPrecodDisabled   transPrecodDisabled;  /* Transform precoding disabled */
1148 }DmrsUlCfg;
1149
1150 /* PUSCH Configuration */
1151 typedef struct puschCfg
1152 {
1153    uint8_t                 dataScramblingId;
1154    DmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1155    ResAllocType            resourceAllocType;
1156    uint8_t                 numTimeDomRsrcAlloc;
1157    PuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1158    TransformPrecoder       transformPrecoder;
1159 }PuschCfg;
1160
1161 /* Initial Uplink BWP */
1162 typedef struct initialUlBwp
1163 {
1164    bool       pucchPresent;
1165    PucchCfg   pucchCfg; 
1166    bool       puschPresent;
1167    PuschCfg   puschCfg;
1168 }InitialUlBwp;
1169
1170 /* Uplink BWP information */
1171 typedef struct ulBwpInfo
1172 {
1173    uint8_t        bwpId;
1174 }UlBwpInfo;
1175
1176 /* Serving cell configuration */
1177 typedef struct servCellCfgInfo
1178 {
1179    InitialDlBwp       initDlBwp;
1180    uint8_t            numDlBwpToAdd;
1181    DlBwpInfo          DlBwpToAddList[MAX_NUM_BWP];
1182    uint8_t            firstActvDlBwpId;
1183    uint8_t            defaultDlBwpId;
1184    uint8_t            *bwpInactivityTmr;
1185    PdschServCellCfg   pdschServCellCfg;
1186    InitialUlBwp       initUlBwp;
1187    uint8_t            numUlBwpToAdd;
1188    UlBwpInfo          UlBwpToAddList[MAX_NUM_BWP];
1189    uint8_t            firstActvUlBwpId;
1190 }ServCellCfgInfo;
1191
1192 /* Special cell configuration */
1193 typedef struct spCellCfg
1194 {
1195    uint8_t           servCellIdx;
1196    ServCellCfgInfo   servCellCfg;
1197 }SpCellCfg;
1198
1199 typedef struct ambrCfg
1200 {
1201    uint32_t ulBr;   /* UL Bit rate */
1202 }AmbrCfg;
1203
1204 typedef struct nonDynFiveQi
1205 {
1206    uint16_t   fiveQi;
1207    uint8_t    priorLevel;
1208    uint16_t   avgWindow;
1209    uint16_t   maxDataBurstVol;
1210 }NonDynFiveQi;
1211
1212 typedef struct dynFiveQi
1213 {
1214    uint8_t    priorLevel;
1215    uint16_t   packetDelayBudget;
1216    uint8_t    packetErrRateScalar;
1217    uint8_t    packetErrRateExp;
1218    uint16_t   fiveQi;
1219    uint8_t    delayCritical;
1220    uint16_t   avgWindow;
1221    uint16_t   maxDataBurstVol;
1222 }DynFiveQi;
1223
1224 typedef struct ngRanAllocAndRetPri
1225 {
1226    uint8_t priorityLevel;
1227    uint8_t preEmptionCap;
1228    uint8_t preEmptionVul;
1229 }NgRanAllocAndRetPri;
1230
1231 typedef struct grbQosInfo
1232 {
1233    uint32_t maxFlowBitRateDl;
1234    uint32_t maxFlowBitRateUl;
1235    uint32_t guarFlowBitRateDl;
1236    uint32_t guarFlowBitRateUl;
1237 }GrbQosInfo;
1238
1239 typedef struct drbQos
1240 {
1241    QosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1242    union
1243    {
1244       NonDynFiveQi   nonDyn5Qi;
1245       DynFiveQi      dyn5Qi;
1246    }u;
1247    NgRanAllocAndRetPri ngRanRetPri;
1248    GrbQosInfo grbQosInfo;
1249    uint16_t             pduSessionId;
1250    uint32_t             ulPduSessAggMaxBitRate;
1251 }DrbQosInfo;
1252
1253 typedef struct ulLcCfg
1254 {
1255    uint8_t priority;
1256    uint8_t lcGroup;
1257    uint8_t schReqId;
1258    PBitRate pbr;        // prioritisedBitRate
1259    BucketSizeDur bsd;        // bucketSizeDuration
1260 }UlLcCfg;
1261
1262 typedef struct duLcCfg
1263 {
1264    LcPriority lcp;      // logical Channel Prioritization
1265 }DlLcCfg;
1266
1267 typedef struct lcCfg
1268 {
1269    ConfigType configType;
1270    uint8_t lcId;
1271    DrbQosInfo *drbQos; 
1272    Snssai  *snssai;
1273    bool ulLcCfgPres;
1274    UlLcCfg ulLcCfg;
1275    DlLcCfg dlLcCfg;
1276 }LcCfg;
1277
1278 typedef struct modulationInfo
1279 {
1280    uint8_t     modOrder;    /* Modulation order */
1281    uint8_t     mcsIndex;    /* MCS Index */
1282    McsTable    mcsTable;    /* MCS table */
1283 }ModulationInfo;
1284
1285 typedef struct macUeCfg
1286 {
1287    uint16_t cellId;
1288    uint8_t  ueId;
1289    uint16_t crnti;
1290    bool macCellGrpCfgPres;
1291    MacCellGrpCfg macCellGrpCfg;
1292    bool phyCellGrpCfgPres;
1293    PhyCellGrpCfg phyCellGrpCfg;
1294    bool spCellCfgPres;
1295    SpCellCfg spCellCfg;
1296    AmbrCfg   *ambrCfg;
1297    ModulationInfo dlModInfo;    /* DL modulation info */
1298    ModulationInfo ulModInfo;    /* UL modulation info */
1299    uint8_t numLcs;
1300    LcCfg lcCfgList[MAX_NUM_LC];
1301    UeCfgState macUeCfgState;    /* InActive / Completed */
1302    DataTransmissionAction transmissionAction;
1303 }MacUeCfg;
1304
1305 typedef struct nrcgi
1306 {
1307    Plmn      plmn;
1308    uint16_t  cellId;
1309 }Nrcgi;
1310
1311 typedef struct srbFailInfo
1312 {
1313    uint8_t       srbId;
1314    FailureCause  cause;
1315 }SRBFailInfo;
1316
1317 typedef struct drbFailInfo
1318 {
1319    uint8_t       drbId;
1320    FailureCause  cause;
1321 }DRBFailInfo;
1322
1323 typedef struct sCellFailInfo
1324 {
1325    Nrcgi         nrcgi;
1326    FailureCause  cause;
1327 }SCellFailInfo;
1328
1329 typedef struct ueCfgRsp
1330 {
1331    uint16_t       cellId;
1332    uint16_t       ueId;
1333    MacRsp         result;
1334    uint8_t        numSRBFailed;   /* valid values : 0 to MAX_NUM_SRB */ 
1335    SRBFailInfo    *failedSRBlisti;
1336    uint8_t        numDRBFailed;   /* valid values : 0 to MAX_NUM_DRB */
1337    DRBFailInfo    *failedDRBlist;
1338    uint8_t        numSCellFailed; /* valid values : 0 to MAX_NUM_SCELL */
1339    SCellFailInfo  *failedSCellList;
1340 }MacUeCfgRsp;
1341
1342 typedef struct rachRsrcReq
1343 {
1344    uint16_t cellId;
1345    uint16_t ueId;
1346    uint8_t  numSsb;
1347    uint8_t  ssbIdx[MAX_NUM_SSB];
1348 }MacRachRsrcReq;
1349
1350 typedef struct macCfraSsbResource
1351 {
1352    uint8_t  ssbIdx;
1353    uint8_t  raPreambleIdx;
1354 }MacCfraSsbResource;
1355
1356 typedef struct macCfraResource
1357 {
1358    uint8_t   numSsb;
1359    MacCfraSsbResource ssbResource[MAX_NUM_SSB];
1360 }MacCfraResource;
1361
1362 typedef struct macRachRsrcRsp
1363 {
1364    uint16_t   cellId;
1365    uint16_t   ueId;
1366    MacRsp     result;
1367    uint16_t   newCrnti;     /* This parameter maps to 3GPP TS 38.331 newUE-Identity */
1368    MacCfraResource  cfraResource;
1369 }MacRachRsrcRsp;
1370
1371 typedef struct macRachRsrcRel
1372 {
1373    uint16_t cellId;
1374    uint16_t ueId;
1375    uint16_t crnti;
1376 }MacRachRsrcRel;
1377
1378 typedef struct ueDelete
1379 {
1380     uint16_t cellId;
1381     uint8_t  ueId;
1382     uint16_t crnti;
1383 }MacUeDelete;
1384
1385 typedef struct ueDeleteRsp
1386 {
1387    uint16_t cellId;
1388    uint8_t  ueId;
1389    UeDeleteStatus result;
1390 }MacUeDeleteRsp;
1391
1392 typedef struct macCellDelete
1393 {
1394    uint16_t cellId;
1395 }MacCellDelete;
1396
1397 typedef struct macCellDeleteRsp
1398 {
1399    uint16_t cellId;
1400    CellDeleteStatus result;
1401 }MacCellDeleteRsp;
1402
1403 typedef struct macSliceRsp
1404 {
1405    Snssai     snssai;
1406    MacRsp     rsp;
1407    RspReason  cause;  
1408 }MacSliceRsp;
1409
1410 typedef struct rrmPolicyRatio
1411 {
1412    uint8_t policyMaxRatio;
1413    uint8_t policyMinRatio;
1414    uint8_t policyDedicatedRatio;
1415 }RrmPolicyRatio;
1416
1417 typedef struct macSliceRrmPolicy
1418 {
1419    Snssai  snssai;
1420    RrmPolicyRatio *rrmPolicyRatio;
1421 }MacSliceRrmPolicy;
1422
1423 typedef struct macSliceCfgReq
1424 {
1425    uint8_t  numOfConfiguredSlice;
1426    MacSliceRrmPolicy **listOfSliceCfg;
1427 }MacSliceCfgReq;
1428
1429 typedef struct macSliceCfgRsp
1430 {
1431    uint8_t  numSliceCfgRsp;
1432    MacSliceRsp  **listOfSliceCfgRsp;
1433 }MacSliceCfgRsp;
1434
1435 typedef struct macPcchInd
1436 {
1437    uint16_t  cellId;
1438    uint16_t  pf;
1439    uint8_t   i_s;
1440    uint16_t  pduLen;
1441    uint8_t  *pcchPdu;
1442 }MacPcchInd;
1443
1444 /* Functions for CellUp Ind from MAC to DU APP*/
1445 typedef uint8_t (*DuMacCellUpInd) ARGS((
1446          Pst       *pst,
1447          OduCellId *cellId ));
1448
1449 /* Functions for slot Ind from MAC to DU APP*/
1450 typedef uint8_t (*DuMacSlotInd) ARGS((
1451          Pst       *pst,
1452          SlotTimingInfo *slotIndInfo));
1453
1454 /* Functions for stop Ind from MAC to DU APP*/
1455 typedef uint8_t (*DuMacStopInd) ARGS((
1456          Pst        *pst,
1457          OduCellId  *cellId ));
1458
1459 /* Functions for mac cell start req */
1460 typedef uint8_t (*DuMacCellStart) ARGS((
1461          Pst        *pst, 
1462          OduCellId  *cellId));
1463
1464 /* Functions for mac cell stop request */
1465 typedef uint8_t (*DuMacCellStop) ARGS((
1466          Pst        *pst,
1467          OduCellId  *cellId ));
1468
1469 /* Function pointers for packing macCellCfg Request and Confirm */
1470 typedef uint8_t (*packMacCellCfgReq) ARGS((
1471          Pst           *pst,
1472          MacCellCfg    *macCellCfg ));
1473
1474 typedef uint8_t (*packMacCellCfgConfirm) ARGS((
1475          Pst              *pst,
1476          MacCellCfgCfm    *macCellCfgCfm ));
1477
1478 typedef uint8_t (*DuMacCellCfgReq) ARGS((
1479          Pst        *pst,        
1480          MacCellCfg *macCellCfg));
1481
1482 typedef uint8_t (*DuMacCellCfgCfm) ARGS((
1483          Pst        *pst,        
1484          MacCellCfgCfm *macCellCfgCfm ));
1485
1486 /* Functions for UL CCCH Ind from MAC to DU APP*/
1487 typedef uint8_t (*DuMacUlCcchInd) ARGS((
1488          Pst           *pst,
1489          UlCcchIndInfo *ulCcchIndInfo ));
1490
1491 /* Functions for DL CCCH Ind from DU APP to MAC*/
1492 typedef uint8_t (*DuMacDlCcchInd) ARGS((
1493          Pst           *pst,
1494          DlCcchIndInfo *dlCcchIndInfo ));
1495
1496 /* UE create Request from DU APP to MAC*/
1497 typedef uint8_t (*DuMacUeCreateReq) ARGS((
1498          Pst           *pst,
1499          MacUeCfg      *ueCfg ));
1500
1501 /* UE create Response from MAC to DU APP */
1502 typedef uint8_t (*MacDuUeCfgRspFunc) ARGS((
1503          Pst           *pst, 
1504          MacUeCfgRsp   *cfgRsp));
1505
1506 /* UE Reconfig Request from DU APP to MAC */
1507 typedef uint8_t (*DuMacUeReconfigReq) ARGS((
1508          Pst           *pst,
1509          MacUeCfg      *ueCfg ));
1510
1511 /* RACH Resource Request from DU APP to MAC */
1512 typedef uint8_t (*DuMacRachRsrcReq) ARGS((
1513     Pst            *pst,
1514     MacRachRsrcReq *rachRsrcReq));
1515
1516 /* RACH Resource Response from MAC to DU APP */
1517 typedef uint8_t (*MacDuRachRsrcRspFunc) ARGS((
1518     Pst            *pst,
1519     MacRachRsrcRsp *rachRsrcRsp));
1520
1521 /* RACH Resource Release from DU APP to MAC */
1522 typedef uint8_t (*DuMacRachRsrcRel) ARGS((
1523     Pst            *pst,
1524     MacRachRsrcRel *rachRsrcRel));
1525
1526 /* UE Delete Request from DU APP to MAC*/
1527 typedef uint8_t (*DuMacUeDeleteReq) ARGS((
1528      Pst           *pst,
1529      MacUeDelete   *ueDel ));
1530
1531 /* UE Delete Response from MAC to DU APP*/
1532 typedef uint8_t (*MacDuUeDeleteRspFunc) ARGS((
1533      Pst            *pst,
1534      MacUeDeleteRsp *deleteRsp));
1535
1536 /* Cell Delete Request from DU APP to MAC*/
1537 typedef uint8_t (*DuMacCellDeleteReq) ARGS((
1538      Pst           *pst,
1539      MacCellDelete *cellDelete ));
1540
1541 /* Cell Delete Response from MAC to DU APP*/
1542 typedef uint8_t (*MacDuCellDeleteRspFunc) ARGS((
1543      Pst            *pst,
1544      MacCellDeleteRsp *cellDeleteRsp));
1545
1546 /* Slice Cfg Request from DU APP to MAC*/
1547 typedef uint8_t (*DuMacSliceCfgReq) ARGS((
1548      Pst           *pst,
1549      MacSliceCfgReq *CfgReq));
1550
1551 /* Slice Cfg Response from MAC to DU APP */
1552 typedef uint8_t (*MacDuSliceCfgRspFunc) ARGS((
1553          Pst           *pst, 
1554          MacSliceCfgRsp   *cfgRsp));
1555
1556 /* Slice ReReCfg Request from DU APP to MAC*/
1557 typedef uint8_t (*DuMacSliceRecfgReq) ARGS((
1558      Pst           *pst,
1559      MacSliceCfgReq *CfgReq));
1560
1561 /* Slice ReReCfg Response from MAC to DU APP */
1562 typedef uint8_t (*MacDuSliceReCfgRspFunc) ARGS((
1563         Pst           *pst,
1564         MacSliceCfgRsp   *cfgRsp));
1565
1566 /* Pcch indication from DU APP to MAC*/
1567 typedef uint8_t (*DuMacDlPcchInd) ARGS((
1568      Pst        *pst,
1569      MacPcchInd *pcchInd));
1570
1571 uint64_t ueBitMapPerCell[MAX_NUM_CELL]; /* Bit Map to store used/free UE-IDX per Cell */
1572
1573 uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId);
1574 uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf);
1575 uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId);
1576 uint8_t packMacCellStart(Pst *pst, OduCellId *cellId);
1577 uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf);
1578 uint8_t MacProcCellStart(Pst *pst, OduCellId *cellId);
1579 uint8_t packMacCellStop(Pst *pst, OduCellId *cellId);
1580 uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf);
1581 uint8_t MacProcCellStop(Pst *pst, OduCellId *cellId);
1582 uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
1583 uint8_t unpackDuMacCellCfg(DuMacCellCfgReq func,  Pst *pst,  Buffer *mBuf);
1584 uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
1585 uint8_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
1586 uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
1587 uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
1588 uint8_t packMacStopInd(Pst *pst, OduCellId *cellId);
1589 uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
1590 uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId);
1591 uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
1592 uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
1593 uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
1594 uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
1595 uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
1596 uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
1597 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
1598 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf);
1599 uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
1600 uint8_t sendStopIndMacToDuApp(uint16_t cellId);
1601 uint8_t packDuMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
1602 uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf);
1603 uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
1604 uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg);
1605 uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf);
1606 uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg);
1607 uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq);
1608 uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf);
1609 uint8_t MacProcRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq);
1610 uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp);
1611 uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf);
1612 uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp);
1613 uint8_t packDuMacRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel);
1614 uint8_t unpackMacRachRsrcRel(DuMacRachRsrcRel func, Pst *pst, Buffer *mBuf);
1615 uint8_t MacProcRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel);
1616 uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDelete);
1617 uint8_t MacProcUeDeleteReq(Pst *pst,  MacUeDelete *ueDelete);
1618 uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf);
1619 uint8_t packDuMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp);
1620 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp);
1621 uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf);
1622 uint8_t packDuMacCellDeleteReq(Pst *pst, MacCellDelete *cellDelete);
1623 uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete);
1624 uint8_t unpackMacCellDeleteReq(DuMacCellDeleteReq func, Pst *pst, Buffer *mBuf);
1625 uint8_t packDuMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp);
1626 uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp);
1627 uint8_t unpackDuMacCellDeleteRsp(MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf);
1628 uint8_t packDuMacSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq);
1629 uint8_t MacProcSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq);
1630 uint8_t unpackMacSliceCfgReq(DuMacSliceCfgReq func, Pst *pst, Buffer *mBuf);
1631 uint8_t DuProcMacSliceCfgRsp(Pst *pst,  MacSliceCfgRsp *cfgRsp);
1632 uint8_t packDuMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp);
1633 uint8_t unpackDuMacSliceCfgRsp(MacDuSliceCfgRspFunc func, Pst *pst, Buffer *mBuf);
1634 uint8_t packDuMacSliceRecfgReq(Pst *pst, MacSliceCfgReq *sliceReCfgReq);
1635 uint8_t MacProcSliceReCfgReq(Pst *pst, MacSliceCfgReq *sliceReCfgReq);
1636 uint8_t unpackMacSliceReCfgReq(DuMacSliceRecfgReq func, Pst *pst, Buffer *mBuf);
1637 uint8_t DuProcMacSliceReCfgRsp(Pst *pst,  MacSliceCfgRsp *cfgRsp);
1638 uint8_t packDuMacSliceReCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp);
1639 uint8_t unpackDuMacSliceReCfgRsp(MacDuSliceReCfgRspFunc func, Pst *pst, Buffer *mBuf);
1640 uint8_t duHandleSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo);
1641 uint8_t packMacSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo);
1642 uint8_t unpackDuMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
1643 uint8_t packDuMacDlPcchInd(Pst *pst, MacPcchInd *pcchInd);
1644 uint8_t MacProcDlPcchInd(Pst *pst, MacPcchInd *pcchInd);
1645 uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf);
1646 int8_t getFreeBitFromUeBitMap(uint16_t cellId);
1647 void unsetBitInUeBitMap(uint16_t cellId, uint8_t bitPos);
1648 #endif
1649
1650
1651 /**********************************************************************
1652   End of file
1653  **********************************************************************/