[ Jira id - ODUHIGH-593 ] Pack and unpack function nomenclature correction
[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    SupportedSliceList suppSliceList;
793 }SchPlmnInfoList;
794
795 #ifdef NR_DRX
796 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
797
798 typedef struct schDrxOnDurationTimer
799 {
800    bool     onDurationTimerValInMs;
801    union
802    {
803       uint8_t  subMilliSeconds;
804       uint16_t milliSeconds;
805    }onDurationtimerValue;
806 }SchDrxOnDurationTimer;
807
808 typedef struct schDrxLongCycleStartOffset
809 {
810    uint16_t drxLongCycleStartOffsetChoice;
811    uint16_t drxLongCycleStartOffsetVal;
812 }SchDrxLongCycleStartOffset;
813
814 typedef struct schShortDrx
815 {
816    uint16_t   drxShortCycle;
817    uint8_t    drxShortCycleTimer;
818 }SchShortDrx;
819
820 typedef struct schDrxCfg
821 {
822    SchDrxOnDurationTimer       drxOnDurationTimer;
823    uint16_t                    drxInactivityTimer;
824    uint8_t                     drxHarqRttTimerDl;
825    uint8_t                     drxHarqRttTimerUl;
826    uint16_t                    drxRetransmissionTimerDl;
827    uint16_t                    drxRetransmissionTimerUl;
828    SchDrxLongCycleStartOffset  drxLongCycleStartOffset;
829    bool                        shortDrxPres;
830    SchShortDrx                 shortDrx;
831    uint8_t                     drxSlotOffset;
832 }SchDrxCfg;
833 #endif
834
835 /*Spec 38.331 'NrNsPmaxList'*/
836 typedef struct schNrNsPmaxList
837 {
838    long additionalPMax;
839    long additionalSpectrumEmission;
840 }SchNrNsPmaxList;
841
842 /*Spec 38.331 'FrequencyInfoDL-SIB'*/
843 typedef struct schMultiFreqBandListSib
844 {
845    long freqBandIndNr;
846    SchNrNsPmaxList nrNsPmaxList[1];
847 }SchMultiFreqBandListSib;
848
849 /*Spec 38.331 'SCS-SpecificCarrier'*/
850 typedef struct schScsSpecificCarrier
851 {
852   uint16_t offsetToCarrier;
853   uint8_t  subCarrierSpacing;
854   uint16_t carrierBw;
855   uint16_t txDirectCurrentLoc;
856 }SchScsSpecificCarrier;
857
858 /*Spec 38.331 'FrequencyInfoDL-SIB'*/
859 typedef struct schFreqInfoDlSib
860 {
861    SchMultiFreqBandListSib mutiFreqBandList[1];
862    uint16_t                offsetToPointA;
863    SchScsSpecificCarrier   schSpcCarrier[1];
864 }SchFreqInfoDlSib;
865
866 typedef struct schBcchCfg
867 {
868    long modPeriodCoeff;
869 }SchBcchCfg;
870
871 /*Spec 38.331 'DownlinkConfigCommonSIB'*/
872 typedef struct schDlCfgCommon
873 {
874    SchFreqInfoDlSib  schFreqInfoDlSib;
875    SchBwpDlCfg       schInitialDlBwp;  /* Initial DL BWP */
876    SchBcchCfg        schBcchCfg;
877    SchPcchCfg        schPcchCfg;
878 }SchDlCfgCommon;
879
880 /*Spec 38.331 'FrequencyInfoUL-SIB'*/
881 typedef struct schFreqInfoUlSib
882 {
883    SchMultiFreqBandListSib mutiFreqBandList[1];
884    uint16_t                absoluteFreqPointA;
885    SchScsSpecificCarrier   schSpcCarrier[1];
886    int8_t                  schPMax;
887    bool                    frequencyShift7p5khz;
888 }SchFreqInfoUlSib;
889
890 /*Spec 38.331 'UplinkConfigCommonSIB '*/
891 typedef struct schUlCfgCommon
892 {
893    SchFreqInfoUlSib  schFreqInfoUlSib;
894    SchBwpUlCfg       schInitialUlBwp;  /* Initial DL BWP */
895    uint16_t          schTimeAlignTimer;
896 }SchUlCfgCommon;
897
898 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.1 Cell Conf Request*/
899 typedef struct schCellCfg
900 {
901    uint16_t        cellId;                 /* Cell Id */
902    uint8_t         numOfBeams;
903    uint8_t         numLayers;
904    uint8_t         numAntPorts;
905    uint16_t        phyCellId;               /* Physical cell id */
906    SchPlmnInfoList plmnInfoList[MAX_PLMN];  /* Consits of PlmnId and Snssai list */
907    SchDuplexMode   dupMode;                 /* Duplex type: TDD/FDD */
908    uint8_t         dlBandwidth;             /* Supported B/W */
909    uint8_t         ulBandwidth;             /* Supported B/W */
910    SchDlCfgCommon  dlCfgCommon;             /*Spec 38.331 DownlinkConfigCommonSIB*/
911    SchUlCfgCommon  ulCfgCommon;             /*Spec 38.331 UplinkConfigCommonSIB*/
912 #ifdef NR_TDD
913    TDDCfg          tddCfg;                  /* Spec 38.331 tdd-UL-DL-ConfigurationCommon */ 
914 #endif 
915
916   /*Ref:Spec 38.331 "ssb-PositionsInBurst", Value 0 in Bitmap => corresponding SS/PBCH block is not transmitted
917     *value 1 => corresponding SS/PBCH block is transmitted*/
918    uint32_t            ssbPosInBurst[SCH_SSB_MASK_SIZE];  /* Bitmap for actually transmitted SSB. */
919    SchSSBPeriod        ssbPeriod;        /* SSB Periodicity in msec */
920    uint32_t            ssbFrequency;     /* SB frequency in kHz*/
921    uint8_t             dmrsTypeAPos;
922    uint8_t             ssbScs;           /* SSB subcarrier spacing*/
923    SchPdcchConfigSib1  pdcchCfgSib1;     /* Req to configure CORESET#0 and SearchSpace#0*/
924    uint32_t            ssbPbchPwr;       /* SSB block power */
925    uint8_t             ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
926    uint16_t            sib1PduLen;
927 }SchCellCfg;
928
929 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.1 Cell Config Response*/
930 typedef struct schCellCfgCfm
931 {
932    uint16_t         cellId;     /* Cell Id */
933    SchMacRsp        rsp;   
934    CauseOfResult    cause;
935 }SchCellCfgCfm;
936
937 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.2 Cell Del Req*/
938 typedef struct schCellDeleteReq 
939 {
940    uint16_t   cellId;
941 }SchCellDeleteReq;
942
943 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.2 Cell Del Response*/
944 typedef struct schCellDeleteRsp
945 {
946    uint16_t        cellId;
947    SchMacRsp       rsp;
948    CauseOfResult   cause;
949 }SchCellDeleteRsp;
950
951 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.2.3*/
952 typedef struct schRrmPolicyRatio
953 {
954    uint8_t maxRatio;
955    uint8_t minRatio;
956    uint8_t dedicatedRatio;
957 }SchRrmPolicyRatio;
958
959 typedef struct schRrmPolicyOfSlice
960 {
961    Snssai  snssai;
962    SchRrmPolicyRatio rrmPolicyRatioInfo;
963 }SchRrmPolicyOfSlice;
964
965 typedef struct schSliceCfgReq
966 {
967    uint8_t  numOfConfiguredSlice;
968    SchRrmPolicyOfSlice **listOfSlices;
969 }SchSliceCfgReq;
970
971 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.3 Slice Cfg Response*/
972 typedef struct schSliceCfgRsp
973 {
974    Snssai     snssai;
975    SchMacRsp  rsp;
976    CauseOfResult cause;
977 }SchSliceCfgRsp;
978
979 /*As per ORAN-WG8 V7.0.0 Sec 11.2.4.3.4 , Slice Cfg and Recfg are same structures*/
980 typedef struct schSliceCfgReq SchSliceRecfgReq;
981 typedef struct schSliceCfgRsp SchSliceRecfgRsp;
982
983 typedef struct ssbInfo
984 {
985    uint8_t         ssbIdx;          /* SSB Index */
986    TimeDomainAlloc tdAlloc;         /* Time domain allocation */
987    FreqDomainRsrc  fdAlloc;         /* Freq domain allocation */
988 }SsbInfo;
989
990 typedef struct sib1AllocInfo
991 {
992    BwpCfg bwp;
993    PdcchCfg *sib1PdcchCfg;
994 }Sib1AllocInfo;
995
996 typedef struct prachSchInfo
997 {
998    uint8_t  numPrachOcas;   /* Num Prach Ocassions */
999    uint8_t  prachFormat;    /* PRACH Format */
1000    uint8_t  numRa;          /* Freq domain ocassion */
1001    uint8_t  prachStartSymb; /* Freq domain ocassion */
1002 }SchPrachInfo;
1003
1004 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
1005 typedef struct dlBrdcstAlloc
1006 {
1007    uint16_t     crnti; /* SI-RNTI */
1008    /* Ssb transmission is determined as follows:
1009     * 0 : No tranamission
1010     * 1 : SSB Transmission
1011     * 2 : SSB Repetition */
1012    uint8_t ssbTransmissionMode;
1013    uint8_t ssbIdxSupported;
1014    SsbInfo ssbInfo[MAX_SSB_IDX];
1015    bool    systemInfoIndicator;
1016    uint8_t *siContent; 
1017    /* Sib1 transmission is determined as follows:
1018     * 0 : No tranamission
1019     * 1 : SIB1 Transmission
1020     * 2 : SIB1 Repetition */
1021    uint8_t sib1TransmissionMode;
1022    Sib1AllocInfo sib1Alloc;
1023 }DlBrdcstAlloc;
1024
1025 typedef struct msg3UlGrant
1026 {
1027    uint8_t         freqHopFlag;
1028    uint16_t        bwpSize;
1029    FreqDomainRsrc  msg3FreqAlloc;
1030    uint8_t         k2Index;
1031    uint8_t         mcs;
1032    uint8_t         tpc;
1033    uint8_t         csiReq;
1034 }Msg3UlGrant;
1035
1036 typedef struct rarInfo
1037 {
1038    uint8_t         RAPID;
1039    uint16_t        ta;
1040    Msg3UlGrant     ulGrant;
1041    uint16_t        tcrnti;
1042    uint8_t         rarPdu[RAR_PAYLOAD_SIZE];
1043    uint8_t         rarPduLen;
1044 }RarInfo;
1045
1046 typedef struct rarAlloc
1047 {
1048    uint16_t   raRnti;
1049    RarInfo    rarInfo;
1050    BwpCfg     bwp;
1051    PdcchCfg   *rarPdcchCfg;
1052    PdschCfg   *rarPdschCfg;
1053 }RarAlloc;
1054
1055 typedef struct lcSchInfo
1056 {
1057    uint8_t   lcId;
1058    uint32_t  schBytes; 
1059 }LcSchInfo;
1060
1061 typedef struct ceSchInfo
1062 {
1063    uint8_t   ceLcId;
1064    uint8_t   *ceContent; 
1065 }CeSchInfo;
1066
1067 typedef struct freqDomainAlloc
1068 {
1069    uint8_t          resAllocType; /* Resource allocation type */
1070    union
1071    {
1072       ResAllocType0    type0;
1073       ResAllocType1    type1;
1074    }resAlloc;
1075 }FreqDomainAlloc;
1076
1077 typedef struct transportBlock
1078 {
1079    uint8_t    mcs;       
1080    bool       ndi;       
1081    uint8_t    rv;        
1082    uint16_t   tbSize;    
1083    uint8_t    numCe;
1084    CeSchInfo  ceSchInfo[MAX_NUM_LC]; 
1085    uint8_t    numLc;
1086    LcSchInfo  lcSchInfo[MAX_NUM_LC]; 
1087 }TransportBlock;
1088
1089 typedef struct dlMsgSchedInfo
1090 {
1091    uint16_t        crnti;
1092    uint8_t         dciFormatId;
1093    uint8_t         harqProcNum;
1094    bool            vrbPrbMapping;
1095    uint8_t         dlAssignIdx;
1096    uint8_t         pucchTpc;
1097    uint8_t         pucchResInd;
1098    uint8_t         harqFeedbackInd;
1099    uint16_t        dlMsgPduLen;
1100    uint8_t         *dlMsgPdu;
1101    FreqDomainAlloc freqAlloc;
1102    TimeDomainAlloc timeAlloc;
1103    uint8_t         numOfTbs;
1104    TransportBlock  transportBlock[2];
1105    BwpCfg          bwp;
1106    PdcchCfg        *dlMsgPdcchCfg;
1107    PdschCfg        *dlMsgPdschCfg;
1108 }DlMsgSchInfo;
1109
1110 typedef struct schSlotValue
1111 {
1112    SlotTimingInfo currentTime;
1113    SlotTimingInfo broadcastTime;
1114    SlotTimingInfo rarTime;
1115    SlotTimingInfo dlMsgTime;
1116    SlotTimingInfo ulDciTime;
1117 }SchSlotValue;
1118
1119
1120 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-36 DCI Format0_0 Configuration */
1121 typedef struct format0_0
1122 {
1123    uint8_t         resourceAllocType;
1124    FreqDomainAlloc freqAlloc;
1125    TimeDomainAlloc timeAlloc;
1126    uint16_t        rowIndex;
1127    uint8_t         mcs;
1128    uint8_t         harqProcId;  
1129    bool            freqHopFlag;
1130    uint8_t         ndi;    
1131    uint8_t         rvIndex;     
1132    uint8_t         tpcCmd;
1133    bool            sulIndicator;
1134 }Format0_0;
1135
1136 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-40 DCI Format 0_1 Configuration */
1137 typedef struct format0_1
1138 {
1139    uint8_t         carrierIndicator;
1140    bool            sulIndicator;
1141    uint8_t         bwpIndicator;
1142    uint8_t         resourceAlloc;
1143    FreqDomainRsrc  freqAlloc;
1144    TimeDomainAlloc timeAlloc;
1145    uint16_t        rowIndex;
1146    uint8_t         mcs;
1147    uint8_t         harqProcId;  
1148    bool            freqHopFlag;
1149    uint8_t         ndi;   
1150    uint8_t         rvIndex;    
1151    uint8_t         firstDownlinkAssignmentIndex;
1152    uint8_t         secondDownlinkAssignmentIndex;
1153    uint8_t         tpcCommand;
1154    uint8_t         srsResourceSetIndicator;
1155    uint8_t         srsResourceIndicator;
1156    uint8_t         tpmi;
1157    uint8_t         antennaPorts;
1158    uint8_t         srsRequest;
1159    uint8_t         csiRequest;
1160    uint8_t         cbgTransmissionInfo;
1161    uint8_t         ptrsDmrs;
1162    uint8_t         betaOffsetIndicator;
1163    bool            dmrsSequenceInitialization;
1164    bool            ulschIndicatior;
1165 }Format0_1;
1166
1167 typedef struct dciFormat
1168 {
1169    FormatType     formatType;     /* DCI Format */
1170    union
1171    {
1172       Format0_0  format0_0;      /* Format 0_0 */
1173       Format0_1  format0_1;      /* Format 0_1 */
1174    }format;
1175 }DciFormat;
1176
1177 typedef struct dciInfo
1178 {
1179    uint16_t       crnti;          /* CRNTI */
1180    BwpCfg         bwpCfg;         /* BWP Cfg */
1181    CoresetCfg     coresetCfg;     /* Coreset1 Cfg */
1182    DciFormat      dciFormatInfo;  /* Dci Format */
1183    DlDCI          dciInfo;        /* DlDCI */
1184 }DciInfo;
1185
1186
1187 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Section 11.2.4.3.8 DL Scheduling Information */
1188 typedef struct dlSchedInfo
1189 {
1190    uint16_t     cellId;  /* Cell Id */
1191    SchSlotValue schSlotValue;
1192
1193    /* Allocation for broadcast messages */
1194    bool isBroadcastPres;
1195    DlBrdcstAlloc brdcstAlloc;
1196
1197    /* Allocation for RAR message */
1198    RarAlloc *rarAlloc[MAX_NUM_UE];
1199
1200    /* UL grant in response to BSR */
1201    DciInfo    *ulGrant;
1202
1203    /* Allocation from dedicated DL msg */
1204    DlMsgSchInfo *dlMsgAlloc[MAX_NUM_UE];
1205
1206 }DlSchedInfo;
1207
1208 /*Reference: O-RAN.WG8.AAD.v7.0.0, Sec 11.2.4.3.13 Downlink Paging Allocation*/
1209 typedef struct interleaved_t
1210 {
1211    uint8_t regBundleSize;
1212    uint8_t interleaverSize;
1213    uint16_t shiftIndex;
1214 }Interleaved;
1215
1216 typedef struct pageDlDci
1217 {
1218    uint8_t    freqDomainResource[6];
1219    uint8_t    durationSymbols;
1220    uint8_t    cceRegMappingType;
1221    union
1222    {
1223       Interleaved  interleaved;
1224       uint8_t      nonInterleaved;
1225    }cceReg;
1226    uint8_t    ssStartSymbolIndex;
1227    uint8_t    cceIndex;
1228    uint8_t    aggregLevel;
1229    uint8_t    precoderGranularity;
1230    uint8_t    coreSetSize;
1231 }PageDlDci;
1232
1233 typedef struct resAllocType1 PageFreqDomainAlloc;
1234
1235 typedef struct pageTimeDomainAlloc
1236 {
1237    uint8_t mappingType;
1238    uint16_t startSymb;
1239    uint16_t numSymb;
1240 }PageTimeDomainAlloc;
1241
1242 typedef struct pageDmrsConfig
1243 {
1244    uint8_t dmrsType;
1245    uint8_t dmrsAddPos;
1246    uint8_t nrOfDmrsSymbols;
1247 }PageDmrsConfig;
1248
1249 typedef struct pageTbInfo
1250 {
1251    uint8_t         mcs;
1252    uint32_t        tbSize;
1253 }PageTbInfo;
1254
1255 typedef struct pageDlSch
1256 {
1257    PageFreqDomainAlloc  freqAlloc;
1258    PageTimeDomainAlloc  timeAlloc;
1259    PageDmrsConfig       dmrs;
1260    uint8_t              vrbPrbMapping;
1261    PageTbInfo           tbInfo;
1262    uint8_t              tbScaling;
1263    uint16_t             dlPagePduLen;
1264    uint8_t             *dlPagePdu;
1265 }PageDlSch;
1266
1267 typedef struct dlPageAlloc
1268 {
1269    uint16_t       cellId;
1270    SlotTimingInfo dlPageTime;
1271    uint8_t        ssbIdx;
1272    bool           shortMsgInd;
1273    uint8_t        shortMsg;
1274    BwpCfg         bwp;
1275    PageDlDci      pageDlDci;
1276    PageDlSch      pageDlSch;
1277 }DlPageAlloc;
1278
1279 typedef struct tbInfo
1280 {
1281    uint8_t      mcs;       /* MCS */
1282    uint8_t      ndi;       /* NDI */
1283    uint8_t      rv;        /* Redundancy Version */
1284    uint16_t     tbSize;    /* TB Size */
1285    uint8_t      qamOrder;  /* Modulation Order */
1286    SchMcsTable  mcsTable;  /* MCS Table */
1287 }TbInfo;
1288
1289 typedef struct schPuschInfo
1290 {
1291    uint8_t          harqProcId;   /* HARQ Process ID */
1292    uint16_t         crnti;
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    uint16_t         crnti;
1338    FreqDomainRsrc   fdAlloc;      
1339    TimeDomainAlloc  tdAlloc;      
1340    uint8_t          srFlag;
1341    HarqFdbkInfo     harqInfo;
1342    CsiFdbkInfo      csiInfo;
1343    BeamformingInfo  beamPucchInfo;
1344    uint8_t          pucchFormat;
1345    uint8_t          intraFreqHop;
1346    uint16_t         secondPrbHop;
1347    uint8_t          initialCyclicShift;
1348    uint8_t          occLen;
1349    uint8_t          occIdx;
1350    uint8_t          timeDomOCC;
1351    uint8_t          addDmrs;
1352    bool             pi2BPSK;
1353 }SchPucchInfo;
1354
1355 typedef struct schPuschUci
1356 {
1357    uint8_t          harqProcId;   /* HARQ Process ID */
1358    uint16_t         crnti;
1359    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
1360    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
1361    TbInfo           tbInfo;       /* TB information */
1362    HarqInfo         harqInfo;    /* Harq Information */
1363    CsiInfo          csiInfo;    /* Csi information*/
1364 }SchPuschUci;
1365
1366 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Section 11.2.4.3.9 UL Scheduling Information */
1367 typedef struct ulSchedInfo
1368 {
1369    uint16_t         cellId;         /* Cell Id */
1370    SlotTimingInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
1371    uint8_t          dataType;       /* Type of info being scheduled */
1372    SchPrachInfo     prachSchInfo;   /* Prach scheduling info */
1373    SchPuschInfo     schPuschInfo[MAX_NUM_UE];   /* Pusch scheduling info */
1374    SchPuschUci      schPuschUci[MAX_NUM_UE];    /* Pusch Uci */
1375    SchPucchInfo     schPucchInfo[MAX_NUM_UE];   /* Pucch and Uci scheduling info */
1376 }UlSchedInfo;
1377
1378 /* Info of Scheduling Request to Add/Modify */
1379 typedef struct schSchedReqInfo
1380 {
1381    uint8_t              schedReqId;
1382    SchSrProhibitTimer   srProhibitTmr;
1383    SchSrTransMax        srTransMax;
1384 }SchSchedReqInfo;
1385
1386 /* Scheduling Request Configuration */
1387 typedef struct schSchedReqCfg
1388 {
1389    uint8_t          addModListCount;
1390    SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
1391    uint8_t          relListCount;
1392    uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
1393 }SchSchedReqCfg;
1394
1395 /* Info of Tag to Add/Modify */
1396 typedef struct schTagInfo
1397 {
1398    uint8_t       tagId;
1399    SchTimeAlignmentTimer  timeAlignmentTmr;
1400 }SchTagInfo;
1401
1402 /* Timing Advance Group Configuration */
1403 typedef struct schTagCfg
1404 {
1405    uint8_t      addModListCount;
1406    SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
1407    uint8_t      relListCount;
1408    uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
1409 }SchTagCfg;
1410
1411 /* Configuration for Power headroom reporting */
1412 typedef struct schPhrCfg
1413 {
1414    SchPhrPeriodicTimer       periodicTmr;
1415    SchPhrProhibitTimer       prohibitTmr;
1416    SchPhrTxPwrFactorChange   txpowerFactorChange;
1417    bool                      multiplePhr;
1418    bool                      dummy;
1419    bool                      type2OtherCell;
1420    SchPhrModeOtherCG         modeOtherCG;
1421 }SchPhrCfg;
1422
1423 /* MAC cell Group configuration */
1424 typedef struct schMacCellGrpCfg
1425 {
1426    SchSchedReqCfg   schedReqCfg;
1427    SchTagCfg        tagCfg;
1428    SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
1429 #ifdef NR_DRX
1430    bool             drxCfgPresent;
1431    SchDrxCfg        drxCfg;          /* Drx configuration */
1432 #endif
1433 }SchMacCellGrpCfg;
1434
1435 /* Physical Cell Group Configuration */
1436 typedef struct schPhyCellGrpCfg
1437 {
1438    SchPdschHarqAckCodebook    pdschHarqAckCodebook;
1439    int8_t     pNrFr1;
1440 }SchPhyCellGrpCfg;
1441
1442 /* Control resource set info */
1443 typedef struct schControlRsrcSet
1444 {
1445    uint8_t             cRSetId;                /* Control resource set id */
1446    uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
1447    uint8_t             duration;
1448    SchREGMappingType   cceRegMappingType;
1449    SchPrecoderGranul   precoderGranularity;
1450    uint16_t            dmrsScramblingId;
1451 }SchControlRsrcSet;
1452
1453 /*Slot Perioicity and Offset*/
1454 typedef struct schMSlotPeriodAndOffset
1455 {
1456    SchMSlotPeriodicity  mSlotPeriodicity;
1457    uint16_t             mSlotOffset;
1458 }SchMSlotPeriodAndOffset;
1459
1460 /* Search Space info */
1461 typedef struct schSearchSpace
1462 {
1463    uint8_t                  searchSpaceId;
1464    uint8_t                  cRSetId;
1465    SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1466    uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1467    SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1468    SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1469    SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1470    SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1471    SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1472    SchSearchSpaceType       searchSpaceType;
1473    uint8_t                  ueSpecificDciFormat;
1474 }SchSearchSpace;
1475
1476 /* PDCCH cofniguration */
1477 typedef struct schPdcchConfig
1478 {
1479    uint8_t           numCRsetToAddMod;
1480    SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1481    uint8_t           numCRsetToRel;
1482    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1483    uint8_t           numSearchSpcToAddMod;
1484    SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1485    uint8_t           numSearchSpcToRel;
1486    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1487 }SchPdcchConfig;
1488
1489 /* PDSCH time domain resource allocation */
1490 typedef struct schPdschTimeDomRsrcAlloc
1491 {
1492    uint8_t    *k0;
1493    SchTimeDomRsrcAllocMappingType    mappingType;
1494    uint8_t    startSymbol;
1495    uint8_t    symbolLength;
1496 }SchPdschTimeDomRsrcAlloc;
1497
1498
1499 typedef struct schPdschBundling
1500 {
1501    struct schStaticBundling
1502    {
1503      SchBundlingSizeSet2 size;
1504    }SchStaticBundling;
1505    struct schDynamicBundling
1506    {
1507      SchBundlingSizeSet1 sizeSet1;
1508      SchBundlingSizeSet2 sizeSet2;
1509    }SchDynamicBundling;
1510 }SchPdschBundling;
1511
1512 /* DMRS downlink configuration */
1513 typedef struct schDmrsDlCfg
1514 {
1515    SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
1516 }SchDmrsDlCfg;
1517
1518 /* PDSCH Configuration */
1519 typedef struct schPdschConfig
1520 {
1521    SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1522    SchResourceAllocType       resourceAllocType;
1523    uint8_t                    numTimeDomRsrcAlloc;
1524    SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1525    SchRBGSize                 rbgSize;
1526    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1527    SchBundlingType            bundlingType;
1528    SchPdschBundling           bundlingInfo;
1529 }SchPdschConfig;
1530
1531 /* Initial Downlink BWP */
1532 typedef struct schInitalDlBwp
1533 {
1534    bool             pdcchCfgPres;
1535    SchPdcchConfig   pdcchCfg;
1536    bool             pdschCfgPres;
1537    SchPdschConfig   pdschCfg;
1538 }SchInitalDlBwp;
1539
1540 /*Spec 38.331 'RadioLinkMonitoringConfig'*/
1541 typedef uint8_t SchRadioLinkMonitoringRsId;
1542
1543 typedef struct schRadioLinkMonRS
1544 {
1545    SchRadioLinkMonitoringRsId  radioLinkMonitoringRsId;
1546    SchPurposeOfFailureDet      purpose; 
1547    union
1548    {
1549       uint8_t ssbIndx;
1550       uint8_t nzpCsiRsResId;
1551    }SchDetectionRes;
1552 }SchRadioLinkMonRS;
1553
1554 typedef struct schRadioLinkConfig
1555 {
1556    SchRadioLinkMonRS           failurDetResAddModList[MAX_FAILURE_DET_RESOURCES];
1557    SchRadioLinkMonitoringRsId  failurDetResRelList[MAX_FAILURE_DET_RESOURCES];
1558    uint8_t                     beamFailureInstanceMaxCount;
1559    uint8_t                     beamFailureDetectionTimer;
1560 }SchRadioLinkConfig;
1561
1562 /*Spec 38.331 "SPS-Config'*/
1563 typedef struct schSpsConfig
1564 {
1565    uint16_t     periodicity;
1566    uint8_t      numOfHqProcess;
1567    uint8_t      n1PucchAN;
1568    SchMcsTable  mcsTable;
1569 }SchSpsConfig;
1570
1571 /* Spec 38.331, 'BWP-DownlinkDedicated'*/
1572 typedef struct schBwpDlCfgDed
1573 {
1574   SchPdcchConfig     pdcchCfgDed;
1575   SchPdschConfig     pdschCfgDed;
1576   SchSpsConfig       spsCfgDed;
1577   SchRadioLinkConfig radioLnkMonCfgDed;
1578 }SchBwpDlCfgDed;
1579
1580 /* Spec 38.331, 'BWP-Downlink' Downlink BWP information */
1581 typedef struct schDlBwpInfo
1582 {
1583    uint8_t          bwpId;
1584    SchBwpDlCfg      bwpCommon;
1585    SchBwpDlCfgDed   bwpDedicated;
1586 }SchDlBwpInfo;
1587
1588 /* PDCCH Serving Cell configuration */
1589 typedef struct schPdschServCellCfg
1590 {
1591    uint8_t                  *maxMimoLayers;           
1592    SchNumHarqProcForPdsch   numHarqProcForPdsch;
1593    SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
1594    bool                     *codeBlkGrpFlushInd;
1595    SchPdschXOverhead        *xOverhead;
1596 }SchPdschServCellCfg;
1597
1598 typedef struct schRaPrioritization
1599 {
1600    uint8_t powerRampingStepHighPriority;
1601    uint8_t scalingFactorBI;
1602 }SchRaPrioritization;
1603
1604 typedef struct schBfrCsiRsRes
1605 {
1606    uint8_t csrRsIndex;
1607    uint8_t raOccList;
1608    uint8_t raPreambleIndex;
1609 }SchBfrCsiRsRes;
1610
1611 typedef struct schBfrSsbRes
1612 {
1613    uint16_t ssbIndex;
1614    uint8_t raPreambleIndex;
1615 }SchBfrSsbRes;
1616
1617 typedef struct schPrachResDedBfr
1618 {
1619    SchBfrSsbRes    ssb;
1620    SchBfrCsiRsRes  csiRs;
1621 }SchPrachResDedBfr;
1622
1623 /*Spec 38.331 'BeamFailureRecoveryConfig' */
1624 typedef struct schBeamFailRecoveryCfg
1625 {
1626    uint8_t             rootSeqIndexBfr;
1627    SchRachCfgGeneric   rachCfgBfr;
1628    uint8_t             rsrpThreshSsbBfr;     /* RSRP Threshold SSB */
1629    SchPrachResDedBfr   candidateBeamRSList;
1630    uint8_t             ssbPerRachBfr;        /* SSB per RACH occassion */
1631    uint8_t             raSsbOccMaskIndex;
1632    uint8_t             recoverySearchSpaceId;
1633    SchRaPrioritization raPrioBfr;
1634    uint16_t            bfrTimer;
1635    uint8_t             msg1SubcSpacing;  /* Subcarrier spacing of RACH */
1636 }SchBeamFailRecoveryCfg;
1637
1638 /* PUCCH Configuration */
1639 typedef struct schPucchResrcSetInfo
1640 {
1641    uint8_t resrcSetId;
1642    uint8_t resrcListCount;
1643    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1644    uint8_t maxPayLoadSize;
1645 }SchPucchResrcSetInfo;
1646
1647 typedef struct schPucchResrcSetCfg
1648 {
1649    uint8_t resrcSetToAddModListCount;
1650    SchPucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1651    uint8_t resrcSetToRelListCount;
1652    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1653 }SchPucchResrcSetCfg;
1654
1655 typedef struct schPucchFormat0
1656 {
1657    uint8_t initialCyclicShift;
1658    uint8_t numSymbols;
1659    uint8_t startSymbolIdx;
1660 }SchPucchFormat0;
1661
1662 typedef struct schPucchFormat1
1663 {
1664    uint8_t initialCyclicShift;
1665    uint8_t numSymbols;
1666    uint8_t startSymbolIdx;
1667    uint8_t timeDomOCC;
1668 }SchPucchFormat1;
1669
1670 typedef struct schPucchFormat2_3
1671 {
1672    uint8_t numPrbs;
1673    uint8_t numSymbols;
1674    uint8_t startSymbolIdx;
1675 }SchPucchFormat2_3;
1676
1677 typedef struct schPucchFormat4
1678 {
1679    uint8_t numSymbols;
1680    uint8_t occLen;
1681    uint8_t occIdx;
1682    uint8_t startSymbolIdx;
1683 }SchPucchFormat4;
1684
1685 typedef struct schPucchResrcInfo
1686 {
1687    uint8_t  resrcId;
1688    uint16_t startPrb;
1689    uint8_t  intraFreqHop;
1690    uint16_t secondPrbHop;
1691    uint8_t  pucchFormat;
1692    union{
1693       SchPucchFormat0   *format0; 
1694       SchPucchFormat1   *format1;
1695       SchPucchFormat2_3 *format2;
1696       SchPucchFormat2_3 *format3;
1697       SchPucchFormat4   *format4;
1698    }SchPucchFormat;
1699 }SchPucchResrcInfo;
1700
1701 typedef struct schPucchResrcCfg
1702 {
1703    uint8_t resrcToAddModListCount;
1704    SchPucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1705    uint8_t resrcToRelListCount;
1706    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1707 }SchPucchResrcCfg;
1708
1709
1710 typedef struct schSchedReqResrcInfo
1711 {
1712    uint8_t resrcId;
1713    uint8_t requestId;
1714    uint8_t periodicity;
1715    uint16_t offset;
1716    uint8_t resrc;
1717 }SchSchedReqResrcInfo;
1718
1719 typedef struct schPucchSchedReqCfg
1720 {
1721    uint8_t           schedAddModListCount;
1722    SchSchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1723    uint8_t           schedRelListCount;
1724    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1725 }SchPucchSchedReqCfg;
1726
1727 typedef struct schSpatialRelationInfo
1728 {
1729    uint8_t spatialRelationId;
1730    uint8_t servCellIdx;
1731    uint8_t pathLossRefRSId;
1732    uint8_t p0PucchId;
1733    uint8_t closeLoopIdx;
1734 }SchSpatialRelationInfo;
1735
1736 typedef struct schPucchSpatialCfg
1737 {
1738    uint8_t spatialAddModListCount;
1739    SchSpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1740    uint8_t spatialRelListCount;
1741    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1742 }SchPucchSpatialCfg;
1743
1744 typedef struct schP0PucchCfg
1745 {
1746    uint8_t p0PucchId;
1747    int     p0PucchVal;
1748 }SchP0PucchCfg;
1749
1750 typedef struct schPathLossRefRSCfg
1751 {
1752    uint8_t pathLossRefRSId;
1753 }SchPathLossRefRSCfg;
1754
1755 typedef struct schPucchMultiCsiCfg
1756 {
1757    uint8_t  multiCsiResrcListCount;
1758    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1759 }SchPucchMultiCsiCfg;
1760
1761 typedef struct schPucchDlDataToUlAck
1762 {
1763    uint8_t  dlDataToUlAckListCount;
1764    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1765 }SchPucchDlDataToUlAck;
1766
1767 typedef struct schPucchPowerControl
1768 {
1769    int deltaF_Format0;
1770    int deltaF_Format1;
1771    int deltaF_Format2;
1772    int deltaF_Format3;
1773    int deltaF_Format4;
1774    uint8_t p0SetCount;
1775    SchP0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1776    uint8_t pathLossRefRSListCount;
1777    SchPathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1778 }SchPucchPowerControl;
1779
1780 typedef struct schPucchCfg
1781 {
1782    SchPucchResrcSetCfg   *resrcSet;
1783    SchPucchResrcCfg      *resrc;
1784    SchPucchFormatCfg     *format1; 
1785    SchPucchFormatCfg     *format2; 
1786    SchPucchFormatCfg     *format3; 
1787    SchPucchFormatCfg     *format4;
1788    SchPucchSchedReqCfg   *schedReq;
1789    SchPucchMultiCsiCfg   *multiCsiCfg;
1790    SchPucchSpatialCfg    *spatialInfo;
1791    SchPucchDlDataToUlAck *dlDataToUlAck;
1792    SchPucchPowerControl  *powerControl;
1793 }SchPucchCfg;
1794
1795 /* Transform precoding disabled */
1796 typedef struct schTransPrecodDisabled
1797 {
1798    uint16_t   scramblingId0;
1799 }SchTransPrecodDisabled;
1800
1801 /* DMRS Uplink configuration */
1802 typedef struct SchDmrsUlCfg
1803 {
1804    SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
1805    SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
1806 }SchDmrsUlCfg;
1807
1808 /* PUSCH Configuration */
1809 typedef struct schPuschCfg
1810 {
1811    uint8_t                    dataScramblingId;
1812    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1813    SchResourceAllocType       resourceAllocType;
1814    uint8_t                    numTimeDomRsrcAlloc;
1815    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1816    SchTransformPrecoder       transformPrecoder;
1817 }SchPuschCfg;
1818
1819 /* Initial Uplink BWP */
1820 typedef struct schInitialUlBwp
1821 {
1822    bool          pucchCfgPres;
1823    SchPucchCfg   pucchCfg;
1824    bool          puschCfgPres;
1825    SchPuschCfg   puschCfg;
1826 }SchInitialUlBwp;
1827
1828 typedef struct schBwpCfgDedicated
1829 {
1830    SchPucchCfg   pucchCfg;
1831    SchPuschCfg   puschCfg;
1832 }SchBwpCfgDedicated;
1833
1834 /* Uplink BWP information */
1835 typedef struct schUlBwpInfo
1836 {
1837    uint8_t             bwpId;
1838    SchBwpUlCfg         bwpCommon;
1839    SchBwpCfgDedicated  bwpDed;
1840 }SchUlBwpInfo;
1841
1842 typedef struct schBwpRelInfo
1843 {
1844    uint8_t bwpId;
1845 }SchBwpRelInfo;
1846
1847 /* Serving cell configuration */
1848 typedef struct schServCellRecfgInfo
1849 {
1850    SchInitalDlBwp          initDlBwp;
1851    SchRadioLinkConfig      radioLinkMonConfig;
1852    uint8_t                 numDlBwpToAddOrMod;
1853    SchDlBwpInfo            dlBwpToAddOrModList[MAX_NUM_BWP];
1854    uint8_t                 numDlBwpToRel;
1855    SchBwpRelInfo           dlBwpToRelList[MAX_NUM_BWP];
1856    uint8_t                 firstActvDlBwpId;
1857    uint8_t                 defaultDlBwpId;
1858    uint8_t                 *bwpInactivityTmr;
1859    SchPdschServCellCfg     pdschServCellCfg;
1860    SchInitialUlBwp         initUlBwp;
1861    SchBeamFailRecoveryCfg  beamFailureRecoveryCfg;
1862    uint8_t                 numUlBwpToAddOrMod;
1863    SchUlBwpInfo            ulBwpToAddOrModList[MAX_NUM_BWP];
1864    uint8_t                 numUlBwpToRel;
1865    SchBwpRelInfo           ulBwpToRelList[MAX_NUM_BWP];
1866    uint8_t                 firstActvUlBwpId;
1867 }SchServCellRecfgInfo;
1868
1869 /* Serving cell configuration */
1870 typedef struct schServCellCfgInfo
1871 {
1872    SchInitalDlBwp        initDlBwp;
1873    SchRadioLinkConfig    radioLinkMonConfig;
1874    uint8_t               numDlBwpToAdd;
1875    SchDlBwpInfo          dlBwpToAddList[MAX_NUM_BWP];
1876    uint8_t               firstActvDlBwpId;
1877    uint8_t               defaultDlBwpId;
1878    uint8_t               *bwpInactivityTmr;
1879    SchPdschServCellCfg     pdschServCellCfg;
1880    SchInitialUlBwp         initUlBwp;
1881    SchBeamFailRecoveryCfg  beamFailureRecoveryCfg;
1882    uint8_t                 numUlBwpToAdd;
1883    SchUlBwpInfo            ulBwpToAddList[MAX_NUM_BWP];
1884    uint8_t                 firstActvUlBwpId;
1885 }SchServCellCfgInfo;
1886
1887 typedef struct schNonDynFiveQi
1888 {
1889    uint16_t   fiveQi;
1890    uint8_t    priorLevel;
1891    uint16_t   avgWindow;
1892    uint16_t   maxDataBurstVol;
1893 }SchNonDynFiveQi;
1894
1895 typedef struct schDynFiveQi
1896 {
1897    uint8_t    priorLevel;
1898    uint16_t   packetDelayBudget;
1899    uint8_t    packetErrRateScalar;
1900    uint8_t    packetErrRateExp;
1901    uint16_t   fiveQi;
1902    uint8_t    delayCritical;
1903    uint16_t   avgWindow;
1904    uint16_t   maxDataBurstVol;
1905 }SchDynFiveQi;
1906
1907 typedef struct schNgRanAllocAndRetPri
1908 {
1909    uint8_t priorityLevel;
1910    uint8_t preEmptionCap;
1911    uint8_t preEmptionVul;
1912 }SchNgRanAllocAndRetPri;
1913
1914 typedef struct schGrbQosFlowInfo
1915 {
1916    uint32_t maxFlowBitRateDl;
1917    uint32_t maxFlowBitRateUl;
1918    uint32_t guarFlowBitRateDl;
1919    uint32_t guarFlowBitRateUl;
1920 }SchGrbQosFlowInfo;
1921
1922 /* DRB QoS */
1923 typedef struct schDrbQos
1924 {
1925    SchQosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1926    union
1927    {
1928       SchNonDynFiveQi   nonDyn5Qi;
1929       SchDynFiveQi      dyn5Qi;
1930    }u;
1931    SchNgRanAllocAndRetPri  ngRanRetPri;
1932    SchGrbQosFlowInfo       grbQosFlowInfo;
1933    uint16_t                pduSessionId;
1934    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
1935 }SchDrbQosInfo;
1936
1937 /* Special cell configuration */
1938 typedef struct schSpCellCfg
1939 {
1940    uint8_t           servCellIdx;
1941    SchServCellCfgInfo   servCellCfg;
1942 }SchSpCellCfg;
1943
1944 /* Special cell Reconfiguration */
1945 typedef struct schSpCellRecfg
1946 {
1947    uint8_t           servCellIdx;
1948    SchServCellRecfgInfo   servCellRecfg;
1949 }SchSpCellRecfg;
1950
1951 /* Uplink logical channel configuration */
1952 typedef struct SchUlLcCfg
1953 {
1954    uint8_t priority;
1955    uint8_t lcGroup;
1956    uint8_t schReqId;
1957    uint8_t pbr;        // prioritisedBitRate
1958    uint8_t bsd;        // bucketSizeDuration
1959 }SchUlLcCfg;
1960
1961 /* Downlink logical channel configuration */
1962 typedef struct schDlLcCfg
1963 {
1964    uint8_t lcp;      // logical Channel Prioritization
1965 }SchDlLcCfg;
1966
1967 /* Logical Channel configuration */
1968 typedef struct schLcCfg
1969 {
1970    uint8_t        lcId;
1971    Snssai         *snssai;
1972    SchDrbQosInfo  *drbQos;
1973    SchDlLcCfg     dlLcCfg;
1974    SchUlLcCfg     ulLcCfg;
1975 }SchLcCfg;
1976
1977 /* Aggregate max bit rate */
1978 typedef struct schAmbrCfg
1979 {
1980    uint32_t   ulBr;   /* Ul BitRate */
1981 }SchAmbrCfg;
1982
1983 typedef struct schModulationInfo
1984 {
1985    uint8_t      modOrder;
1986    uint8_t      mcsIndex;
1987    SchMcsTable  mcsTable;
1988 }SchModulationInfo;
1989
1990 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.5' UE Configuration Request*/
1991 typedef struct schUeCfgReq
1992 {
1993    uint16_t           cellId;
1994    uint8_t            beamIdx; 
1995    uint16_t           crnti;
1996    bool               macCellGrpCfgPres;
1997    SchMacCellGrpCfg   macCellGrpCfg;
1998    bool               phyCellGrpCfgPres;
1999    SchPhyCellGrpCfg   phyCellGrpCfg;
2000    bool               spCellCfgPres;
2001    SchSpCellCfg       spCellCfg;
2002    SchAmbrCfg         *ambrCfg;
2003    SchModulationInfo  dlModInfo;
2004    SchModulationInfo  ulModInfo;
2005    uint8_t            numLcsToAdd;
2006    SchLcCfg           schLcCfg[MAX_NUM_LC];
2007 }SchUeCfgReq;
2008
2009 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.6' UE Reconfiguration Request*/
2010 typedef struct schUeRecfgReq
2011 {
2012    uint16_t         cellId;
2013    uint8_t          beamIdx;
2014    uint16_t         crnti;
2015    bool             macCellGrpRecfgPres;
2016    SchMacCellGrpCfg macCellGrpRecfg;
2017    bool             phyCellGrpRecfgPres;
2018    SchPhyCellGrpCfg phyCellGrpRecfg;
2019    bool             spCellRecfgPres;
2020    SchSpCellRecfg   spCellRecfg;
2021    SchAmbrCfg       *ambrRecfg;
2022    SchModulationInfo  dlModInfo;
2023    SchModulationInfo  ulModInfo;
2024    uint8_t            numLcsToAdd;
2025    SchLcCfg           schLcCfgAdd[MAX_NUM_LC];
2026    uint8_t            numLcsToDel;
2027    uint8_t            lcIdToDel[MAX_NUM_LC];
2028    uint8_t            numLcsToMod;
2029    SchLcCfg           schLcCfgMod[MAX_NUM_LC];
2030    SchDataTransmission dataTransmissionInfo;
2031 #ifdef NR_DRX   
2032    bool     drxConfigIndicatorRelease;
2033 #endif
2034 }SchUeRecfgReq;
2035
2036 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.5 UE Confg Response*/
2037 typedef struct schUeCfgRsp
2038 {
2039    uint16_t   cellId;
2040    uint8_t    beamIdx;
2041    uint16_t   crnti;
2042    SchMacRsp  rsp;
2043    CauseOfResult cause;
2044 }SchUeCfgRsp;
2045
2046 /*As per WG8 V7.0.0 Sec 11.2.4.3.6, UE ReCFG and UECFG have same structure definition*/
2047 typedef struct schUeCfgRsp SchUeRecfgRsp;
2048
2049 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.7' Delete UE Request*/
2050 typedef struct schUeDelete
2051 {
2052    uint16_t   cellId;
2053    uint16_t   crnti;
2054 }SchUeDelete;
2055
2056 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.4.3.7*/
2057 typedef struct schUeDeleteRsp
2058 {
2059    uint16_t   cellId;
2060    uint16_t   crnti;
2061    SchMacRsp  rsp;
2062    CauseOfResult cause;
2063 }SchUeDeleteRsp;
2064
2065 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.8' DL HARQ Indication*/
2066 typedef struct dlHarqInd
2067 {
2068    uint16_t       cellId;
2069    uint16_t       crnti;
2070    SlotTimingInfo slotInd;
2071    uint8_t        numHarq;
2072    uint8_t        harqPayload[MAX_HARQ_BITS_IN_BYTES];
2073 }DlHarqInd;
2074
2075 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.9' UL HARQ (CRC) Indication*/
2076 typedef struct crcIndInfo
2077 {
2078    uint16_t       cellId;
2079    uint16_t       crnti;
2080    SlotTimingInfo timingInfo;
2081    uint16_t       numCrcInd;
2082    uint8_t        crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
2083 }CrcIndInfo;
2084
2085 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.10' UL Channel Quality Indication*/
2086 typedef struct ulCqiReport
2087 {
2088    CqiUlReportType  reportType;
2089    uint16_t ulCqi;
2090    uint8_t  timingAdv;
2091 }UlCqiReport;
2092
2093 typedef struct schUlCqiInd
2094 {
2095    uint16_t       cellId;
2096    uint16_t       crnti;
2097    SlotTimingInfo timingInfo;
2098    uint8_t        numUlCqiReported;
2099    UlCqiReport    ulCqiRpt;
2100 }SchUlCqiInd;
2101
2102 /*Spec O-RAN, WG8, V7.0.0, '11.2.4.2.11' DL Channel Quality Indication*/
2103 typedef struct dlCqiReport
2104 {
2105    uint8_t  reportType; /*Bitmap for CQI, PMI, RI, CRI report*/
2106    uint16_t cqi;
2107    uint16_t pmi;
2108    uint16_t cri;
2109    uint16_t ri;
2110 }DlCqiReport;
2111
2112 typedef struct schDlCqiInd
2113 {
2114    uint16_t       cellId;
2115    uint16_t       crnti;
2116    SlotTimingInfo timingInfo;
2117    uint8_t        numDlCqiReported;
2118    DlCqiReport    dlCqiRpt;
2119 }SchDlCqiInd;
2120
2121 /*Spec O-RAN WG8 v7.0.0, '11.2.4.2.12' Rach Ind contents*/
2122 typedef struct rachIndInfo
2123 {
2124    uint16_t    cellId;
2125    uint16_t    crnti;
2126    SlotTimingInfo timingInfo;
2127    uint8_t     slotIdx;
2128    uint8_t     symbolIdx;
2129    uint8_t     freqIdx;
2130    uint8_t     preambleIdx;
2131    uint16_t    timingAdv;
2132 }RachIndInfo;
2133
2134 /*Spec O-RAN WG8 v7.0.0, '11.2.4.2.13' Paging Ind contents*/
2135 typedef struct schPageInd
2136 {
2137    uint16_t  cellId;
2138    uint16_t  pf;
2139    uint8_t   i_s;
2140    uint16_t  pduLen;
2141    uint8_t  *pagePdu;
2142 }SchPageInd;
2143
2144 /*ORAN WG8 v7.0.0, Sec 11.2.4.2.14 Rach Res Request*/
2145 typedef struct schRachRsrcReq
2146 {
2147    SlotTimingInfo slotInd;
2148    uint16_t       cellId;
2149    uint16_t       crnti;
2150    uint8_t        numSsb;
2151    uint8_t        ssbIdx[MAX_NUM_SSB];
2152 }SchRachRsrcReq;
2153
2154 typedef struct schCfraSsbResource
2155 {
2156    uint8_t  ssbIdx;
2157    uint8_t  raPreambleIdx;
2158 }SchCfraSsbResource;
2159
2160 typedef struct schCfraRsrc
2161 {
2162    uint8_t   numSsb;
2163    SchCfraSsbResource ssbResource[MAX_NUM_SSB];
2164 }SchCfraResource;
2165
2166 typedef struct schRachRsrcRsp
2167 {
2168    uint16_t   cellId;
2169    uint16_t   crnti;
2170    SchMacRsp  result;
2171    SchCfraResource  cfraResource;
2172 }SchRachRsrcRsp;
2173
2174 /*ORAN WG8 v7.0.0, Sec 11.2.4.2.15 Rach Res Release*/
2175 typedef struct schRachRsrcRel
2176 {
2177    SlotTimingInfo slotInd;
2178    uint16_t   cellId;
2179    uint16_t   crnti;
2180    SchCfraResource  cfraResource;
2181 }SchRachRsrcRel;
2182
2183 /*O-RAN WG* v7.0.0 Sec 11.2.4.2.16 DL RLC Buffer Status Information*/
2184 typedef struct dlRlcBOInfo
2185 {
2186    uint16_t    cellId;
2187    uint16_t    crnti;
2188    uint8_t     lcId;
2189    uint32_t    dataVolume;
2190 }DlRlcBoInfo;
2191
2192 /*O-RAN WG8 v7.0.0 Sec 11.2.4.2.17 Scheduling Request Indication*/
2193 typedef struct srUciIndInfo
2194 {
2195    uint16_t    cellId;
2196    uint16_t    crnti;
2197    SlotTimingInfo slotInd;
2198    uint8_t     numSrBits;
2199    uint8_t     srPayload[MAX_SR_BITS_IN_BYTES];
2200 }SrUciIndInfo;
2201
2202 /*O-RAN WG* v7.0.0 Sec 11.2.4.2.18 UL RLC Buffer Status Information*/
2203 typedef struct dataVolInfo
2204 {
2205    uint8_t  lcgId;
2206    uint32_t dataVol;
2207 }DataVolInfo;
2208
2209 typedef struct ulBufferStatusRptInd
2210 {
2211    uint16_t    cellId;
2212    uint16_t    crnti;
2213    BsrType     bsrType;
2214    uint8_t     numLcg;
2215    DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
2216 }UlBufferStatusRptInd;
2217
2218 /**O-RAN WG* v7.0.0 Sec 11.2.4.2.19 Power Headroom Indication*/
2219 typedef struct phrData /*Spec 38.321 Sec 6.1.3.8*/
2220 {
2221    uint8_t phr;
2222    uint8_t pcmax_f_c;
2223 }PhrData;
2224
2225 typedef struct singlePhrInfo
2226 {
2227    PhrData  phrData;
2228 }SinglePhrInfo;
2229
2230 typedef struct multiPhr
2231 {
2232    PhType   phType;
2233    PhrData  phrData;
2234 }MultiPhr;
2235
2236 typedef struct multiplePhrInfo /*Spec 38.321 Sec 6.1.3.9*/
2237 {
2238    uint8_t  numPhrReported;
2239    MultiPhr multiPhrStat[MAX_PHR_REPORT];
2240 }MultiplePhrInfo;
2241
2242 typedef struct schPwrHeadroomInd
2243 {
2244    uint16_t    cellId;
2245    uint16_t    crnti;
2246    PhrType     phrType;
2247    union
2248    {
2249       SinglePhrInfo   singlePhr;
2250       MultiplePhrInfo multiPhr;
2251    }phrInfo;
2252 }SchPwrHeadroomInd;
2253
2254 typedef struct schUeHqInfo
2255 {
2256    uint16_t  crnti;
2257    uint8_t   hqProcId;
2258 }SchUeHqInfo;
2259
2260 typedef struct schRlsHqInfo
2261 {
2262    uint16_t     cellId;
2263    uint8_t      numUes;
2264    SchUeHqInfo  *ueHqInfo;
2265 }SchRlsHqInfo;
2266
2267 /* Statistics Request from MAC to SCH */
2268 typedef struct schStatsGrpInfo
2269 {
2270    uint8_t   groupId;
2271    uint16_t  periodicity;  /* In milliseconds */
2272    uint8_t   numStats;
2273    SchMeasurementType statsList[MAX_NUM_STATS];
2274 }SchStatsGrpInfo;
2275
2276 typedef struct schStatsReq
2277 {
2278    uint64_t  subscriptionId;
2279    uint8_t   numStatsGroup;
2280    SchStatsGrpInfo   statsGrpList[MAX_NUM_STATS_GRP];
2281 }SchStatsReq;
2282
2283 typedef struct schStatsReq SchStatsModificationReq;
2284 typedef struct schStatsRsp SchStatsModificationRsp;
2285
2286 /* Statistics Response from SCH to MAC */
2287 typedef struct schStatsGrpRejected
2288 {
2289    uint8_t   groupId;
2290    CauseOfResult cause;
2291 }SchStatsGrpRejected;
2292
2293 typedef struct schStatsRsp
2294 {
2295    uint64_t             subscriptionId;
2296    uint8_t              numGrpAccepted;
2297    uint8_t              statsGrpAcceptedList[MAX_NUM_STATS_GRP];
2298    uint8_t              numGrpRejected;
2299    SchStatsGrpRejected  statsGrpRejectedList[MAX_NUM_STATS_GRP];
2300 }SchStatsRsp;
2301
2302 /* Statistics Indication from SCH to MAC */
2303 typedef struct schStats
2304 {
2305    SchMeasurementType type;
2306    double value;
2307 }SchStats;
2308
2309 typedef struct schStatsInd
2310 {
2311    uint64_t    subscriptionId;
2312    uint8_t     groupId;
2313    uint8_t     numStats;
2314    SchStats    measuredStatsList[MAX_NUM_STATS];
2315 }SchStatsInd;
2316
2317 typedef struct schStatsDeleteReq
2318 {
2319    uint64_t  subscriptionId;
2320    uint8_t   numStatsGroupToBeDeleted;
2321    uint8_t   statsGrpIdToBeDelList[MAX_NUM_STATS_GRP];
2322 }SchStatsDeleteReq;
2323
2324 typedef struct statsDeleteResult
2325 {
2326    uint8_t       groupId;
2327    SchMacRsp     statsGrpDelRsp;
2328    CauseOfResult statsGrpDelCause;
2329 }StatsDeleteResult;
2330
2331 typedef struct schStatsDeleteRsp
2332 {
2333    uint64_t          subscriptionId; /* subscription Id */
2334    SchMacRsp         subsDelRsp;    /* deletion status of all statsGrp with given subscriptionId */
2335    CauseOfResult     subsDelCause;  /* cause of failure in deletion of all statsGrp with given subscriptionId*/
2336    uint8_t           numStatsGroupDeleted; /* num of action deleted */ 
2337    StatsDeleteResult statsGrpDelInfo[MAX_NUM_STATS_GRP]; /* list of the deletion status for specific actions */
2338 }SchStatsDeleteRsp;
2339
2340 /* function declarations */
2341 uint8_t MacMessageRouter(Pst *pst, void *msg);
2342 uint8_t SchMessageRouter(Pst *pst, void *msg);
2343
2344 /**********************************************************************
2345   End of file
2346  **********************************************************************/
2347