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