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