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