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