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