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