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