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