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