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