[Epic-ID: ODUHIGH-538] XML based input configuration
[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    SupportedSliceList suppSliceList;
653 }PlmnInfoList;
654
655 typedef struct schPageCfg
656 {
657   uint8_t  numPO;                    /*Derived from Ns*/
658   bool     poPresent;                /*Whether FirstPDCCH-MonitoringPO is present or not*/
659   uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
660 }SchPageCfg;
661
662 typedef struct pdcchConfigSib1
663 {
664    uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
665    uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
666 }PdcchConfigSib1;
667
668 typedef struct sib1CellCfg
669 {
670    PdcchConfigSib1  pdcchCfgSib1;  /*Freq pos where UE may find SS/PBCH block with SIB1*/
671    uint8_t          *sib1Pdu;
672    uint16_t         sib1PduLen;
673    SchPageCfg       pagingCfg;
674 } Sib1CellCfg; 
675
676 typedef struct bwpParams
677 {
678    uint16_t firstPrb;
679    uint16_t numPrb;
680    uint8_t  scs;
681    uint8_t  cyclicPrefix;
682 }BwpParams;
683
684 typedef struct candidatesInfo
685 {
686    uint8_t aggLevel1;
687    uint8_t aggLevel2;
688    uint8_t aggLevel4;
689    uint8_t aggLevel8;
690    uint8_t aggLevel16;
691 }CandidatesInfo;
692
693 typedef struct searchSpaceCfg
694 {
695    uint8_t searchSpaceId;
696    uint8_t coresetId;
697    uint16_t monitoringSlot;
698    uint16_t duration;
699    uint16_t monitoringSymbol;
700    CandidatesInfo candidate;
701 }SearchSpaceCfg;
702
703 typedef struct pdcchConfigCommon
704 {
705    /* only one search space is configured during SIB1 */
706    SearchSpaceCfg commonSearchSpace;
707    uint8_t raSearchSpaceId;
708 }PdcchConfigCommon;
709
710 typedef struct pdschCfgCommTimeDomRsrcAlloc
711 {
712    uint8_t k0;
713    uint8_t mappingType;
714    uint8_t startSymbol;
715    uint8_t lengthSymbol;
716 }PdschCfgCommTimeDomRsrcAlloc;
717
718 typedef struct pdschConfigCommon
719 {
720    uint8_t  numTimeDomAlloc;
721    /* PDSCH time domain DL resource allocation list */
722    PdschCfgCommTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_DL_ALLOC]; 
723 }PdschConfigCommon;
724
725 typedef struct pucchConfigCommon
726 {
727    uint8_t pucchResourceCommon;
728    uint8_t pucchGroupHopping;
729 }PucchConfigCommon;
730
731 /* PUSCH Time Domain Resource Allocation */
732 typedef struct puschTimeDomRsrcAlloc
733 {
734    uint8_t             k2;
735    CommonMappingType   mappingType;
736    uint8_t             startSymbol;
737    uint8_t             symbolLength;
738    uint8_t             startSymbolAndLength;
739 }PuschTimeDomRsrcAlloc;
740
741 typedef struct puschConfigCommon
742 {
743    /* PUSCH-TimeDomainResourceAllocation info */
744    uint8_t                 numTimeDomRsrcAlloc;
745    PuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
746 }PuschConfigCommon;
747
748 typedef struct bwpDlConfig
749 {
750    BwpParams         bwp;
751    PdcchConfigCommon pdcchCommon;
752    PdschConfigCommon pdschCommon;
753 }BwpDlConfig;
754
755 typedef struct bwpUlConfig
756 {
757    BwpParams         bwp;
758    // rach config common sent in PrachCfg
759    PucchConfigCommon pucchCommon;
760    PuschConfigCommon puschCommon;
761 }BwpUlConfig;
762
763
764 typedef struct cellCfg
765 {
766    MacOpState      opState;
767    MacAdminState   adminState;
768    MacCellState    cellState;
769    PlmnInfoList plmnInfoList[MAX_PLMN];   /* Consits of PlmnId and Snssai list */
770    uint32_t     phyCellId;                /* Physical cell id */
771    uint32_t     tac;
772    uint32_t     ssbFreq;
773    uint16_t     subCarrSpacing;
774    DuplexMode   dupType;          /* Duplex type: TDD/FDD */
775    Sib1CellCfg  sib1Cfg;          /* SIB1 config */
776    BwpDlConfig  initialDlBwp;     /* Initial DL BWP */
777    BwpUlConfig  initialUlBwp;     /* Initial UL BWP */
778 }CellCfg;
779
780 typedef struct ssbCfg
781 {
782    uint32_t    ssbPbchPwr;       /* SSB block power */
783    uint8_t     scsCmn;           /* subcarrier spacing for common */
784    uint16_t    ssbOffsetPointA;  /* SSB subcarrier offset from point A */
785    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
786    uint8_t     ssbScOffset;       /* Subcarrier Offset */
787    uint32_t    ssbMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
788    uint8_t     beamId[NUM_SSB];
789    BetaPss     betaPss;
790    BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
791    uint8_t     mibPdu[3];           /* MIB payload */
792    uint8_t     dmrsTypeAPos;     /* DMRS Type A position */
793 }SsbCfg;
794
795 typedef struct fdmInfo
796 {
797    uint16_t   rootSeqIdx;        /* Root sequence index */
798    uint8_t    numRootSeq;        /* Number of root sequences required for FD */
799    uint16_t   k1;                /* Frequency Offset for each FD */
800    uint8_t    zeroCorrZoneCfg;   /* Zero correlation zone cofig */
801 }PrachFdmInfo;
802
803 typedef struct prachCfg
804 {
805    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
806    uint8_t       prachSubcSpacing;    /* Subcarrier spacing of RACH */
807    uint8_t       msg1Fdm;             /* Number of RACH frequency domain occasions/ PRACH FDM (1,2,4,8) */
808    uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
809    PrachFdmInfo  fdm[8];              /* FDM info */
810    RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
811    uint8_t       ssbPerRach;          /* SSB per RACH occassion */
812    uint8_t       totalNumRaPreamble;  /* Total number of RA preambles */
813    uint8_t       numCbPreamblePerSsb; /* Number of CB preamble per SSB */
814    uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
815    uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
816    uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
817    uint8_t       raRspWindow;         /* RA Response Window */
818 }PrachCfg;
819
820 #ifdef NR_DRX
821 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
822 typedef struct drxOnDurationTimer
823 {
824    bool  onDurationTimerValInMs;
825    union
826    {
827       uint8_t  subMilliSeconds;
828       uint16_t milliSeconds;
829    }onDurationtimerValue;
830 }DrxOnDurationTimer;
831
832 typedef struct drxLongCycleStartOffset
833 {
834    uint16_t drxLongCycleStartOffsetChoice;
835    uint16_t drxLongCycleStartOffsetVal;
836 }DrxLongCycleStartOffset;
837
838 typedef struct shortDrx
839 {
840    uint16_t   drxShortCycle;
841    uint8_t    drxShortCycleTimer;
842 }ShortDrx;
843
844 typedef struct drxCfg
845 {
846    DrxOnDurationTimer       drxOnDurationTimer;   
847    uint16_t                 drxInactivityTimer;
848    uint8_t                  drxHarqRttTimerDl;
849    uint8_t                  drxHarqRttTimerUl;
850    uint16_t                 drxRetransmissionTimerDl;
851    uint16_t                 drxRetransmissionTimerUl;
852    DrxLongCycleStartOffset  drxLongCycleStartOffset;
853    bool                     shortDrxPres;
854    ShortDrx                 shortDrx;
855    uint8_t                  drxSlotOffset;
856 }DrxCfg;
857 #endif
858
859 typedef struct precodingConf
860 {
861    uint16_t numLayers;
862    uint16_t numAntPorts;
863 }PrecodingConf;
864
865 typedef struct beamformingConf
866 {    
867    uint16_t numOfBeams;
868    uint16_t numTxRUs;
869    uint16_t beamIdx;
870    uint16_t beamType;
871    uint32_t beamAzimuth;
872    uint32_t beamTilt;
873    uint32_t beamHorizWidth;
874    uint32_t beamVertWidth;
875    uint32_t coverageShape;
876    uint32_t digitalTilt;
877    uint32_t digitalAzimuth;    
878 }BeamformingConf;
879
880 typedef struct csiRsCfg
881 {
882    uint8_t   *csiFreqDomainAlloc;
883    uint8_t    csiNrofPorts;
884    uint8_t    csirsfirstOFDMSymbolInTimeDomain;
885    uint8_t    csirsfirstOFDMSymbolInTimeDomain2;
886    uint8_t    csirscdmType;
887    uint8_t    csirsdensity;
888    uint8_t    csirsdensitydot5;
889    uint8_t    powerControlOffset;
890    uint8_t    powerControlOffsetSS;
891    uint16_t   periodicityAndOffset;
892 }CsiRsCfg;
893
894 typedef struct macCellCfg
895 {
896    uint16_t         cellId;           /* Cell Id */
897    CarrierCfg       carrCfg;          /* Carrier configuration */
898    CellCfg          cellCfg;          /* Cell Configuration*/
899    SsbCfg           ssbCfg;           /* SSB configuration */          
900    CsiRsCfg         csiRsCfg;         /*Reference: 38.331 CSI-MeasConfig*/
901    PrachCfg         prachCfg;         /* PRACH Configuration */
902 #ifdef NR_TDD
903    TDDCfg           tddCfg;           /* TDD periodicity and slot configuration */
904 #endif
905    PrecodingConf    precodingConf;
906    BeamformingConf  beamCfg;
907 }MacCellCfg;
908
909 typedef struct macCellCfgCfm
910 {
911    uint16_t       cellId;
912    uint8_t        rsp; 
913 }MacCellCfgCfm;
914
915 typedef struct ulCcchInd
916 {
917    uint16_t cellId;
918    uint16_t crnti;
919    uint16_t ulCcchMsgLen;
920    uint8_t  *ulCcchMsg;
921 }UlCcchIndInfo;
922
923 typedef struct dlCcchInd
924 {
925    uint16_t      cellId;
926    uint16_t      crnti;
927    DlCcchMsgType msgType;
928    uint16_t      dlCcchMsgLen;
929    uint8_t       *dlCcchMsg;
930 }DlCcchIndInfo;
931
932 typedef struct bsrTmrCfg
933 {
934    uint16_t     periodicTimer;
935    uint16_t     retxTimer;
936    uint16_t     srDelayTimer;
937 }BsrTmrCfg;
938
939
940 /* Info of Scheduling Request to Add/Modify */
941 typedef struct schedReqInfo
942 {
943    uint8_t         schedReqId;
944    SrProhibitTimer srProhibitTmr;
945    SrTransMax      srTransMax;
946 }SchedReqInfo;
947
948 /* Scheduling Request Configuration */
949 typedef struct schedReqCfg
950 {
951    uint8_t       addModListCount;
952    SchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
953    uint8_t       relListCount;
954    uint8_t       relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
955 }SchedReqCfg;
956
957 typedef struct tagInfo
958 {
959    uint8_t tagId;
960    TimeAlignmentTimer timeAlignTimer;
961 }TagInfo;
962
963 typedef struct tagCfg
964 {
965    uint8_t      addModListCount;
966    TagInfo      addModList[MAC_NUM_TAGS];  /* List of Tag to Add/Modify */
967    uint8_t      relListCount;
968    uint8_t      relList[MAC_NUM_TAGS];     /* list of Tag Id to release */
969 }TagCfg;
970
971 typedef struct phrCfg
972 {
973    PhrPeriodicTimer periodicTimer;
974    PhrProhibitTimer prohibitTimer; 
975    PhrTxPwrFactorChange txPowerFactor;
976    bool     multiplePHR;       
977    bool     dummy;
978    bool     phrType2OtherCell;
979    PhrModeOtherCG phrOtherCG;
980 }PhrCfg;
981
982 typedef struct macCellGrpCfg
983 {
984    SchedReqCfg schReqCfg;
985    TagCfg      tagCfg;
986    BsrTmrCfg   bsrTmrCfg;
987    bool        phrCfgSetupPres;   /* true/false: phrCfgSetup/phrCfgRelease */
988    PhrCfg      phrCfg;
989 #ifdef NR_DRX
990    bool        drxCfgPresent;
991    DrxCfg      drxCfg;
992 #endif
993 }MacCellGrpCfg;
994
995 typedef struct phyCellGrpCfg
996 {
997    PdschHarqAckCodebook  pdschHarqAckCodebook;
998    uint8_t    pNrFr1;
999 }PhyCellGrpCfg;
1000
1001 /* Control resource set info */
1002 typedef struct controlRsrcSet
1003 {
1004    uint8_t     cRSetId;                /* Control resource set id */
1005    uint8_t     freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
1006    uint8_t     duration;
1007    REGMappingType cceRegMappingType;
1008    PrecoderGranul precoderGranularity;
1009    uint16_t    dmrsScramblingId;
1010 }ControlRsrcSet;
1011
1012 typedef struct mSlotPeriodAndOffset
1013 {
1014    MSlotPeriodicity  mSlotPeriodicity;
1015    uint16_t          mSlotOffset;
1016 }MSlotPeriodAndOffset;
1017
1018 /* Search Space info */
1019 typedef struct searchSpace
1020 {
1021    uint8_t     searchSpaceId;
1022    uint8_t     cRSetId;
1023    MSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1024    uint8_t     mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1025    AggrLevel   numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1026    AggrLevel   numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1027    AggrLevel   numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1028    AggrLevel   numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1029    AggrLevel   numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1030    SearchSpaceType searchSpaceType;
1031    uint8_t     ueSpecificDciFormat;
1032 }SearchSpace;
1033
1034 /* PDCCH cofniguration */
1035 typedef struct pdcchConfig
1036 {
1037    uint8_t           numCRsetToAddMod;
1038    ControlRsrcSet    cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1039    uint8_t           numCRsetToRel;
1040    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1041    uint8_t           numSearchSpcToAddMod;
1042    SearchSpace       searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1043    uint8_t           numSearchSpcToRel;
1044    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1045 }PdcchConfig;
1046
1047 /* PDSCH time domain resource allocation */
1048 typedef struct pdschTimeDomRsrcAlloc
1049 {
1050    uint8_t           *k0;
1051    CommonMappingType mappingType;
1052    uint8_t           startSymbol;
1053    uint8_t           symbolLength;
1054    uint8_t           startSymbolAndLength;
1055 }PdschTimeDomRsrcAlloc;
1056
1057
1058 typedef struct pdschBundling
1059 {
1060    struct staticBundling
1061    {
1062      BundlingSizeSet2 size;
1063    }StaticBundling;
1064    struct dynamicBundling
1065    {
1066      BundlingSizeSet1 sizeSet1;
1067      BundlingSizeSet2 sizeSet2;
1068    }DynamicBundling;
1069 }PdschBundling;
1070
1071 /* DMRS downlink configuration */
1072 typedef struct dmrsDlCfg
1073 {
1074    AddPosType  addPos;       /* DMRS additional position */
1075 }DmrsDlCfg;
1076
1077 /* PDSCH Configuration */
1078 typedef struct pdschConfig
1079 {
1080    DmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1081    ResAllocType            resourceAllocType;
1082    uint8_t                 numTimeDomRsrcAlloc;
1083    PdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1084    RBGSize                 rbgSize;
1085    CodeWordsSchedDci       numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1086    BundlingType            bundlingType;
1087    PdschBundling           bundlingInfo;
1088 }PdschConfig;
1089
1090 /* Initial Downlink BWP */
1091 typedef struct initialDlBwp
1092 {
1093    bool          pdcchPresent;
1094    PdcchConfig   pdcchCfg;
1095    bool          pdschPresent;
1096    PdschConfig   pdschCfg;
1097 }InitialDlBwp;
1098
1099 /*Spec 38.331 "SPS-Config'*/
1100 typedef struct spsConfig
1101 {
1102    uint16_t     periodicity;
1103    uint8_t      numOfHqProcess;
1104    uint8_t      n1PucchAN;
1105    McsTable     mcsTable;
1106 }SpsConfig;
1107
1108 typedef uint8_t RadioLinkMonitoringRsId;
1109
1110 typedef struct radioLinkMonRS
1111 {
1112    RadioLinkMonitoringRsId radioLinkMonitoringRsId;
1113    PurposeOfFailureDet      purpose; 
1114    union
1115    {
1116       uint8_t ssbIndx;
1117       uint8_t nzpCsiRsResId;
1118    }detectionRes;
1119 }RadioLinkMonRS;
1120
1121 typedef struct radioLinkConfig
1122 {
1123    RadioLinkMonRS             failurDetResAddModList[1];
1124    RadioLinkMonitoringRsId   failurDetResRelList[1];
1125    uint8_t                    beamFailureInstanceMaxCount;
1126    uint8_t                    beamFailureDetectionTimer;
1127 }RadioLinkConfig;
1128
1129 /* Spec 38.331, 'BWP-DownlinkDedicated'*/
1130 typedef struct bwpDlCfgDed
1131 {
1132   PdcchConfig     pdcchCfgDed;
1133   PdschConfig     pdschCfgDed;
1134   SpsConfig       spsCfgDed;
1135   RadioLinkConfig radioLnkMonCfgDed;
1136 }BwpDlCfgDed;
1137
1138 /* Downlink BWP information */
1139 typedef struct dlBwpInfo
1140 {
1141    uint8_t          bwpId;
1142    BwpDlConfig      bwpCommon;
1143    BwpDlCfgDed      bwpDedicated;
1144 }DlBwpInfo;
1145
1146 /* PDCCH Serving Cell configuration */
1147 typedef struct pdschServCellCfg
1148 {
1149    uint8_t              *maxMimoLayers;           
1150    NumHarqProcForPdsch  numHarqProcForPdsch;
1151    MaxCodeBlkGrpPerTB   *maxCodeBlkGrpPerTb;
1152    bool                 *codeBlkGrpFlushInd;
1153    PdschXOverhead       *xOverhead;
1154 }PdschServCellCfg;
1155
1156 /* PUCCH Configuration */
1157
1158 typedef struct pucchResrcSetInfo
1159 {
1160    uint8_t resrcSetId;
1161    uint8_t resrcListCount;
1162    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1163    uint8_t maxPayLoadSize;
1164 }PucchResrcSetInfo;
1165
1166 typedef struct pucchResrcSetCfg
1167 {
1168    uint8_t resrcSetToAddModListCount;
1169    PucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1170    uint8_t resrcSetToRelListCount;
1171    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1172 }PucchResrcSetCfg;
1173
1174 typedef struct pucchFormat0
1175 {
1176    uint8_t initialCyclicShift;
1177    uint8_t numSymbols;
1178    uint8_t startSymbolIdx;
1179 }PucchFormat0;
1180
1181 typedef struct pucchFormat1
1182 {
1183    uint8_t initialCyclicShift;
1184    uint8_t numSymbols;
1185    uint8_t startSymbolIdx;
1186    uint8_t timeDomOCC;
1187 }PucchFormat1;
1188
1189 typedef struct pucchFormat2_3
1190 {
1191    uint8_t numPrbs;
1192    uint8_t numSymbols;
1193    uint8_t startSymbolIdx;
1194 }PucchFormat2_3;
1195
1196 typedef struct pucchFormat4
1197 {
1198    uint8_t numSymbols;
1199    uint8_t occLen;
1200    uint8_t occIdx;
1201    uint8_t startSymbolIdx;
1202 }PucchFormat4;
1203
1204 typedef struct pucchResrcInfo
1205 {
1206    uint8_t  resrcId;
1207    uint16_t startPrb;
1208    uint8_t  intraFreqHop;
1209    uint16_t secondPrbHop;
1210    uint8_t  pucchFormat;
1211    union
1212    {
1213       PucchFormat0   *format0; 
1214       PucchFormat1   *format1;
1215       PucchFormat2_3 *format2;
1216       PucchFormat2_3 *format3;
1217       PucchFormat4   *format4;
1218    }PucchFormat;
1219 }PucchResrcInfo;
1220
1221 typedef struct pucchResrcCfg
1222 {
1223    uint8_t resrcToAddModListCount;
1224    PucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1225    uint8_t resrcToRelListCount;
1226    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1227 }PucchResrcCfg;
1228
1229 typedef struct pucchFormatCfg
1230 {
1231    bool interSlotFreqHop;
1232    bool addDmrs;
1233    uint8_t maxCodeRate;
1234    uint8_t numSlots;
1235    bool    pi2BPSK;
1236    bool    harqAckCSI;
1237 }PucchFormatCfg;
1238
1239 typedef struct schedReqResrcInfo
1240 {
1241    uint8_t resrcId;
1242    uint8_t requestId;
1243    uint8_t periodicity;
1244    uint16_t offset;
1245    uint8_t resrc;
1246 }SchedReqResrcInfo;
1247
1248 typedef struct pucchSchedReqCfg
1249 {
1250    uint8_t           schedAddModListCount;
1251    SchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1252    uint8_t           schedRelListCount;
1253    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1254 }PucchSchedReqCfg;
1255
1256 typedef struct spatialRelationInfo
1257 {
1258    uint8_t spatialRelationId;
1259    uint8_t servCellIdx;
1260    uint8_t pathLossRefRSId;
1261    uint8_t p0PucchId;
1262    uint8_t closeLoopIdx;
1263 }SpatialRelationInfo;
1264
1265 typedef struct pucchSpatialCfg
1266 {
1267    uint8_t spatialAddModListCount;
1268    SpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1269    uint8_t spatialRelListCount;
1270    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1271 }PucchSpatialCfg;
1272
1273 typedef struct p0PucchCfg
1274 {
1275    uint8_t p0PucchId;
1276    int     p0PucchVal;
1277 }P0PucchCfg;
1278
1279 typedef struct pathLossRefRSCfg
1280 {
1281    uint8_t pathLossRefRSId;
1282 }PathLossRefRSCfg;
1283
1284 typedef struct pucchMultiCsiCfg
1285 {
1286    uint8_t  multiCsiResrcListCount;
1287    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1288 }PucchMultiCsiCfg;
1289
1290 typedef struct pucchDlDataToUlAck
1291 {
1292    uint8_t  dlDataToUlAckListCount;
1293    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1294 }PucchDlDataToUlAck;
1295
1296 typedef struct pucchPowerControl
1297 {
1298    int deltaF_Format0;
1299    int deltaF_Format1;
1300    int deltaF_Format2;
1301    int deltaF_Format3;
1302    int deltaF_Format4;
1303    uint8_t p0SetCount;
1304    P0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1305    uint8_t pathLossRefRSListCount;
1306    PathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1307 }PucchPowerControl;
1308
1309 typedef struct pucchCfg
1310 {
1311    PucchResrcSetCfg  *resrcSet;
1312    PucchResrcCfg     *resrc;
1313    PucchFormatCfg    *format1; 
1314    PucchFormatCfg    *format2; 
1315    PucchFormatCfg    *format3; 
1316    PucchFormatCfg    *format4;
1317    PucchSchedReqCfg  *schedReq;
1318    PucchMultiCsiCfg  *multiCsiCfg;
1319    PucchSpatialCfg   *spatialInfo;
1320    PucchDlDataToUlAck *dlDataToUlAck;
1321    PucchPowerControl *powerControl;
1322 }PucchCfg;
1323
1324 /* Transform precoding disabled */
1325 typedef struct transPrecodDisabled
1326 {
1327    uint16_t   scramblingId0;
1328 }TransPrecodDisabled;
1329
1330 /* DMRS Uplink configuration */
1331 typedef struct dmrsUlCfg
1332 {
1333    AddPosType            addPos;               /* DMRS additional position */
1334    TransPrecodDisabled   transPrecodDisabled;  /* Transform precoding disabled */
1335 }DmrsUlCfg;
1336
1337 /* PUSCH Configuration */
1338 typedef struct puschCfg
1339 {
1340    uint8_t                 dataScramblingId;
1341    DmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1342    ResAllocType            resourceAllocType;
1343    uint8_t                 numTimeDomRsrcAlloc;
1344    PuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1345    TransformPrecoder       transformPrecoder;
1346 }PuschCfg;
1347
1348 /* Initial Uplink BWP */
1349 typedef struct initialUlBwp
1350 {
1351    bool       pucchPresent;
1352    PucchCfg   pucchCfg; 
1353    bool       puschPresent;
1354    PuschCfg   puschCfg;
1355 }InitialUlBwp;
1356
1357 typedef struct bwpUlCfgDed
1358 {
1359    PucchCfg   pucchCfg;
1360    PuschCfg   puschCfg;
1361 }BwpUlCfgDed;
1362
1363 /* Uplink BWP information */
1364 typedef struct ulBwpInfo
1365 {
1366    uint8_t          bwpId;
1367    BwpUlConfig      bwpCommon;
1368    BwpUlCfgDed      bwpDed;
1369 }UlBwpInfo;
1370
1371 typedef struct rachCfgGeneric
1372 {
1373    uint8_t      prachCfgIdx;       /* PRACH config idx */
1374    uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
1375    uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
1376    uint8_t      zeroCorrZoneCfg;   /* Zero correlation zone cofig */
1377    int16_t      preambleRcvdTargetPower; /*Prach Target power received*/
1378    uint8_t      preambleTransMax;  /*Preamble Transmission Max power*/
1379    uint8_t      pwrRampingStep;    /*Power Ramping Step*/
1380    uint8_t      raRspWindow;       /* RA Response Window */
1381 }RachCfgGeneric;
1382
1383 typedef struct raPrioritization
1384 {
1385    uint8_t powerRampingStepHighPriority;
1386    uint8_t scalingFactorBI;
1387 }RaPrioritization;
1388
1389 typedef struct bfrCsiRsRes
1390 {
1391    uint8_t csrRsIndex;
1392    uint8_t raOccList;
1393    uint8_t raPreambleIndex;
1394 }BfrCsiRsRes;
1395
1396 typedef struct bfrSsbRes
1397 {
1398    uint16_t ssbIndex;
1399    uint8_t raPreambleIndex;
1400 }BfrSsbRes;
1401
1402 typedef struct prachResDedBfr
1403 {
1404    BfrSsbRes    ssb;
1405    BfrCsiRsRes  csiRs;
1406 }PrachResDedBfr;
1407
1408 /*Spec 38.331 'BeamFailureRecoveryConfig' */
1409 typedef struct beamFailRecoveryCfg
1410 {
1411    uint8_t             rootSeqIndexBfr;
1412    RachCfgGeneric      rachCfgBfr;
1413    uint8_t             rsrpThreshSsbBfr;
1414    PrachResDedBfr      candidteBeamRSList;
1415    uint8_t             ssbPerachBfr;
1416    uint8_t             raSsbOccMaskIndex;
1417    uint8_t             recoverySearchSpaceId;
1418    RaPrioritization    raPrioBfr;
1419    uint16_t            bfrTimer;
1420    uint8_t             msg1SubcSpacing;
1421 }BeamFailRecoveryCfg;
1422
1423 /* Serving cell configuration */
1424 typedef struct servCellCfgInfo
1425 {
1426    InitialDlBwp         initDlBwp;
1427    RadioLinkConfig      radioLinkMonConfig;
1428    uint8_t              numDlBwpToAdd;
1429    DlBwpInfo            dlBwpToAddList[MAX_NUM_BWP];
1430    uint8_t              firstActvDlBwpId;
1431    uint8_t              defaultDlBwpId;
1432    uint8_t              *bwpInactivityTmr;
1433    PdschServCellCfg     pdschServCellCfg;
1434    InitialUlBwp         initUlBwp;
1435    BeamFailRecoveryCfg  beamFailureRecoveryCfg;
1436    uint8_t              numUlBwpToAdd;
1437    UlBwpInfo            ulBwpToAddList[MAX_NUM_BWP];
1438    uint8_t              firstActvUlBwpId;
1439 }ServCellCfgInfo;
1440
1441 /* Special cell configuration */
1442 typedef struct spCellCfg
1443 {
1444    uint8_t           servCellIdx;
1445    ServCellCfgInfo   servCellCfg;
1446 }SpCellCfg;
1447
1448 typedef struct bwpRelInfo
1449 {
1450    uint8_t bwpId;
1451 }BwpRelInfo;
1452
1453 /* Serving cell Re-configuration */
1454 typedef struct servCellRecfgInfo
1455 {
1456    InitialDlBwp       initDlBwp;
1457    RadioLinkConfig    radioLinkMonConfig;
1458    uint8_t            numDlBwpToAddOrMod;
1459    DlBwpInfo          dlBwpToAddOrModList[MAX_NUM_BWP];
1460    uint8_t            numDlBwpToRel;
1461    BwpRelInfo         dlBwpToRelList[MAX_NUM_BWP];
1462    uint8_t            firstActvDlBwpId;
1463    uint8_t            defaultDlBwpId;
1464    uint8_t            *bwpInactivityTmr;
1465    PdschServCellCfg   pdschServCellCfg;
1466    InitialUlBwp       initUlBwp;
1467    uint8_t            numUlBwpToAddOrMod;
1468    UlBwpInfo          ulBwpToAddOrModList[MAX_NUM_BWP];
1469    uint8_t            numUlBwpToRel;
1470    BwpRelInfo         ulBwpToRelList[MAX_NUM_BWP];
1471    uint8_t            firstActvUlBwpId;
1472 }ServCellRecfgInfo;
1473
1474 /* Special cell Re-configuration */
1475 typedef struct spCellRecfg 
1476 {
1477    uint8_t             servCellIdx;
1478    ServCellRecfgInfo   servCellCfg;
1479 }SpCellRecfg;
1480
1481 typedef struct ambrCfg
1482 {
1483    uint32_t ulBr;   /* UL Bit rate */
1484 }AmbrCfg;
1485
1486 typedef struct nonDynFiveQi
1487 {
1488    uint16_t   fiveQi;
1489    uint8_t    priorLevel;
1490    uint16_t   avgWindow;
1491    uint16_t   maxDataBurstVol;
1492 }NonDynFiveQi;
1493
1494 typedef struct dynFiveQi
1495 {
1496    uint8_t    priorLevel;
1497    uint16_t   packetDelayBudget;
1498    uint8_t    packetErrRateScalar;
1499    uint8_t    packetErrRateExp;
1500    uint16_t   fiveQi;
1501    uint8_t    delayCritical;
1502    uint16_t   avgWindow;
1503    uint16_t   maxDataBurstVol;
1504 }DynFiveQi;
1505
1506 typedef struct ngRanAllocAndRetPri
1507 {
1508    uint8_t priorityLevel;
1509    uint8_t preEmptionCap;
1510    uint8_t preEmptionVul;
1511 }NgRanAllocAndRetPri;
1512
1513 typedef struct grbQosInfo
1514 {
1515    uint32_t maxFlowBitRateDl;
1516    uint32_t maxFlowBitRateUl;
1517    uint32_t guarFlowBitRateDl;
1518    uint32_t guarFlowBitRateUl;
1519 }GrbQosInfo;
1520
1521 typedef struct drbQos
1522 {
1523    QosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1524    union
1525    {
1526       NonDynFiveQi   nonDyn5Qi;
1527       DynFiveQi      dyn5Qi;
1528    }u;
1529    NgRanAllocAndRetPri ngRanRetPri;
1530    GrbQosInfo grbQosInfo;
1531    uint16_t             pduSessionId;
1532    uint32_t             ulPduSessAggMaxBitRate;
1533 }DrbQosInfo;
1534
1535 typedef struct ulLcCfg
1536 {
1537    uint8_t priority;
1538    uint8_t lcGroup;
1539    uint8_t schReqId;
1540    PBitRate pbr;        // prioritisedBitRate
1541    BucketSizeDur bsd;        // bucketSizeDuration
1542 }UlLcCfg;
1543
1544 typedef struct dlLcCfg
1545 {
1546    LcPriority lcp;      // logical Channel Prioritization
1547 }DlLcCfg;
1548
1549 typedef struct lcCfg
1550 {
1551    uint8_t lcId;
1552    Snssai  *snssai;
1553    DrbQosInfo *drbQos; 
1554    bool ulLcCfgPres;
1555    UlLcCfg ulLcCfg;
1556    DlLcCfg dlLcCfg;
1557 }LcCfg;
1558
1559 typedef struct modulationInfo
1560 {
1561    uint8_t     modOrder;    /* Modulation order */
1562    uint8_t     mcsIndex;    /* MCS Index */
1563    McsTable    mcsTable;    /* MCS table */
1564 }ModulationInfo;
1565
1566 typedef struct macUeCreateReq
1567 {
1568    uint16_t               cellId;
1569    uint8_t                ueId;
1570    uint8_t                beamIdx;
1571    uint16_t               crnti;
1572    bool                   macCellGrpCfgPres;
1573    MacCellGrpCfg          macCellGrpCfg;
1574    bool                   phyCellGrpCfgPres;
1575    PhyCellGrpCfg          phyCellGrpCfg;
1576    bool                   spCellCfgPres;
1577    SpCellCfg              spCellCfg;
1578    AmbrCfg                *ambrCfg;
1579    ModulationInfo         dlModInfo;    /* DL modulation info */ 
1580    ModulationInfo         ulModInfo;    /* UL modulation info */
1581    uint8_t                numLcs;
1582    LcCfg                  lcCfgList[MAX_NUM_LC];
1583 }MacUeCreateReq;
1584
1585 /* UE Re-configuration */
1586 typedef struct macUeRecfg
1587 {
1588    uint16_t        cellId;
1589    uint8_t         ueId;
1590    uint8_t         beamIdx;
1591    uint16_t        crnti;
1592    bool            macCellGrpRecfgPres;
1593    MacCellGrpCfg   macCellGrpRecfg;
1594    bool            phyCellGrpRecfgPres;
1595    PhyCellGrpCfg   phyCellGrpRecfg;
1596    bool            spCellRecfgPres;
1597    SpCellRecfg     spCellRecfg;
1598    AmbrCfg         *ambrRecfg;
1599    ModulationInfo  dlModInfo;
1600    ModulationInfo  ulModInfo;
1601    uint8_t         numLcsToAdd;
1602    LcCfg           lcCfgAdd[MAX_NUM_LC];
1603    uint8_t         numLcsToDel;
1604    uint8_t         lcIdToDel[MAX_NUM_LC];
1605    uint8_t         numLcsToMod;
1606    LcCfg           lcCfgMod[MAX_NUM_LC];
1607    DataTransmissionAction transmissionAction;
1608 #ifdef NR_DRX   
1609    bool            drxConfigIndicatorRelease;
1610 #endif
1611 }MacUeRecfg;
1612
1613 typedef struct nrcgi
1614 {
1615    Plmn      plmn;
1616    uint16_t  cellId;
1617 }Nrcgi;
1618
1619 typedef struct srbFailInfo
1620 {
1621    uint8_t       srbId;
1622    FailureCause  cause;
1623 }SRBFailInfo;
1624
1625 typedef struct drbFailInfo
1626 {
1627    uint8_t       drbId;
1628    FailureCause  cause;
1629 }DRBFailInfo;
1630
1631 typedef struct sCellFailInfo
1632 {
1633    Nrcgi         nrcgi;
1634    FailureCause  cause;
1635 }SCellFailInfo;
1636
1637 typedef struct macUeCreateRsp
1638 {
1639    uint16_t       cellId;
1640    uint16_t       ueId;
1641    MacRsp         result;
1642    uint8_t        numSRBFailed;   /* valid values : 0 to MAX_NUM_SRB */ 
1643    SRBFailInfo    *failedSRBlisti;
1644    uint8_t        numDRBFailed;   /* valid values : 0 to MAX_NUM_DRB */
1645    DRBFailInfo    *failedDRBlist;
1646    uint8_t        numSCellFailed; /* valid values : 0 to MAX_NUM_SCELL */
1647    SCellFailInfo  *failedSCellList;
1648    uint8_t        numDRBModFailed;   /* valid values : 0 to MAX_NUM_DRB */
1649    DRBFailInfo    *failedDRBModlist;
1650 }MacUeCreateRsp;
1651
1652 typedef struct macUeCreateRsp MacUeRecfgRsp;
1653
1654 typedef struct rachRsrcReq
1655 {
1656    uint16_t cellId;
1657    uint16_t ueId;
1658    uint8_t  numSsb;
1659    uint8_t  ssbIdx[MAX_NUM_SSB];
1660 }MacRachRsrcReq;
1661
1662 typedef struct macCfraSsbResource
1663 {
1664    uint8_t  ssbIdx;
1665    uint8_t  raPreambleIdx;
1666 }MacCfraSsbResource;
1667
1668 typedef struct macCfraResource
1669 {
1670    uint8_t   numSsb;
1671    MacCfraSsbResource ssbResource[MAX_NUM_SSB];
1672 }MacCfraResource;
1673
1674 typedef struct macRachRsrcRsp
1675 {
1676    uint16_t   cellId;
1677    uint16_t   ueId;
1678    MacRsp     result;
1679    uint16_t   newCrnti;     /* This parameter maps to 3GPP TS 38.331 newUE-Identity */
1680    MacCfraResource  cfraResource;
1681 }MacRachRsrcRsp;
1682
1683 typedef struct macRachRsrcRel
1684 {
1685    uint16_t cellId;
1686    uint16_t ueId;
1687    uint16_t crnti;
1688 }MacRachRsrcRel;
1689
1690 typedef struct ueDelete
1691 {
1692     uint16_t cellId;
1693     uint8_t  ueId;
1694     uint16_t crnti;
1695 }MacUeDelete;
1696
1697 typedef struct ueDeleteRsp
1698 {
1699    uint16_t cellId;
1700    uint8_t  ueId;
1701    CauseOfResult  status;
1702 }MacUeDeleteRsp;
1703
1704 typedef struct macCellDeleteReq
1705 {
1706    uint16_t cellId;
1707 }MacCellDeleteReq;
1708
1709 typedef struct macCellDeleteRsp
1710 {
1711    uint16_t cellId;
1712    CauseOfResult  status;
1713 }MacCellDeleteRsp;
1714
1715 typedef struct macSliceCfgRsp 
1716 {
1717    Snssai     snssai;
1718    MacRsp     rsp;
1719    CauseOfResult  cause;  
1720 }MacSliceCfgRsp;
1721
1722 typedef struct rrmPolicyRatio
1723 {
1724    uint8_t maxRatio;
1725    uint8_t minRatio;
1726    uint8_t dedicatedRatio;
1727 }RrmPolicyRatio;
1728
1729 typedef struct rrmPolicyMemberList
1730 {
1731    Plmn    plmn;
1732    Snssai  snssai;
1733 }RrmPolicyMemberList;
1734
1735 typedef struct macSliceRrmPolicy
1736 {
1737    ResourceType        resourceType;
1738    uint8_t             numOfRrmPolicyMem;
1739    RrmPolicyMemberList **rRMPolicyMemberList;
1740    RrmPolicyRatio      policyRatio;
1741 }MacSliceRrmPolicy;
1742
1743 typedef struct macSliceCfgReq
1744 {
1745    uint8_t           numOfRrmPolicy;
1746    MacSliceRrmPolicy **listOfRrmPolicy;
1747 }MacSliceCfgReq;
1748
1749 /*As per ORAN-WG8, Slice Cfg and ReCfg are same structures*/
1750 typedef struct macSliceCfgReq MacSliceRecfgReq;
1751 typedef struct macSliceCfgRsp MacSliceRecfgRsp;
1752
1753 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.17 DL PCCH Indication */
1754 typedef struct dlPcchInd
1755 {
1756    uint16_t  cellId;
1757    uint16_t  pf;
1758    uint8_t   i_s;
1759    uint16_t  pduLen;
1760    uint8_t  *pcchPdu;
1761 }DlPcchInd;
1762
1763
1764 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.1 Cell Start */
1765 typedef struct cellInfo
1766 {
1767     SlotTimingInfo slotInfo;
1768     uint16_t       cellId;
1769 }CellInfo;
1770
1771 typedef struct cellInfo CellStartInfo;
1772 typedef struct cellInfo CellStopInfo;
1773
1774 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.12 UE Reset Request */
1775 typedef struct ueReset
1776 {
1777     uint16_t cellId;
1778     uint8_t  ueId;
1779 }MacUeResetReq;
1780
1781 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.13 UE Reset Response */
1782 typedef struct ueResetRsp
1783 {
1784    uint16_t cellId;
1785    uint8_t  ueId;
1786    CauseOfResult  status;
1787 }MacUeResetRsp;
1788
1789 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.14 UE Sync Status Indication */
1790 typedef struct ueSyncStatusInd
1791 {
1792    uint16_t   cellId;
1793    uint8_t    ueId;
1794    SyncStatus status;
1795 }MacUeSyncStatusInd;
1796
1797 /* The following list of structures is taken from the SI-SchedulingInfo section of specification 33.331. */
1798 typedef struct sibTypeInfo
1799 {
1800    SibType sibType;
1801    uint8_t valueTag;
1802    bool    areaScope;
1803 }SibTypeInfo;
1804
1805 typedef struct sibMappingInfo
1806 {
1807    uint8_t      numSibTypeInfo;
1808    SibTypeInfo  sibTypeInfo[NUM_SIB];
1809 }SibMappingInfo;
1810
1811 typedef struct schedulingInfo 
1812 {
1813    SiBroadcastStatus siBroadcastStatus;
1814    SiPeriodicity     siPeriodicity;
1815    SibMappingInfo    sibMappingInfo;
1816 }SchedulingInfo;
1817
1818 typedef struct rachOccasionsSi
1819 {
1820    RachCfgGeneric     rachConfigSi;
1821    SsbPerRachOccasion ssbPerRachOccasion;
1822 }RachOccasionsSi;
1823
1824 typedef struct siReqRsrc 
1825 {
1826    uint8_t raPreambleStartIndex;
1827    uint8_t raAssociationPeriodIndex;
1828    uint8_t raSsbOccasionMaskIndex; 
1829 }SiReqRsrc;
1830
1831 typedef struct siRequestResource
1832 {
1833    uint8_t    numOfSiReqRsrc;
1834    SiReqRsrc  siReqRsrc[MAX_SI_MESSAGE];
1835 }SiRequestResource;
1836
1837 typedef struct siRequestConfig
1838 {
1839    RachOccasionsSi    rachOccasionsSi;
1840    SiRequestPeriod    siRequestPeriod;
1841    SiRequestResource  siRequestResource;
1842 }SiRequestConfig;
1843
1844 typedef struct schedulingInfoList
1845 {
1846    uint8_t        numSchInfo;
1847    SchedulingInfo schedulingInfo[MAX_SI_MESSAGE];
1848 }SchedulingInfoList;
1849
1850 typedef struct siSchedulingInfo
1851 {
1852    SchedulingInfoList schInfoList;
1853    SiWindowLength     siWindowLength;
1854    SiRequestConfig    siRequestConfig;
1855    SiRequestConfig    siRequestConfigSUL;
1856    uint8_t            *siAreaID;
1857 }SiSchedulingInfo;
1858
1859 /*  Ref: ORAN_WG8.V7.0.0 Sec 1.1.1.18 DL Broadcast Request  */
1860 typedef struct macDlBroadcastReq
1861 {
1862     uint16_t         cellId;
1863     uint8_t          numSiBlock;
1864     SiSchedulingInfo **siSchedulingInfo;
1865 }MacDlBroadcastReq;
1866
1867 typedef struct macStatsGrpInfo
1868 {
1869    uint8_t   groupId;
1870    uint16_t  periodicity;  /* In milliseconds */
1871    uint8_t   numStats;
1872    MacMeasurementType statsList[MAX_NUM_STATS];
1873 }MacStatsGrpInfo;
1874
1875 typedef struct macStatsReq
1876 {
1877    uint64_t          subscriptionId;
1878    uint8_t           numStatsGroup;
1879    MacStatsGrpInfo   statsGrpList[MAX_NUM_STATS_GRP];
1880 }MacStatsReq;
1881
1882 typedef struct macStatsGrpRejected
1883 {
1884    uint8_t  groupId;
1885    CauseOfResult cause;
1886 }MacStatsGrpRejected;
1887
1888 typedef struct macStatsRsp
1889 {
1890    uint64_t             subscriptionId;
1891    uint8_t              numGrpAccepted;
1892    uint8_t              statsGrpAcceptedList[MAX_NUM_STATS_GRP];
1893    uint8_t              numGrpRejected;
1894    MacStatsGrpRejected  statsGrpRejectedList[MAX_NUM_STATS_GRP];
1895 }MacStatsRsp;
1896
1897 typedef struct macStats
1898 {
1899    MacMeasurementType type;
1900    double value;
1901 }MacStats;
1902
1903 typedef struct macStatsInd
1904 {
1905    uint64_t    subscriptionId;
1906    uint8_t     groupId;
1907    uint8_t     numStats;
1908    MacStats    measuredStatsList[MAX_NUM_STATS];
1909 }MacStatsInd;
1910
1911 typedef struct macStatsDeleteReq
1912 {
1913    uint64_t    subscriptionId;
1914    uint8_t     numStatsGroupToBeDeleted;
1915    uint8_t     statsGrpIdToBeDelList[MAX_NUM_STATS_GRP];
1916 }MacStatsDeleteReq;
1917
1918 typedef struct macStatsDeleteInfo
1919 {
1920    uint8_t       groupId;
1921    MacRsp        statsGrpDelRsp;
1922    CauseOfResult statsGrpDelCause;
1923 }MacStatsDeleteInfo;
1924
1925 typedef struct macStatsDeleteRsp
1926 {
1927    uint64_t           subscriptionId; /* subscription Id */
1928    MacRsp             subsDelRsp;    /* deletion status of all statsGrp with given subscriptionId */
1929    CauseOfResult      subsDelCause;  /* cause of failure in deletion of all statsGrp with given subscriptionId */
1930    uint8_t            numStatsGroupDeleted; /* number of actions to deleted */ 
1931    MacStatsDeleteInfo statsGrpDelInfo[MAX_NUM_STATS_GRP]; /*list of the deletion statuses for specific actions */
1932 }MacStatsDeleteRsp;
1933
1934 typedef struct macStatsReq MacStatsModificationReq;
1935 typedef struct macStatsRsp MacStatsModificationRsp;
1936
1937 /****************** FUNCTION POINTERS ********************************/
1938
1939 /* DL broadcast req from DU APP to MAC*/
1940 typedef uint8_t (*DuMacDlBroadcastReq) ARGS((
1941          Pst           *pst,
1942          MacDlBroadcastReq *dlBroadcast));
1943
1944 /* Functions for CellUp Ind from MAC to DU APP*/
1945 typedef uint8_t (*DuMacCellUpInd) ARGS((
1946          Pst       *pst,
1947          OduCellId *cellId ));
1948
1949 /* Functions for slot Ind from MAC to DU APP*/
1950 typedef uint8_t (*DuMacSlotInd) ARGS((
1951          Pst       *pst,
1952          SlotTimingInfo *slotIndInfo));
1953
1954 /* Functions for stop Ind from MAC to DU APP*/
1955 typedef uint8_t (*DuMacStopInd) ARGS((
1956          Pst        *pst,
1957          OduCellId  *cellId ));
1958
1959 /* Functions for mac cell start req */
1960 typedef uint8_t (*DuMacCellStart) ARGS((
1961          Pst        *pst, 
1962          CellStartInfo  *cellId));
1963
1964 /* Functions for mac cell stop request */
1965 typedef uint8_t (*DuMacCellStop) ARGS((
1966          Pst        *pst,
1967          CellStopInfo  *cellId ));
1968
1969 /* Function pointers for packing macCellCfg Request and Confirm */
1970 typedef uint8_t (*packMacCellCfgReq) ARGS((
1971          Pst           *pst,
1972          MacCellCfg    *macCellCfg ));
1973
1974 typedef uint8_t (*packMacCellCfgConfirm) ARGS((
1975          Pst              *pst,
1976          MacCellCfgCfm    *macCellCfgCfm ));
1977
1978 typedef uint8_t (*DuMacCellCfgReq) ARGS((
1979          Pst        *pst,        
1980          MacCellCfg *macCellCfg));
1981
1982 typedef uint8_t (*DuMacCellCfgCfm) ARGS((
1983          Pst        *pst,        
1984          MacCellCfgCfm *macCellCfgCfm ));
1985
1986 /* Functions for UL CCCH Ind from MAC to DU APP*/
1987 typedef uint8_t (*DuMacUlCcchInd) ARGS((
1988          Pst           *pst,
1989          UlCcchIndInfo *ulCcchIndInfo ));
1990
1991 /* Functions for DL CCCH Ind from DU APP to MAC*/
1992 typedef uint8_t (*DuMacDlCcchInd) ARGS((
1993          Pst           *pst,
1994          DlCcchIndInfo *dlCcchIndInfo ));
1995
1996 /* UE create Request from DU APP to MAC*/
1997 typedef uint8_t (*DuMacUeCreateReq) ARGS((
1998          Pst           *pst,
1999          MacUeCreateReq      *ueCfg ));
2000
2001 /* UE create Response from MAC to DU APP */
2002 typedef uint8_t (*MacDuUeCreateRspFunc) ARGS((
2003          Pst           *pst, 
2004          MacUeCreateRsp   *cfgRsp));
2005
2006 /* UE Reconfig Request from DU APP to MAC */
2007 typedef uint8_t (*DuMacUeReconfigReq) ARGS((
2008          Pst           *pst,
2009          MacUeRecfg      *ueCfg ));
2010
2011 /* UE Reconfig Response from MAC to DU APP */
2012 typedef uint8_t (*MacDuUeRecfgRspFunc) ARGS((
2013          Pst           *pst, 
2014          MacUeRecfgRsp   *cfgRsp));
2015
2016 /* RACH Resource Request from DU APP to MAC */
2017 typedef uint8_t (*DuMacRachRsrcReq) ARGS((
2018     Pst            *pst,
2019     MacRachRsrcReq *rachRsrcReq));
2020
2021 /* RACH Resource Response from MAC to DU APP */
2022 typedef uint8_t (*MacDuRachRsrcRspFunc) ARGS((
2023     Pst            *pst,
2024     MacRachRsrcRsp *rachRsrcRsp));
2025
2026 /* RACH Resource Release from DU APP to MAC */
2027 typedef uint8_t (*DuMacRachRsrcRel) ARGS((
2028     Pst            *pst,
2029     MacRachRsrcRel *rachRsrcRel));
2030
2031 /* UE Delete Request from DU APP to MAC*/
2032 typedef uint8_t (*DuMacUeDeleteReq) ARGS((
2033      Pst           *pst,
2034      MacUeDelete   *ueDel ));
2035
2036 /* UE Delete Response from MAC to DU APP*/
2037 typedef uint8_t (*MacDuUeDeleteRspFunc) ARGS((
2038      Pst            *pst,
2039      MacUeDeleteRsp *deleteRsp));
2040
2041 /* Cell Delete Request from DU APP to MAC*/
2042 typedef uint8_t (*DuMacCellDeleteReq) ARGS((
2043      Pst           *pst,
2044      MacCellDeleteReq *cellDelete ));
2045
2046 /* Cell Delete Response from MAC to DU APP*/
2047 typedef uint8_t (*MacDuCellDeleteRspFunc) ARGS((
2048      Pst            *pst,
2049      MacCellDeleteRsp *cellDeleteRsp));
2050
2051 /* Slice Cfg Request from DU APP to MAC*/
2052 typedef uint8_t (*DuMacSliceCfgReq) ARGS((
2053      Pst           *pst,
2054      MacSliceCfgReq *CfgReq));
2055
2056 /* Slice Cfg Response from MAC to DU APP */
2057 typedef uint8_t (*MacDuSliceCfgRspFunc) ARGS((
2058          Pst           *pst, 
2059          MacSliceCfgRsp   *cfgRsp));
2060
2061 /* Slice ReReCfg Request from DU APP to MAC*/
2062 typedef uint8_t (*DuMacSliceRecfgReq) ARGS((
2063      Pst           *pst,
2064      MacSliceRecfgReq *CfgReq));
2065
2066 /* Slice ReReCfg Response from MAC to DU APP */
2067 typedef uint8_t (*MacDuSliceRecfgRspFunc) ARGS((
2068         Pst           *pst,
2069         MacSliceRecfgRsp   *cfgRsp));
2070
2071 /* Pcch indication from DU APP to MAC*/
2072 typedef uint8_t (*DuMacDlPcchInd) ARGS((
2073      Pst        *pst,
2074      DlPcchInd *pcchInd));
2075
2076 /* UE Reset Request from DU APP to MAC*/
2077 typedef uint8_t (*DuMacUeResetReq) ARGS((
2078      Pst           *pst,
2079      MacUeResetReq *ueReset ));
2080
2081 /* UE Reset Response from MAC to DU APP*/
2082 typedef uint8_t (*MacDuUeResetRspFunc) ARGS((
2083      Pst            *pst,
2084      MacUeResetRsp *resetRsp));
2085
2086 /* UE sync status indication from MAC to DU APP*/
2087 typedef uint8_t (*MacDuUeSyncStatusIndFunc) ARGS((
2088         Pst            *pst,
2089         MacUeSyncStatusInd *syncStatusInd));
2090
2091 /* Statitics Request from DU APP to MAC */
2092 typedef uint8_t (*DuMacStatsReqFunc) ARGS((
2093       Pst *pst,
2094       MacStatsReq *statsReq));
2095
2096 /* Statistics Response from MAC to DU APP */
2097 typedef uint8_t (*MacDuStatsRspFunc) ARGS((
2098       Pst *pst,
2099       MacStatsRsp *statsRsp));
2100
2101 /* Statistics Ind from MAC to DU APP */
2102 typedef uint8_t (*MacDuStatsIndFunc) ARGS((
2103       Pst *pst,
2104       MacStatsInd *statsInd));
2105
2106 /* Statitics Delete Request from DU APP to MAC */
2107 typedef uint8_t (*DuMacStatsDeleteReqFunc) ARGS((
2108          Pst *pst,
2109          MacStatsDeleteReq *statsDeleteReq));
2110
2111 /* Statistics Delete Response from MAC to DU APP */
2112 typedef uint8_t (*MacDuStatsDeleteRspFunc) ARGS((
2113          Pst *pst,
2114          MacStatsDeleteRsp *statsDeleteRsp));
2115
2116 /* Statitics Modification Request from DU APP to MAC */
2117 typedef uint8_t (*DuMacStatsModificationReqFunc) ARGS((
2118       Pst *pst,
2119       MacStatsModificationReq *statsModificationReq));
2120
2121 /* Statistics Modification Response from MAC to DU APP */
2122 typedef uint8_t (*MacDuStatsModificationRspFunc) ARGS((
2123       Pst *pst,
2124       MacStatsModificationRsp *statsModificationRsp));
2125
2126 /******************** FUNCTION DECLARATIONS ********************************/
2127 uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId);
2128 uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf);
2129 uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId);
2130
2131 uint8_t packMacCellStart(Pst *pst, CellStartInfo *cellStartInfo);
2132 uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf);
2133 uint8_t MacProcCellStart(Pst *pst, CellStartInfo *cellStartInfo);
2134
2135 uint8_t packMacCellStop(Pst *pst, CellStopInfo *cellStopInfo);
2136 uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf);
2137 uint8_t MacProcCellStop(Pst *pst, CellStopInfo *cellStopInfo);
2138
2139 uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
2140 uint8_t unpackDuMacCellCfg(DuMacCellCfgReq func,  Pst *pst,  Buffer *mBuf);
2141 uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
2142
2143 uint8_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
2144 uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
2145 uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
2146
2147 uint8_t packMacStopInd(Pst *pst, OduCellId *cellId);
2148 uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
2149 uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId);
2150 uint8_t sendStopIndMacToDuApp(uint16_t cellId);
2151
2152 uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
2153 uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
2154 uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
2155
2156 uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
2157 uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
2158 uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
2159
2160 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCreateReq *ueCfg);
2161 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf);
2162 uint8_t MacProcUeCreateReq(Pst *pst, MacUeCreateReq *ueCfg);
2163
2164 uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp);
2165 uint8_t unpackDuMacUeCreateRsp(MacDuUeCreateRspFunc func, Pst *pst, Buffer *mBuf);
2166 uint8_t DuProcMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp);
2167
2168 uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg);
2169 uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf);
2170 uint8_t MacProcUeReconfigReq(Pst *pst, MacUeRecfg *ueRecfg);
2171
2172 uint8_t packDuMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp);
2173 uint8_t unpackDuMacUeRecfgRsp(MacDuUeRecfgRspFunc func, Pst *pst, Buffer *mBuf);
2174 uint8_t DuProcMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp);
2175
2176 uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq);
2177 uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf);
2178 uint8_t MacProcRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq);
2179
2180 uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp);
2181 uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf);
2182 uint8_t DuProcMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp);
2183
2184 uint8_t packDuMacRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel);
2185 uint8_t unpackMacRachRsrcRel(DuMacRachRsrcRel func, Pst *pst, Buffer *mBuf);
2186 uint8_t MacProcRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel);
2187
2188 uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDelete);
2189 uint8_t MacProcUeDeleteReq(Pst *pst,  MacUeDelete *ueDelete);
2190 uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf);
2191
2192 uint8_t packDuMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp);
2193 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp);
2194 uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf);
2195
2196 uint8_t packDuMacCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete);
2197 uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete);
2198 uint8_t unpackMacCellDeleteReq(DuMacCellDeleteReq func, Pst *pst, Buffer *mBuf);
2199
2200 uint8_t packDuMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp);
2201 uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp);
2202 uint8_t unpackDuMacCellDeleteRsp(MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf);
2203
2204 uint8_t packDuMacSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq);
2205 uint8_t MacProcSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq);
2206 uint8_t unpackMacSliceCfgReq(DuMacSliceCfgReq func, Pst *pst, Buffer *mBuf);
2207
2208 uint8_t DuProcMacSliceCfgRsp(Pst *pst,  MacSliceCfgRsp *cfgRsp);
2209 uint8_t packDuMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp);
2210 uint8_t unpackDuMacSliceCfgRsp(MacDuSliceCfgRspFunc func, Pst *pst, Buffer *mBuf);
2211
2212 uint8_t packDuMacSliceRecfgReq(Pst *pst, MacSliceRecfgReq *sliceRecfgReq);
2213 uint8_t MacProcSliceRecfgReq(Pst *pst, MacSliceRecfgReq *sliceRecfgReq);
2214 uint8_t unpackMacSliceRecfgReq(DuMacSliceRecfgReq func, Pst *pst, Buffer *mBuf);
2215
2216 uint8_t DuProcMacSliceRecfgRsp(Pst *pst,  MacSliceRecfgRsp *sliceRecfgRsp);
2217 uint8_t packDuMacSliceRecfgRsp(Pst *pst, MacSliceRecfgRsp *sliceRecfgRsp);
2218 uint8_t unpackDuMacSliceRecfgRsp(MacDuSliceRecfgRspFunc func, Pst *pst, Buffer *mBuf);
2219
2220 uint8_t duHandleSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo);
2221 uint8_t packMacSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo);
2222 uint8_t unpackDuMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
2223
2224 uint8_t packDuMacDlPcchInd(Pst *pst, DlPcchInd *pcchInd);
2225 uint8_t MacProcDlPcchInd(Pst *pst, DlPcchInd *pcchInd);
2226 uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf);
2227
2228 int8_t getFreeBitFromUeBitMap(uint16_t cellId);
2229 void unsetBitInUeBitMap(uint16_t cellId, uint8_t bitPos);
2230
2231 uint8_t packDuMacUeResetReq(Pst *pst, MacUeResetReq *ueReset);
2232 uint8_t MacProcUeResetReq(Pst *pst,  MacUeResetReq *ueReset);
2233 uint8_t unpackMacUeResetReq(DuMacUeResetReq func, Pst *pst, Buffer *mBuf);
2234
2235 uint8_t packDuMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp);
2236 uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp);
2237 uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf);
2238
2239 uint8_t packDuMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
2240 uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
2241 uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buffer *mBuf);
2242
2243 uint8_t packDuMacDlBroadcastReq(Pst *pst, MacDlBroadcastReq *dlBroadcastReq);
2244 uint8_t MacProcDlBroadcastReq(Pst *pst,  MacDlBroadcastReq *dlBroadcastReq);
2245 uint8_t unpackMacDlBroadcastReq(DuMacDlBroadcastReq func, Pst *pst, Buffer *mBuf);
2246
2247 uint8_t packDuMacStatsReq(Pst *pst, MacStatsReq *statsReq);
2248 uint8_t MacProcStatsReq(Pst *pst, MacStatsReq *statsReq);
2249 uint8_t unpackMacStatsReq(DuMacStatsReqFunc func, Pst *pst, Buffer *mBuf);
2250
2251 uint8_t packDuMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp);
2252 uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp);
2253 uint8_t unpackDuMacStatsRsp(MacDuStatsRspFunc func, Pst *pst, Buffer *mBuf);
2254
2255 uint8_t packDuMacStatsInd(Pst *pst, MacStatsInd *statsRsp);
2256 uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsRsp);
2257 uint8_t unpackDuMacStatsInd(MacDuStatsIndFunc func, Pst *pst, Buffer *mBuf);
2258
2259 uint8_t packDuMacStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq);
2260 uint8_t MacProcStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq);
2261 uint8_t unpackMacStatsDeleteReq(DuMacStatsDeleteReqFunc func, Pst *pst, Buffer *mBuf);
2262
2263 uint8_t packDuMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp);
2264 uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp);
2265 uint8_t unpackDuMacStatsDeleteRsp(MacDuStatsDeleteRspFunc func, Pst *pst, Buffer *mBuf);
2266
2267 uint8_t packDuMacStatsModificationReq(Pst *pst, MacStatsModificationReq *statsModificationReq);
2268 uint8_t MacProcStatsModificationReq(Pst *pst, MacStatsModificationReq *statsModificationReq);
2269 uint8_t unpackMacStatsModificationReq(DuMacStatsModificationReqFunc func, Pst *pst, Buffer *mBuf);
2270
2271 uint8_t packDuMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsModificationRsp);
2272 uint8_t DuProcMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsModificationRsp);
2273 uint8_t unpackDuMacStatsModificationRsp(MacDuStatsModificationRspFunc func, Pst *pst, Buffer *mBuf);
2274
2275
2276 #endif
2277
2278
2279 /**********************************************************************
2280   End of file
2281  **********************************************************************/