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