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