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