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