32cd057b3e377b506ca27554a604b7eb2ba0b49e
[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 #define MAX_SI_MESSAGE 32 /* As per 138 331 V15.3, RRC Multiplicity and type constraint definitions maxSI-Message = 32 */ 
25 #define NUM_SIB 32         /* As per 138 331 V15.3, RRC Multiplicity and type constraint definitions  maxSIB = 32 */ 
26 #define NUM_SSB         1       /* max value is 64 */
27 #define SSB_MASK_SIZE   1       /* SSB mask size is 32bit for sub6 */
28 #define SIB1_REPETITION_PERIOD   20
29 #define CORESET_0_INDEX      0
30 #define CORESET_1_INDEX      1
31 #define CORESET_2_INDEX      2
32 #define CORESET_3_INDEX      3
33 #define CORESET_4_INDEX      4
34 #define SEARCHSPACE_0_INDEX   0
35 #define SEARCHSPACE_1_INDEX   1
36 #define SEARCHSPACE_2_INDEX   2
37 #define SEARCHSPACE_3_INDEX   3
38 #define SEARCHSPACE_4_INDEX   4
39 #define SS_MONITORING_SLOT_SL1   0 /* all slots */
40 #define SS_MONITORING_SYMBOL     0x2000; /* symbol-0, set 14th bit */
41
42 /* Macro for Ue Context */
43 #define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
44 #define MAC_NUM_TAGS 4                  /* Max number of timing advance groups */
45 #define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
46 #define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
47 #define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
48 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
49 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
50 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
51 #define MAX_NUM_SCELL  32
52
53 /* PUCCH Configuration Macro */
54 #define MAX_NUM_PUCCH_RESRC 128
55 #define MAX_NUM_PUCCH_RESRC_SET 4
56 #define MAX_NUM_PUCCH_PER_RESRC_SET 32
57 #define MAX_NUM_SPATIAL_RELATIONS 8
58 #define MAX_NUM_PUCCH_P0_PER_SET 8
59 #define MAX_NUM_PATH_LOSS_REF_RS 4
60 #define MAX_NUM_DL_DATA_TO_UL_ACK 15
61
62 /* Event IDs */
63 #define EVENT_MAC_CELL_CONFIG_REQ    200
64 #define EVENT_MAC_CELL_CONFIG_CFM    201
65 #define EVENT_MAC_CELL_START         202
66 #define EVENT_MAC_CELL_STOP          203
67 #define EVENT_MAC_CELL_UP_IND        204
68 #define EVENT_MAC_STOP_IND           205
69 #define EVENT_MAC_UL_CCCH_IND        206
70 #define EVENT_MAC_DL_CCCH_IND        207
71 #define EVENT_MAC_UE_CREATE_REQ      208
72 #define EVENT_MAC_UE_CREATE_RSP      209
73 #define EVENT_MAC_UE_RECONFIG_REQ    210
74 #define EVENT_MAC_UE_RECONFIG_RSP    211
75 #define EVENT_MAC_UE_DELETE_REQ      212
76 #define EVENT_MAC_UE_DELETE_RSP      213
77 #define EVENT_MAC_CELL_DELETE_REQ    214
78 #define EVENT_MAC_CELL_DELETE_RSP    215
79 #define EVENT_MAC_SLICE_CFG_REQ      216
80 #define EVENT_MAC_SLICE_CFG_RSP      217
81 #define EVENT_MAC_SLICE_RECFG_REQ    218
82 #define EVENT_MAC_SLICE_RECFG_RSP    219
83 #define EVENT_MAC_SLOT_IND           220
84 #define EVENT_MAC_RACH_RESOURCE_REQ  221
85 #define EVENT_MAC_RACH_RESOURCE_RSP  222
86 #define EVENT_MAC_RACH_RESOURCE_REL  223
87 #define EVENT_MAC_DL_PCCH_IND        224
88 #define EVENT_MAC_UE_RESET_REQ       225
89 #define EVENT_MAC_UE_RESET_RSP       226
90 #define EVENT_MAC_UE_SYNC_STATUS_IND 227
91 #define EVENT_MAC_DL_BROADCAST_REQ   228
92 #define EVENT_MAC_STATISTICS_REQ     229
93 #define EVENT_MAC_STATISTICS_RSP     230
94 #define EVENT_MAC_STATISTICS_IND     231
95 #define EVENT_MAC_STATS_DELETE_REQ   232
96 #define EVENT_MAC_STATS_DELETE_RSP   233
97 #define EVENT_MAC_STATISTICS_MODIFY_REQ     234
98 #define EVENT_MAC_STATISTICS_MODIFY_RSP     235
99
100 #define BSR_PERIODIC_TIMER_SF_10 10
101 #define BSR_RETX_TIMER_SF_320 320
102 #define BSR_SR_DELAY_TMR_2560 2560
103
104 #define PAGING_SCHED_DELTA  4
105 #define MAX_PLMN 2
106
107 /********************* Global Variable ********************/
108 uint64_t ueBitMapPerCell[MAX_NUM_CELL]; /* Bit Map to store used/free UE-IDX per Cell */
109
110 /********************* Interface structure definition ********************/
111 typedef enum
112 {
113    SIB_TYPE2,
114    SIB_TYPE3,
115    SIB_TYPE4,
116    SIB_TYPE5,
117    SIB_TYPE6,
118    SIB_TYPE7,
119    SIB_TYPE8,
120    SIB_TYPE9,
121    SPARE
122 }SibType;
123
124 typedef enum
125 {
126    SSB_PER_RACH_OCCASION_ONE_EIGHTH,
127    SSB_PER_RACH_OCCASION_ONE_FOURTH,
128    SSB_PER_RACH_OCCASION_ONE_HALF,
129    SSB_PER_RACH_OCCASION_ONE,
130    SSB_PER_RACH_OCCASION_TWO,
131    SSB_PER_RACH_OCCASION_FOUR,
132    SSB_PER_RACH_OCCASION_EIGHT,
133    SSB_PER_RACH_OCCASION_SIXTEEN
134 }SsbPerRachOccasion;
135
136 typedef enum
137 {
138    BROADCASTING,
139    NOTBROADCASTING,
140 }SiBroadcastStatus;
141
142 typedef enum
143 {
144    RF8,
145    RF16,
146    RF32,
147    RF64,
148    RF128,
149    RF256,
150    RF512
151 }SiPeriodicity;
152
153 typedef enum
154 {
155    S5,
156    S10,
157    S20, 
158    S40, 
159    S80, 
160    S160, 
161    S320, 
162    S640, 
163    S1280
164 }SiWindowLength;
165
166 typedef enum
167 {
168    SI_REQ_PERIOD_1,
169    SI_REQ_PERIOD_2,
170    SI_REQ_PERIOD_4,
171    SI_REQ_PERIOD_6,
172    SI_REQ_PERIOD_8,
173    SI_REQ_PERIOD_10,
174    SI_REQ_PERIOD_12,
175    SI_REQ_PERIOD_16
176 }SiRequestPeriod;
177
178 typedef enum
179 {
180    MAC_DU_APP_RSP_NOK,
181    MAC_DU_APP_RSP_OK
182 }MacRsp;
183
184 typedef enum
185 {
186    IN_SYNC,
187    OUT_OF_SYNC,
188    OUT_OF_SUNC_MAX_RETRIES
189 }SyncStatus;
190
191 typedef enum
192 {
193    DUP_MODE_FDD,
194    DUP_MODE_TDD
195 }DuplexMode;
196
197 typedef enum
198 {
199    MAC_GEN_FULL_PBCH_PAYLD,   /* MAC generated the full PBCH Payload */
200    PHY_GEN_TIMING_PBCH_BIT,   /* PHY generates the timing PBCH bits */
201    PHY_GEN_FULL_PBCH_PAYLD    /* PHY generates full PBCH payload */
202 }BchPduOpt;
203
204 typedef enum
205 {
206    LONG_SEQUENCE,
207    SHORT_SEQUENCE
208 }PrachSeqLen;
209
210 typedef enum
211 {
212    UNRESTRICTED,
213    RESTRICTED_SET_TYPE_A,
214    RESTRICTED_SET_TYPE_B
215 }RstSetCfg;
216
217 typedef enum
218 {
219    DONT_REPORT_RSSI,
220    RSSI_UNIT_DBM,
221    RSSI_UNIT_DBFS
222 }RSSIMeasUnit;
223
224 typedef enum
225 {
226    BETA_PSS_0DB,
227    BETA_PSS_3DB
228 }BetaPss;
229
230 typedef enum 
231 {
232    SSB_PRDCTY_MS_5,
233    SSB_PRDCTY_MS_10,
234    SSB_PRDCTY_MS_20,
235    SSB_PRDCTY_MS_40,
236    SSB_PRDCTY_MS_80,
237    SSB_PRDCTY_MS_160
238 }SSBPeriod;
239
240 typedef enum
241 {
242    RRC_REJECT,
243    RRC_SETUP
244 }DlCcchMsgType;
245
246 /* Enums for Ue Create Request */
247
248 /* SR PROHIBIT TIMER */
249 typedef enum
250 {
251    SR_PROHIBIT_MS_1,
252    SR_PROHIBIT_MS_2,
253    SR_PROHIBIT_MS_4,
254    SR_PROHIBIT_MS_8,
255    SR_PROHIBIT_MS_16,
256    SR_PROHIBIT_MS_32,
257    SR_PROHIBIT_MS_64,
258    SR_PROHIBIT_MS_128
259 }SrProhibitTimer;
260
261 typedef enum
262 {
263    SR_TRANS_MAX_N_4,
264    SR_TRANS_MAX_N_8,
265    SR_TRANS_MAX_N_16,
266    SR_TRANS_MAX_N_32,
267    SR_TRANS_MAX_N_64,
268    SR_TRANS_MAX_spare3,
269    SR_TRANS_MAX_spare2,
270    SR_TRANS_MAX_spare1
271 }SrTransMax;
272
273 typedef enum
274 {
275    TIME_ALIGNMENT_TIMER_MS_500,
276    TIME_ALIGNMENT_TIMER_MS_750,
277    TIME_ALIGNMENT_TIMER_MS_1280,
278    TIME_ALIGNMENT_TIMER_MS_1920,
279    TIME_ALIGNMENT_TIMER_MS_2560,
280    TIME_ALIGNMENT_TIMER_MS_5120,
281    TIME_ALIGNMENT_TIMER_MS_10240,
282    TIME_ALIGNMENT_TIMER_INFINITY
283 }TimeAlignmentTimer;
284
285 typedef enum
286 {
287    PHR_PERIODIC_TIMER_SF_10,
288    PHR_PERIODIC_TIMER_SF_20,
289    PHR_PERIODIC_TIMER_SF_50,
290    PHR_PERIODIC_TIMER_SF_100,
291    PHR_PERIODIC_TIMER_SF_200,
292    PHR_PERIODIC_TIMER_SF_500,
293    PHR_PERIODIC_TIMER_SF_1000,
294    PHR_PERIODIC_TIMER_INFINITY
295 }PhrPeriodicTimer;
296
297 typedef enum
298 {
299    PHR_PROHIBIT_TIMER_SF_0,
300    PHR_PROHIBIT_TIMER_SF_10,
301    PHR_PROHIBIT_TIMER_SF_20,
302    PHR_PROHIBIT_TIMER_SF_50,
303    PHR_PROHIBIT_TIMER_SF_100,
304    PHR_PROHIBIT_TIMER_SF_200,
305    PHR_PROHIBIT_TIMER_SF_500,
306    PHR_PROHIBIT_TIMER_SF_1000
307 }PhrProhibitTimer;
308
309 typedef enum
310 {
311    PHR_TX_PWR_FACTOR_CHANGE_DB_1,
312    PHR_TX_PWR_FACTOR_CHANGE_DB_3,
313    PHR_TX_PWR_FACTOR_CHANGE_DB_6,
314    PHR_TX_PWR_FACTOR_CHANGE_INFINITY
315 }PhrTxPwrFactorChange;
316
317 typedef enum
318 {
319    PHR_MODE_OTHER_CG_REAL,
320    PHR_MODE_OTHER_CG_VIRTUAL
321 }PhrModeOtherCG;
322
323 typedef enum
324 {
325    PDSCH_HARQ_ACK_CODEBOOK_SEMISTATIC,
326    PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC
327 }PdschHarqAckCodebook;
328
329 typedef enum
330 {
331    NUM_HARQ_PROC_FOR_PDSCH_N_2,
332    NUM_HARQ_PROC_FOR_PDSCH_N_4,
333    NUM_HARQ_PROC_FOR_PDSCH_N_6,
334    NUM_HARQ_PROC_FOR_PDSCH_N_10,
335    NUM_HARQ_PROC_FOR_PDSCH_N_16
336 }NumHarqProcForPdsch;
337
338 typedef enum
339 {
340    MAX_CODE_BLOCK_GROUP_PER_TB_N_2,
341    MAX_CODE_BLOCK_GROUP_PER_TB_N_4,
342    MAX_CODE_BLOCK_GROUP_PER_TB_N_6,
343    MAX_CODE_BLOCK_GROUP_PER_TB_N_8
344 }MaxCodeBlkGrpPerTB;
345
346 typedef enum
347 {
348    PDSCH_X_OVERHEAD_6,
349    PDSCH_X_OVERHEAD_12,
350    PDSCH_X_OVERHEAD_18
351 }PdschXOverhead;
352
353 typedef enum
354 {
355    TRANSFORM_PRECODER_ENABLED,
356    TRANSFORM_PRECODER_DISABLED
357 }TransformPrecoder;
358
359 typedef enum 
360 {
361    CCE_REG_MAPPINGTYPE_PR_INTERLEAVED = 1,
362    CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED
363 }REGMappingType;
364
365 typedef enum
366 {
367    SLOTPERIODICITY_PR_SL1 = 1,
368    SLOTPERIODICITY_PR_SL2,
369    SLOTPERIODICITY_PR_SL4,
370    SLOTPERIODICITY_PR_SL5,
371    SLOTPERIODICITY_PR_SL8,
372    SLOTPERIODICITY_PR_SL10,
373    SLOTPERIODICITY_PR_SL16,
374    SLOTPERIODICITY_PR_SL20,
375    SLOTPERIODICITY_PR_SL40,
376    SLOTPERIODICITY_PR_SL80,
377    SLOTPERIODICITY_PR_SL160,
378    SLOTPERIODICITY_PR_SL320,
379    SLOTPERIODICITY_PR_SL640,
380    SLOTPERIODICITY_PR_SL1280,
381    SLOTPERIODICITY_PR_SL2560
382 }MSlotPeriodicity;
383
384 typedef enum
385 {
386    SAMEASREG_BUNDLE,
387    ALL_CONTIGUOUS_RBS
388 }PrecoderGranul;
389
390 typedef enum
391 {
392    SEARCHSPACETYPE_PR_COMMON = 1,
393    SEARCHSPACETYPE_PR_UE_SPECIFIC
394 }SearchSpaceType;
395
396 typedef enum
397 {
398    QOS_NON_DYNAMIC = 1,
399    QOS_DYNAMIC
400 }QosType;
401
402 typedef enum
403 {
404    AGGREGATIONLEVEL_N0  = 0,  
405    AGGREGATIONLEVEL_N1  = 1,
406    AGGREGATIONLEVEL_N2  = 2,
407    AGGREGATIONLEVEL_N3  = 3,
408    AGGREGATIONLEVEL_N4  = 4,
409    AGGREGATIONLEVEL_N5  = 5,
410    AGGREGATIONLEVEL_N6  = 6,
411    AGGREGATIONLEVEL_N8  = 7
412 }AggrLevel;
413
414 typedef enum
415 {
416    ADDITIONALPOSITION_POS0,
417    ADDITIONALPOSITION_POS1,
418    ADDITIONALPOSITION_POS3
419 }AddPosType;
420
421 typedef enum
422 {
423    MAPPING_TYPEA,
424    MAPPING_TYPEB
425 }CommonMappingType;
426
427 typedef enum
428 {
429    RESOURCEALLOCATION_TYPE0,
430    RESOURCEALLOCATION_TYPE1,
431    RESOURCEALLOCATION_DYNAMICSWITCH
432 }ResAllocType;
433
434 typedef enum
435 {
436    RBG_SIZE_CONFIG1,
437    RBG_SIZE_CONFIG2
438 }RBGSize;
439
440 typedef enum
441 {
442    CODEWORDS_SCHED_BY_DCI_N1,
443    CODEWORDS_SCHED_BY_DCI_N2
444 }CodeWordsSchedDci;
445
446 typedef enum
447 {
448    TYPE_STATIC_BUNDLING = 1,
449    TYPE_DYNAMIC_BUNDLING
450 }BundlingType;
451
452 typedef enum
453 {
454    SET2_SIZE_N4,
455    SET2_SIZE_WIDEBAND
456 }BundlingSizeSet2;
457
458 typedef enum
459 {
460    SET1_SIZE_N4,
461    SET1_SIZE_WIDEBAND,
462    SET1_SIZE_N2_WIDEBAND,
463    SET1_SIZE_N4_WIDEBAND
464 }BundlingSizeSet1;
465
466 typedef enum
467 {
468    LC_PRIORITY_1 = 1,
469    LC_PRIORITY_2,
470    LC_PRIORITY_3
471 }LcPriority;
472
473 typedef enum
474 {
475   PBR_KBPS_0,
476   PBR_KBPS_8,
477   PBR_KBPS_16,
478   PBR_KBPS_32,
479   PBR_KBPS_64,
480   PBR_KBPS_128,
481   PBR_KBPS_256,
482   PBR_KBPS_512,
483   PBR_KBPS_1024,
484   PBR_KBPS_2048,
485   PBR_KBPS_4096,
486   PBR_KBPS_8192,
487   PBR_KBPS_16384,
488   PBR_KBPS_32768,
489   PBR_KBPS_65536,
490   PBR_KBPS_INFINITY
491 }PBitRate;
492
493 typedef enum
494 {
495    BSD_MS_5,
496    BSD_MS_10,
497    BSD_MS_20,
498    BSD_MS_50,
499    BSD_MS_100,
500    BSD_MS_150,
501    BSD_MS_300,
502    BSD_MS_500,
503    BSD_MS_1000,
504    BSD_SPARE_7,
505    BSD_SPARE_6,
506    BSD_SPARE_5,
507    BSD_SPARE_4,
508    BSD_SPARE_3,
509    BSD_SPARE_2,
510    BSD_SPARE_1
511
512 }BucketSizeDur;
513
514 typedef enum
515 {
516    RADIO_NW_LAYER_FAIL,
517    TRANSPORT_LAYER_FAIL,
518    PROTOCOL_FAIL,
519    MISCELLANEOUS
520 }CauseGrp;
521
522 typedef enum
523 {
524    UNSPECIFIED_RADIO_NW_CAUSE,
525    RL_FAIL_RLC,
526    UNKNOWN_GNB_CU_UE_F1AP_ID,
527    ALREADY_ALLOCATED_GNB_CU_UE_F1AP_ID,
528    UNKNOWN_GNB_DU_UE_F1AP_ID,
529    ALREADY_ALLOCATED_GNB_DU_UE_F1AP_ID,
530    UNKNOWN_UE_F1AP_ID_PAIR,
531    INCONSISTENT_UE_F1AP_ID_PAIR,
532    INTERACTION_WITH_OTHER_PROCEDURE,
533    UNSUPPORTED_QCI,
534    ACTION_REQUIRED_FOR_RADIO_REASONS,
535    RADIO_RESOURCES_UNAVAILABLE,
536    CANCELLED_PROCEDURE,
537    RELEASE_NORMAL,
538    CELL_UNAVAILABLE,
539    OTHER_RL_FAILURE,
540    UE_REJECTION,
541    RESOURCES_UNAVAILABLE_FOR_SLICE
542 }RadioNwLyrCause;
543
544 typedef enum
545 {
546    UNSPECIFIED_TRANSPORT_LAYER_CAUSE,
547    TRANSPORT_RESOURCE_UNAVAILABLE
548 }TransLyrCause;
549
550 typedef enum
551 {
552    TRANSFER_SYNTAX_ERROR,
553    ABSTRACT_SYNTAX_ERROR_REJECT,
554    ABSTRACT_SYNTAX_ERROR_IGNORE_AND_REJECT,
555    INCOMPATIBLE_MESSAGE_FOR_RECEIVER_STATE,
556    SEMANTIC_ERR,
557    ABSTRAXCT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MSG,
558    UNSPECIFIED_PROTOCOL_CAUSE
559 }ProtCause;
560
561 typedef enum
562 {
563    CONTROL_PROCESSING_OVERLOAD,
564    NOT_ENOUGH_USER,
565    PLANE_PROCESSING_RESOURCES,
566    HARDWARE_FAIL,
567    INTERVENTION_BY_O_AND_M,
568    UNSPECIFIED_MISC_CAUSE
569 }MiscFailCause;
570
571 typedef enum
572 {
573    MCS_TABLE_QAM64,
574    MCS_TABLE_QAM256,
575    MCS_TABLE_QAM64_LOW_SE
576 }McsTable;
577
578 typedef enum
579 {
580    RSRC_PRB,
581    RSRC_DRB,
582    RSRC_RRC_CONNECTED_USERS
583 }ResourceType;
584
585 typedef enum
586 {
587    TRANSMISSION_ALLOWED,
588    STOP_TRANSMISSION,
589    RESTART_TRANSMISSION
590 }DataTransmissionAction;
591
592 /* Performance measurements from 3GPP TS 28.552 Release 15 */
593 typedef enum
594 {
595    MAC_DL_TOTAL_PRB_USAGE,
596    MAC_UL_TOTAL_PRB_USAGE
597 }MacMeasurementType;
598
599 typedef struct failureCause 
600 {
601    CauseGrp   type;
602    union
603    {
604       RadioNwLyrCause   radioNwResult;
605       TransLyrCause     transportResult;
606       ProtCause         protcolResult;
607       MiscFailCause     miscResult;
608    }u;
609 }FailureCause;
610
611 typedef struct carrierCfg
612 {
613    uint32_t   dlBw;                   /* DL bandwidth */
614    uint32_t   arfcnDL;                 /* Absolute frequency Number of DL */
615    uint32_t   ulBw;                   /* UL bandwidth */
616    uint32_t   arfcnUL;                 /* Absolute frequency Number of UL */
617    uint16_t   numTxAnt;               /* Number of Tx antennas */
618    uint16_t   numRxAnt;               /* Number of Rx antennas */
619 }CarrierCfg;
620
621 typedef enum
622 {
623    OP_DISABLED,     
624    OP_ENABLED,     
625 }MacOpState;
626
627 typedef enum
628 {
629    ADMIN_LOCKED,     
630    ADMIN_UNLOCKED,  
631    ADMIN_SHUTTING_DOWN, 
632 }MacAdminState;
633
634 typedef enum
635 {
636    CELL_IDLE,
637    CELL_INACTIVE,
638    CELL_ACTIVE,
639 }MacCellState;
640
641 /*Spec Ref: 38.331: RadioLinkMonitoringConfig*/
642 typedef enum
643 {
644    BeamFailure,
645    Rlf,
646    Both
647 }PurposeOfFailureDet;
648
649 typedef struct plmnInfoList
650 {
651    Plmn           plmn;
652    uint8_t        numSupportedSlice; /* Total slice supporting */
653    Snssai         **snssai;         /* List of supporting snssai*/
654 }PlmnInfoList;
655
656 typedef struct schPageCfg
657 {
658   uint8_t  numPO;                    /*Derived from Ns*/
659   bool     poPresent;                /*Whether FirstPDCCH-MonitoringPO is present or not*/
660   uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
661 }SchPageCfg;
662
663 typedef struct pdcchConfigSib1
664 {
665    uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
666    uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
667 }PdcchConfigSib1;
668
669 typedef struct sib1CellCfg
670 {
671    PdcchConfigSib1  pdcchCfgSib1;  /*Freq pos where UE may find SS/PBCH block with SIB1*/
672    uint8_t          *sib1Pdu;
673    uint16_t         sib1PduLen;
674    SchPageCfg       pagingCfg;
675 } Sib1CellCfg; 
676
677 typedef struct bwpParams
678 {
679    uint16_t firstPrb;
680    uint16_t numPrb;
681    uint8_t  scs;
682    uint8_t  cyclicPrefix;
683 }BwpParams;
684
685 typedef struct candidatesInfo
686 {
687    uint8_t aggLevel1;
688    uint8_t aggLevel2;
689    uint8_t aggLevel4;
690    uint8_t aggLevel8;
691    uint8_t aggLevel16;
692 }CandidatesInfo;
693
694 typedef struct searchSpaceCfg
695 {
696    uint8_t searchSpaceId;
697    uint8_t coresetId;
698    uint16_t monitoringSlot;
699    uint16_t duration;
700    uint16_t monitoringSymbol;
701    CandidatesInfo candidate;
702 }SearchSpaceCfg;
703
704 typedef struct pdcchConfigCommon
705 {
706    /* only one search space is configured during SIB1 */
707    SearchSpaceCfg commonSearchSpace;
708    uint8_t raSearchSpaceId;
709 }PdcchConfigCommon;
710
711 typedef struct pdschCfgCommTimeDomRsrcAlloc
712 {
713    uint8_t k0;
714    uint8_t mappingType;
715    uint8_t startSymbol;
716    uint8_t lengthSymbol;
717 }PdschCfgCommTimeDomRsrcAlloc;
718
719 typedef struct pdschConfigCommon
720 {
721    uint8_t  numTimeDomAlloc;
722    /* PDSCH time domain DL resource allocation list */
723    PdschCfgCommTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_DL_ALLOC]; 
724 }PdschConfigCommon;
725
726 typedef struct pucchConfigCommon
727 {
728    uint8_t pucchResourceCommon;
729    uint8_t pucchGroupHopping;
730 }PucchConfigCommon;
731
732 /* PUSCH Time Domain Resource Allocation */
733 typedef struct puschTimeDomRsrcAlloc
734 {
735    uint8_t             k2;
736    CommonMappingType   mappingType;
737    uint8_t             startSymbol;
738    uint8_t             symbolLength;
739    uint8_t             startSymbolAndLength;
740 }PuschTimeDomRsrcAlloc;
741
742 typedef struct puschConfigCommon
743 {
744    /* PUSCH-TimeDomainResourceAllocation info */
745    uint8_t                 numTimeDomRsrcAlloc;
746    PuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
747 }PuschConfigCommon;
748
749 typedef struct bwpDlConfig
750 {
751    BwpParams         bwp;
752    PdcchConfigCommon pdcchCommon;
753    PdschConfigCommon pdschCommon;
754 }BwpDlConfig;
755
756 typedef struct bwpUlConfig
757 {
758    BwpParams         bwp;
759    // rach config common sent in PrachCfg
760    PucchConfigCommon pucchCommon;
761    PuschConfigCommon puschCommon;
762 }BwpUlConfig;
763
764
765 typedef struct cellCfg
766 {
767    MacOpState      opState;
768    MacAdminState   adminState;
769    MacCellState    cellState;
770    PlmnInfoList plmnInfoList[MAX_PLMN];   /* Consits of PlmnId and Snssai list */
771    uint32_t     phyCellId;                /* Physical cell id */
772    uint32_t     tac;
773    uint32_t     ssbFreq;
774    uint16_t     subCarrSpacing;
775    DuplexMode   dupType;          /* Duplex type: TDD/FDD */
776    Sib1CellCfg  sib1Cfg;          /* SIB1 config */
777    BwpDlConfig  initialDlBwp;     /* Initial DL BWP */
778    BwpUlConfig  initialUlBwp;     /* Initial UL BWP */
779 }CellCfg;
780
781 typedef struct ssbCfg
782 {
783    uint32_t    ssbPbchPwr;       /* SSB block power */
784    uint8_t     scsCmn;           /* subcarrier spacing for common */
785    uint16_t    ssbOffsetPointA;  /* SSB subcarrier offset from point A */
786    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
787    uint8_t     ssbScOffset;       /* Subcarrier Offset */
788    uint32_t    ssbMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
789    uint8_t     beamId[NUM_SSB];
790    BetaPss     betaPss;
791    BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
792    uint8_t     mibPdu[3];           /* MIB payload */
793    uint8_t     dmrsTypeAPos;     /* DMRS Type A position */
794 }SsbCfg;
795
796 typedef struct fdmInfo
797 {
798    uint16_t   rootSeqIdx;        /* Root sequence index */
799    uint8_t    numRootSeq;        /* Number of root sequences required for FD */
800    uint16_t   k1;                /* Frequency Offset for each FD */
801    uint8_t    zeroCorrZoneCfg;   /* Zero correlation zone cofig */
802 }PrachFdmInfo;
803
804 typedef struct prachCfg
805 {
806    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
807    uint8_t       prachSubcSpacing;    /* Subcarrier spacing of RACH */
808    uint8_t       msg1Fdm;             /* Number of RACH frequency domain occasions/ PRACH FDM (1,2,4,8) */
809    uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
810    PrachFdmInfo  fdm[8];              /* FDM info */
811    RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
812    uint8_t       ssbPerRach;          /* SSB per RACH occassion */
813    uint8_t       totalNumRaPreamble;  /* Total number of RA preambles */
814    uint8_t       numCbPreamblePerSsb; /* Number of CB preamble per SSB */
815    uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
816    uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
817    uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
818    uint8_t       raRspWindow;         /* RA Response Window */
819 }PrachCfg;
820
821 #ifdef NR_DRX
822 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
823 typedef struct drxOnDurationTimer
824 {
825    bool  onDurationTimerValInMs;
826    union
827    {
828       uint8_t  subMilliSeconds;
829       uint16_t milliSeconds;
830    }onDurationtimerValue;
831 }DrxOnDurationTimer;
832
833 typedef struct drxLongCycleStartOffset
834 {
835    uint16_t drxLongCycleStartOffsetChoice;
836    uint16_t drxLongCycleStartOffsetVal;
837 }DrxLongCycleStartOffset;
838
839 typedef struct shortDrx
840 {
841    uint16_t   drxShortCycle;
842    uint8_t    drxShortCycleTimer;
843 }ShortDrx;
844
845 typedef struct drxCfg
846 {
847    DrxOnDurationTimer       drxOnDurationTimer;   
848    uint16_t                 drxInactivityTimer;
849    uint8_t                  drxHarqRttTimerDl;
850    uint8_t                  drxHarqRttTimerUl;
851    uint16_t                 drxRetransmissionTimerDl;
852    uint16_t                 drxRetransmissionTimerUl;
853    DrxLongCycleStartOffset  drxLongCycleStartOffset;
854    bool                     shortDrxPres;
855    ShortDrx                 shortDrx;
856    uint8_t                  drxSlotOffset;
857 }DrxCfg;
858 #endif
859
860 typedef struct precodingConf
861 {
862    uint16_t numLayers;
863    uint16_t numAntPorts;
864 }PrecodingConf;
865
866 typedef struct beamformingConf
867 {    
868    uint16_t numOfBeams;
869    uint16_t numTxRUs;
870    uint16_t beamIdx;
871    uint16_t beamType;
872    uint32_t beamAzimuth;
873    uint32_t beamTilt;
874    uint32_t beamHorizWidth;
875    uint32_t beamVertWidth;
876    uint32_t coverageShape;
877    uint32_t digitalTilt;
878    uint32_t digitalAzimuth;    
879 }BeamformingConf;
880
881 typedef struct csiRsCfg
882 {
883    uint8_t   *csiFreqDomainAlloc;
884    uint8_t    csiNrofPorts;
885    uint8_t    csirsfirstOFDMSymbolInTimeDomain;
886    uint8_t    csirsfirstOFDMSymbolInTimeDomain2;
887    uint8_t    csirscdmType;
888    uint8_t    csirsdensity;
889    uint8_t    csirsdensitydot5;
890    uint8_t    powerControlOffset;
891    uint8_t    powerControlOffsetSS;
892    uint16_t   periodicityAndOffset;
893 }CsiRsCfg;
894
895 typedef struct macCellCfg
896 {
897    uint16_t         cellId;           /* Cell Id */
898    CarrierCfg       carrCfg;          /* Carrier configuration */
899    CellCfg          cellCfg;          /* Cell Configuration*/
900    SsbCfg           ssbCfg;           /* SSB configuration */          
901    CsiRsCfg         csiRsCfg;         /*Reference: 38.331 CSI-MeasConfig*/
902    PrachCfg         prachCfg;         /* PRACH Configuration */
903 #ifdef NR_TDD
904    TDDCfg           tddCfg;           /* TDD periodicity and slot configuration */
905 #endif
906    PrecodingConf    precodingConf;
907    BeamformingConf  beamCfg;
908 }MacCellCfg;
909
910 typedef struct macCellCfgCfm
911 {
912    uint16_t       cellId;
913    uint8_t        rsp; 
914 }MacCellCfgCfm;
915
916 typedef struct ulCcchInd
917 {
918    uint16_t cellId;
919    uint16_t crnti;
920    uint16_t ulCcchMsgLen;
921    uint8_t  *ulCcchMsg;
922 }UlCcchIndInfo;
923
924 typedef struct dlCcchInd
925 {
926    uint16_t      cellId;
927    uint16_t      crnti;
928    DlCcchMsgType msgType;
929    uint16_t      dlCcchMsgLen;
930    uint8_t       *dlCcchMsg;
931 }DlCcchIndInfo;
932
933 typedef struct bsrTmrCfg
934 {
935    uint16_t     periodicTimer;
936    uint16_t     retxTimer;
937    uint16_t     srDelayTimer;
938 }BsrTmrCfg;
939
940
941 /* Info of Scheduling Request to Add/Modify */
942 typedef struct schedReqInfo
943 {
944    uint8_t         schedReqId;
945    SrProhibitTimer srProhibitTmr;
946    SrTransMax      srTransMax;
947 }SchedReqInfo;
948
949 /* Scheduling Request Configuration */
950 typedef struct schedReqCfg
951 {
952    uint8_t       addModListCount;
953    SchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
954    uint8_t       relListCount;
955    uint8_t       relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
956 }SchedReqCfg;
957
958 typedef struct tagInfo
959 {
960    uint8_t tagId;
961    TimeAlignmentTimer timeAlignTimer;
962 }TagInfo;
963
964 typedef struct tagCfg
965 {
966    uint8_t      addModListCount;
967    TagInfo      addModList[MAC_NUM_TAGS];  /* List of Tag to Add/Modify */
968    uint8_t      relListCount;
969    uint8_t      relList[MAC_NUM_TAGS];     /* list of Tag Id to release */
970 }TagCfg;
971
972 typedef struct phrCfg
973 {
974    PhrPeriodicTimer periodicTimer;
975    PhrProhibitTimer prohibitTimer; 
976    PhrTxPwrFactorChange txPowerFactor;
977    bool     multiplePHR;       
978    bool     dummy;
979    bool     phrType2OtherCell;
980    PhrModeOtherCG phrOtherCG;
981 }PhrCfg;
982
983 typedef struct macCellGrpCfg
984 {
985    SchedReqCfg schReqCfg;
986    TagCfg      tagCfg;
987    BsrTmrCfg   bsrTmrCfg;
988    bool        phrCfgSetupPres;   /* true/false: phrCfgSetup/phrCfgRelease */
989    PhrCfg      phrCfg;
990 #ifdef NR_DRX
991    bool        drxCfgPresent;
992    DrxCfg      drxCfg;
993 #endif
994 }MacCellGrpCfg;
995
996 typedef struct phyCellGrpCfg
997 {
998    PdschHarqAckCodebook  pdschHarqAckCodebook;
999    uint8_t    pNrFr1;
1000 }PhyCellGrpCfg;
1001
1002 /* Control resource set info */
1003 typedef struct controlRsrcSet
1004 {
1005    uint8_t     cRSetId;                /* Control resource set id */
1006    uint8_t     freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
1007    uint8_t     duration;
1008    REGMappingType cceRegMappingType;
1009    PrecoderGranul precoderGranularity;
1010    uint16_t    dmrsScramblingId;
1011 }ControlRsrcSet;
1012
1013 typedef struct mSlotPeriodAndOffset
1014 {
1015    MSlotPeriodicity  mSlotPeriodicity;
1016    uint16_t          mSlotOffset;
1017 }MSlotPeriodAndOffset;
1018
1019 /* Search Space info */
1020 typedef struct searchSpace
1021 {
1022    uint8_t     searchSpaceId;
1023    uint8_t     cRSetId;
1024    MSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1025    uint8_t     mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1026    AggrLevel   numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1027    AggrLevel   numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1028    AggrLevel   numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1029    AggrLevel   numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1030    AggrLevel   numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1031    SearchSpaceType searchSpaceType;
1032    uint8_t     ueSpecificDciFormat;
1033 }SearchSpace;
1034
1035 /* PDCCH cofniguration */
1036 typedef struct pdcchConfig
1037 {
1038    uint8_t           numCRsetToAddMod;
1039    ControlRsrcSet    cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1040    uint8_t           numCRsetToRel;
1041    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1042    uint8_t           numSearchSpcToAddMod;
1043    SearchSpace       searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1044    uint8_t           numSearchSpcToRel;
1045    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1046 }PdcchConfig;
1047
1048 /* PDSCH time domain resource allocation */
1049 typedef struct pdschTimeDomRsrcAlloc
1050 {
1051    uint8_t           *k0;
1052    CommonMappingType mappingType;
1053    uint8_t           startSymbol;
1054    uint8_t           symbolLength;
1055    uint8_t           startSymbolAndLength;
1056 }PdschTimeDomRsrcAlloc;
1057
1058
1059 typedef struct pdschBundling
1060 {
1061    struct staticBundling
1062    {
1063      BundlingSizeSet2 size;
1064    }StaticBundling;
1065    struct dynamicBundling
1066    {
1067      BundlingSizeSet1 sizeSet1;
1068      BundlingSizeSet2 sizeSet2;
1069    }DynamicBundling;
1070 }PdschBundling;
1071
1072 /* DMRS downlink configuration */
1073 typedef struct dmrsDlCfg
1074 {
1075    AddPosType  addPos;       /* DMRS additional position */
1076 }DmrsDlCfg;
1077
1078 /* PDSCH Configuration */
1079 typedef struct pdschConfig
1080 {
1081    DmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1082    ResAllocType            resourceAllocType;
1083    uint8_t                 numTimeDomRsrcAlloc;
1084    PdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1085    RBGSize                 rbgSize;
1086    CodeWordsSchedDci       numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1087    BundlingType            bundlingType;
1088    PdschBundling           bundlingInfo;
1089 }PdschConfig;
1090
1091 /* Initial Downlink BWP */
1092 typedef struct initialDlBwp
1093 {
1094    bool          pdcchPresent;
1095    PdcchConfig   pdcchCfg;
1096    bool          pdschPresent;
1097    PdschConfig   pdschCfg;
1098 }InitialDlBwp;
1099
1100 /*Spec 38.331 "SPS-Config'*/
1101 typedef struct spsConfig
1102 {
1103    uint16_t     periodicity;
1104    uint8_t      numOfHqProcess;
1105    uint8_t      n1PucchAN;
1106    McsTable     mcsTable;
1107 }SpsConfig;
1108
1109 typedef uint8_t RadioLinkMonitoringRsId;
1110
1111 typedef struct radioLinkMonRS
1112 {
1113    RadioLinkMonitoringRsId radioLinkMonitoringRsId;
1114    PurposeOfFailureDet      purpose; 
1115    union
1116    {
1117       uint8_t ssbIndx;
1118       uint8_t nzpCsiRsResId;
1119    }detectionRes;
1120 }RadioLinkMonRS;
1121
1122 typedef struct radioLinkConfig
1123 {
1124    RadioLinkMonRS             failurDetResAddModList[1];
1125    RadioLinkMonitoringRsId   failurDetResRelList[1];
1126    uint8_t                    beamFailureInstanceMaxCount;
1127    uint8_t                    beamFailureDetectionTimer;
1128 }RadioLinkConfig;
1129
1130 /* Spec 38.331, 'BWP-DownlinkDedicated'*/
1131 typedef struct bwpDlCfgDed
1132 {
1133   PdcchConfig     pdcchCfgDed;
1134   PdschConfig     pdschCfgDed;
1135   SpsConfig       spsCfgDed;
1136   RadioLinkConfig radioLnkMonCfgDed;
1137 }BwpDlCfgDed;
1138
1139 /* Downlink BWP information */
1140 typedef struct dlBwpInfo
1141 {
1142    uint8_t          bwpId;
1143    BwpDlConfig      bwpCommon;
1144    BwpDlCfgDed      bwpDedicated;
1145 }DlBwpInfo;
1146
1147 /* PDCCH Serving Cell configuration */
1148 typedef struct pdschServCellCfg
1149 {
1150    uint8_t              *maxMimoLayers;           
1151    NumHarqProcForPdsch  numHarqProcForPdsch;
1152    MaxCodeBlkGrpPerTB   *maxCodeBlkGrpPerTb;
1153    bool                 *codeBlkGrpFlushInd;
1154    PdschXOverhead       *xOverhead;
1155 }PdschServCellCfg;
1156
1157 /* PUCCH Configuration */
1158
1159 typedef struct pucchResrcSetInfo
1160 {
1161    uint8_t resrcSetId;
1162    uint8_t resrcListCount;
1163    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1164    uint8_t maxPayLoadSize;
1165 }PucchResrcSetInfo;
1166
1167 typedef struct pucchResrcSetCfg
1168 {
1169    uint8_t resrcSetToAddModListCount;
1170    PucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1171    uint8_t resrcSetToRelListCount;
1172    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1173 }PucchResrcSetCfg;
1174
1175 typedef struct pucchFormat0
1176 {
1177    uint8_t initialCyclicShift;
1178    uint8_t numSymbols;
1179    uint8_t startSymbolIdx;
1180 }PucchFormat0;
1181
1182 typedef struct pucchFormat1
1183 {
1184    uint8_t initialCyclicShift;
1185    uint8_t numSymbols;
1186    uint8_t startSymbolIdx;
1187    uint8_t timeDomOCC;
1188 }PucchFormat1;
1189
1190 typedef struct pucchFormat2_3
1191 {
1192    uint8_t numPrbs;
1193    uint8_t numSymbols;
1194    uint8_t startSymbolIdx;
1195 }PucchFormat2_3;
1196
1197 typedef struct pucchFormat4
1198 {
1199    uint8_t numSymbols;
1200    uint8_t occLen;
1201    uint8_t occIdx;
1202    uint8_t startSymbolIdx;
1203 }PucchFormat4;
1204
1205 typedef struct pucchResrcInfo
1206 {
1207    uint8_t  resrcId;
1208    uint16_t startPrb;
1209    uint8_t  intraFreqHop;
1210    uint16_t secondPrbHop;
1211    uint8_t  pucchFormat;
1212    union
1213    {
1214       PucchFormat0   *format0; 
1215       PucchFormat1   *format1;
1216       PucchFormat2_3 *format2;
1217       PucchFormat2_3 *format3;
1218       PucchFormat4   *format4;
1219    }PucchFormat;
1220 }PucchResrcInfo;
1221
1222 typedef struct pucchResrcCfg
1223 {
1224    uint8_t resrcToAddModListCount;
1225    PucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1226    uint8_t resrcToRelListCount;
1227    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1228 }PucchResrcCfg;
1229
1230 typedef struct pucchFormatCfg
1231 {
1232    bool interSlotFreqHop;
1233    bool addDmrs;
1234    uint8_t maxCodeRate;
1235    uint8_t numSlots;
1236    bool    pi2BPSK;
1237    bool    harqAckCSI;
1238 }PucchFormatCfg;
1239
1240 typedef struct schedReqResrcInfo
1241 {
1242    uint8_t resrcId;
1243    uint8_t requestId;
1244    uint8_t periodicity;
1245    uint16_t offset;
1246    uint8_t resrc;
1247 }SchedReqResrcInfo;
1248
1249 typedef struct pucchSchedReqCfg
1250 {
1251    uint8_t           schedAddModListCount;
1252    SchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1253    uint8_t           schedRelListCount;
1254    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1255 }PucchSchedReqCfg;
1256
1257 typedef struct spatialRelationInfo
1258 {
1259    uint8_t spatialRelationId;
1260    uint8_t servCellIdx;
1261    uint8_t pathLossRefRSId;
1262    uint8_t p0PucchId;
1263    uint8_t closeLoopIdx;
1264 }SpatialRelationInfo;
1265
1266 typedef struct pucchSpatialCfg
1267 {
1268    uint8_t spatialAddModListCount;
1269    SpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1270    uint8_t spatialRelListCount;
1271    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1272 }PucchSpatialCfg;
1273
1274 typedef struct p0PucchCfg
1275 {
1276    uint8_t p0PucchId;
1277    int     p0PucchVal;
1278 }P0PucchCfg;
1279
1280 typedef struct pathLossRefRSCfg
1281 {
1282    uint8_t pathLossRefRSId;
1283 }PathLossRefRSCfg;
1284
1285 typedef struct pucchMultiCsiCfg
1286 {
1287    uint8_t  multiCsiResrcListCount;
1288    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1289 }PucchMultiCsiCfg;
1290
1291 typedef struct pucchDlDataToUlAck
1292 {
1293    uint8_t  dlDataToUlAckListCount;
1294    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1295 }PucchDlDataToUlAck;
1296
1297 typedef struct pucchPowerControl
1298 {
1299    int deltaF_Format0;
1300    int deltaF_Format1;
1301    int deltaF_Format2;
1302    int deltaF_Format3;
1303    int deltaF_Format4;
1304    uint8_t p0SetCount;
1305    P0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1306    uint8_t pathLossRefRSListCount;
1307    PathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1308 }PucchPowerControl;
1309
1310 typedef struct pucchCfg
1311 {
1312    PucchResrcSetCfg  *resrcSet;
1313    PucchResrcCfg     *resrc;
1314    PucchFormatCfg    *format1; 
1315    PucchFormatCfg    *format2; 
1316    PucchFormatCfg    *format3; 
1317    PucchFormatCfg    *format4;
1318    PucchSchedReqCfg  *schedReq;
1319    PucchMultiCsiCfg  *multiCsiCfg;
1320    PucchSpatialCfg   *spatialInfo;
1321    PucchDlDataToUlAck *dlDataToUlAck;
1322    PucchPowerControl *powerControl;
1323 }PucchCfg;
1324
1325 /* Transform precoding disabled */
1326 typedef struct transPrecodDisabled
1327 {
1328    uint16_t   scramblingId0;
1329 }TransPrecodDisabled;
1330
1331 /* DMRS Uplink configuration */
1332 typedef struct dmrsUlCfg
1333 {
1334    AddPosType            addPos;               /* DMRS additional position */
1335    TransPrecodDisabled   transPrecodDisabled;  /* Transform precoding disabled */
1336 }DmrsUlCfg;
1337
1338 /* PUSCH Configuration */
1339 typedef struct puschCfg
1340 {
1341    uint8_t                 dataScramblingId;
1342    DmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1343    ResAllocType            resourceAllocType;
1344    uint8_t                 numTimeDomRsrcAlloc;
1345    PuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1346    TransformPrecoder       transformPrecoder;
1347 }PuschCfg;
1348
1349 /* Initial Uplink BWP */
1350 typedef struct initialUlBwp
1351 {
1352    bool       pucchPresent;
1353    PucchCfg   pucchCfg; 
1354    bool       puschPresent;
1355    PuschCfg   puschCfg;
1356 }InitialUlBwp;
1357
1358 typedef struct bwpUlCfgDed
1359 {
1360    PucchCfg   pucchCfg;
1361    PuschCfg   puschCfg;
1362 }BwpUlCfgDed;
1363
1364 /* Uplink BWP information */
1365 typedef struct ulBwpInfo
1366 {
1367    uint8_t          bwpId;
1368    BwpUlConfig      bwpCommon;
1369    BwpUlCfgDed      bwpDed;
1370 }UlBwpInfo;
1371
1372 typedef struct rachCfgGeneric
1373 {
1374    uint8_t      prachCfgIdx;       /* PRACH config idx */
1375    uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
1376    uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
1377    uint8_t      zeroCorrZoneCfg;   /* Zero correlation zone cofig */
1378    int16_t      preambleRcvdTargetPower; /*Prach Target power received*/
1379    uint8_t      preambleTransMax;  /*Preamble Transmission Max power*/
1380    uint8_t      pwrRampingStep;    /*Power Ramping Step*/
1381    uint8_t      raRspWindow;       /* RA Response Window */
1382 }RachCfgGeneric;
1383
1384 typedef struct raPrioritization
1385 {
1386    uint8_t powerRampingStepHighPriority;
1387    uint8_t scalingFactorBI;
1388 }RaPrioritization;
1389
1390 typedef struct bfrCsiRsRes
1391 {
1392    uint8_t csrRsIndex;
1393    uint8_t raOccList;
1394    uint8_t raPreambleIndex;
1395 }BfrCsiRsRes;
1396
1397 typedef struct bfrSsbRes
1398 {
1399    uint16_t ssbIndex;
1400    uint8_t raPreambleIndex;
1401 }BfrSsbRes;
1402
1403 typedef struct prachResDedBfr
1404 {
1405    BfrSsbRes    ssb;
1406    BfrCsiRsRes  csiRs;
1407 }PrachResDedBfr;
1408
1409 /*Spec 38.331 'BeamFailureRecoveryConfig' */
1410 typedef struct beamFailRecoveryCfg
1411 {
1412    uint8_t             rootSeqIndexBfr;
1413    RachCfgGeneric      rachCfgBfr;
1414    uint8_t             rsrpThreshSsbBfr;
1415    PrachResDedBfr      candidteBeamRSList;
1416    uint8_t             ssbPerachBfr;
1417    uint8_t             raSsbOccMaskIndex;
1418    uint8_t             recoverySearchSpaceId;
1419    RaPrioritization    raPrioBfr;
1420    uint16_t            bfrTimer;
1421    uint8_t             msg1SubcSpacing;
1422 }BeamFailRecoveryCfg;
1423
1424 /* Serving cell configuration */
1425 typedef struct servCellCfgInfo
1426 {
1427    InitialDlBwp         initDlBwp;
1428    RadioLinkConfig      radioLinkMonConfig;
1429    uint8_t              numDlBwpToAdd;
1430    DlBwpInfo            dlBwpToAddList[MAX_NUM_BWP];
1431    uint8_t              firstActvDlBwpId;
1432    uint8_t              defaultDlBwpId;
1433    uint8_t              *bwpInactivityTmr;
1434    PdschServCellCfg     pdschServCellCfg;
1435    InitialUlBwp         initUlBwp;
1436    BeamFailRecoveryCfg  beamFailureRecoveryCfg;
1437    uint8_t              numUlBwpToAdd;
1438    UlBwpInfo            ulBwpToAddList[MAX_NUM_BWP];
1439    uint8_t              firstActvUlBwpId;
1440 }ServCellCfgInfo;
1441
1442 /* Special cell configuration */
1443 typedef struct spCellCfg
1444 {
1445    uint8_t           servCellIdx;
1446    ServCellCfgInfo   servCellCfg;
1447 }SpCellCfg;
1448
1449 typedef struct bwpRelInfo
1450 {
1451    uint8_t bwpId;
1452 }BwpRelInfo;
1453
1454 /* Serving cell Re-configuration */
1455 typedef struct servCellRecfgInfo
1456 {
1457    InitialDlBwp       initDlBwp;
1458    RadioLinkConfig    radioLinkMonConfig;
1459    uint8_t            numDlBwpToAddOrMod;
1460    DlBwpInfo          dlBwpToAddOrModList[MAX_NUM_BWP];
1461    uint8_t            numDlBwpToRel;
1462    BwpRelInfo         dlBwpToRelList[MAX_NUM_BWP];
1463    uint8_t            firstActvDlBwpId;
1464    uint8_t            defaultDlBwpId;
1465    uint8_t            *bwpInactivityTmr;
1466    PdschServCellCfg   pdschServCellCfg;
1467    InitialUlBwp       initUlBwp;
1468    uint8_t            numUlBwpToAddOrMod;
1469    UlBwpInfo          ulBwpToAddOrModList[MAX_NUM_BWP];
1470    uint8_t            numUlBwpToRel;
1471    BwpRelInfo         ulBwpToRelList[MAX_NUM_BWP];
1472    uint8_t            firstActvUlBwpId;
1473 }ServCellRecfgInfo;
1474
1475 /* Special cell Re-configuration */
1476 typedef struct spCellRecfg 
1477 {
1478    uint8_t             servCellIdx;
1479    ServCellRecfgInfo   servCellCfg;
1480 }SpCellRecfg;
1481
1482 typedef struct ambrCfg
1483 {
1484    uint32_t ulBr;   /* UL Bit rate */
1485 }AmbrCfg;
1486
1487 typedef struct nonDynFiveQi
1488 {
1489    uint16_t   fiveQi;
1490    uint8_t    priorLevel;
1491    uint16_t   avgWindow;
1492    uint16_t   maxDataBurstVol;
1493 }NonDynFiveQi;
1494
1495 typedef struct dynFiveQi
1496 {
1497    uint8_t    priorLevel;
1498    uint16_t   packetDelayBudget;
1499    uint8_t    packetErrRateScalar;
1500    uint8_t    packetErrRateExp;
1501    uint16_t   fiveQi;
1502    uint8_t    delayCritical;
1503    uint16_t   avgWindow;
1504    uint16_t   maxDataBurstVol;
1505 }DynFiveQi;
1506
1507 typedef struct ngRanAllocAndRetPri
1508 {
1509    uint8_t priorityLevel;
1510    uint8_t preEmptionCap;
1511    uint8_t preEmptionVul;
1512 }NgRanAllocAndRetPri;
1513
1514 typedef struct grbQosInfo
1515 {
1516    uint32_t maxFlowBitRateDl;
1517    uint32_t maxFlowBitRateUl;
1518    uint32_t guarFlowBitRateDl;
1519    uint32_t guarFlowBitRateUl;
1520 }GrbQosInfo;
1521
1522 typedef struct drbQos
1523 {
1524    QosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1525    union
1526    {
1527       NonDynFiveQi   nonDyn5Qi;
1528       DynFiveQi      dyn5Qi;
1529    }u;
1530    NgRanAllocAndRetPri ngRanRetPri;
1531    GrbQosInfo grbQosInfo;
1532    uint16_t             pduSessionId;
1533    uint32_t             ulPduSessAggMaxBitRate;
1534 }DrbQosInfo;
1535
1536 typedef struct ulLcCfg
1537 {
1538    uint8_t priority;
1539    uint8_t lcGroup;
1540    uint8_t schReqId;
1541    PBitRate pbr;        // prioritisedBitRate
1542    BucketSizeDur bsd;        // bucketSizeDuration
1543 }UlLcCfg;
1544
1545 typedef struct dlLcCfg
1546 {
1547    LcPriority lcp;      // logical Channel Prioritization
1548 }DlLcCfg;
1549
1550 typedef struct lcCfg
1551 {
1552    uint8_t lcId;
1553    Snssai  *snssai;
1554    DrbQosInfo *drbQos; 
1555    bool ulLcCfgPres;
1556    UlLcCfg ulLcCfg;
1557    DlLcCfg dlLcCfg;
1558 }LcCfg;
1559
1560 typedef struct modulationInfo
1561 {
1562    uint8_t     modOrder;    /* Modulation order */
1563    uint8_t     mcsIndex;    /* MCS Index */
1564    McsTable    mcsTable;    /* MCS table */
1565 }ModulationInfo;
1566
1567 typedef struct macUeCreateReq
1568 {
1569    uint16_t               cellId;
1570    uint8_t                ueId;
1571    uint8_t                beamIdx;
1572    uint16_t               crnti;
1573    bool                   macCellGrpCfgPres;
1574    MacCellGrpCfg          macCellGrpCfg;
1575    bool                   phyCellGrpCfgPres;
1576    PhyCellGrpCfg          phyCellGrpCfg;
1577    bool                   spCellCfgPres;
1578    SpCellCfg              spCellCfg;
1579    AmbrCfg                *ambrCfg;
1580    ModulationInfo         dlModInfo;    /* DL modulation info */ 
1581    ModulationInfo         ulModInfo;    /* UL modulation info */
1582    uint8_t                numLcs;
1583    LcCfg                  lcCfgList[MAX_NUM_LC];
1584 }MacUeCreateReq;
1585
1586 /* UE Re-configuration */
1587 typedef struct macUeRecfg
1588 {
1589    uint16_t        cellId;
1590    uint8_t         ueId;
1591    uint8_t         beamIdx;
1592    uint16_t        crnti;
1593    bool            macCellGrpRecfgPres;
1594    MacCellGrpCfg   macCellGrpRecfg;
1595    bool            phyCellGrpRecfgPres;
1596    PhyCellGrpCfg   phyCellGrpRecfg;
1597    bool            spCellRecfgPres;
1598    SpCellRecfg     spCellRecfg;
1599    AmbrCfg         *ambrRecfg;
1600    ModulationInfo  dlModInfo;
1601    ModulationInfo  ulModInfo;
1602    uint8_t         numLcsToAdd;
1603    LcCfg           lcCfgAdd[MAX_NUM_LC];
1604    uint8_t         numLcsToDel;
1605    uint8_t         lcIdToDel[MAX_NUM_LC];
1606    uint8_t         numLcsToMod;
1607    LcCfg           lcCfgMod[MAX_NUM_LC];
1608    DataTransmissionAction transmissionAction;
1609 #ifdef NR_DRX   
1610    bool            drxConfigIndicatorRelease;
1611 #endif
1612 }MacUeRecfg;
1613
1614 typedef struct nrcgi
1615 {
1616    Plmn      plmn;
1617    uint16_t  cellId;
1618 }Nrcgi;
1619
1620 typedef struct srbFailInfo
1621 {
1622    uint8_t       srbId;
1623    FailureCause  cause;
1624 }SRBFailInfo;
1625
1626 typedef struct drbFailInfo
1627 {
1628    uint8_t       drbId;
1629    FailureCause  cause;
1630 }DRBFailInfo;
1631
1632 typedef struct sCellFailInfo
1633 {
1634    Nrcgi         nrcgi;
1635    FailureCause  cause;
1636 }SCellFailInfo;
1637
1638 typedef struct macUeCreateRsp
1639 {
1640    uint16_t       cellId;
1641    uint16_t       ueId;
1642    MacRsp         result;
1643    uint8_t        numSRBFailed;   /* valid values : 0 to MAX_NUM_SRB */ 
1644    SRBFailInfo    *failedSRBlisti;
1645    uint8_t        numDRBFailed;   /* valid values : 0 to MAX_NUM_DRB */
1646    DRBFailInfo    *failedDRBlist;
1647    uint8_t        numSCellFailed; /* valid values : 0 to MAX_NUM_SCELL */
1648    SCellFailInfo  *failedSCellList;
1649    uint8_t        numDRBModFailed;   /* valid values : 0 to MAX_NUM_DRB */
1650    DRBFailInfo    *failedDRBModlist;
1651 }MacUeCreateRsp;
1652
1653 typedef struct macUeCreateRsp MacUeRecfgRsp;
1654
1655 typedef struct rachRsrcReq
1656 {
1657    uint16_t cellId;
1658    uint16_t ueId;
1659    uint8_t  numSsb;
1660    uint8_t  ssbIdx[MAX_NUM_SSB];
1661 }MacRachRsrcReq;
1662
1663 typedef struct macCfraSsbResource
1664 {
1665    uint8_t  ssbIdx;
1666    uint8_t  raPreambleIdx;
1667 }MacCfraSsbResource;
1668
1669 typedef struct macCfraResource
1670 {
1671    uint8_t   numSsb;
1672    MacCfraSsbResource ssbResource[MAX_NUM_SSB];
1673 }MacCfraResource;
1674
1675 typedef struct macRachRsrcRsp
1676 {
1677    uint16_t   cellId;
1678    uint16_t   ueId;
1679    MacRsp     result;
1680    uint16_t   newCrnti;     /* This parameter maps to 3GPP TS 38.331 newUE-Identity */
1681    MacCfraResource  cfraResource;
1682 }MacRachRsrcRsp;
1683
1684 typedef struct macRachRsrcRel
1685 {
1686    uint16_t cellId;
1687    uint16_t ueId;
1688    uint16_t crnti;
1689 }MacRachRsrcRel;
1690
1691 typedef struct ueDelete
1692 {
1693     uint16_t cellId;
1694     uint8_t  ueId;
1695     uint16_t crnti;
1696 }MacUeDelete;
1697
1698 typedef struct ueDeleteRsp
1699 {
1700    uint16_t cellId;
1701    uint8_t  ueId;
1702    CauseOfResult  status;
1703 }MacUeDeleteRsp;
1704
1705 typedef struct macCellDeleteReq
1706 {
1707    uint16_t cellId;
1708 }MacCellDeleteReq;
1709
1710 typedef struct macCellDeleteRsp
1711 {
1712    uint16_t cellId;
1713    CauseOfResult  status;
1714 }MacCellDeleteRsp;
1715
1716 typedef struct macSliceCfgRsp 
1717 {
1718    Snssai     snssai;
1719    MacRsp     rsp;
1720    CauseOfResult  cause;  
1721 }MacSliceCfgRsp;
1722
1723 typedef struct rrmPolicyRatio
1724 {
1725    uint8_t maxRatio;
1726    uint8_t minRatio;
1727    uint8_t dedicatedRatio;
1728 }RrmPolicyRatio;
1729
1730 typedef struct rrmPolicyMemberList
1731 {
1732    Plmn    plmn;
1733    Snssai  snssai;
1734 }RrmPolicyMemberList;
1735
1736 typedef struct macSliceRrmPolicy
1737 {
1738    ResourceType        resourceType;
1739    uint8_t             numOfRrmPolicyMem;
1740    RrmPolicyMemberList **rRMPolicyMemberList;
1741    RrmPolicyRatio      policyRatio;
1742 }MacSliceRrmPolicy;
1743
1744 typedef struct macSliceCfgReq
1745 {
1746    uint8_t           numOfRrmPolicy;
1747    MacSliceRrmPolicy **listOfRrmPolicy;
1748 }MacSliceCfgReq;
1749
1750 /*As per ORAN-WG8, Slice Cfg and ReCfg are same structures*/
1751 typedef struct macSliceCfgReq MacSliceRecfgReq;
1752 typedef struct macSliceCfgRsp MacSliceRecfgRsp;
1753
1754 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.17 DL PCCH Indication */
1755 typedef struct dlPcchInd
1756 {
1757    uint16_t  cellId;
1758    uint16_t  pf;
1759    uint8_t   i_s;
1760    uint16_t  pduLen;
1761    uint8_t  *pcchPdu;
1762 }DlPcchInd;
1763
1764
1765 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.1 Cell Start */
1766 typedef struct cellInfo
1767 {
1768     SlotTimingInfo slotInfo;
1769     uint16_t       cellId;
1770 }CellInfo;
1771
1772 typedef struct cellInfo CellStartInfo;
1773 typedef struct cellInfo CellStopInfo;
1774
1775 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.12 UE Reset Request */
1776 typedef struct ueReset
1777 {
1778     uint16_t cellId;
1779     uint8_t  ueId;
1780 }MacUeResetReq;
1781
1782 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.13 UE Reset Response */
1783 typedef struct ueResetRsp
1784 {
1785    uint16_t cellId;
1786    uint8_t  ueId;
1787    CauseOfResult  status;
1788 }MacUeResetRsp;
1789
1790 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.14 UE Sync Status Indication */
1791 typedef struct ueSyncStatusInd
1792 {
1793    uint16_t   cellId;
1794    uint8_t    ueId;
1795    SyncStatus status;
1796 }MacUeSyncStatusInd;
1797
1798 /* The following list of structures is taken from the SI-SchedulingInfo section of specification 33.331. */
1799 typedef struct sibTypeInfo
1800 {
1801    SibType sibType;
1802    uint8_t valueTag;
1803    bool    areaScope;
1804 }SibTypeInfo;
1805
1806 typedef struct sibMappingInfo
1807 {
1808    uint8_t      numSibTypeInfo;
1809    SibTypeInfo  sibTypeInfo[NUM_SIB];
1810 }SibMappingInfo;
1811
1812 typedef struct schedulingInfo 
1813 {
1814    SiBroadcastStatus siBroadcastStatus;
1815    SiPeriodicity     siPeriodicity;
1816    SibMappingInfo    sibMappingInfo;
1817 }SchedulingInfo;
1818
1819 typedef struct rachOccasionsSi
1820 {
1821    RachCfgGeneric     rachConfigSi;
1822    SsbPerRachOccasion ssbPerRachOccasion;
1823 }RachOccasionsSi;
1824
1825 typedef struct siReqRsrc 
1826 {
1827    uint8_t raPreambleStartIndex;
1828    uint8_t raAssociationPeriodIndex;
1829    uint8_t raSsbOccasionMaskIndex; 
1830 }SiReqRsrc;
1831
1832 typedef struct siRequestResource
1833 {
1834    uint8_t    numOfSiReqRsrc;
1835    SiReqRsrc  siReqRsrc[MAX_SI_MESSAGE];
1836 }SiRequestResource;
1837
1838 typedef struct siRequestConfig
1839 {
1840    RachOccasionsSi    rachOccasionsSi;
1841    SiRequestPeriod    siRequestPeriod;
1842    SiRequestResource  siRequestResource;
1843 }SiRequestConfig;
1844
1845 typedef struct schedulingInfoList
1846 {
1847    uint8_t        numSchInfo;
1848    SchedulingInfo schedulingInfo[MAX_SI_MESSAGE];
1849 }SchedulingInfoList;
1850
1851 typedef struct siSchedulingInfo
1852 {
1853    SchedulingInfoList schInfoList;
1854    SiWindowLength     siWindowLength;
1855    SiRequestConfig    siRequestConfig;
1856    SiRequestConfig    siRequestConfigSUL;
1857    uint8_t            *siAreaID;
1858 }SiSchedulingInfo;
1859
1860 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.18 DL Broadcast Request  */
1861 typedef struct macDlBroadcastReq
1862 {
1863     uint16_t         cellId;
1864     uint8_t          numSiBlock;
1865     SiSchedulingInfo **siSchedulingInfo;
1866 }MacDlBroadcastReq;
1867
1868 typedef struct macStatsGrpInfo
1869 {
1870    uint8_t   groupId;
1871    uint16_t  periodicity;  /* In milliseconds */
1872    uint8_t   numStats;
1873    MacMeasurementType statsList[MAX_NUM_STATS];
1874 }MacStatsGrpInfo;
1875
1876 typedef struct macStatsReq
1877 {
1878    uint64_t          subscriptionId;
1879    uint8_t           numStatsGroup;
1880    MacStatsGrpInfo   statsGrpList[MAX_NUM_STATS_GRP];
1881 }MacStatsReq;
1882
1883 typedef struct macStatsGrpRejected
1884 {
1885    uint8_t  groupId;
1886    CauseOfResult cause;
1887 }MacStatsGrpRejected;
1888
1889 typedef struct macStatsRsp
1890 {
1891    uint64_t             subscriptionId;
1892    uint8_t              numGrpAccepted;
1893    uint8_t              statsGrpAcceptedList[MAX_NUM_STATS_GRP];
1894    uint8_t              numGrpRejected;
1895    MacStatsGrpRejected  statsGrpRejectedList[MAX_NUM_STATS_GRP];
1896 }MacStatsRsp;
1897
1898 typedef struct macStats
1899 {
1900    MacMeasurementType type;
1901    double value;
1902 }MacStats;
1903
1904 typedef struct macStatsInd
1905 {
1906    uint64_t    subscriptionId;
1907    uint8_t     groupId;
1908    uint8_t     numStats;
1909    MacStats    measuredStatsList[MAX_NUM_STATS];
1910 }MacStatsInd;
1911
1912 typedef struct macStatsDeleteReq
1913 {
1914    uint64_t    subscriptionId;
1915    uint8_t     numStatsGroupToBeDeleted;
1916    uint8_t     statsGrpIdToBeDelList[MAX_NUM_STATS_GRP];
1917 }MacStatsDeleteReq;
1918
1919 typedef struct macStatsDeleteInfo
1920 {
1921    uint8_t       groupId;
1922    MacRsp        statsGrpDelRsp;
1923    CauseOfResult statsGrpDelCause;
1924 }MacStatsDeleteInfo;
1925
1926 typedef struct macStatsDeleteRsp
1927 {
1928    uint64_t           subscriptionId; /* subscription Id */
1929    MacRsp             subsDelRsp;    /* deletion status of all statsGrp with given subscriptionId */
1930    CauseOfResult      subsDelCause;  /* cause of failure in deletion of all statsGrp with given subscriptionId */
1931    uint8_t            numStatsGroupDeleted; /* number of actions to deleted */ 
1932    MacStatsDeleteInfo statsGrpDelInfo[MAX_NUM_STATS_GRP]; /*list of the deletion statuses for specific actions */
1933 }MacStatsDeleteRsp;
1934
1935 typedef struct macStatsReq MacStatsModificationReq;
1936 typedef struct macStatsRsp MacStatsModificationRsp;
1937
1938 /****************** FUNCTION POINTERS ********************************/
1939
1940 /* DL broadcast req from DU APP to MAC*/
1941 typedef uint8_t (*DuMacDlBroadcastReq) ARGS((
1942          Pst           *pst,
1943          MacDlBroadcastReq *dlBroadcast));
1944
1945 /* Functions for CellUp Ind from MAC to DU APP*/
1946 typedef uint8_t (*DuMacCellUpInd) ARGS((
1947          Pst       *pst,
1948          OduCellId *cellId ));
1949
1950 /* Functions for slot Ind from MAC to DU APP*/
1951 typedef uint8_t (*DuMacSlotInd) ARGS((
1952          Pst       *pst,
1953          SlotTimingInfo *slotIndInfo));
1954
1955 /* Functions for stop Ind from MAC to DU APP*/
1956 typedef uint8_t (*DuMacStopInd) ARGS((
1957          Pst        *pst,
1958          OduCellId  *cellId ));
1959
1960 /* Functions for mac cell start req */
1961 typedef uint8_t (*DuMacCellStart) ARGS((
1962          Pst        *pst, 
1963          CellStartInfo  *cellId));
1964
1965 /* Functions for mac cell stop request */
1966 typedef uint8_t (*DuMacCellStop) ARGS((
1967          Pst        *pst,
1968          CellStopInfo  *cellId ));
1969
1970 /* Function pointers for packing macCellCfg Request and Confirm */
1971 typedef uint8_t (*packMacCellCfgReq) ARGS((
1972          Pst           *pst,
1973          MacCellCfg    *macCellCfg ));
1974
1975 typedef uint8_t (*packMacCellCfgConfirm) ARGS((
1976          Pst              *pst,
1977          MacCellCfgCfm    *macCellCfgCfm ));
1978
1979 typedef uint8_t (*DuMacCellCfgReq) ARGS((
1980          Pst        *pst,        
1981          MacCellCfg *macCellCfg));
1982
1983 typedef uint8_t (*DuMacCellCfgCfm) ARGS((
1984          Pst        *pst,        
1985          MacCellCfgCfm *macCellCfgCfm ));
1986
1987 /* Functions for UL CCCH Ind from MAC to DU APP*/
1988 typedef uint8_t (*DuMacUlCcchInd) ARGS((
1989          Pst           *pst,
1990          UlCcchIndInfo *ulCcchIndInfo ));
1991
1992 /* Functions for DL CCCH Ind from DU APP to MAC*/
1993 typedef uint8_t (*DuMacDlCcchInd) ARGS((
1994          Pst           *pst,
1995          DlCcchIndInfo *dlCcchIndInfo ));
1996
1997 /* UE create Request from DU APP to MAC*/
1998 typedef uint8_t (*DuMacUeCreateReq) ARGS((
1999          Pst           *pst,
2000          MacUeCreateReq      *ueCfg ));
2001
2002 /* UE create Response from MAC to DU APP */
2003 typedef uint8_t (*MacDuUeCreateRspFunc) ARGS((
2004          Pst           *pst, 
2005          MacUeCreateRsp   *cfgRsp));
2006
2007 /* UE Reconfig Request from DU APP to MAC */
2008 typedef uint8_t (*DuMacUeReconfigReq) ARGS((
2009          Pst           *pst,
2010          MacUeRecfg      *ueCfg ));
2011
2012 /* UE Reconfig Response from MAC to DU APP */
2013 typedef uint8_t (*MacDuUeRecfgRspFunc) ARGS((
2014          Pst           *pst, 
2015          MacUeRecfgRsp   *cfgRsp));
2016
2017 /* RACH Resource Request from DU APP to MAC */
2018 typedef uint8_t (*DuMacRachRsrcReq) ARGS((
2019     Pst            *pst,
2020     MacRachRsrcReq *rachRsrcReq));
2021
2022 /* RACH Resource Response from MAC to DU APP */
2023 typedef uint8_t (*MacDuRachRsrcRspFunc) ARGS((
2024     Pst            *pst,
2025     MacRachRsrcRsp *rachRsrcRsp));
2026
2027 /* RACH Resource Release from DU APP to MAC */
2028 typedef uint8_t (*DuMacRachRsrcRel) ARGS((
2029     Pst            *pst,
2030     MacRachRsrcRel *rachRsrcRel));
2031
2032 /* UE Delete Request from DU APP to MAC*/
2033 typedef uint8_t (*DuMacUeDeleteReq) ARGS((
2034      Pst           *pst,
2035      MacUeDelete   *ueDel ));
2036
2037 /* UE Delete Response from MAC to DU APP*/
2038 typedef uint8_t (*MacDuUeDeleteRspFunc) ARGS((
2039      Pst            *pst,
2040      MacUeDeleteRsp *deleteRsp));
2041
2042 /* Cell Delete Request from DU APP to MAC*/
2043 typedef uint8_t (*DuMacCellDeleteReq) ARGS((
2044      Pst           *pst,
2045      MacCellDeleteReq *cellDelete ));
2046
2047 /* Cell Delete Response from MAC to DU APP*/
2048 typedef uint8_t (*MacDuCellDeleteRspFunc) ARGS((
2049      Pst            *pst,
2050      MacCellDeleteRsp *cellDeleteRsp));
2051
2052 /* Slice Cfg Request from DU APP to MAC*/
2053 typedef uint8_t (*DuMacSliceCfgReq) ARGS((
2054      Pst           *pst,
2055      MacSliceCfgReq *CfgReq));
2056
2057 /* Slice Cfg Response from MAC to DU APP */
2058 typedef uint8_t (*MacDuSliceCfgRspFunc) ARGS((
2059          Pst           *pst, 
2060          MacSliceCfgRsp   *cfgRsp));
2061
2062 /* Slice ReReCfg Request from DU APP to MAC*/
2063 typedef uint8_t (*DuMacSliceRecfgReq) ARGS((
2064      Pst           *pst,
2065      MacSliceRecfgReq *CfgReq));
2066
2067 /* Slice ReReCfg Response from MAC to DU APP */
2068 typedef uint8_t (*MacDuSliceRecfgRspFunc) ARGS((
2069         Pst           *pst,
2070         MacSliceRecfgRsp   *cfgRsp));
2071
2072 /* Pcch indication from DU APP to MAC*/
2073 typedef uint8_t (*DuMacDlPcchInd) ARGS((
2074      Pst        *pst,
2075      DlPcchInd *pcchInd));
2076
2077 /* UE Reset Request from DU APP to MAC*/
2078 typedef uint8_t (*DuMacUeResetReq) ARGS((
2079      Pst           *pst,
2080      MacUeResetReq *ueReset ));
2081
2082 /* UE Reset Response from MAC to DU APP*/
2083 typedef uint8_t (*MacDuUeResetRspFunc) ARGS((
2084      Pst            *pst,
2085      MacUeResetRsp *resetRsp));
2086
2087 /* UE sync status indication from MAC to DU APP*/
2088 typedef uint8_t (*MacDuUeSyncStatusIndFunc) ARGS((
2089         Pst            *pst,
2090         MacUeSyncStatusInd *syncStatusInd));
2091
2092 /* Statitics Request from DU APP to MAC */
2093 typedef uint8_t (*DuMacStatsReqFunc) ARGS((
2094       Pst *pst,
2095       MacStatsReq *statsReq));
2096
2097 /* Statistics Response from MAC to DU APP */
2098 typedef uint8_t (*MacDuStatsRspFunc) ARGS((
2099       Pst *pst,
2100       MacStatsRsp *statsRsp));
2101
2102 /* Statistics Ind from MAC to DU APP */
2103 typedef uint8_t (*MacDuStatsIndFunc) ARGS((
2104       Pst *pst,
2105       MacStatsInd *statsInd));
2106
2107 /* Statitics Delete Request from DU APP to MAC */
2108 typedef uint8_t (*DuMacStatsDeleteReqFunc) ARGS((
2109          Pst *pst,
2110          MacStatsDeleteReq *statsDeleteReq));
2111
2112 /* Statistics Delete Response from MAC to DU APP */
2113 typedef uint8_t (*MacDuStatsDeleteRspFunc) ARGS((
2114          Pst *pst,
2115          MacStatsDeleteRsp *statsDeleteRsp));
2116
2117 /* Statitics Modification Request from DU APP to MAC */
2118 typedef uint8_t (*DuMacStatsModificationReqFunc) ARGS((
2119       Pst *pst,
2120       MacStatsModificationReq *statsModificationReq));
2121
2122 /* Statistics Modification Response from MAC to DU APP */
2123 typedef uint8_t (*MacDuStatsModificationRspFunc) ARGS((
2124       Pst *pst,
2125       MacStatsModificationRsp *statsModificationRsp));
2126
2127 /******************** FUNCTION DECLARATIONS ********************************/
2128 uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId);
2129 uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf);
2130 uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId);
2131
2132 uint8_t packMacCellStart(Pst *pst, CellStartInfo *cellStartInfo);
2133 uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf);
2134 uint8_t MacProcCellStart(Pst *pst, CellStartInfo *cellStartInfo);
2135
2136 uint8_t packMacCellStop(Pst *pst, CellStopInfo *cellStopInfo);
2137 uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf);
2138 uint8_t MacProcCellStop(Pst *pst, CellStopInfo *cellStopInfo);
2139
2140 uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
2141 uint8_t unpackDuMacCellCfg(DuMacCellCfgReq func,  Pst *pst,  Buffer *mBuf);
2142 uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
2143
2144 uint8_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
2145 uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
2146 uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
2147
2148 uint8_t packMacStopInd(Pst *pst, OduCellId *cellId);
2149 uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
2150 uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId);
2151 uint8_t sendStopIndMacToDuApp(uint16_t cellId);
2152
2153 uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
2154 uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
2155 uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
2156
2157 uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
2158 uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
2159 uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
2160
2161 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCreateReq *ueCfg);
2162 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf);
2163 uint8_t MacProcUeCreateReq(Pst *pst, MacUeCreateReq *ueCfg);
2164
2165 uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp);
2166 uint8_t unpackDuMacUeCreateRsp(MacDuUeCreateRspFunc func, Pst *pst, Buffer *mBuf);
2167 uint8_t DuProcMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp);
2168
2169 uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg);
2170 uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf);
2171 uint8_t MacProcUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg);
2172
2173 uint8_t packDuMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp);
2174 uint8_t unpackDuMacUeRecfgRsp(MacDuUeRecfgRspFunc func, Pst *pst, Buffer *mBuf);
2175 uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp);
2176
2177 uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq);
2178 uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf);
2179 uint8_t MacProcRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq);
2180
2181 uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp);
2182 uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf);
2183 uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp);
2184
2185 uint8_t packDuMacRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel);
2186 uint8_t unpackMacRachRsrcRel(DuMacRachRsrcRel func, Pst *pst, Buffer *mBuf);
2187 uint8_t MacProcRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel);
2188
2189 uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDelete);
2190 uint8_t MacProcUeDeleteReq(Pst *pst,  MacUeDelete *ueDelete);
2191 uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf);
2192
2193 uint8_t packDuMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp);
2194 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp);
2195 uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf);
2196
2197 uint8_t packDuMacCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete);
2198 uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete);
2199 uint8_t unpackMacCellDeleteReq(DuMacCellDeleteReq func, Pst *pst, Buffer *mBuf);
2200
2201 uint8_t packDuMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp);
2202 uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp);
2203 uint8_t unpackDuMacCellDeleteRsp(MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf);
2204
2205 uint8_t packDuMacSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq);
2206 uint8_t MacProcSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq);
2207 uint8_t unpackMacSliceCfgReq(DuMacSliceCfgReq func, Pst *pst, Buffer *mBuf);
2208
2209 uint8_t DuProcMacSliceCfgRsp(Pst *pst,  MacSliceCfgRsp *cfgRsp);
2210 uint8_t packDuMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp);
2211 uint8_t unpackDuMacSliceCfgRsp(MacDuSliceCfgRspFunc func, Pst *pst, Buffer *mBuf);
2212
2213 uint8_t packDuMacSliceRecfgReq(Pst *pst, MacSliceRecfgReq *sliceRecfgReq);
2214 uint8_t MacProcSliceRecfgReq(Pst *pst, MacSliceRecfgReq *sliceRecfgReq);
2215 uint8_t unpackMacSliceRecfgReq(DuMacSliceRecfgReq func, Pst *pst, Buffer *mBuf);
2216
2217 uint8_t DuProcMacSliceRecfgRsp(Pst *pst,  MacSliceRecfgRsp *sliceRecfgRsp);
2218 uint8_t packDuMacSliceRecfgRsp(Pst *pst, MacSliceRecfgRsp *sliceRecfgRsp);
2219 uint8_t unpackDuMacSliceRecfgRsp(MacDuSliceRecfgRspFunc func, Pst *pst, Buffer *mBuf);
2220
2221 uint8_t duHandleSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo);
2222 uint8_t packMacSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo);
2223 uint8_t unpackDuMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
2224
2225 uint8_t packDuMacDlPcchInd(Pst *pst, DlPcchInd *pcchInd);
2226 uint8_t MacProcDlPcchInd(Pst *pst, DlPcchInd *pcchInd);
2227 uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf);
2228
2229 int8_t getFreeBitFromUeBitMap(uint16_t cellId);
2230 void unsetBitInUeBitMap(uint16_t cellId, uint8_t bitPos);
2231
2232 uint8_t packDuMacUeResetReq(Pst *pst, MacUeResetReq *ueReset);
2233 uint8_t MacProcUeResetReq(Pst *pst,  MacUeResetReq *ueReset);
2234 uint8_t unpackMacUeResetReq(DuMacUeResetReq func, Pst *pst, Buffer *mBuf);
2235
2236 uint8_t packDuMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp);
2237 uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp);
2238 uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf);
2239
2240 uint8_t packDuMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
2241 uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
2242 uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buffer *mBuf);
2243
2244 uint8_t packDuMacDlBroadcastReq(Pst *pst, MacDlBroadcastReq *dlBroadcastReq);
2245 uint8_t MacProcDlBroadcastReq(Pst *pst,  MacDlBroadcastReq *dlBroadcastReq);
2246 uint8_t unpackMacDlBroadcastReq(DuMacDlBroadcastReq func, Pst *pst, Buffer *mBuf);
2247
2248 uint8_t packDuMacStatsReq(Pst *pst, MacStatsReq *statsReq);
2249 uint8_t MacProcStatsReq(Pst *pst, MacStatsReq *statsReq);
2250 uint8_t unpackMacStatsReq(DuMacStatsReqFunc func, Pst *pst, Buffer *mBuf);
2251
2252 uint8_t packDuMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp);
2253 uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp);
2254 uint8_t unpackDuMacStatsRsp(MacDuStatsRspFunc func, Pst *pst, Buffer *mBuf);
2255
2256 uint8_t packDuMacStatsInd(Pst *pst, MacStatsInd *statsRsp);
2257 uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsRsp);
2258 uint8_t unpackDuMacStatsInd(MacDuStatsIndFunc func, Pst *pst, Buffer *mBuf);
2259
2260 uint8_t packDuMacStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq);
2261 uint8_t MacProcStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq);
2262 uint8_t unpackMacStatsDeleteReq(DuMacStatsDeleteReqFunc func, Pst *pst, Buffer *mBuf);
2263
2264 uint8_t packDuMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp);
2265 uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp);
2266 uint8_t unpackDuMacStatsDeleteRsp(MacDuStatsDeleteRspFunc func, Pst *pst, Buffer *mBuf);
2267
2268 uint8_t packDuMacStatsModificationReq(Pst *pst, MacStatsModificationReq *statsModificationReq);
2269 uint8_t MacProcStatsModificationReq(Pst *pst, MacStatsModificationReq *statsModificationReq);
2270 uint8_t unpackMacStatsModificationReq(DuMacStatsModificationReqFunc func, Pst *pst, Buffer *mBuf);
2271
2272 uint8_t packDuMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsModificationRsp);
2273 uint8_t DuProcMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsModificationRsp);
2274 uint8_t unpackDuMacStatsModificationRsp(MacDuStatsModificationRspFunc func, Pst *pst, Buffer *mBuf);
2275
2276
2277 #endif
2278
2279
2280 /**********************************************************************
2281   End of file
2282  **********************************************************************/