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