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