[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] WG8 Alignment | Ue reset req and rsp
[o-du/l2.git] / src / cm / mac_sch_interface.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 /* events */
20 #define EVENT_SCH_GEN_CFG            1
21 #define EVENT_SCH_CELL_CFG           2
22 #define EVENT_SCH_CELL_CFG_CFM       3
23 #define EVENT_DL_SCH_INFO            4 
24 #define EVENT_UL_SCH_INFO            5 
25 #define EVENT_RACH_IND_TO_SCH        6
26 #define EVENT_CRC_IND_TO_SCH         7
27 #define EVENT_DL_RLC_BO_INFO_TO_SCH  8
28 #define EVENT_ADD_UE_CONFIG_REQ_TO_SCH   9
29 #define EVENT_UE_CONFIG_RSP_TO_MAC   10
30 #define EVENT_SLOT_IND_TO_SCH        11
31 #define EVENT_SHORT_BSR              12
32 #define EVENT_UCI_IND_TO_SCH         13
33 #define EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH 14
34 #define EVENT_UE_RECONFIG_RSP_TO_MAC 15
35 #define EVENT_UE_DELETE_REQ_TO_SCH   16
36 #define EVENT_UE_DELETE_RSP_TO_MAC   17
37 #define EVENT_CELL_DELETE_REQ_TO_SCH 18
38 #define EVENT_CELL_DELETE_RSP_TO_MAC 19
39 #define EVENT_LONG_BSR               20
40 #define EVENT_SLICE_CFG_REQ_TO_SCH   21
41 #define EVENT_SLICE_CFG_RSP_TO_MAC   22
42 #define EVENT_SLICE_RECFG_REQ_TO_SCH 23
43 #define EVENT_SLICE_RECFG_RSP_TO_MAC 24
44 #define EVENT_RACH_RESOURCE_REQUEST_TO_SCH  25
45 #define EVENT_RACH_RESOURCE_RESPONSE_TO_MAC 26
46 #define EVENT_RACH_RESOURCE_RELEASE_TO_SCH  27
47 #define EVENT_PAGING_IND_TO_SCH      28
48 #define EVENT_DL_PAGING_ALLOC        29
49 #define EVENT_DL_REL_HQ_PROC         30 
50 #define EVENT_DL_HARQ_IND_TO_SCH     31
51 #define EVENT_DL_CQI_TO_SCH          32
52 #define EVENT_UL_CQI_TO_SCH          33
53 #define EVENT_PHR_IND_TO_SCH         34
54 /*macros*/
55 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
56 #define SCH_SSB_MASK_SIZE   1
57
58 #define MAX_NUM_PRG     1 /* max value should be later 275 */
59 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
60 #define MAX_CODEWORDS  1  /* max should be 2 */
61 #define SCH_HARQ_PROC_ID 1 /* harq proc id */
62 #define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
63
64 /* Datatype in UL SCH Info */
65 #define SCH_DATATYPE_PUSCH 1
66 #define SCH_DATATYPE_PUSCH_UCI 2
67 #define SCH_DATATYPE_UCI 4
68 #define SCH_DATATYPE_SRS 8
69 #define SCH_DATATYPE_PRACH 16
70
71 #define MAX_NUMBER_OF_CRC_IND_BITS 1
72 #define MAX_NUMBER_OF_UCI_IND_BITS 1
73 #define MAX_SR_BITS_IN_BYTES       1
74 #define MAX_HARQ_BITS_IN_BYTES     1
75 #define MAX_NUM_LOGICAL_CHANNEL_GROUPS 8
76 #define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
77 #define MAX_NUM_TAGS 4                  /* Max number of timing advance groups */
78 #define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
79 #define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
80 #define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
81 #define FREQ_DOM_RSRC_SIZE  6           /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
82 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
83 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
84 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
85
86 /* PUCCH Configuration Macro */
87 #define MAX_NUM_PUCCH_RESRC 128
88 #define MAX_NUM_PUCCH_RESRC_SET 4
89 #define MAX_NUM_PUCCH_PER_RESRC_SET 32
90 #define MAX_NUM_SPATIAL_RELATIONS 8
91 #define MAX_NUM_PUCCH_P0_PER_SET 8
92 #define MAX_NUM_PATH_LOSS_REF_RS 4
93 #define MAX_NUM_DL_DATA_TO_UL_ACK 15
94 #define QPSK_MODULATION 2
95
96 #define RAR_PAYLOAD_SIZE 10             /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 8 bytes long and 2 bytes of padding */
97 #define TX_PAYLOAD_HDR_LEN 32           /* Intel L1 requires adding a 32 byte header to transmitted payload */
98 #define UL_TX_BUFFER_SIZE 5
99
100 #define MAX_NUM_CONFIG_SLOTS 160  /*Max number of slots as per the numerology*/
101 #define MAX_NUM_K0_IDX 16 /* Max number of pdsch time domain downlink allocation */
102 #define MAX_NUM_K1_IDX 8  /* As per spec 38.213 section 9.2.3 Max number of PDSCH-to-HARQ resource indication */
103 #define MIN_NUM_K1_IDX 4  /* Min K1 values */
104 #define MAX_NUM_K2_IDX 16 /* PUSCH time domain UL resource allocation list */
105 #define DEFAULT_K0_VALUE 0 /* As per 38.331, PDSCH-TimeDomainResourceAllocation field descriptions */
106 /* As per 38.331, PUSCH-TimeDomainResourceAllocationList field descriptions */
107 #define DEFAULT_K2_VALUE_FOR_SCS15  1 
108 #define DEFAULT_K2_VALUE_FOR_SCS30  1 
109 #define DEFAULT_K2_VALUE_FOR_SCS60  2
110 #define DEFAULT_K2_VALUE_FOR_SCS120 3 
111
112 #define MAX_PLMN 2
113 #define DL_DMRS_SYMBOL_POS 4 /* Bitmap value 00000000000100 i.e. using 3rd symbol for PDSCH DMRS */
114
115 #define MAX_PHR_REPORT 1 /*TODO: Range of PHR reports in multiple PHR.*/
116 #define MAX_FAILURE_DET_RESOURCES 10 /*Spec 38.331 'maxNrofFailureDetectionResources'*/
117
118 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr, numOfSlot)          \
119 {                                                          \
120    if ((crntTime.slot + incr) > (numOfSlot - 1))           \
121    {                                                       \
122       toFill.sfn = (crntTime.sfn + 1);                     \
123    }                                                       \
124    else                                                    \
125    {                                                       \
126       toFill.sfn = crntTime.sfn;                           \
127    }                                                       \
128    toFill.slot = (crntTime.slot + incr) % numOfSlot;       \
129    if (toFill.sfn >= MAX_SFN)                              \
130    {                                                       \
131       toFill.sfn%=MAX_SFN;                                 \
132    }                                                       \
133 }
134
135 typedef enum
136 {
137    PRB_RSRC,
138    DRB_RSRC,
139    RRC_CONNECTED_USERS_RSRC
140 }SchResourceType;
141
142 typedef enum
143 {
144    NO_TRANSMISSION,
145    NEW_TRANSMISSION,
146    REPEATITION 
147 }PduTxOccsaion;
148
149 typedef enum
150 {
151    SR_PROHIBIT_MS1,
152    SR_PROHIBIT_MS2,
153    SR_PROHIBIT_MS4,
154    SR_PROHIBIT_MS8,
155    SR_PROHIBIT_MS16,
156    SR_PROHIBIT_MS32,
157    SR_PROHIBIT_MS64,
158    SR_PROHIBIT_MS128
159 }SchSrProhibitTimer;
160
161 typedef enum
162 {
163    SR_TRANS_MAX_N4,
164    SR_TRANS_MAX_N8,
165    SR_TRANS_MAX_N16,
166    SR_TRANS_MAX_N32,
167    SR_TRANS_MAX_N64,
168    SR_TRANS_MAX_SPARE3,
169    SR_TRANS_MAX_SPARE2,
170    SR_TRANS_MAX_SPARE1
171 }SchSrTransMax;
172
173 typedef enum
174 {
175    TIME_ALIGNMENT_TIMER_MS500,
176    TIME_ALIGNMENT_TIMER_MS750,
177    TIME_ALIGNMENT_TIMER_MS1280,
178    TIME_ALIGNMENT_TIMER_MS1920,
179    TIME_ALIGNMENT_TIMER_MS2560,
180    TIME_ALIGNMENT_TIMER_MS5120,
181    TIME_ALIGNMENT_TIMER_MS10240,
182    TIME_ALIGNMENT_TIMER_INFINITE
183 }SchTimeAlignmentTimer;
184
185 typedef enum
186 {
187    PHR_PERIODIC_TIMER_SF10,
188    PHR_PERIODIC_TIMER_SF20,
189    PHR_PERIODIC_TIMER_SF50,
190    PHR_PERIODIC_TIMER_SF100,
191    PHR_PERIODIC_TIMER_SF200,
192    PHR_PERIODIC_TIMER_SF500,
193    PHR_PERIODIC_TIMER_SF1000,
194    PHR_PERIODIC_TIMER_INFINITE
195 }SchPhrPeriodicTimer;
196
197 typedef enum
198 {
199    PHR_PROHIBIT_TIMER_SF0,
200    PHR_PROHIBIT_TIMER_SF10,
201    PHR_PROHIBIT_TIMER_SF20,
202    PHR_PROHIBIT_TIMER_SF50,
203    PHR_PROHIBIT_TIMER_SF100,
204    PHR_PROHIBIT_TIMER_SF200,
205    PHR_PROHIBIT_TIMER_SF500,
206    PHR_PROHIBIT_TIMER_SF1000
207 }SchPhrProhibitTimer;
208
209 typedef enum
210 {
211    PHR_TX_PWR_FACTOR_CHANGE_DB1,
212    PHR_TX_PWR_FACTOR_CHANGE_DB3,
213    PHR_TX_PWR_FACTOR_CHANGE_DB6,
214    PHR_TX_PWR_FACTOR_CHANGE_INFINITE
215 }SchPhrTxPwrFactorChange;
216
217 typedef enum
218 {
219    PHR_MODE_REAL,
220    PHR_MODE_VIRTUAL
221 }SchPhrModeOtherCG;
222
223 typedef enum
224 {
225    HARQ_ACK_CODEBOOK_SEMISTATIC,
226    HARQ_ACK_CODEBOOK_DYNAMIC
227 }SchPdschHarqAckCodebook;
228
229 typedef enum
230 {
231    NUM_HARQ_PROC_FOR_PDSCH_N2,
232    NUM_HARQ_PROC_FOR_PDSCH_N4,
233    NUM_HARQ_PROC_FOR_PDSCH_N6,
234    NUM_HARQ_PROC_FOR_PDSCH_N10,
235    NUM_HARQ_PROC_FOR_PDSCH_N16
236 }SchNumHarqProcForPdsch;
237
238 typedef enum
239 {
240    MAX_CODE_BLOCK_GROUP_PER_TB_N2,
241    MAX_CODE_BLOCK_GROUP_PER_TB_N4,
242    MAX_CODE_BLOCK_GROUP_PER_TB_N6,
243    MAX_CODE_BLOCK_GROUP_PER_TB_N8
244 }SchMaxCodeBlkGrpPerTB;
245
246 typedef enum
247 {
248    PDSCH_X_OVERHEAD_XOH_6,
249    PDSCH_X_OVERHEAD_XOH_12,
250    PDSCH_X_OVERHEAD_XOH_18
251 }SchPdschXOverhead;
252
253 typedef enum
254 {
255    DMRS_ADDITIONAL_POS0,
256    DMRS_ADDITIONAL_POS1,
257    DMRS_ADDITIONAL_POS3
258 }SchDmrsAdditionPosition;
259
260 typedef enum
261 {
262    RESOURCE_ALLOCTION_TYPE_0,
263    RESOURCE_ALLOCTION_TYPE_1,
264    RESOURCE_ALLOCTION_DYN_SWITCH
265 }SchResourceAllocType;
266
267 typedef enum
268 {
269    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_A,
270    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_B
271 }SchTimeDomRsrcAllocMappingType;
272
273 typedef enum
274 {
275    ENABLED_TRANSFORM_PRECODER,
276    DISABLED_TRANSFORM_PRECODER
277 }SchTransformPrecoder;
278
279 typedef enum
280 {
281    INTERLEAVED_CCE_REG_MAPPING = 1,
282    NONINTERLEAVED_CCE_REG_MAPPING
283 }SchREGMappingType;
284
285 typedef enum
286 {
287    SLOT_PERIODICITY_AND_OFFSET_SL_1 = 1,
288    SLOT_PERIODICITY_AND_OFFSET_SL_2,
289    SLOT_PERIODICITY_AND_OFFSET_SL_4,
290    SLOT_PERIODICITY_AND_OFFSET_SL_5,
291    SLOT_PERIODICITY_AND_OFFSET_SL_8,
292    SLOT_PERIODICITY_AND_OFFSET_SL_10,
293    SLOT_PERIODICITY_AND_OFFSET_SL_16,
294    SLOT_PERIODICITY_AND_OFFSET_SL_20,
295    SLOT_PERIODICITY_AND_OFFSET_SL_40,
296    SLOT_PERIODICITY_AND_OFFSET_SL_80,
297    SLOT_PERIODICITY_AND_OFFSET_SL_160,
298    SLOT_PERIODICITY_AND_OFFSET_SL_320,
299    SLOT_PERIODICITY_AND_OFFSET_SL_640,
300    SLOT_PERIODICITY_AND_OFFSET_SL_1280,
301    SLOT_PERIODICITY_AND_OFFSET_SL_2560
302 }SchMSlotPeriodAndOffset;
303
304 typedef enum
305 {
306    SAME_AS_REG_BUNDLE,
307    ALL_CONTIGUOUS_RB
308 }SchPrecoderGranul;
309
310 typedef enum
311 {
312    SEARCH_SPACE_TYPE_COMMON = 1,
313    SEARCH_SPACE_TYPE_UE_SPECIFIC
314 }SchSearchSpaceType;
315
316 typedef enum
317 {
318    SCH_QOS_NON_DYNAMIC = 1,
319    SCH_QOS_DYNAMIC
320 }SchQosType;
321
322 typedef enum
323 {
324    AGGREGATION_LEVEL_N0,
325    AGGREGATION_LEVEL_N1,
326    AGGREGATION_LEVEL_N2,
327    AGGREGATION_LEVEL_N3,
328    AGGREGATION_LEVEL_N4,
329    AGGREGATION_LEVEL_N5,
330    AGGREGATION_LEVEL_N6,
331    AGGREGATION_LEVEL_N8
332 }SchAggrLevel;
333
334 typedef enum
335 {
336    RBG_SIZE_CONFIG_1,
337    RBG_SIZE_CONFIG_2
338 }SchRBGSize;
339
340 typedef enum
341 {
342    CODE_WORDS_SCHED_BY_DCI_N1,
343    CODE_WORDS_SCHED_BY_DCI_N2
344 }SchCodeWordsSchedByDci;
345
346 typedef enum
347 {
348    STATIC_BUNDLING_TYPE = 1,
349    DYNAMIC_BUNDLING_TYPE
350 }SchBundlingType;
351
352 typedef enum
353 {
354    SCH_SET1_SIZE_N4,
355    SCH_SET1_SIZE_WIDEBAND,
356    SCH_SET1_SIZE_N2_WIDEBAND,
357    SCH_SET1_SIZE_N4_WIDEBAND
358 }SchBundlingSizeSet1;
359
360 typedef enum
361 {
362    SCH_SET2_SIZE_N4,
363    SCH_SET2_SIZE_WIDEBAND
364 }SchBundlingSizeSet2;
365
366 typedef enum
367 {
368    DUPLEX_MODE_FDD,
369    DUPLEX_MODE_TDD
370 }SchDuplexMode;
371
372 typedef enum
373 {
374    SSB_PRDCTY_MS5,
375    SSB_PRDCTY_MS10,
376    SSB_PRDCTY_MS20,
377    SSB_PRDCTY_MS40,
378    SSB_PRDCTY_MS80,
379    SSB_PRDCTY_MS160
380 }SchSSBPeriod;
381
382 typedef enum
383 {
384    RSP_OK,
385    RSP_NOK
386 }SchMacRsp;
387
388 typedef enum
389 {
390    SHORT_BSR,
391    LONG_BSR,
392    SHORT_TRUNCATED_BSR,
393    LONG_TRUNCATED_BSR
394 }BsrType;
395
396 typedef enum
397 {
398    SINGLE_ENTRY_PHR,
399    MULTIPLE_ENTRY_PHR
400 }PhrType;
401
402 typedef enum
403 {
404   PH_TYPE_1,
405   PH_TYPE_2
406 }PhType;
407
408 typedef enum
409 {
410    FORMAT0_0,
411    FORMAT0_1,
412    FORMAT1_0,
413    FORMAT1_1
414 }FormatType;
415
416 typedef enum
417 {
418    SCH_MCS_TABLE_QAM_64,
419    SCH_MCS_TABLE_QAM_256,
420    SCH_MCS_TABLE_QAM_64_LOW_SE
421 }SchMcsTable;
422
423 typedef enum
424 {
425    NONE,
426    PDCCH_PDU,
427    PDSCH_PDU,
428    BOTH
429 }DlPduType;
430
431 typedef enum
432 {
433    DATA_TRANSMISSION_ALLOWED,
434    STOP_DATA_TRANSMISSION,
435    RESTART_DATA_TRANSMISSION
436 }SchDataTransmission;
437
438 typedef enum
439 {
440    SchBeamFailure,
441    SchRlf,
442    SchBoth
443 }SchPurposeOfFailureDet;
444
445 typedef enum
446 {
447    CQI_PUCCH = 1,
448    CQI_PUSCH
449 }CqiUlReportType;
450
451 /*structures*/
452 typedef struct timeDomainAlloc
453 {
454    uint16_t startSymb;
455    uint16_t numSymb;
456 }TimeDomainAlloc;
457
458 typedef struct resAllocType0 
459 {
460    uint8_t rbBitmap[36];
461 }ResAllocType0;
462
463 typedef struct resAllocType1 
464 {
465    uint16_t startPrb;
466    uint16_t numPrb;
467 }ResAllocType1;
468
469 typedef struct resAllocType1 FreqDomainRsrc;
470
471 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-32 BWP Information  */
472 typedef struct bwpCfg
473 {
474    uint8_t         subcarrierSpacing;
475    uint8_t         cyclicPrefix;
476    FreqDomainRsrc  freqAlloc;   
477 }BwpCfg;
478
479 typedef struct prg
480 {
481    uint16_t pmIdx;
482    uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
483 } Prg;
484
485 typedef struct beamformingInfo
486 {
487    uint16_t numPrgs;
488    uint16_t prgSize;
489    uint8_t  digBfInterfaces;
490    Prg  prg[MAX_NUM_PRG];
491 } BeamformingInfo;
492
493 /* SIB1 PDSCH structures */
494
495 typedef struct codewordinfo
496 {
497    uint16_t targetCodeRate;
498    uint8_t  qamModOrder;
499    uint8_t  mcsIndex;
500    uint8_t  mcsTable;
501    uint8_t  rvIndex;
502    uint32_t tbSize;
503 } CodewordInfo;
504
505 typedef struct dmrsInfo
506 {
507    uint16_t dlDmrsSymbPos;
508    uint8_t  dmrsConfigType;
509    uint16_t dlDmrsScramblingId;
510    uint8_t  scid;
511    uint8_t  numDmrsCdmGrpsNoData;
512    uint16_t dmrsPorts;
513    uint8_t mappingType;
514    uint8_t nrOfDmrsSymbols;
515    uint8_t dmrsAddPos;
516 } DmrsInfo;
517
518 typedef struct pdschFreqAlloc
519 {
520    uint8_t  resourceAllocType;
521    /* since we are using type-1, rbBitmap excluded */
522    uint8_t  rbBitmap[36];
523    uint16_t startPrb;
524    uint16_t numPrb;
525    uint8_t  vrbPrbMapping;
526 }PdschFreqAlloc;
527
528 typedef struct pdschTimeAlloc
529 {
530    uint8_t  rowIndex; 
531    uint16_t startSymb;
532    uint16_t numSymb;
533 } PdschTimeAlloc;
534
535 typedef struct txPowerPdschInfo
536 {
537    uint8_t powerControlOffset;
538    uint8_t powerControlOffsetSS;
539 } TxPowerPdschInfo;
540
541 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-43 PDSCH Configuration */
542 typedef struct pdschCfg
543 {
544    uint16_t         pduBitmap;
545    uint16_t         rnti;
546    uint16_t         pduIndex;
547    uint8_t          numCodewords;
548    CodewordInfo     codeword[MAX_CODEWORDS];
549    uint16_t         dataScramblingId;
550    uint8_t          numLayers;
551    uint8_t          transmissionScheme;
552    uint8_t          refPoint;
553    DmrsInfo         dmrs;
554    PdschFreqAlloc   pdschFreqAlloc;
555    PdschTimeAlloc   pdschTimeAlloc;
556    BeamformingInfo  beamPdschInfo;
557    TxPowerPdschInfo txPdschPower;
558 } PdschCfg;
559 /* SIB1 PDSCH structures end */
560
561 /* SIB1 interface structure */
562
563 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-35 CORESET Configuration */
564 typedef struct coresetCfg
565 {
566    uint8_t coreSetSize;
567    uint8_t startSymbolIndex;
568    uint8_t durationSymbols;
569    uint8_t freqDomainResource[6];
570    uint8_t cceRegMappingType;
571    uint8_t regBundleSize;
572    uint8_t interleaverSize;
573    uint16_t shiftIndex;
574    uint8_t coreSetType;
575    uint8_t coresetPoolIndex;
576    uint8_t precoderGranularity;
577    uint8_t cceIndex;
578    uint8_t aggregationLevel;
579 } CoresetCfg;
580
581 typedef struct txPowerPdcchInfo
582 {
583    uint8_t beta_pdcch_1_0;
584    uint8_t powerControlOffsetSS;
585 }TxPowerPdcchInfo;
586
587 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-42 DL-DCI Configuration */
588 typedef struct dlDCI
589 {
590    uint16_t rnti;
591    uint16_t scramblingId;
592    uint16_t scramblingRnti;
593    uint8_t cceIndex;
594    uint8_t aggregLevel;
595    BeamformingInfo beamPdcchInfo;
596    TxPowerPdcchInfo txPdcchPower;
597    PdschCfg     pdschCfg;
598 }DlDCI;
599
600 typedef struct pdcchCfg
601 {
602    /* coreset-0 configuration */
603    CoresetCfg coresetCfg;
604    uint16_t   numDlDci;
605    DlDCI      dci; /* as of now its only one DCI, later it will be numDlCi */
606 } PdcchCfg;
607 /* end of SIB1 PDCCH structures */
608
609 typedef struct schPcchCfg
610 {
611    uint8_t  numPO;                    /*Derived from Ns*/
612    bool     poPresent;                /*FirstPDCCH-MonitoringPO is present or not*/
613    uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
614 }SchPcchCfg;
615
616 typedef struct schPdcchConfigSib1
617 {
618    uint8_t  coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
619    uint8_t  searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
620 }SchPdcchConfigSib1;
621
622 typedef struct schRachCfgGeneric
623 {
624    uint8_t      prachCfgIdx;       /* PRACH config idx */
625    uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
626    uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
627    uint8_t      zeroCorrZoneCfg;   /* Zero correlation zone cofig */
628    int16_t      preambleRcvdTargetPower;
629    uint8_t      preambleTransMax;
630    uint8_t      pwrRampingStep;
631    uint8_t      raRspWindow;       /* RA Response Window */
632 }SchRachCfgGeneric;
633
634 typedef struct schRachCfg
635 {
636    SchRachCfgGeneric  prachCfgGeneric;
637    uint8_t      totalNumRaPreamble; /* Total number of RA preambles */
638    uint8_t      ssbPerRach;        /* SSB per RACH occassion */
639    uint8_t      numCbPreamblePerSsb; /* Number of CB preamble per SSB */
640    uint8_t      raContResTmr;      /* RA Contention Resoultion Timer */
641    uint8_t      rsrpThreshSsb;     /* RSRP Threshold SSB */
642    uint16_t     rootSeqIdx;        /* Root sequence index */
643    uint16_t     rootSeqLen;        /* root sequence length */
644    uint8_t      numRootSeq;        /* Number of root sequences required for FD */
645    uint8_t      msg1SubcSpacing;  /* Subcarrier spacing of RACH */
646 }SchRachCfg;
647
648 typedef struct schBwpParams
649 {
650    FreqDomainRsrc  freqAlloc;
651    uint8_t         scs;
652    uint8_t         cyclicPrefix;
653 }SchBwpParams;
654
655 typedef struct schCandidatesInfo
656 {
657    uint8_t aggLevel1;
658    uint8_t aggLevel2;
659    uint8_t aggLevel4;
660    uint8_t aggLevel8;
661    uint8_t aggLevel16;
662 }SchCandidatesInfo;
663
664 typedef struct schSearchSpaceCfg
665 {
666    uint8_t  searchSpaceId;
667    uint8_t  coresetId;
668    uint8_t  freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
669    uint16_t monitoringSlot;
670    uint16_t duration;
671    uint16_t monitoringSymbol;
672    SchCandidatesInfo candidate;
673 }SchSearchSpaceCfg;
674
675 typedef struct schPdcchCfgCmn
676 {
677    SchSearchSpaceCfg commonSearchSpace;
678    uint8_t raSearchSpaceId;
679 }SchPdcchCfgCmn;
680
681 typedef struct schPdschCfgCmnTimeDomRsrcAlloc
682 {
683    uint8_t k0;
684    uint8_t mappingType;
685    uint8_t startSymbol;
686    uint8_t lengthSymbol;
687 }SchPdschCfgCmnTimeDomRsrcAlloc;
688
689 typedef struct schPdschCfgCmn
690 {
691    uint8_t   numTimeDomAlloc;
692    SchPdschCfgCmnTimeDomRsrcAlloc timeDomRsrcAllocList[MAX_NUM_DL_ALLOC];
693 }SchPdschCfgCmn;
694
695 typedef struct schPucchCfgCmn
696 {
697    uint8_t pucchResourceCommon;
698    uint8_t pucchGroupHopping;
699 }SchPucchCfgCmn;
700
701 /* PUSCH Time Domain Resource Allocation */
702 typedef struct schPuschTimeDomRsrcAlloc
703 {
704    uint8_t   k2;
705    SchTimeDomRsrcAllocMappingType   mappingType;
706    uint8_t   startSymbol;
707    uint8_t   symbolLength;
708 }SchPuschTimeDomRsrcAlloc;
709
710 typedef struct schPuschCfgCmn
711 {
712    uint8_t                    numTimeDomRsrcAlloc;
713    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
714 }SchPuschCfgCmn;
715
716 typedef struct schK1TimingInfo
717 {
718    uint8_t numK1;
719    uint8_t k1Indexes[MAX_NUM_K1_IDX];
720 }SchK1TimingInfo;
721
722 typedef struct schK0TimingInfo
723 {
724    uint8_t k0Index;
725    SchK1TimingInfo k1TimingInfo;
726 }SchK0TimingInfo;
727
728 typedef struct schK0K1TimingInfo
729 {
730    uint8_t numK0;
731    SchK0TimingInfo k0Indexes[MAX_NUM_K0_IDX];
732 }SchK0K1TimingInfo;
733
734 typedef struct schK0K1TimingInfoTbl
735 {
736    uint16_t tblSize;
737    SchK0K1TimingInfo k0k1TimingInfo[MAX_NUM_CONFIG_SLOTS];
738 }SchK0K1TimingInfoTbl;
739
740 typedef struct schBwpDlCfg
741 {
742    SchBwpParams   bwp;
743    SchPdcchCfgCmn pdcchCommon;
744    SchPdschCfgCmn pdschCommon;
745 }SchBwpDlCfg;
746
747 typedef struct schK2TimingInfo
748 {
749    uint8_t numK2; 
750    uint8_t k2Indexes[MAX_NUM_K2_IDX]; 
751 }SchK2TimingInfo;
752
753 typedef struct schK2TimingInfoTbl
754 {
755    uint16_t tblSize; 
756    SchK2TimingInfo k2TimingInfo[MAX_NUM_CONFIG_SLOTS]; 
757 }SchK2TimingInfoTbl;
758
759 typedef struct schBwpUlCfg
760 {
761    SchBwpParams   bwp;
762    SchRachCfg     schRachCfg;       /* PRACH config */
763    SchPucchCfgCmn pucchCommon;
764    SchPuschCfgCmn puschCommon;
765 }SchBwpUlCfg;
766
767 typedef struct schPlmnInfoList
768 {
769    Plmn           plmn;
770    uint8_t        numSliceSupport; /* Total slice supporting */
771    Snssai         **snssai;         /* List of supporting snssai*/
772 }SchPlmnInfoList;
773
774 #ifdef NR_DRX
775 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
776
777 typedef struct schDrxOnDurationTimer
778 {
779    bool     onDurationTimerValInMs;
780    union
781    {
782       uint8_t  subMilliSeconds;
783       uint16_t milliSeconds;
784    }onDurationtimerValue;
785 }SchDrxOnDurationTimer;
786
787 typedef struct schDrxLongCycleStartOffset
788 {
789    uint16_t drxLongCycleStartOffsetChoice;
790    uint16_t drxLongCycleStartOffsetVal;
791 }SchDrxLongCycleStartOffset;
792
793 typedef struct schShortDrx
794 {
795    uint16_t   drxShortCycle;
796    uint8_t    drxShortCycleTimer;
797 }SchShortDrx;
798
799 typedef struct schDrxCfg
800 {
801    SchDrxOnDurationTimer       drxOnDurationTimer;
802    uint16_t                    drxInactivityTimer;
803    uint8_t                     drxHarqRttTimerDl;
804    uint8_t                     drxHarqRttTimerUl;
805    uint16_t                    drxRetransmissionTimerDl;
806    uint16_t                    drxRetransmissionTimerUl;
807    SchDrxLongCycleStartOffset  drxLongCycleStartOffset;
808    bool                        shortDrxPres;
809    SchShortDrx                 shortDrx;
810    uint8_t                     drxSlotOffset;
811 }SchDrxCfg;
812 #endif
813
814 /*Spec 38.331 'NrNsPmaxList'*/
815 typedef struct schNrNsPmaxList
816 {
817    long additionalPMax;
818    long additionalSpectrumEmission;
819 }SchNrNsPmaxList;
820
821 /*Spec 38.331 'FrequencyInfoDL-SIB'*/
822 typedef struct schMultiFreqBandListSib
823 {
824    long freqBandIndNr;
825    SchNrNsPmaxList nrNsPmaxList[1];
826 }SchMultiFreqBandListSib;
827
828 /*Spec 38.331 'SCS-SpecificCarrier'*/
829 typedef struct schScsSpecificCarrier
830 {
831   uint16_t offsetToCarrier;
832   uint8_t  subCarrierSpacing;
833   uint16_t carrierBw;
834   uint16_t txDirectCurrentLoc;
835 }SchScsSpecificCarrier;
836
837 /*Spec 38.331 'FrequencyInfoDL-SIB'*/
838 typedef struct schFreqInfoDlSib
839 {
840    SchMultiFreqBandListSib mutiFreqBandList[1];
841    uint16_t                offsetToPointA;
842    SchScsSpecificCarrier   schSpcCarrier[1];
843 }SchFreqInfoDlSib;
844
845 typedef struct schBcchCfg
846 {
847    long modPeriodCoeff;
848 }SchBcchCfg;
849
850 /*Spec 38.331 'DownlinkConfigCommonSIB'*/
851 typedef struct schDlCfgCommon
852 {
853    SchFreqInfoDlSib  schFreqInfoDlSib;
854    SchBwpDlCfg       schInitialDlBwp;  /* Initial DL BWP */
855    SchBcchCfg        schBcchCfg;
856    SchPcchCfg        schPcchCfg;
857 }SchDlCfgCommon;
858
859 /*Spec 38.331 'FrequencyInfoUL-SIB'*/
860 typedef struct schFreqInfoUlSib
861 {
862    SchMultiFreqBandListSib mutiFreqBandList[1];
863    uint16_t                absoluteFreqPointA;
864    SchScsSpecificCarrier   schSpcCarrier[1];
865    int8_t                  schPMax;
866    bool                    frequencyShift7p5khz;
867 }SchFreqInfoUlSib;
868
869 /*Spec 38.331 'UplinkConfigCommonSIB '*/
870 typedef struct schUlCfgCommon
871 {
872    SchFreqInfoUlSib  schFreqInfoUlSib;
873    SchBwpUlCfg       schInitialUlBwp;  /* Initial DL BWP */
874    uint16_t          schTimeAlignTimer;
875 }SchUlCfgCommon;
876
877 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.1 Cell Conf Request*/
878 typedef struct schCellCfg
879 {
880    uint16_t        cellId;                 /* Cell Id */
881    uint8_t         numOfBeams;
882    uint8_t         numLayers;
883    uint8_t         numAntPorts;
884    uint16_t        phyCellId;               /* Physical cell id */
885    SchPlmnInfoList plmnInfoList[MAX_PLMN];  /* Consits of PlmnId and Snssai list */
886    SchDuplexMode   dupMode;                 /* Duplex type: TDD/FDD */
887    uint8_t         numerology;              /* Supported numerology */
888    uint8_t         dlBandwidth;             /* Supported B/W */
889    uint8_t         ulBandwidth;             /* Supported B/W */
890    SchDlCfgCommon  dlCfgCommon;             /*Spec 38.331 DownlinkConfigCommonSIB*/
891    SchUlCfgCommon  ulCfgCommon;             /*Spec 38.331 UplinkConfigCommonSIB*/
892 #ifdef NR_TDD
893    TDDCfg          tddCfg;                  /* Spec 38.331 tdd-UL-DL-ConfigurationCommon */ 
894 #endif 
895
896   /*Ref:Spec 38.331 "ssb-PositionsInBurst", Value 0 in Bitmap => corresponding SS/PBCH block is not transmitted
897     *value 1 => corresponding SS/PBCH block is transmitted*/
898    uint32_t            ssbPosInBurst[SCH_SSB_MASK_SIZE];  /* Bitmap for actually transmitted SSB. */
899    SchSSBPeriod        ssbPeriod;        /* SSB Periodicity in msec */
900    uint32_t            ssbFrequency;     /* SB frequency in kHz*/
901    uint8_t             dmrsTypeAPos;
902    uint8_t             scsCommon;        /* subcarrier spacing for common [0-3]*/
903    SchPdcchConfigSib1  pdcchCfgSib1;      /* Req to configure CORESET#0 and SearchSpace#0*/
904    uint32_t            ssbPbchPwr;       /* SSB block power */
905    uint8_t             ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
906    uint16_t            sib1PduLen;
907 }SchCellCfg;
908
909 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.1 Cell Config Response*/
910 typedef struct schCellCfgCfm
911 {
912    uint16_t         cellId;     /* Cell Id */
913    SchMacRsp        rsp;   
914    CauseOfResult    cause;
915 }SchCellCfgCfm;
916
917 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.2 Cell Del Req*/
918 typedef struct schCellDeleteReq 
919 {
920    uint16_t   cellId;
921 }SchCellDeleteReq;
922
923 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.2 Cell Del Response*/
924 typedef struct schCellDeleteRsp
925 {
926    uint16_t        cellId;
927    SchMacRsp       rsp;
928    CauseOfResult   cause;
929 }SchCellDeleteRsp;
930
931 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.3*/
932 typedef struct schRrmPolicyRatio
933 {
934    uint8_t maxRatio;
935    uint8_t minRatio;
936    uint8_t dedicatedRatio;
937 }SchRrmPolicyRatio;
938
939 typedef struct schRrmPolicyOfSlice
940 {
941    Snssai  snssai;
942    SchRrmPolicyRatio rrmPolicyRatioInfo;
943 }SchRrmPolicyOfSlice;
944
945 typedef struct schSliceCfgReq
946 {
947    uint8_t  numOfConfiguredSlice;
948    SchRrmPolicyOfSlice **listOfSlices;
949 }SchSliceCfgReq;
950
951 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.3 Slice Cfg Response*/
952 typedef struct schSliceCfgRsp
953 {
954    Snssai     snssai;
955    SchMacRsp  rsp;
956    CauseOfResult cause;
957 }SchSliceCfgRsp;
958
959 /*As per ORAN-WG8 V7.0.0 Sec 11.2.4.3.4 , Slice Cfg and Recfg are same structures*/
960 typedef struct schSliceCfgReq SchSliceRecfgReq;
961 typedef struct schSliceCfgRsp SchSliceRecfgRsp;
962
963 typedef struct ssbInfo
964 {
965    uint8_t         ssbIdx;          /* SSB Index */
966    TimeDomainAlloc tdAlloc;         /* Time domain allocation */
967    FreqDomainRsrc  fdAlloc;         /* Freq domain allocation */
968 }SsbInfo;
969
970 typedef struct sib1AllocInfo
971 {
972    BwpCfg bwp;
973    PdcchCfg *sib1PdcchCfg;
974 }Sib1AllocInfo;
975
976 typedef struct prachSchInfo
977 {
978    uint8_t  numPrachOcas;   /* Num Prach Ocassions */
979    uint8_t  prachFormat;    /* PRACH Format */
980    uint8_t  numRa;          /* Freq domain ocassion */
981    uint8_t  prachStartSymb; /* Freq domain ocassion */
982 }SchPrachInfo;
983
984 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
985 typedef struct dlBrdcstAlloc
986 {
987    uint16_t     crnti; /* SI-RNTI */
988    /* Ssb transmission is determined as follows:
989     * 0 : No tranamission
990     * 1 : SSB Transmission
991     * 2 : SSB Repetition */
992    uint8_t ssbTransmissionMode;
993    uint8_t ssbIdxSupported;
994    SsbInfo ssbInfo[MAX_SSB_IDX];
995    bool    systemInfoIndicator;
996    uint8_t *siContent; 
997    /* Sib1 transmission is determined as follows:
998     * 0 : No tranamission
999     * 1 : SIB1 Transmission
1000     * 2 : SIB1 Repetition */
1001    uint8_t sib1TransmissionMode;
1002    Sib1AllocInfo sib1Alloc;
1003 }DlBrdcstAlloc;
1004
1005 typedef struct msg3UlGrant
1006 {
1007    uint8_t         freqHopFlag;
1008    uint16_t        bwpSize;
1009    FreqDomainRsrc  msg3FreqAlloc;
1010    uint8_t         k2Index;
1011    uint8_t         mcs;
1012    uint8_t         tpc;
1013    uint8_t         csiReq;
1014 }Msg3UlGrant;
1015
1016 typedef struct rarInfo
1017 {
1018    uint8_t         RAPID;
1019    uint16_t        ta;
1020    Msg3UlGrant     ulGrant;
1021    uint16_t        tcrnti;
1022    uint8_t         rarPdu[RAR_PAYLOAD_SIZE];
1023    uint8_t         rarPduLen;
1024 }RarInfo;
1025
1026 typedef struct rarAlloc
1027 {
1028    uint16_t   raRnti;
1029    RarInfo    rarInfo;
1030    BwpCfg     bwp;
1031    PdcchCfg   *rarPdcchCfg;
1032    PdschCfg   *rarPdschCfg;
1033 }RarAlloc;
1034
1035 typedef struct lcSchInfo
1036 {
1037    uint8_t   lcId;
1038    uint32_t  schBytes; 
1039 }LcSchInfo;
1040
1041 typedef struct ceSchInfo
1042 {
1043    uint8_t   ceLcId;
1044    uint8_t   *ceContent; 
1045 }CeSchInfo;
1046
1047 typedef struct freqDomainAlloc
1048 {
1049    uint8_t          resAllocType; /* Resource allocation type */
1050    union
1051    {
1052       ResAllocType0    type0;
1053       ResAllocType1    type1;
1054    }resAlloc;
1055 }FreqDomainAlloc;
1056
1057 typedef struct transportBlock
1058 {
1059    uint8_t    mcs;       
1060    bool       ndi;       
1061    uint8_t    rv;        
1062    uint16_t   tbSize;    
1063    uint8_t    numCe;
1064    CeSchInfo  ceSchInfo[MAX_NUM_LC]; 
1065    uint8_t    numLc;
1066    LcSchInfo  lcSchInfo[MAX_NUM_LC]; 
1067 }TransportBlock;
1068
1069 typedef struct dlMsgSchedInfo
1070 {
1071    uint16_t        crnti;
1072    uint8_t         dciFormatId;
1073    uint8_t         harqProcNum;
1074    bool            vrbPrbMapping;
1075    uint8_t         dlAssignIdx;
1076    uint8_t         pucchTpc;
1077    uint8_t         pucchResInd;
1078    uint8_t         harqFeedbackInd;
1079    uint16_t        dlMsgPduLen;
1080    uint8_t         *dlMsgPdu;
1081    FreqDomainAlloc freqAlloc;
1082    TimeDomainAlloc timeAlloc;
1083    uint8_t         numOfTbs;
1084    TransportBlock  transportBlock[2];
1085    BwpCfg          bwp;
1086    PdcchCfg        *dlMsgPdcchCfg;
1087    PdschCfg        *dlMsgPdschCfg;
1088 }DlMsgSchInfo;
1089
1090 typedef struct schSlotValue
1091 {
1092    SlotTimingInfo currentTime;
1093    SlotTimingInfo broadcastTime;
1094    SlotTimingInfo rarTime;
1095    SlotTimingInfo dlMsgTime;
1096    SlotTimingInfo ulDciTime;
1097 }SchSlotValue;
1098
1099
1100 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-36 DCI Format0_0 Configuration */
1101 typedef struct format0_0
1102 {
1103    uint8_t         resourceAllocType;
1104    FreqDomainAlloc freqAlloc;
1105    TimeDomainAlloc timeAlloc;
1106    uint16_t        rowIndex;
1107    uint8_t         mcs;
1108    uint8_t         harqProcId;  
1109    bool            freqHopFlag;
1110    uint8_t         ndi;    
1111    uint8_t         rvIndex;     
1112    uint8_t         tpcCmd;
1113    bool            sulIndicator;
1114 }Format0_0;
1115
1116 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-40 DCI Format 0_1 Configuration */
1117 typedef struct format0_1
1118 {
1119    uint8_t         carrierIndicator;
1120    bool            sulIndicator;
1121    uint8_t         bwpIndicator;
1122    uint8_t         resourceAlloc;
1123    FreqDomainRsrc  freqAlloc;
1124    TimeDomainAlloc timeAlloc;
1125    uint16_t        rowIndex;
1126    uint8_t         mcs;
1127    uint8_t         harqProcId;  
1128    bool            freqHopFlag;
1129    uint8_t         ndi;   
1130    uint8_t         rvIndex;    
1131    uint8_t         firstDownlinkAssignmentIndex;
1132    uint8_t         secondDownlinkAssignmentIndex;
1133    uint8_t         tpcCommand;
1134    uint8_t         srsResourceSetIndicator;
1135    uint8_t         srsResourceIndicator;
1136    uint8_t         tpmi;
1137    uint8_t         antennaPorts;
1138    uint8_t         srsRequest;
1139    uint8_t         csiRequest;
1140    uint8_t         cbgTransmissionInfo;
1141    uint8_t         ptrsDmrs;
1142    uint8_t         betaOffsetIndicator;
1143    bool            dmrsSequenceInitialization;
1144    bool            ulschIndicatior;
1145 }Format0_1;
1146
1147 typedef struct dciFormat
1148 {
1149    FormatType     formatType;     /* DCI Format */
1150    union
1151    {
1152       Format0_0  format0_0;      /* Format 0_0 */
1153       Format0_1  format0_1;      /* Format 0_1 */
1154    }format;
1155 }DciFormat;
1156
1157 typedef struct dciInfo
1158 {
1159    uint16_t       crnti;          /* CRNTI */
1160    BwpCfg         bwpCfg;         /* BWP Cfg */
1161    CoresetCfg     coresetCfg;     /* Coreset1 Cfg */
1162    DciFormat      dciFormatInfo;  /* Dci Format */
1163    DlDCI          dciInfo;        /* DlDCI */
1164 }DciInfo;
1165
1166
1167 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Section 11.2.4.3.8 DL Scheduling Information */
1168 typedef struct dlSchedInfo
1169 {
1170    uint16_t     cellId;  /* Cell Id */
1171    SchSlotValue schSlotValue;
1172
1173    /* Allocation for broadcast messages */
1174    bool isBroadcastPres;
1175    DlBrdcstAlloc brdcstAlloc;
1176
1177    /* Allocation for RAR message */
1178    RarAlloc *rarAlloc[MAX_NUM_UE];
1179
1180    /* UL grant in response to BSR */
1181    DciInfo    *ulGrant;
1182
1183    /* Allocation from dedicated DL msg */
1184    DlMsgSchInfo *dlMsgAlloc[MAX_NUM_UE];
1185
1186 }DlSchedInfo;
1187
1188 /*Reference: O-RAN.WG8.AAD.v7.0.0, Sec 11.2.4.3.13 Downlink Paging Allocation*/
1189 typedef struct interleaved_t
1190 {
1191    uint8_t regBundleSize;
1192    uint8_t interleaverSize;
1193    uint16_t shiftIndex;
1194 }Interleaved;
1195
1196 typedef struct pageDlDci
1197 {
1198    uint8_t    freqDomainResource[6];
1199    uint8_t    durationSymbols;
1200    uint8_t    cceRegMappingType;
1201    union
1202    {
1203       Interleaved  interleaved;
1204       uint8_t      nonInterleaved;
1205    }cceReg;
1206    uint8_t    ssStartSymbolIndex;
1207    uint8_t    cceIndex;
1208    uint8_t    aggregLevel;
1209    uint8_t    precoderGranularity;
1210    uint8_t    coreSetSize;
1211 }PageDlDci;
1212
1213 typedef struct resAllocType1 PageFreqDomainAlloc;
1214
1215 typedef struct pageTimeDomainAlloc
1216 {
1217    uint8_t mappingType;
1218    uint16_t startSymb;
1219    uint16_t numSymb;
1220 }PageTimeDomainAlloc;
1221
1222 typedef struct pageDmrsConfig
1223 {
1224    uint8_t dmrsType;
1225    uint8_t dmrsAddPos;
1226    uint8_t nrOfDmrsSymbols;
1227 }PageDmrsConfig;
1228
1229 typedef struct pageTbInfo
1230 {
1231    uint8_t         mcs;
1232    uint32_t        tbSize;
1233 }PageTbInfo;
1234
1235 typedef struct pageDlSch
1236 {
1237    PageFreqDomainAlloc  freqAlloc;
1238    PageTimeDomainAlloc  timeAlloc;
1239    PageDmrsConfig       dmrs;
1240    uint8_t              vrbPrbMapping;
1241    PageTbInfo           tbInfo;
1242    uint8_t              tbScaling;
1243    uint16_t             dlPagePduLen;
1244    uint8_t             *dlPagePdu;
1245 }PageDlSch;
1246
1247 typedef struct dlPageAlloc
1248 {
1249    uint16_t       cellId;
1250    SlotTimingInfo dlPageTime;
1251    uint8_t        ssbIdx;
1252    bool           shortMsgInd;
1253    uint8_t        shortMsg;
1254    BwpCfg         bwp;
1255    PageDlDci      pageDlDci;
1256    PageDlSch      pageDlSch;
1257 }DlPageAlloc;
1258
1259 typedef struct tbInfo
1260 {
1261    uint8_t      mcs;       /* MCS */
1262    uint8_t      ndi;       /* NDI */
1263    uint8_t      rv;        /* Redundancy Version */
1264    uint16_t     tbSize;    /* TB Size */
1265    uint8_t      qamOrder;  /* Modulation Order */
1266    SchMcsTable  mcsTable;  /* MCS Table */
1267 }TbInfo;
1268
1269 typedef struct schPuschInfo
1270 {
1271    uint8_t          harqProcId;   /* HARQ Process ID */
1272    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
1273    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
1274    TbInfo           tbInfo;       /* TB info */
1275 #ifdef INTEL_FAPI    
1276    uint8_t          dmrsMappingType;
1277    uint8_t          nrOfDmrsSymbols;
1278    uint8_t          dmrsAddPos;
1279 #endif
1280 }SchPuschInfo;
1281
1282 typedef struct harqInfo
1283 {
1284    uint16_t    harqAckBitLength;
1285    uint8_t     betaOffsetHarqAck;
1286 }HarqInfo;
1287
1288 typedef struct csiInfo
1289 {
1290    uint16_t csiBits;
1291    uint8_t  betaOffsetCsi;
1292 }CsiInfo;
1293
1294 typedef struct harqFdbkInfo
1295 {
1296    uint16_t    harqBitLength;
1297 }HarqFdbkInfo;
1298
1299 typedef struct csiFdbkInfo
1300 {
1301    uint16_t csiBits;
1302 }CsiFdbkInfo;
1303
1304 typedef struct schPucchFormatCfg
1305 {
1306    uint8_t interSlotFreqHop;
1307    uint8_t addDmrs;
1308    uint8_t maxCodeRate;
1309    uint8_t numSlots;
1310    bool    pi2BPSK;
1311    bool    harqAckCSI;
1312 }SchPucchFormatCfg;
1313
1314 typedef struct schPucchInfo
1315 {
1316    FreqDomainRsrc   fdAlloc;      
1317    TimeDomainAlloc  tdAlloc;      
1318    uint8_t          srFlag;
1319    HarqFdbkInfo     harqInfo;
1320    CsiFdbkInfo      csiInfo;
1321    BeamformingInfo  beamPucchInfo;
1322    uint8_t          pucchFormat;
1323    uint8_t          intraFreqHop;
1324    uint16_t         secondPrbHop;
1325    uint8_t          initialCyclicShift;
1326    uint8_t          occLen;
1327    uint8_t          occIdx;
1328    uint8_t          timeDomOCC;
1329    uint8_t          addDmrs;
1330    bool             pi2BPSK;
1331 }SchPucchInfo;
1332
1333 typedef struct schPuschUci
1334 {
1335    uint8_t          harqProcId;   /* HARQ Process ID */
1336    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
1337    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
1338    TbInfo           tbInfo;       /* TB information */
1339    HarqInfo         harqInfo;    /* Harq Information */
1340    CsiInfo          csiInfo;    /* Csi information*/
1341 }SchPuschUci;
1342
1343 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Section 11.2.4.3.9 UL Scheduling Information */
1344 typedef struct ulSchedInfo
1345 {
1346    uint16_t         cellId;         /* Cell Id */
1347    uint16_t         crnti;          /* CRNI */
1348    SlotTimingInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
1349    uint8_t          dataType;       /* Type of info being scheduled */
1350    SchPrachInfo     prachSchInfo;   /* Prach scheduling info */
1351    SchPuschInfo     schPuschInfo;   /* Pusch scheduling info */
1352    SchPuschUci      schPuschUci;    /* Pusch Uci */
1353    SchPucchInfo     schPucchInfo;   /* Pucch and Uci scheduling info */
1354 }UlSchedInfo;
1355
1356 /* Info of Scheduling Request to Add/Modify */
1357 typedef struct schSchedReqInfo
1358 {
1359    uint8_t              schedReqId;
1360    SchSrProhibitTimer   srProhibitTmr;
1361    SchSrTransMax        srTransMax;
1362 }SchSchedReqInfo;
1363
1364 /* Scheduling Request Configuration */
1365 typedef struct schSchedReqCfg
1366 {
1367    uint8_t          addModListCount;
1368    SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
1369    uint8_t          relListCount;
1370    uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
1371 }SchSchedReqCfg;
1372
1373 /* Info of Tag to Add/Modify */
1374 typedef struct schTagInfo
1375 {
1376    uint8_t       tagId;
1377    SchTimeAlignmentTimer  timeAlignmentTmr;
1378 }SchTagInfo;
1379
1380 /* Timing Advance Group Configuration */
1381 typedef struct schTagCfg
1382 {
1383    uint8_t      addModListCount;
1384    SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
1385    uint8_t      relListCount;
1386    uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
1387 }SchTagCfg;
1388
1389 /* Configuration for Power headroom reporting */
1390 typedef struct schPhrCfg
1391 {
1392    SchPhrPeriodicTimer       periodicTmr;
1393    SchPhrProhibitTimer       prohibitTmr;
1394    SchPhrTxPwrFactorChange   txpowerFactorChange;
1395    bool                      multiplePhr;
1396    bool                      dummy;
1397    bool                      type2OtherCell;
1398    SchPhrModeOtherCG         modeOtherCG;
1399 }SchPhrCfg;
1400
1401 /* MAC cell Group configuration */
1402 typedef struct schMacCellGrpCfg
1403 {
1404    SchSchedReqCfg   schedReqCfg;
1405    SchTagCfg        tagCfg;
1406    SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
1407 #ifdef NR_DRX
1408    bool             drxCfgPresent;
1409    SchDrxCfg        drxCfg;          /* Drx configuration */
1410 #endif
1411 }SchMacCellGrpCfg;
1412
1413 /* Physical Cell Group Configuration */
1414 typedef struct schPhyCellGrpCfg
1415 {
1416    SchPdschHarqAckCodebook    pdschHarqAckCodebook;
1417    int8_t     pNrFr1;
1418 }SchPhyCellGrpCfg;
1419
1420 /* Control resource set info */
1421 typedef struct schControlRsrcSet
1422 {
1423    uint8_t             cRSetId;                /* Control resource set id */
1424    uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
1425    uint8_t             duration;
1426    SchREGMappingType   cceRegMappingType;
1427    SchPrecoderGranul   precoderGranularity;
1428    uint16_t            dmrsScramblingId;
1429 }SchControlRsrcSet;
1430
1431 /* Search Space info */
1432 typedef struct schSearchSpace
1433 {
1434    uint8_t                  searchSpaceId;
1435    uint8_t                  cRSetId;
1436    SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1437    uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1438    SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1439    SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1440    SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1441    SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1442    SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1443    SchSearchSpaceType       searchSpaceType;
1444    uint8_t                  ueSpecificDciFormat;
1445 }SchSearchSpace;
1446
1447 /* PDCCH cofniguration */
1448 typedef struct schPdcchConfig
1449 {
1450    uint8_t           numCRsetToAddMod;
1451    SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1452    uint8_t           numCRsetToRel;
1453    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1454    uint8_t           numSearchSpcToAddMod;
1455    SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1456    uint8_t           numSearchSpcToRel;
1457    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1458 }SchPdcchConfig;
1459
1460 /* PDSCH time domain resource allocation */
1461 typedef struct schPdschTimeDomRsrcAlloc
1462 {
1463    uint8_t    *k0;
1464    SchTimeDomRsrcAllocMappingType    mappingType;
1465    uint8_t    startSymbol;
1466    uint8_t    symbolLength;
1467 }SchPdschTimeDomRsrcAlloc;
1468
1469
1470 typedef struct schPdschBundling
1471 {
1472    struct schStaticBundling
1473    {
1474      SchBundlingSizeSet2 size;
1475    }SchStaticBundling;
1476    struct schDynamicBundling
1477    {
1478      SchBundlingSizeSet1 sizeSet1;
1479      SchBundlingSizeSet2 sizeSet2;
1480    }SchDynamicBundling;
1481 }SchPdschBundling;
1482
1483 /* DMRS downlink configuration */
1484 typedef struct schDmrsDlCfg
1485 {
1486    SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
1487 }SchDmrsDlCfg;
1488
1489 /* PDSCH Configuration */
1490 typedef struct schPdschConfig
1491 {
1492    SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1493    SchResourceAllocType       resourceAllocType;
1494    uint8_t                    numTimeDomRsrcAlloc;
1495    SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1496    SchRBGSize                 rbgSize;
1497    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1498    SchBundlingType            bundlingType;
1499    SchPdschBundling           bundlingInfo;
1500 }SchPdschConfig;
1501
1502 /* Initial Downlink BWP */
1503 typedef struct schInitalDlBwp
1504 {
1505    bool             pdcchCfgPres;
1506    SchPdcchConfig   pdcchCfg;
1507    bool             pdschCfgPres;
1508    SchPdschConfig   pdschCfg;
1509 }SchInitalDlBwp;
1510
1511 /*Spec 38.331 'RadioLinkMonitoringConfig'*/
1512 typedef uint8_t SchRadioLinkMonitoringRsId;
1513
1514 typedef struct schRadioLinkMonRS
1515 {
1516    SchRadioLinkMonitoringRsId  radioLinkMonitoringRsId;
1517    SchPurposeOfFailureDet      purpose; 
1518    union
1519    {
1520       uint8_t ssbIndx;
1521       uint8_t nzpCsiRsResId;
1522    }SchDetectionRes;
1523 }SchRadioLinkMonRS;
1524
1525 typedef struct schRadioLinkConfig
1526 {
1527    SchRadioLinkMonRS           failurDetResAddModList[MAX_FAILURE_DET_RESOURCES];
1528    SchRadioLinkMonitoringRsId  failurDetResRelList[MAX_FAILURE_DET_RESOURCES];
1529    uint8_t                     beamFailureInstanceMaxCount;
1530    uint8_t                     beamFailureDetectionTimer;
1531 }SchRadioLinkConfig;
1532
1533 /*Spec 38.331 "SPS-Config'*/
1534 typedef struct schSpsConfig
1535 {
1536    uint16_t     periodicity;
1537    uint8_t      numOfHqProcess;
1538    uint8_t      n1PucchAN;
1539    SchMcsTable  mcsTable;
1540 }SchSpsConfig;
1541
1542 /* Spec 38.331, 'BWP-DownlinkDedicated'*/
1543 typedef struct schBwpDlCfgDed
1544 {
1545   SchPdcchConfig     pdcchCfgDed;
1546   SchPdschConfig     pdschCfgDed;
1547   SchSpsConfig       spsCfgDed;
1548   SchRadioLinkConfig radioLnkMonCfgDed;
1549 }SchBwpDlCfgDed;
1550
1551 /* Spec 38.331, 'BWP-Downlink' Downlink BWP information */
1552 typedef struct schDlBwpInfo
1553 {
1554    uint8_t          bwpId;
1555    SchBwpDlCfg      bwpCommon;
1556    SchBwpDlCfgDed   bwpDedicated;
1557 }SchDlBwpInfo;
1558
1559 /* PDCCH Serving Cell configuration */
1560 typedef struct schPdschServCellCfg
1561 {
1562    uint8_t                  *maxMimoLayers;           
1563    SchNumHarqProcForPdsch   numHarqProcForPdsch;
1564    SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
1565    bool                     *codeBlkGrpFlushInd;
1566    SchPdschXOverhead        *xOverhead;
1567 }SchPdschServCellCfg;
1568
1569 typedef struct schRaPrioritization
1570 {
1571    uint8_t powerRampingStepHighPriority;
1572    uint8_t scalingFactorBI;
1573 }SchRaPrioritization;
1574
1575 typedef struct schBfrCsiRsRes
1576 {
1577    uint8_t csrRsIndex;
1578    uint8_t raOccList;
1579    uint8_t raPreambleIndex;
1580 }SchBfrCsiRsRes;
1581
1582 typedef struct schBfrSsbRes
1583 {
1584    uint16_t ssbIndex;
1585    uint8_t raPreambleIndex;
1586 }SchBfrSsbRes;
1587
1588 typedef struct schPrachResDedBfr
1589 {
1590    SchBfrSsbRes    ssb;
1591    SchBfrCsiRsRes  csiRs;
1592 }SchPrachResDedBfr;
1593
1594 /*Spec 38.331 'BeamFailureRecoveryConfig' */
1595 typedef struct schBeamFailRecoveryCfg
1596 {
1597    uint8_t             rootSeqIndexBfr;
1598    SchRachCfgGeneric   rachCfgBfr;
1599    uint8_t             rsrpThreshSsbBfr;     /* RSRP Threshold SSB */
1600    SchPrachResDedBfr   candidateBeamRSList;
1601    uint8_t             ssbPerRachBfr;        /* SSB per RACH occassion */
1602    uint8_t             raSsbOccMaskIndex;
1603    uint8_t             recoverySearchSpaceId;
1604    SchRaPrioritization raPrioBfr;
1605    uint16_t            bfrTimer;
1606    uint8_t             msg1SubcSpacing;  /* Subcarrier spacing of RACH */
1607 }SchBeamFailRecoveryCfg;
1608
1609 /* PUCCH Configuration */
1610 typedef struct schPucchResrcSetInfo
1611 {
1612    uint8_t resrcSetId;
1613    uint8_t resrcListCount;
1614    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1615    uint8_t maxPayLoadSize;
1616 }SchPucchResrcSetInfo;
1617
1618 typedef struct schPucchResrcSetCfg
1619 {
1620    uint8_t resrcSetToAddModListCount;
1621    SchPucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1622    uint8_t resrcSetToRelListCount;
1623    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1624 }SchPucchResrcSetCfg;
1625
1626 typedef struct schPucchFormat0
1627 {
1628    uint8_t initialCyclicShift;
1629    uint8_t numSymbols;
1630    uint8_t startSymbolIdx;
1631 }SchPucchFormat0;
1632
1633 typedef struct schPucchFormat1
1634 {
1635    uint8_t initialCyclicShift;
1636    uint8_t numSymbols;
1637    uint8_t startSymbolIdx;
1638    uint8_t timeDomOCC;
1639 }SchPucchFormat1;
1640
1641 typedef struct schPucchFormat2_3
1642 {
1643    uint8_t numPrbs;
1644    uint8_t numSymbols;
1645    uint8_t startSymbolIdx;
1646 }SchPucchFormat2_3;
1647
1648 typedef struct schPucchFormat4
1649 {
1650    uint8_t numSymbols;
1651    uint8_t occLen;
1652    uint8_t occIdx;
1653    uint8_t startSymbolIdx;
1654 }SchPucchFormat4;
1655
1656 typedef struct schPucchResrcInfo
1657 {
1658    uint8_t  resrcId;
1659    uint16_t startPrb;
1660    uint8_t  intraFreqHop;
1661    uint16_t secondPrbHop;
1662    uint8_t  pucchFormat;
1663    union{
1664       SchPucchFormat0   *format0; 
1665       SchPucchFormat1   *format1;
1666       SchPucchFormat2_3 *format2;
1667       SchPucchFormat2_3 *format3;
1668       SchPucchFormat4   *format4;
1669    }SchPucchFormat;
1670 }SchPucchResrcInfo;
1671
1672 typedef struct schPucchResrcCfg
1673 {
1674    uint8_t resrcToAddModListCount;
1675    SchPucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1676    uint8_t resrcToRelListCount;
1677    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1678 }SchPucchResrcCfg;
1679
1680
1681 typedef struct schSchedReqResrcInfo
1682 {
1683    uint8_t resrcId;
1684    uint8_t requestId;
1685    uint8_t periodicity;
1686    uint16_t offset;
1687    uint8_t resrc;
1688 }SchSchedReqResrcInfo;
1689
1690 typedef struct schPucchSchedReqCfg
1691 {
1692    uint8_t           schedAddModListCount;
1693    SchSchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1694    uint8_t           schedRelListCount;
1695    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1696 }SchPucchSchedReqCfg;
1697
1698 typedef struct schSpatialRelationInfo
1699 {
1700    uint8_t spatialRelationId;
1701    uint8_t servCellIdx;
1702    uint8_t pathLossRefRSId;
1703    uint8_t p0PucchId;
1704    uint8_t closeLoopIdx;
1705 }SchSpatialRelationInfo;
1706
1707 typedef struct schPucchSpatialCfg
1708 {
1709    uint8_t spatialAddModListCount;
1710    SchSpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1711    uint8_t spatialRelListCount;
1712    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1713 }SchPucchSpatialCfg;
1714
1715 typedef struct schP0PucchCfg
1716 {
1717    uint8_t p0PucchId;
1718    int     p0PucchVal;
1719 }SchP0PucchCfg;
1720
1721 typedef struct schPathLossRefRSCfg
1722 {
1723    uint8_t pathLossRefRSId;
1724 }SchPathLossRefRSCfg;
1725
1726 typedef struct schPucchMultiCsiCfg
1727 {
1728    uint8_t  multiCsiResrcListCount;
1729    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1730 }SchPucchMultiCsiCfg;
1731
1732 typedef struct schPucchDlDataToUlAck
1733 {
1734    uint8_t  dlDataToUlAckListCount;
1735    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1736 }SchPucchDlDataToUlAck;
1737
1738 typedef struct schPucchPowerControl
1739 {
1740    int deltaF_Format0;
1741    int deltaF_Format1;
1742    int deltaF_Format2;
1743    int deltaF_Format3;
1744    int deltaF_Format4;
1745    uint8_t p0SetCount;
1746    SchP0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1747    uint8_t pathLossRefRSListCount;
1748    SchPathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1749 }SchPucchPowerControl;
1750
1751 typedef struct schPucchCfg
1752 {
1753    SchPucchResrcSetCfg   *resrcSet;
1754    SchPucchResrcCfg      *resrc;
1755    SchPucchFormatCfg     *format1; 
1756    SchPucchFormatCfg     *format2; 
1757    SchPucchFormatCfg     *format3; 
1758    SchPucchFormatCfg     *format4;
1759    SchPucchSchedReqCfg   *schedReq;
1760    SchPucchMultiCsiCfg   *multiCsiCfg;
1761    SchPucchSpatialCfg    *spatialInfo;
1762    SchPucchDlDataToUlAck *dlDataToUlAck;
1763    SchPucchPowerControl  *powerControl;
1764 }SchPucchCfg;
1765
1766 /* Transform precoding disabled */
1767 typedef struct schTransPrecodDisabled
1768 {
1769    uint16_t   scramblingId0;
1770 }SchTransPrecodDisabled;
1771
1772 /* DMRS Uplink configuration */
1773 typedef struct SchDmrsUlCfg
1774 {
1775    SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
1776    SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
1777 }SchDmrsUlCfg;
1778
1779 /* PUSCH Configuration */
1780 typedef struct schPuschCfg
1781 {
1782    uint8_t                    dataScramblingId;
1783    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1784    SchResourceAllocType       resourceAllocType;
1785    uint8_t                    numTimeDomRsrcAlloc;
1786    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1787    SchTransformPrecoder       transformPrecoder;
1788 }SchPuschCfg;
1789
1790 /* Initial Uplink BWP */
1791 typedef struct schInitialUlBwp
1792 {
1793    bool          pucchCfgPres;
1794    SchPucchCfg   pucchCfg;
1795    bool          puschCfgPres;
1796    SchPuschCfg   puschCfg;
1797 }SchInitialUlBwp;
1798
1799 typedef struct schBwpCfgDedicated
1800 {
1801    SchPucchCfg   pucchCfg;
1802    SchPuschCfg   puschCfg;
1803 }SchBwpCfgDedicated;
1804
1805 /* Uplink BWP information */
1806 typedef struct schUlBwpInfo
1807 {
1808    uint8_t             bwpId;
1809    SchBwpUlCfg         bwpCommon;
1810    SchBwpCfgDedicated  bwpDed;
1811 }SchUlBwpInfo;
1812
1813 typedef struct schBwpRelInfo
1814 {
1815    uint8_t bwpId;
1816 }SchBwpRelInfo;
1817
1818 /* Serving cell configuration */
1819 typedef struct schServCellRecfgInfo
1820 {
1821    SchInitalDlBwp          initDlBwp;
1822    SchRadioLinkConfig      radioLinkMonConfig;
1823    uint8_t                 numDlBwpToAddOrMod;
1824    SchDlBwpInfo            dlBwpToAddOrModList[MAX_NUM_BWP];
1825    uint8_t                 numDlBwpToRel;
1826    SchBwpRelInfo           dlBwpToRelList[MAX_NUM_BWP];
1827    uint8_t                 firstActvDlBwpId;
1828    uint8_t                 defaultDlBwpId;
1829    uint8_t                 *bwpInactivityTmr;
1830    SchPdschServCellCfg     pdschServCellCfg;
1831    SchInitialUlBwp         initUlBwp;
1832    SchBeamFailRecoveryCfg  beamFailureRecoveryCfg;
1833    uint8_t                 numUlBwpToAddOrMod;
1834    SchUlBwpInfo            ulBwpToAddOrModList[MAX_NUM_BWP];
1835    uint8_t                 numUlBwpToRel;
1836    SchBwpRelInfo           ulBwpToRelList[MAX_NUM_BWP];
1837    uint8_t                 firstActvUlBwpId;
1838 }SchServCellRecfgInfo;
1839
1840 /* Serving cell configuration */
1841 typedef struct schServCellCfgInfo
1842 {
1843    SchInitalDlBwp        initDlBwp;
1844    SchRadioLinkConfig    radioLinkMonConfig;
1845    uint8_t               numDlBwpToAdd;
1846    SchDlBwpInfo          dlBwpToAddList[MAX_NUM_BWP];
1847    uint8_t               firstActvDlBwpId;
1848    uint8_t               defaultDlBwpId;
1849    uint8_t               *bwpInactivityTmr;
1850    SchPdschServCellCfg     pdschServCellCfg;
1851    SchInitialUlBwp         initUlBwp;
1852    SchBeamFailRecoveryCfg  beamFailureRecoveryCfg;
1853    uint8_t                 numUlBwpToAdd;
1854    SchUlBwpInfo            ulBwpToAddList[MAX_NUM_BWP];
1855    uint8_t                 firstActvUlBwpId;
1856 }SchServCellCfgInfo;
1857
1858 typedef struct schNonDynFiveQi
1859 {
1860    uint16_t   fiveQi;
1861    uint8_t    priorLevel;
1862    uint16_t   avgWindow;
1863    uint16_t   maxDataBurstVol;
1864 }SchNonDynFiveQi;
1865
1866 typedef struct schDynFiveQi
1867 {
1868    uint8_t    priorLevel;
1869    uint16_t   packetDelayBudget;
1870    uint8_t    packetErrRateScalar;
1871    uint8_t    packetErrRateExp;
1872    uint16_t   fiveQi;
1873    uint8_t    delayCritical;
1874    uint16_t   avgWindow;
1875    uint16_t   maxDataBurstVol;
1876 }SchDynFiveQi;
1877
1878 typedef struct schNgRanAllocAndRetPri
1879 {
1880    uint8_t priorityLevel;
1881    uint8_t preEmptionCap;
1882    uint8_t preEmptionVul;
1883 }SchNgRanAllocAndRetPri;
1884
1885 typedef struct schGrbQosFlowInfo
1886 {
1887    uint32_t maxFlowBitRateDl;
1888    uint32_t maxFlowBitRateUl;
1889    uint32_t guarFlowBitRateDl;
1890    uint32_t guarFlowBitRateUl;
1891 }SchGrbQosFlowInfo;
1892
1893 /* DRB QoS */
1894 typedef struct schDrbQos
1895 {
1896    SchQosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1897    union
1898    {
1899       SchNonDynFiveQi   nonDyn5Qi;
1900       SchDynFiveQi      dyn5Qi;
1901    }u;
1902    SchNgRanAllocAndRetPri  ngRanRetPri;
1903    SchGrbQosFlowInfo       grbQosFlowInfo;
1904    uint16_t                pduSessionId;
1905    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
1906 }SchDrbQosInfo;
1907
1908 /* Special cell configuration */
1909 typedef struct schSpCellCfg
1910 {
1911    uint8_t           servCellIdx;
1912    SchServCellCfgInfo   servCellCfg;
1913 }SchSpCellCfg;
1914
1915 /* Special cell Reconfiguration */
1916 typedef struct schSpCellRecfg
1917 {
1918    uint8_t           servCellIdx;
1919    SchServCellRecfgInfo   servCellRecfg;
1920 }SchSpCellRecfg;
1921
1922 /* Uplink logical channel configuration */
1923 typedef struct SchUlLcCfg
1924 {
1925    uint8_t priority;
1926    uint8_t lcGroup;
1927    uint8_t schReqId;
1928    uint8_t pbr;        // prioritisedBitRate
1929    uint8_t bsd;        // bucketSizeDuration
1930 }SchUlLcCfg;
1931
1932 /* Downlink logical channel configuration */
1933 typedef struct schDlLcCfg
1934 {
1935    uint8_t lcp;      // logical Channel Prioritization
1936 }SchDlLcCfg;
1937
1938 /* Logical Channel configuration */
1939 typedef struct schLcCfg
1940 {
1941    uint8_t        lcId;
1942    Snssai         *snssai;
1943    SchDrbQosInfo  *drbQos;
1944    SchDlLcCfg     dlLcCfg;
1945    SchUlLcCfg     ulLcCfg;
1946 }SchLcCfg;
1947
1948 /* Aggregate max bit rate */
1949 typedef struct schAmbrCfg
1950 {
1951    uint32_t   ulBr;   /* Ul BitRate */
1952 }SchAmbrCfg;
1953
1954 typedef struct schModulationInfo
1955 {
1956    uint8_t      modOrder;
1957    uint8_t      mcsIndex;
1958    SchMcsTable  mcsTable;
1959 }SchModulationInfo;
1960
1961 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.5' UE Configuration Request*/
1962 typedef struct schUeCfgReq
1963 {
1964    uint16_t           cellId;
1965    uint8_t            ueId;
1966    uint8_t            beamIdx; 
1967    uint16_t           crnti;
1968    bool               macCellGrpCfgPres;
1969    SchMacCellGrpCfg   macCellGrpCfg;
1970    bool               phyCellGrpCfgPres;
1971    SchPhyCellGrpCfg   phyCellGrpCfg;
1972    bool               spCellCfgPres;
1973    SchSpCellCfg       spCellCfg;
1974    SchAmbrCfg         *ambrCfg;
1975    SchModulationInfo  dlModInfo;
1976    SchModulationInfo  ulModInfo;
1977    uint8_t            numLcsToAdd;
1978    SchLcCfg           schLcCfg[MAX_NUM_LC];
1979 }SchUeCfgReq;
1980
1981 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.6' UE Reconfiguration Request*/
1982 typedef struct schUeRecfgReq
1983 {
1984    uint16_t         cellId;
1985    uint8_t          ueId;
1986    uint8_t          beamIdx;
1987    uint16_t         crnti;
1988    bool             macCellGrpRecfgPres;
1989    SchMacCellGrpCfg macCellGrpRecfg;
1990    bool             phyCellGrpRecfgPres;
1991    SchPhyCellGrpCfg phyCellGrpRecfg;
1992    bool             spCellRecfgPres;
1993    SchSpCellRecfg   spCellRecfg;
1994    SchAmbrCfg       *ambrRecfg;
1995    SchModulationInfo  dlModInfo;
1996    SchModulationInfo  ulModInfo;
1997    uint8_t            numLcsToAdd;
1998    SchLcCfg           schLcCfgAdd[MAX_NUM_LC];
1999    uint8_t            numLcsToDel;
2000    uint8_t            lcIdToDel[MAX_NUM_LC];
2001    uint8_t            numLcsToMod;
2002    SchLcCfg           schLcCfgMod[MAX_NUM_LC];
2003    SchDataTransmission dataTransmissionInfo;
2004 #ifdef NR_DRX   
2005    bool     drxConfigIndicatorRelease;
2006 #endif
2007 }SchUeRecfgReq;
2008
2009 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.5 UE Confg Response*/
2010 typedef struct schUeCfgRsp
2011 {
2012    uint16_t   cellId;
2013    uint8_t    beamIdx;
2014    uint16_t   ueId;
2015    uint16_t   crnti;
2016    SchMacRsp  rsp;
2017    CauseOfResult cause;
2018 }SchUeCfgRsp;
2019
2020 /*As per WG8 V7.0.0 Sec 11.2.4.3.6, UE ReCFG and UECFG have same structure definition*/
2021 typedef struct schUeCfgRsp SchUeRecfgRsp;
2022
2023 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.7' Delete UE Request*/
2024 typedef struct schUeDelete
2025 {
2026    uint16_t   cellId;
2027    uint16_t   crnti;
2028 }SchUeDelete;
2029
2030 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.7*/
2031 typedef struct schUeDeleteRsp
2032 {
2033    uint16_t   cellId;
2034    uint16_t   crnti;
2035    SchMacRsp  rsp;
2036    CauseOfResult cause;
2037 }SchUeDeleteRsp;
2038
2039 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.8' DL HARQ Indication*/
2040 typedef struct dlHarqInd
2041 {
2042    uint16_t       cellId;
2043    uint16_t       crnti;
2044    SlotTimingInfo slotInd;
2045    uint8_t        numHarq;
2046    uint8_t        harqPayload[MAX_HARQ_BITS_IN_BYTES];
2047 }DlHarqInd;
2048
2049 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.9' UL HARQ (CRC) Indication*/
2050 typedef struct crcIndInfo
2051 {
2052    uint16_t       cellId;
2053    uint16_t       crnti;
2054    SlotTimingInfo timingInfo;
2055    uint16_t       numCrcInd;
2056    uint8_t        crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
2057 }CrcIndInfo;
2058
2059 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.10' UL Channel Quality Indication*/
2060 typedef struct ulCqiReport
2061 {
2062    CqiUlReportType  reportType;
2063    uint16_t ulCqi;
2064    uint8_t  timingAdv;
2065 }UlCqiReport;
2066
2067 typedef struct schUlCqiInd
2068 {
2069    uint16_t       cellId;
2070    uint16_t       crnti;
2071    SlotTimingInfo timingInfo;
2072    uint8_t        numUlCqiReported;
2073    UlCqiReport    ulCqiRpt;
2074 }SchUlCqiInd;
2075
2076 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.11' DL Channel Quality Indication*/
2077 typedef struct dlCqiReport
2078 {
2079    uint8_t  reportType; /*Bitmap for CQI, PMI, RI, CRI report*/
2080    uint16_t cqi;
2081    uint16_t pmi;
2082    uint16_t cri;
2083    uint16_t ri;
2084 }DlCqiReport;
2085
2086 typedef struct schDlCqiInd
2087 {
2088    uint16_t       cellId;
2089    uint16_t       crnti;
2090    SlotTimingInfo timingInfo;
2091    uint8_t        numDlCqiReported;
2092    DlCqiReport    dlCqiRpt;
2093 }SchDlCqiInd;
2094
2095 /*Spec O-RAN WG8 v7.0.0, '11.2.4.2.12' Rach Ind contents*/
2096 typedef struct rachIndInfo
2097 {
2098    uint16_t    cellId;
2099    uint16_t    crnti;
2100    SlotTimingInfo timingInfo;
2101    uint8_t     slotIdx;
2102    uint8_t     symbolIdx;
2103    uint8_t     freqIdx;
2104    uint8_t     preambleIdx;
2105    uint16_t    timingAdv;
2106 }RachIndInfo;
2107
2108 /*Spec O-RAN WG8 v7.0.0, '11.2.4.2.13' Paging Ind contents*/
2109 typedef struct schPageInd
2110 {
2111    uint16_t  cellId;
2112    uint16_t  pf;
2113    uint8_t   i_s;
2114    uint16_t  pduLen;
2115    uint8_t  *pagePdu;
2116 }SchPageInd;
2117
2118 /*ORAN WG8 v7.0.0, Sec 11.2.4.2.14 Rach Res Request*/
2119 typedef struct schRachRsrcReq
2120 {
2121    SlotTimingInfo slotInd;
2122    uint16_t       cellId;
2123    uint16_t       crnti;
2124    uint8_t        numSsb;
2125    uint8_t        ssbIdx[MAX_NUM_SSB];
2126 }SchRachRsrcReq;
2127
2128 typedef struct schCfraSsbResource
2129 {
2130    uint8_t  ssbIdx;
2131    uint8_t  raPreambleIdx;
2132 }SchCfraSsbResource;
2133
2134 typedef struct schCfraRsrc
2135 {
2136    uint8_t   numSsb;
2137    SchCfraSsbResource ssbResource[MAX_NUM_SSB];
2138 }SchCfraResource;
2139
2140 typedef struct schRachRsrcRsp
2141 {
2142    uint16_t   cellId;
2143    uint16_t   crnti;
2144    SchMacRsp  result;
2145    SchCfraResource  cfraResource;
2146 }SchRachRsrcRsp;
2147
2148 /*ORAN WG8 v7.0.0, Sec 11.2.4.2.15 Rach Res Release*/
2149 typedef struct schRachRsrcRel
2150 {
2151    SlotTimingInfo slotInd;
2152    uint16_t   cellId;
2153    uint16_t   crnti;
2154    SchCfraResource  cfraResource;
2155 }SchRachRsrcRel;
2156
2157 /*O-RAN WG* v7.0.0 Sec 11.2.4.2.16 DL RLC Buffer Status Information*/
2158 typedef struct dlRlcBOInfo
2159 {
2160    uint16_t    cellId;
2161    uint16_t    crnti;
2162    uint8_t     lcId;
2163    uint32_t    dataVolume;
2164 }DlRlcBoInfo;
2165
2166 /*O-RAN WG8 v7.0.0 Sec 11.2.4.2.17 Scheduling Request Indication*/
2167 typedef struct srUciIndInfo
2168 {
2169    uint16_t    cellId;
2170    uint16_t    crnti;
2171    SlotTimingInfo slotInd;
2172    uint8_t     numSrBits;
2173    uint8_t     srPayload[MAX_SR_BITS_IN_BYTES];
2174 }SrUciIndInfo;
2175
2176 /*O-RAN WG* v7.0.0 Sec 11.2.4.2.18 UL RLC Buffer Status Information*/
2177 typedef struct dataVolInfo
2178 {
2179    uint8_t  lcgId;
2180    uint32_t dataVol;
2181 }DataVolInfo;
2182
2183 typedef struct ulBufferStatusRptInd
2184 {
2185    uint16_t    cellId;
2186    uint16_t    crnti;
2187    BsrType     bsrType;
2188    uint8_t     numLcg;
2189    DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
2190 }UlBufferStatusRptInd;
2191
2192 /**O-RAN WG* v7.0.0 Sec 11.2.4.2.19 Power Headroom Indication*/
2193 typedef struct phrData /*Spec 38.321 Sec 6.1.3.8*/
2194 {
2195    uint8_t phr;
2196    uint8_t pcmax_f_c;
2197 }PhrData;
2198
2199 typedef struct singlePhrInfo
2200 {
2201    PhrData  phrData;
2202 }SinglePhrInfo;
2203
2204 typedef struct multiPhr
2205 {
2206    PhType   phType;
2207    PhrData  phrData;
2208 }MultiPhr;
2209
2210 typedef struct multiplePhrInfo /*Spec 38.321 Sec 6.1.3.9*/
2211 {
2212    uint8_t  numPhrReported;
2213    MultiPhr multiPhrStat[MAX_PHR_REPORT];
2214 }MultiplePhrInfo;
2215
2216 typedef struct schPwrHeadroomInd
2217 {
2218    uint16_t    cellId;
2219    uint16_t    crnti;
2220    PhrType     phrType;
2221    union
2222    {
2223       SinglePhrInfo   singlePhr;
2224       MultiplePhrInfo multiPhr;
2225    }phrInfo;
2226 }SchPwrHeadroomInd;
2227
2228 typedef struct schUeHqInfo
2229 {
2230    uint16_t  crnti;
2231    uint8_t   hqProcId;
2232 }SchUeHqInfo;
2233
2234 typedef struct schRlsHqInfo
2235 {
2236    uint16_t     cellId;
2237    uint8_t      numUes;
2238    SchUeHqInfo  *ueHqInfo;
2239 }SchRlsHqInfo;
2240
2241 /* function declarations */
2242 uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
2243 uint8_t MacMessageRouter(Pst *pst, void *msg);
2244 uint8_t SchMessageRouter(Pst *pst, void *msg);
2245
2246 /**********************************************************************
2247   End of file
2248  **********************************************************************/
2249