[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-492] WG8 Alignment [RAR Scheduling + Downlink...
[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    uint8_t         RAPID;
962    uint16_t        ta;
963    Msg3UlGrant     ulGrant;
964    uint16_t        tcrnti;
965    uint8_t         rarPdu[RAR_PAYLOAD_SIZE];
966    uint8_t         rarPduLen;
967 }RarInfo;
968
969 typedef struct rarAlloc
970 {
971    uint16_t   raRnti;
972    RarInfo    rarInfo;
973    BwpCfg     bwp;
974    PdcchCfg   *rarPdcchCfg;
975    PdschCfg   *rarPdschCfg;
976 }RarAlloc;
977
978 typedef struct lcSchInfo
979 {
980    uint8_t   lcId;
981    uint32_t  schBytes; 
982 }LcSchInfo;
983
984 typedef struct ceSchInfo
985 {
986    uint8_t   ceLcId;
987    uint8_t   *ceContent; 
988 }CeSchInfo;
989
990 typedef struct freqDomainAlloc
991 {
992    uint8_t          resAllocType; /* Resource allocation type */
993    union
994    {
995       ResAllocType0    type0;
996       ResAllocType1    type1;
997    }resAlloc;
998 }FreqDomainAlloc;
999
1000 typedef struct transportBlock
1001 {
1002    uint8_t    mcs;       
1003    bool       ndi;       
1004    uint8_t    rv;        
1005    uint16_t   tbSize;    
1006    uint8_t    numCe;
1007    CeSchInfo  ceSchInfo[MAX_NUM_LC]; 
1008    uint8_t    numLc;
1009    LcSchInfo  lcSchInfo[MAX_NUM_LC]; 
1010 }TransportBlock;
1011
1012 typedef struct dlMsgSchedInfo
1013 {
1014    uint16_t        crnti;
1015    uint8_t         dciFormatId;
1016    uint8_t         harqProcNum;
1017    bool            vrbPrbMapping;
1018    uint8_t         dlAssignIdx;
1019    uint8_t         pucchTpc;
1020    uint8_t         pucchResInd;
1021    uint8_t         harqFeedbackInd;
1022    uint16_t        dlMsgPduLen;
1023    uint8_t         *dlMsgPdu;
1024    FreqDomainAlloc freqAlloc;
1025    TimeDomainAlloc timeAlloc;
1026    uint8_t         numOfTbs;
1027    TransportBlock  transportBlock[2];
1028    BwpCfg          bwp;
1029    PdcchCfg        *dlMsgPdcchCfg;
1030    PdschCfg        *dlMsgPdschCfg;
1031 }DlMsgSchInfo;
1032
1033 typedef struct schSlotValue
1034 {
1035    SlotTimingInfo currentTime;
1036    SlotTimingInfo broadcastTime;
1037    SlotTimingInfo rarTime;
1038    SlotTimingInfo dlMsgTime;
1039    SlotTimingInfo ulDciTime;
1040 }SchSlotValue;
1041
1042
1043 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-36 DCI Format0_0 Configuration */
1044 typedef struct format0_0
1045 {
1046    uint8_t         resourceAllocType;
1047    FreqDomainAlloc freqAlloc;
1048    TimeDomainAlloc timeAlloc;
1049    uint16_t        rowIndex;
1050    uint8_t         mcs;
1051    uint8_t         harqProcId;  
1052    bool            freqHopFlag;
1053    uint8_t         ndi;    
1054    uint8_t         rvIndex;     
1055    uint8_t         tpcCmd;
1056    bool            sulIndicator;
1057 }Format0_0;
1058
1059 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Table 9-40 DCI Format 0_1 Configuration */
1060 typedef struct format0_1
1061 {
1062    uint8_t         carrierIndicator;
1063    bool            sulIndicator;
1064    uint8_t         bwpIndicator;
1065    uint8_t         resourceAlloc;
1066    FreqDomainRsrc  freqAlloc;
1067    TimeDomainAlloc timeAlloc;
1068    uint16_t        rowIndex;
1069    uint8_t         mcs;
1070    uint8_t         harqProcId;  
1071    bool            freqHopFlag;
1072    uint8_t         ndi;   
1073    uint8_t         rvIndex;    
1074    uint8_t         firstDownlinkAssignmentIndex;
1075    uint8_t         secondDownlinkAssignmentIndex;
1076    uint8_t         tpcCommand;
1077    uint8_t         srsResourceSetIndicator;
1078    uint8_t         srsResourceIndicator;
1079    uint8_t         tpmi;
1080    uint8_t         antennaPorts;
1081    uint8_t         srsRequest;
1082    uint8_t         csiRequest;
1083    uint8_t         cbgTransmissionInfo;
1084    uint8_t         ptrsDmrs;
1085    uint8_t         betaOffsetIndicator;
1086    bool            dmrsSequenceInitialization;
1087    bool            ulschIndicatior;
1088 }Format0_1;
1089
1090 typedef struct dciFormat
1091 {
1092    FormatType     formatType;     /* DCI Format */
1093    union
1094    {
1095       Format0_0  format0_0;      /* Format 0_0 */
1096       Format0_1  format0_1;      /* Format 0_1 */
1097    }format;
1098 }DciFormat;
1099
1100 typedef struct dciInfo
1101 {
1102    uint16_t       crnti;          /* CRNTI */
1103    BwpCfg         bwpCfg;         /* BWP Cfg */
1104    CoresetCfg     coresetCfg;     /* Coreset1 Cfg */
1105    DciFormat      dciFormatInfo;  /* Dci Format */
1106    DlDCI          dciInfo;        /* DlDCI */
1107 }DciInfo;
1108
1109
1110 /* Reference -> O-RAN.WG8.AAD.0-v07.00, Section 11.2.4.3.8 DL Scheduling Information */
1111 typedef struct dlSchedInfo
1112 {
1113    uint16_t     cellId;  /* Cell Id */
1114    SchSlotValue schSlotValue;
1115
1116    /* Allocation for broadcast messages */
1117    bool isBroadcastPres;
1118    DlBrdcstAlloc brdcstAlloc;
1119
1120    /* Allocation for RAR message */
1121    RarAlloc *rarAlloc[MAX_NUM_UE];
1122
1123    /* UL grant in response to BSR */
1124    DciInfo    *ulGrant;
1125
1126    /* Allocation from dedicated DL msg */
1127    DlMsgSchInfo *dlMsgAlloc[MAX_NUM_UE];
1128
1129 }DlSchedInfo;
1130
1131 /*Reference: O-RAN.WG8.AAD.v7.0.0, Sec 11.2.3.3.13 Downlink Paging Allocation*/
1132 typedef struct interleaved_t
1133 {
1134    uint8_t regBundleSize;
1135    uint8_t interleaverSize;
1136    uint16_t shiftIndex;
1137 }Interleaved;
1138
1139 typedef struct pageDlDci
1140 {
1141    uint8_t    freqDomainResource[6];
1142    uint8_t    durationSymbols;
1143    uint8_t    cceRegMappingType;
1144    union
1145    {
1146       Interleaved  interleaved;
1147       uint8_t      nonInterleaved;
1148    }cceReg;
1149    uint8_t    ssStartSymbolIndex;
1150    uint8_t    cceIndex;
1151    uint8_t    aggregLevel;
1152    uint8_t    precoderGranularity;
1153    uint8_t    coreSetSize;
1154 }PageDlDci;
1155
1156 typedef struct resAllocType1 PageFreqDomainAlloc;
1157
1158 typedef struct pageTimeDomainAlloc
1159 {
1160    uint8_t mappingType;
1161    uint16_t startSymb;
1162    uint16_t numSymb;
1163 }PageTimeDomainAlloc;
1164
1165 typedef struct pageDmrsConfig
1166 {
1167    uint8_t dmrsType;
1168    uint8_t dmrsAddPos;
1169    uint8_t nrOfDmrsSymbols;
1170 }PageDmrsConfig;
1171
1172 typedef struct pageTbInfo
1173 {
1174    uint8_t         mcs;
1175    uint32_t        tbSize;
1176 }PageTbInfo;
1177
1178 typedef struct pageDlSch
1179 {
1180    PageFreqDomainAlloc  freqAlloc;
1181    PageTimeDomainAlloc  timeAlloc;
1182    PageDmrsConfig       dmrs;
1183    uint8_t              vrbPrbMapping;
1184    PageTbInfo           tbInfo;
1185    uint8_t              tbScaling;
1186    uint16_t             dlPagePduLen;
1187    uint8_t             *dlPagePdu;
1188 }PageDlSch;
1189
1190 typedef struct dlPageAlloc
1191 {
1192    uint16_t       cellId;
1193    SlotTimingInfo dlPageTime;
1194    uint8_t        ssbIdx;
1195    bool           shortMsgInd;
1196    uint8_t        shortMsg;
1197    BwpCfg         bwp;
1198    PageDlDci      pageDlDci;
1199    PageDlSch      pageDlSch;
1200 }DlPageAlloc;
1201
1202 typedef struct tbInfo
1203 {
1204    uint8_t      mcs;       /* MCS */
1205    uint8_t      ndi;       /* NDI */
1206    uint8_t      rv;        /* Redundancy Version */
1207    uint16_t     tbSize;    /* TB Size */
1208    uint8_t      qamOrder;  /* Modulation Order */
1209    SchMcsTable  mcsTable;  /* MCS Table */
1210 }TbInfo;
1211
1212 typedef struct schPuschInfo
1213 {
1214    uint8_t          harqProcId;   /* HARQ Process ID */
1215    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
1216    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
1217    TbInfo           tbInfo;       /* TB info */
1218 #ifdef INTEL_FAPI    
1219    uint8_t          dmrsMappingType;
1220    uint8_t          nrOfDmrsSymbols;
1221    uint8_t          dmrsAddPos;
1222 #endif
1223 }SchPuschInfo;
1224
1225 typedef struct harqInfo
1226 {
1227    uint16_t    harqAckBitLength;
1228    uint8_t     betaOffsetHarqAck;
1229 }HarqInfo;
1230
1231 typedef struct csiInfo
1232 {
1233    uint16_t csiBits;
1234    uint8_t  betaOffsetCsi;
1235 }CsiInfo;
1236
1237 typedef struct harqAckInfo
1238 {
1239    uint16_t    harqBitLength;
1240 }HarqFdbkInfo;
1241
1242 typedef struct csiPartInfo
1243 {
1244    uint16_t csiBits;
1245 }csiFdbkInfo;
1246
1247 typedef struct schPucchFormatCfg
1248 {
1249    uint8_t interSlotFreqHop;
1250    uint8_t addDmrs;
1251    uint8_t maxCodeRate;
1252    uint8_t numSlots;
1253    bool    pi2BPSK;
1254    bool    harqAckCSI;
1255 }SchPucchFormatCfg;
1256
1257 typedef struct schPucchInfo
1258 {
1259    FreqDomainAlloc  fdAlloc;      
1260    TimeDomainAlloc  tdAlloc;      
1261    uint8_t          srFlag;
1262    HarqFdbkInfo     harqInfo;
1263    csiFdbkInfo      csiInfo;
1264    BeamformingInfo  beamPucchInfo;
1265    uint8_t          pucchFormat;
1266    uint8_t          intraFreqHop;
1267    uint16_t         secondPrbHop;
1268    uint8_t          initialCyclicShift;
1269    uint8_t          occLen;
1270    uint8_t          occIdx;
1271    uint8_t          timeDomOCC;
1272    uint8_t          addDmrs;
1273    bool             pi2BPSK;
1274 }SchPucchInfo;
1275
1276 typedef struct schPuschUci
1277 {
1278    uint8_t          harqProcId;   /* HARQ Process ID */
1279    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
1280    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
1281    TbInfo           tbInfo;       /* TB information */
1282    HarqInfo         harqInfo;    /* Harq Information */
1283    CsiInfo          csiInfo;    /* Csi information*/
1284 }SchPuschUci;
1285
1286 typedef struct ulSchedInfo
1287 {
1288    uint16_t         cellId;         /* Cell Id */
1289    uint16_t         crnti;          /* CRNI */
1290    SlotTimingInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
1291    uint8_t          dataType;       /* Type of info being scheduled */
1292    SchPrachInfo     prachSchInfo;   /* Prach scheduling info */
1293    SchPuschInfo     schPuschInfo;   /* Pusch scheduling info */
1294    SchPuschUci      schPuschUci;    /* Pusch Uci */
1295    SchPucchInfo     schPucchInfo;   /* Pucch and Uci scheduling info */
1296 }UlSchedInfo;
1297
1298 typedef struct rachIndInfo
1299 {
1300    uint16_t    cellId;
1301    uint16_t    crnti;
1302    SlotTimingInfo timingInfo;
1303    uint8_t     slotIdx;
1304    uint8_t     symbolIdx;
1305    uint8_t     freqIdx;
1306    uint8_t     preambleIdx;
1307    uint16_t    timingAdv;
1308 }RachIndInfo;
1309
1310
1311 typedef struct crcIndInfo
1312 {
1313    uint16_t    cellId;
1314    uint16_t    crnti;
1315    SlotTimingInfo timingInfo;
1316    uint16_t    numCrcInd;
1317    uint8_t     crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
1318 }CrcIndInfo;
1319
1320 typedef struct boInfo
1321 {
1322    uint8_t   lcId;
1323    uint32_t  dataVolume;
1324 }BOInfo;
1325
1326 typedef struct dlRlcBOInfo
1327 {
1328    uint16_t    cellId;
1329    uint16_t    crnti;
1330    uint8_t     lcId;
1331    uint32_t    dataVolume;
1332 }DlRlcBoInfo;
1333
1334 /* Info of Scheduling Request to Add/Modify */
1335 typedef struct schSchedReqInfo
1336 {
1337    uint8_t              schedReqId;
1338    SchSrProhibitTimer   srProhibitTmr;
1339    SchSrTransMax        srTransMax;
1340 }SchSchedReqInfo;
1341
1342 /* Scheduling Request Configuration */
1343 typedef struct schSchedReqCfg
1344 {
1345    uint8_t          addModListCount;
1346    SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
1347    uint8_t          relListCount;
1348    uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
1349 }SchSchedReqCfg;
1350
1351 /* Info of Tag to Add/Modify */
1352 typedef struct schTagInfo
1353 {
1354    uint8_t       tagId;
1355    SchTimeAlignmentTimer  timeAlignmentTmr;
1356 }SchTagInfo;
1357
1358 /* Timing Advance Group Configuration */
1359 typedef struct schTagCfg
1360 {
1361    uint8_t      addModListCount;
1362    SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
1363    uint8_t      relListCount;
1364    uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
1365 }SchTagCfg;
1366
1367 /* Configuration for Power headroom reporting */
1368 typedef struct schPhrCfg
1369 {
1370    SchPhrPeriodicTimer       periodicTmr;
1371    SchPhrProhibitTimer       prohibitTmr;
1372    SchPhrTxPwrFactorChange   txpowerFactorChange;
1373    bool                      multiplePhr;
1374    bool                      dummy;
1375    bool                      type2OtherCell;
1376    SchPhrModeOtherCG         modeOtherCG;
1377 }SchPhrCfg;
1378
1379 /* MAC cell Group configuration */
1380 typedef struct schMacCellGrpCfg
1381 {
1382    SchSchedReqCfg   schedReqCfg;
1383    SchTagCfg        tagCfg;
1384    SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
1385 #ifdef NR_DRX
1386    bool             drxCfgPresent;
1387    SchDrxCfg        drxCfg;          /* Drx configuration */
1388 #endif
1389 }SchMacCellGrpCfg;
1390
1391 /* Physical Cell Group Configuration */
1392 typedef struct schPhyCellGrpCfg
1393 {
1394    SchPdschHarqAckCodebook    pdschHarqAckCodebook;
1395    int8_t     pNrFr1;
1396 }SchPhyCellGrpCfg;
1397
1398 /* Control resource set info */
1399 typedef struct schControlRsrcSet
1400 {
1401    uint8_t             cRSetId;                /* Control resource set id */
1402    uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
1403    uint8_t             duration;
1404    SchREGMappingType   cceRegMappingType;
1405    SchPrecoderGranul   precoderGranularity;
1406    uint16_t            dmrsScramblingId;
1407 }SchControlRsrcSet;
1408
1409 /* Search Space info */
1410 typedef struct schSearchSpace
1411 {
1412    uint8_t                  searchSpaceId;
1413    uint8_t                  cRSetId;
1414    SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1415    uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1416    SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1417    SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1418    SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1419    SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1420    SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1421    SchSearchSpaceType       searchSpaceType;
1422    uint8_t                  ueSpecificDciFormat;
1423 }SchSearchSpace;
1424
1425 /* PDCCH cofniguration */
1426 typedef struct schPdcchConfig
1427 {
1428    uint8_t           numCRsetToAddMod;
1429    SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1430    uint8_t           numCRsetToRel;
1431    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1432    uint8_t           numSearchSpcToAddMod;
1433    SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1434    uint8_t           numSearchSpcToRel;
1435    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1436 }SchPdcchConfig;
1437
1438 /* PDSCH time domain resource allocation */
1439 typedef struct schPdschTimeDomRsrcAlloc
1440 {
1441    uint8_t    *k0;
1442    SchTimeDomRsrcAllocMappingType    mappingType;
1443    uint8_t    startSymbol;
1444    uint8_t    symbolLength;
1445 }SchPdschTimeDomRsrcAlloc;
1446
1447
1448 typedef struct schPdschBundling
1449 {
1450    struct schStaticBundling
1451    {
1452      SchBundlingSizeSet2 size;
1453    }SchStaticBundling;
1454    struct schDynamicBundling
1455    {
1456      SchBundlingSizeSet1 sizeSet1;
1457      SchBundlingSizeSet2 sizeSet2;
1458    }SchDynamicBundling;
1459 }SchPdschBundling;
1460
1461 /* DMRS downlink configuration */
1462 typedef struct schDmrsDlCfg
1463 {
1464    SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
1465 }SchDmrsDlCfg;
1466
1467 /* PDSCH Configuration */
1468 typedef struct schPdschConfig
1469 {
1470    SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1471    SchResourceAllocType       resourceAllocType;
1472    uint8_t                    numTimeDomRsrcAlloc;
1473    SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1474    SchRBGSize                 rbgSize;
1475    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1476    SchBundlingType            bundlingType;
1477    SchPdschBundling           bundlingInfo;
1478 }SchPdschConfig;
1479
1480 /* Initial Downlink BWP */
1481 typedef struct schInitalDlBwp
1482 {
1483    bool             pdcchCfgPres;
1484    SchPdcchConfig   pdcchCfg;
1485    bool             pdschCfgPres;
1486    SchPdschConfig   pdschCfg;
1487    bool             k0K1TblPrsnt;
1488    SchK0K1TimingInfoTbl k0K1InfoTbl;
1489 }SchInitalDlBwp;
1490
1491 /* BWP Downlink common */
1492 typedef struct schBwpDlCommon
1493 {
1494 }SchBwpDlCommon;
1495
1496 /* Downlink BWP information */
1497 typedef struct schDlBwpInfo
1498 {
1499    uint8_t          bwpId;
1500 }SchDlBwpInfo;
1501
1502 /* PDCCH Serving Cell configuration */
1503 typedef struct schPdschServCellCfg
1504 {
1505    uint8_t                  *maxMimoLayers;           
1506    SchNumHarqProcForPdsch   numHarqProcForPdsch;
1507    SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
1508    bool                     *codeBlkGrpFlushInd;
1509    SchPdschXOverhead        *xOverhead;
1510 }SchPdschServCellCfg;
1511
1512 /* PUCCH Configuration */
1513 typedef struct schPucchResrcSetInfo
1514 {
1515    uint8_t resrcSetId;
1516    uint8_t resrcListCount;
1517    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1518    uint8_t maxPayLoadSize;
1519 }SchPucchResrcSetInfo;
1520
1521 typedef struct schPucchResrcSetCfg
1522 {
1523    uint8_t resrcSetToAddModListCount;
1524    SchPucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1525    uint8_t resrcSetToRelListCount;
1526    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1527 }SchPucchResrcSetCfg;
1528
1529 typedef struct schPucchFormat0
1530 {
1531    uint8_t initialCyclicShift;
1532    uint8_t numSymbols;
1533    uint8_t startSymbolIdx;
1534 }SchPucchFormat0;
1535
1536 typedef struct schPucchFormat1
1537 {
1538    uint8_t initialCyclicShift;
1539    uint8_t numSymbols;
1540    uint8_t startSymbolIdx;
1541    uint8_t timeDomOCC;
1542 }SchPucchFormat1;
1543
1544 typedef struct schPucchFormat2_3
1545 {
1546    uint8_t numPrbs;
1547    uint8_t numSymbols;
1548    uint8_t startSymbolIdx;
1549 }SchPucchFormat2_3;
1550
1551 typedef struct schPucchFormat4
1552 {
1553    uint8_t numSymbols;
1554    uint8_t occLen;
1555    uint8_t occIdx;
1556    uint8_t startSymbolIdx;
1557 }SchPucchFormat4;
1558
1559 typedef struct schPucchResrcInfo
1560 {
1561    uint8_t  resrcId;
1562    uint16_t startPrb;
1563    uint8_t  intraFreqHop;
1564    uint16_t secondPrbHop;
1565    uint8_t  pucchFormat;
1566    union{
1567       SchPucchFormat0   *format0; 
1568       SchPucchFormat1   *format1;
1569       SchPucchFormat2_3 *format2;
1570       SchPucchFormat2_3 *format3;
1571       SchPucchFormat4   *format4;
1572    }SchPucchFormat;
1573 }SchPucchResrcInfo;
1574
1575 typedef struct schPucchResrcCfg
1576 {
1577    uint8_t resrcToAddModListCount;
1578    SchPucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1579    uint8_t resrcToRelListCount;
1580    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1581 }SchPucchResrcCfg;
1582
1583
1584 typedef struct schSchedReqResrcInfo
1585 {
1586    uint8_t resrcId;
1587    uint8_t requestId;
1588    uint8_t periodicity;
1589    uint16_t offset;
1590    uint8_t resrc;
1591 }SchSchedReqResrcInfo;
1592
1593 typedef struct schPucchSchedReqCfg
1594 {
1595    uint8_t           schedAddModListCount;
1596    SchSchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1597    uint8_t           schedRelListCount;
1598    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1599 }SchPucchSchedReqCfg;
1600
1601 typedef struct schSpatialRelationInfo
1602 {
1603    uint8_t spatialRelationId;
1604    uint8_t servCellIdx;
1605    uint8_t pathLossRefRSId;
1606    uint8_t p0PucchId;
1607    uint8_t closeLoopIdx;
1608 }SchSpatialRelationInfo;
1609
1610 typedef struct schPucchSpatialCfg
1611 {
1612    uint8_t spatialAddModListCount;
1613    SchSpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1614    uint8_t spatialRelListCount;
1615    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1616 }SchPucchSpatialCfg;
1617
1618 typedef struct schP0PucchCfg
1619 {
1620    uint8_t p0PucchId;
1621    int     p0PucchVal;
1622 }SchP0PucchCfg;
1623
1624 typedef struct schPathLossRefRSCfg
1625 {
1626    uint8_t pathLossRefRSId;
1627 }SchPathLossRefRSCfg;
1628
1629 typedef struct schPucchMultiCsiCfg
1630 {
1631    uint8_t  multiCsiResrcListCount;
1632    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1633 }SchPucchMultiCsiCfg;
1634
1635 typedef struct schPucchDlDataToUlAck
1636 {
1637    uint8_t  dlDataToUlAckListCount;
1638    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1639 }SchPucchDlDataToUlAck;
1640
1641 typedef struct schPucchPowerControl
1642 {
1643    int deltaF_Format0;
1644    int deltaF_Format1;
1645    int deltaF_Format2;
1646    int deltaF_Format3;
1647    int deltaF_Format4;
1648    uint8_t p0SetCount;
1649    SchP0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1650    uint8_t pathLossRefRSListCount;
1651    SchPathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1652 }SchPucchPowerControl;
1653
1654 typedef struct schPucchCfg
1655 {
1656    SchPucchResrcSetCfg   *resrcSet;
1657    SchPucchResrcCfg      *resrc;
1658    SchPucchFormatCfg     *format1; 
1659    SchPucchFormatCfg     *format2; 
1660    SchPucchFormatCfg     *format3; 
1661    SchPucchFormatCfg     *format4;
1662    SchPucchSchedReqCfg   *schedReq;
1663    SchPucchMultiCsiCfg   *multiCsiCfg;
1664    SchPucchSpatialCfg    *spatialInfo;
1665    SchPucchDlDataToUlAck *dlDataToUlAck;
1666    SchPucchPowerControl  *powerControl;
1667 }SchPucchCfg;
1668
1669 /* Transform precoding disabled */
1670 typedef struct schTransPrecodDisabled
1671 {
1672    uint16_t   scramblingId0;
1673 }SchTransPrecodDisabled;
1674
1675 /* DMRS Uplink configuration */
1676 typedef struct SchDmrsUlCfg
1677 {
1678    SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
1679    SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
1680 }SchDmrsUlCfg;
1681
1682 /* PUSCH Configuration */
1683 typedef struct schPuschCfg
1684 {
1685    uint8_t                    dataScramblingId;
1686    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1687    SchResourceAllocType       resourceAllocType;
1688    uint8_t                    numTimeDomRsrcAlloc;
1689    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1690    SchTransformPrecoder       transformPrecoder;
1691 }SchPuschCfg;
1692
1693 /* Initial Uplink BWP */
1694 typedef struct schInitialUlBwp
1695 {
1696    bool          pucchCfgPres;
1697    SchPucchCfg   pucchCfg;
1698    bool          puschCfgPres;
1699    SchPuschCfg   puschCfg;
1700    bool          k2TblPrsnt;
1701    SchK2TimingInfoTbl k2InfoTbl;
1702 }SchInitialUlBwp;
1703
1704 /* Uplink BWP information */
1705 typedef struct schUlBwpInfo
1706 {
1707    uint8_t        bwpId;
1708 }SchUlBwpInfo;
1709
1710 /* Serving cell configuration */
1711 typedef struct schServCellRecfgInfo
1712 {
1713    SchInitalDlBwp        initDlBwp;
1714    uint8_t               numDlBwpToAddOrMod;
1715    SchDlBwpInfo          dlBwpToAddOrModList[MAX_NUM_BWP];
1716    uint8_t               numDlBwpToRel;
1717    SchDlBwpInfo          dlBwpToRelList[MAX_NUM_BWP];
1718    uint8_t               firstActvDlBwpId;
1719    uint8_t               defaultDlBwpId;
1720    uint8_t               *bwpInactivityTmr;
1721    SchPdschServCellCfg   pdschServCellCfg;
1722    SchInitialUlBwp       initUlBwp;
1723    uint8_t               numUlBwpToAddOrMod;
1724    SchUlBwpInfo          ulBwpToAddOrModList[MAX_NUM_BWP];
1725    uint8_t               numUlBwpToRel;
1726    SchUlBwpInfo          ulBwpToRelList[MAX_NUM_BWP];
1727    uint8_t               firstActvUlBwpId;
1728 }SchServCellRecfgInfo;
1729
1730 /* Serving cell configuration */
1731 typedef struct schServCellCfgInfo
1732 {
1733    SchInitalDlBwp        initDlBwp;
1734    uint8_t               numDlBwpToAdd;
1735    SchDlBwpInfo          dlBwpToAddList[MAX_NUM_BWP];
1736    uint8_t               firstActvDlBwpId;
1737    uint8_t               defaultDlBwpId;
1738    uint8_t               *bwpInactivityTmr;
1739    SchPdschServCellCfg   pdschServCellCfg;
1740    SchInitialUlBwp       initUlBwp;
1741    uint8_t               numUlBwpToAdd;
1742    SchUlBwpInfo          ulBwpToAddList[MAX_NUM_BWP];
1743    uint8_t               firstActvUlBwpId;
1744 }SchServCellCfgInfo;
1745
1746 typedef struct schNonDynFiveQi
1747 {
1748    uint16_t   fiveQi;
1749    uint8_t    priorLevel;
1750    uint16_t   avgWindow;
1751    uint16_t   maxDataBurstVol;
1752 }SchNonDynFiveQi;
1753
1754 typedef struct schDynFiveQi
1755 {
1756    uint8_t    priorLevel;
1757    uint16_t   packetDelayBudget;
1758    uint8_t    packetErrRateScalar;
1759    uint8_t    packetErrRateExp;
1760    uint16_t   fiveQi;
1761    uint8_t    delayCritical;
1762    uint16_t   avgWindow;
1763    uint16_t   maxDataBurstVol;
1764 }SchDynFiveQi;
1765
1766 typedef struct schNgRanAllocAndRetPri
1767 {
1768    uint8_t priorityLevel;
1769    uint8_t preEmptionCap;
1770    uint8_t preEmptionVul;
1771 }SchNgRanAllocAndRetPri;
1772
1773 typedef struct schGrbQosFlowInfo
1774 {
1775    uint32_t maxFlowBitRateDl;
1776    uint32_t maxFlowBitRateUl;
1777    uint32_t guarFlowBitRateDl;
1778    uint32_t guarFlowBitRateUl;
1779 }SchGrbQosFlowInfo;
1780
1781 /* DRB QoS */
1782 typedef struct schDrbQos
1783 {
1784    SchQosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1785    union
1786    {
1787       SchNonDynFiveQi   nonDyn5Qi;
1788       SchDynFiveQi      dyn5Qi;
1789    }u;
1790    SchNgRanAllocAndRetPri  ngRanRetPri;
1791    SchGrbQosFlowInfo       grbQosFlowInfo;
1792    uint16_t                pduSessionId;
1793    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
1794 }SchDrbQosInfo;
1795
1796 /* Special cell configuration */
1797 typedef struct schSpCellCfg
1798 {
1799    uint8_t           servCellIdx;
1800    SchServCellCfgInfo   servCellCfg;
1801 }SchSpCellCfg;
1802
1803 /* Special cell Reconfiguration */
1804 typedef struct schSpCellRecfg
1805 {
1806    uint8_t           servCellIdx;
1807    SchServCellRecfgInfo   servCellRecfg;
1808 }SchSpCellRecfg;
1809
1810 /* Uplink logical channel configuration */
1811 typedef struct SchUlLcCfg
1812 {
1813    uint8_t priority;
1814    uint8_t lcGroup;
1815    uint8_t schReqId;
1816    uint8_t pbr;        // prioritisedBitRate
1817    uint8_t bsd;        // bucketSizeDuration
1818 }SchUlLcCfg;
1819
1820 /* Downlink logical channel configuration */
1821 typedef struct schDlLcCfg
1822 {
1823    uint8_t lcp;      // logical Channel Prioritization
1824 }SchDlLcCfg;
1825
1826 /* Logical Channel configuration */
1827 typedef struct schLcCfg
1828 {
1829    uint8_t        lcId;
1830    Snssai         *snssai;
1831    SchDrbQosInfo  *drbQos;
1832    SchDlLcCfg     dlLcCfg;
1833    SchUlLcCfg     ulLcCfg;
1834 }SchLcCfg;
1835
1836 /* Aggregate max bit rate */
1837 typedef struct schAmbrCfg
1838 {
1839    uint32_t   ulBr;   /* Ul BitRate */
1840 }SchAmbrCfg;
1841
1842 typedef struct schModulationInfo
1843 {
1844    uint8_t      modOrder;
1845    uint8_t      mcsIndex;
1846    SchMcsTable  mcsTable;
1847 }SchModulationInfo;
1848
1849 /* UE configuration */
1850 typedef struct schUeCfgReq
1851 {
1852    uint16_t        cellId;
1853    uint8_t         ueId;
1854    uint8_t         beamIdx; 
1855    uint16_t        crnti;
1856    bool macCellGrpCfgPres;
1857    SchMacCellGrpCfg   macCellGrpCfg;
1858    bool phyCellGrpCfgPres;
1859    SchPhyCellGrpCfg   phyCellGrpCfg;
1860    bool spCellCfgPres;
1861    SchSpCellCfg       spCellCfg;
1862    SchAmbrCfg         *ambrCfg;
1863    SchModulationInfo  dlModInfo;
1864    SchModulationInfo  ulModInfo;
1865    uint8_t            numLcsToAdd;
1866    SchLcCfg           schLcCfg[MAX_NUM_LC];
1867 }SchUeCfgReq;
1868
1869 /* UE Re-configuration */
1870 typedef struct schUeRecfgReq
1871 {
1872    uint16_t         cellId;
1873    uint8_t          ueId;
1874    uint8_t          beamIdx;
1875    uint16_t         crnti;
1876    bool             macCellGrpRecfgPres;
1877    SchMacCellGrpCfg macCellGrpRecfg;
1878    bool             phyCellGrpRecfgPres;
1879    SchPhyCellGrpCfg phyCellGrpRecfg;
1880    bool             spCellRecfgPres;
1881    SchSpCellRecfg   spCellRecfg;
1882    SchAmbrCfg       *ambrRecfg;
1883    SchModulationInfo  dlModInfo;
1884    SchModulationInfo  ulModInfo;
1885    uint8_t            numLcsToAdd;
1886    SchLcCfg           schLcCfgAdd[MAX_NUM_LC];
1887    uint8_t            numLcsToDel;
1888    uint8_t            lcIdToDel[MAX_NUM_LC];
1889    uint8_t            numLcsToMod;
1890    SchLcCfg           schLcCfgMod[MAX_NUM_LC];
1891    SchDataTransmission dataTransmissionInfo;
1892 #ifdef NR_DRX   
1893    bool     drxConfigIndicatorRelease;
1894 #endif
1895 }SchUeRecfgReq;
1896
1897 typedef struct schUeCfgRsp
1898 {
1899    uint16_t   cellId;
1900    uint8_t    beamIdx;
1901    uint16_t   ueId;
1902    uint16_t   crnti;
1903    SchMacRsp  rsp;
1904    SchFailureCause cause;
1905 }SchUeCfgRsp;
1906
1907 /*As per WG8, UE ReCFG and UECFG have same structure definition*/
1908 typedef struct schUeCfgRsp SchUeRecfgRsp;
1909
1910 typedef struct schRachRsrcReq
1911 {
1912    SlotTimingInfo slotInd;
1913    uint16_t       cellId;
1914    uint16_t       crnti;
1915    uint8_t        numSsb;
1916    uint8_t        ssbIdx[MAX_NUM_SSB];
1917 }SchRachRsrcReq;
1918
1919 typedef struct schCfraSsbResource
1920 {
1921    uint8_t  ssbIdx;
1922    uint8_t  raPreambleIdx;
1923 }SchCfraSsbResource;
1924
1925 typedef struct schCfraRsrc
1926 {
1927    uint8_t   numSsb;
1928    SchCfraSsbResource ssbResource[MAX_NUM_SSB];
1929 }SchCfraResource;
1930
1931 typedef struct schRachRsrcRsp
1932 {
1933    uint16_t   cellId;
1934    uint16_t   crnti;
1935    SchMacRsp  result;
1936    SchCfraResource  cfraResource;
1937 }SchRachRsrcRsp;
1938
1939 typedef struct schRachRsrcRel
1940 {
1941    SlotTimingInfo slotInd;
1942    uint16_t   cellId;
1943    uint16_t   crnti;
1944    SchCfraResource  cfraResource;
1945 }SchRachRsrcRel;
1946
1947 typedef struct schUeDelete
1948 {
1949    uint16_t   cellId;
1950    uint16_t   crnti;
1951 }SchUeDelete;
1952
1953 typedef struct schUeDeleteRsp
1954 {
1955    uint16_t   cellId;
1956    uint16_t   crnti;
1957    SchMacRsp  rsp;
1958    ErrorCause cause;
1959 }SchUeDeleteRsp;
1960
1961 typedef struct schCellDeleteReq 
1962 {
1963    uint16_t   cellId;
1964 }SchCellDeleteReq;
1965
1966
1967 typedef struct schCellDeleteRsp
1968 {
1969    uint16_t        cellId;
1970    SchMacRsp       rsp;
1971    SchFailureCause cause;
1972 }SchCellDeleteRsp;
1973
1974 typedef struct dataVolInfo
1975 {
1976    uint8_t  lcgId;
1977    uint32_t dataVol;
1978 }DataVolInfo;
1979
1980 typedef struct ulBufferStatusRptInd
1981 {
1982    uint16_t    cellId;
1983    uint16_t    crnti;
1984    BsrType     bsrType;
1985    uint8_t     numLcg;
1986    DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
1987 }UlBufferStatusRptInd;
1988
1989 typedef struct srUciIndInfo
1990 {
1991    uint16_t    cellId;
1992    uint16_t    crnti;
1993    SlotTimingInfo slotInd;
1994    uint8_t     numSrBits;
1995    uint8_t     srPayload[MAX_SR_BITS_IN_BYTES];
1996 }SrUciIndInfo;
1997
1998 typedef struct dlHarqInd
1999 {
2000    uint16_t    cellId;
2001    uint16_t    crnti;
2002    SlotTimingInfo slotInd;
2003    uint8_t     numHarq;
2004    uint8_t     harqPayload[MAX_HARQ_BITS_IN_BYTES];
2005 }DlHarqInd;
2006
2007 typedef struct schRrmPolicyRatio
2008 {
2009    uint8_t maxRatio;
2010    uint8_t minRatio;
2011    uint8_t dedicatedRatio;
2012 }SchRrmPolicyRatio;
2013
2014 typedef struct schRrmPolicyOfSlice
2015 {
2016    Snssai  snssai;
2017    SchRrmPolicyRatio rrmPolicyRatioInfo;
2018 }SchRrmPolicyOfSlice;
2019
2020 typedef struct schSliceCfgReq
2021 {
2022    uint8_t  numOfConfiguredSlice;
2023    SchRrmPolicyOfSlice **listOfSlices;
2024 }SchSliceCfgReq;
2025
2026 typedef struct sliceRsp
2027 {
2028    Snssai     snssai;
2029    SchMacRsp  rsp;
2030    RspCause   cause;
2031 }SliceRsp;
2032
2033 typedef struct schSliceCfgRsp
2034 {
2035    uint8_t    numSliceCfgRsp;
2036    SliceRsp   **listOfSliceCfgRsp;
2037 }SchSliceCfgRsp;
2038
2039 /*As per ORAN-WG8, Slice Cfg and Recfg are same structures*/
2040 typedef struct schSliceCfgReq SchSliceRecfgReq;
2041 typedef struct schSliceCfgRsp SchSliceRecfgRsp;
2042
2043 typedef struct schPageInd
2044 {
2045    uint16_t  cellId;
2046    uint16_t  pf;
2047    uint8_t   i_s;
2048    uint16_t  pduLen;
2049    uint8_t  *pagePdu;
2050 }SchPageInd;
2051
2052 typedef struct schUeHqInfo
2053 {
2054    uint16_t  crnti;
2055    uint8_t   hqProcId;
2056 }SchUeHqInfo;
2057
2058 typedef struct schRlsHqInfo
2059 {
2060    uint16_t     cellId;
2061    uint8_t      numUes;
2062    SchUeHqInfo  *ueHqInfo;
2063 }SchRlsHqInfo;
2064
2065 /* function declarations */
2066 uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
2067 uint8_t MacMessageRouter(Pst *pst, void *msg);
2068 uint8_t SchMessageRouter(Pst *pst, void *msg);
2069
2070 /**********************************************************************
2071   End of file
2072  **********************************************************************/
2073