Merge "DL throughput calculation for UM [Issue-ID: ODUHIGH-319]"
[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_CELL_CFG           1
21 #define EVENT_SCH_CELL_CFG_CFM       2
22 #define EVENT_DL_ALLOC               3 
23 #define EVENT_UL_SCH_INFO            4 
24 #define EVENT_RACH_IND_TO_SCH        5
25 #define EVENT_CRC_IND_TO_SCH         6
26 #define EVENT_DL_RLC_BO_INFO_TO_SCH  7
27 #define EVENT_ADD_UE_CONFIG_REQ_TO_SCH   8
28 #define EVENT_UE_CONFIG_RSP_TO_MAC   9
29 #define EVENT_SLOT_IND_TO_SCH        10
30 #define EVENT_SHORT_BSR              11
31 #define EVENT_UCI_IND_TO_SCH         12
32 #define EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH 13
33 #define EVENT_UE_RECONFIG_RSP_TO_MAC 14
34 #define EVENT_UE_DELETE_REQ_TO_SCH   15
35 #define EVENT_UE_DELETE_RSP_TO_MAC   16
36 #define EVENT_CELL_DELETE_REQ_TO_SCH   17
37 #define EVENT_CELL_DELETE_RSP_TO_MAC   18
38
39
40 /*macros*/
41 #define NO_SSB 0
42 #define SSB_TRANSMISSION 1
43 #define SSB_REPEAT 2
44 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
45 #define SCH_SSB_MASK_SIZE   1
46
47 #define NO_SIB1 0
48 #define SIB1_TRANSMISSION 1
49 #define SIB1_REPITITION 2
50
51 #define MAX_NUM_PRG     1 /* max value should be later 275 */
52 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
53 #define MAX_CODEWORDS  1  /* max should be 2 */
54 #define SCH_HARQ_PROC_ID 1 /* harq proc id */
55 #define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
56
57 /* Datatype in UL SCH Info */
58 #define SCH_DATATYPE_PUSCH 1
59 #define SCH_DATATYPE_PUSCH_UCI 2
60 #define SCH_DATATYPE_UCI 4
61 #define SCH_DATATYPE_SRS 8
62 #define SCH_DATATYPE_PRACH 16
63
64 #define MAX_NUMBER_OF_CRC_IND_BITS 1
65 #define MAX_NUMBER_OF_UCI_IND_BITS 1
66 #define MAX_SR_BITS_IN_BYTES       1
67 #define MAX_NUM_LOGICAL_CHANNEL_GROUPS 8
68 /* can we have a common numslot numscs between mac sch */
69 #ifdef NR_TDD
70 #define MAX_SLOTS 20
71 #else
72 #define MAX_SLOTS 10
73 #endif
74 #define MAX_SFN   1024
75 #define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
76 #define MAX_NUM_TAGS 4                  /* Max number of timing advance groups */
77 #define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
78 #define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
79 #define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
80 #define FREQ_DOM_RSRC_SIZE  6           /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
81 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
82 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
83 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
84
85 /* PUCCH Configuration Macro */
86 #define MAX_NUM_PUCCH_RESRC 128
87 #define MAX_NUM_PUCCH_RESRC_SET 4
88 #define MAX_NUM_PUCCH_PER_RESRC_SET 32
89 #define MAX_NUM_SPATIAL_RELATIONS 8
90 #define MAX_NUM_PUCCH_P0_PER_SET 8
91 #define MAX_NUM_PATH_LOSS_REF_RS 4
92 #define MAX_NUM_DL_DATA_TO_UL_ACK 15
93 #define SD_SIZE   3
94
95 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
96 {                                                          \
97    if ((crntTime.slot + incr) > (MAX_SLOTS - 1))           \
98    {                                                       \
99       toFill.sfn = (crntTime.sfn + 1);                     \
100    }                                                       \
101    else                                                    \
102    {                                                       \
103       toFill.sfn = crntTime.sfn;                           \
104    }                                                       \
105    toFill.slot = (crntTime.slot + incr) % MAX_SLOTS;       \
106    if (toFill.sfn >= MAX_SFN)                              \
107    {                                                       \
108       toFill.sfn%=MAX_SFN;                                 \
109    }                                                       \
110 }
111
112 typedef enum
113 {
114    UNSPECIFIED_CAUSE,
115    INVALID_PARAM_VALUE,
116    RESOURCE_UNAVAILABLE,
117    SYSTEM_ERROR
118 }SchFailureCause;
119
120 typedef enum
121 {
122    SR_PROHIBIT_MS1,
123    SR_PROHIBIT_MS2,
124    SR_PROHIBIT_MS4,
125    SR_PROHIBIT_MS8,
126    SR_PROHIBIT_MS16,
127    SR_PROHIBIT_MS32,
128    SR_PROHIBIT_MS64,
129    SR_PROHIBIT_MS128
130 }SchSrProhibitTimer;
131
132 typedef enum
133 {
134    NOT_APPLICABLE,
135    INVALID_CELLID,
136    INVALID_UEIDX
137 }ErrorCause;
138
139 typedef enum
140 {
141    SR_TRANS_MAX_N4,
142    SR_TRANS_MAX_N8,
143    SR_TRANS_MAX_N16,
144    SR_TRANS_MAX_N32,
145    SR_TRANS_MAX_N64,
146    SR_TRANS_MAX_SPARE3,
147    SR_TRANS_MAX_SPARE2,
148    SR_TRANS_MAX_SPARE1
149 }SchSrTransMax;
150
151 typedef enum
152 {
153    TIME_ALIGNMENT_TIMER_MS500,
154    TIME_ALIGNMENT_TIMER_MS750,
155    TIME_ALIGNMENT_TIMER_MS1280,
156    TIME_ALIGNMENT_TIMER_MS1920,
157    TIME_ALIGNMENT_TIMER_MS2560,
158    TIME_ALIGNMENT_TIMER_MS5120,
159    TIME_ALIGNMENT_TIMER_MS10240,
160    TIME_ALIGNMENT_TIMER_INFINITE
161 }SchTimeAlignmentTimer;
162
163 typedef enum
164 {
165    PHR_PERIODIC_TIMER_SF10,
166    PHR_PERIODIC_TIMER_SF20,
167    PHR_PERIODIC_TIMER_SF50,
168    PHR_PERIODIC_TIMER_SF100,
169    PHR_PERIODIC_TIMER_SF200,
170    PHR_PERIODIC_TIMER_SF500,
171    PHR_PERIODIC_TIMER_SF1000,
172    PHR_PERIODIC_TIMER_INFINITE
173 }SchPhrPeriodicTimer;
174
175 typedef enum
176 {
177    PHR_PROHIBIT_TIMER_SF0,
178    PHR_PROHIBIT_TIMER_SF10,
179    PHR_PROHIBIT_TIMER_SF20,
180    PHR_PROHIBIT_TIMER_SF50,
181    PHR_PROHIBIT_TIMER_SF100,
182    PHR_PROHIBIT_TIMER_SF200,
183    PHR_PROHIBIT_TIMER_SF500,
184    PHR_PROHIBIT_TIMER_SF1000
185 }SchPhrProhibitTimer;
186
187 typedef enum
188 {
189    PHR_TX_PWR_FACTOR_CHANGE_DB1,
190    PHR_TX_PWR_FACTOR_CHANGE_DB3,
191    PHR_TX_PWR_FACTOR_CHANGE_DB6,
192    PHR_TX_PWR_FACTOR_CHANGE_INFINITE
193 }SchPhrTxPwrFactorChange;
194
195 typedef enum
196 {
197    PHR_MODE_REAL,
198    PHR_MODE_VIRTUAL
199 }SchPhrModeOtherCG;
200
201 typedef enum
202 {
203    HARQ_ACK_CODEBOOK_SEMISTATIC,
204    HARQ_ACK_CODEBOOK_DYNAMIC
205 }SchPdschHarqAckCodebook;
206
207 typedef enum
208 {
209    NUM_HARQ_PROC_FOR_PDSCH_N2,
210    NUM_HARQ_PROC_FOR_PDSCH_N4,
211    NUM_HARQ_PROC_FOR_PDSCH_N6,
212    NUM_HARQ_PROC_FOR_PDSCH_N10,
213    NUM_HARQ_PROC_FOR_PDSCH_N16
214 }SchNumHarqProcForPdsch;
215
216 typedef enum
217 {
218    MAX_CODE_BLOCK_GROUP_PER_TB_N2,
219    MAX_CODE_BLOCK_GROUP_PER_TB_N4,
220    MAX_CODE_BLOCK_GROUP_PER_TB_N6,
221    MAX_CODE_BLOCK_GROUP_PER_TB_N8
222 }SchMaxCodeBlkGrpPerTB;
223
224 typedef enum
225 {
226    PDSCH_X_OVERHEAD_XOH_6,
227    PDSCH_X_OVERHEAD_XOH_12,
228    PDSCH_X_OVERHEAD_XOH_18
229 }SchPdschXOverhead;
230
231 typedef enum
232 {
233    DMRS_ADDITIONAL_POS0,
234    DMRS_ADDITIONAL_POS1,
235    DMRS_ADDITIONAL_POS3
236 }SchDmrsAdditionPosition;
237
238 typedef enum
239 {
240    RESOURCE_ALLOCTION_TYPE_0,
241    RESOURCE_ALLOCTION_TYPE_1,
242    RESOURCE_ALLOCTION_DYN_SWITCH
243 }SchResourceAllocType;
244
245 typedef enum
246 {
247    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_A,
248    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_B
249 }SchTimeDomRsrcAllocMappingType;
250
251 typedef enum
252 {
253    ENABLED_TRANSFORM_PRECODER,
254    DISABLED_TRANSFORM_PRECODER
255 }SchTransformPrecoder;
256
257 typedef enum
258 {
259    INTERLEAVED_CCE_REG_MAPPING = 1,
260    NONINTERLEAVED_CCE_REG_MAPPING
261 }SchREGMappingType;
262
263 typedef enum
264 {
265    SLOT_PERIODICITY_AND_OFFSET_SL_1 = 1,
266    SLOT_PERIODICITY_AND_OFFSET_SL_2,
267    SLOT_PERIODICITY_AND_OFFSET_SL_4,
268    SLOT_PERIODICITY_AND_OFFSET_SL_5,
269    SLOT_PERIODICITY_AND_OFFSET_SL_8,
270    SLOT_PERIODICITY_AND_OFFSET_SL_10,
271    SLOT_PERIODICITY_AND_OFFSET_SL_16,
272    SLOT_PERIODICITY_AND_OFFSET_SL_20,
273    SLOT_PERIODICITY_AND_OFFSET_SL_40,
274    SLOT_PERIODICITY_AND_OFFSET_SL_80,
275    SLOT_PERIODICITY_AND_OFFSET_SL_160,
276    SLOT_PERIODICITY_AND_OFFSET_SL_320,
277    SLOT_PERIODICITY_AND_OFFSET_SL_640,
278    SLOT_PERIODICITY_AND_OFFSET_SL_1280,
279    SLOT_PERIODICITY_AND_OFFSET_SL_2560
280 }SchMSlotPeriodAndOffset;
281
282 typedef enum
283 {
284    SAME_AS_REG_BUNDLE,
285    ALL_CONTIGUOUS_RB
286 }SchPrecoderGranul;
287
288 typedef enum
289 {
290    SEARCH_SPACE_TYPE_COMMON = 1,
291    SEARCH_SPACE_TYPE_UE_SPECIFIC
292 }SchSearchSpaceType;
293
294 typedef enum
295 {
296    SCH_QOS_NON_DYNAMIC = 1,
297    SCH_QOS_DYNAMIC
298 }SchQosType;
299
300 typedef enum
301 {
302    AGGREGATION_LEVEL_N0,
303    AGGREGATION_LEVEL_N1,
304    AGGREGATION_LEVEL_N2,
305    AGGREGATION_LEVEL_N3,
306    AGGREGATION_LEVEL_N4,
307    AGGREGATION_LEVEL_N5,
308    AGGREGATION_LEVEL_N6,
309    AGGREGATION_LEVEL_N8
310 }SchAggrLevel;
311
312 typedef enum
313 {
314    RBG_SIZE_CONFIG_1,
315    RBG_SIZE_CONFIG_2
316 }SchRBGSize;
317
318 typedef enum
319 {
320    CODE_WORDS_SCHED_BY_DCI_N1,
321    CODE_WORDS_SCHED_BY_DCI_N2
322 }SchCodeWordsSchedByDci;
323
324 typedef enum
325 {
326    STATIC_BUNDLING_TYPE = 1,
327    DYNAMIC_BUNDLING_TYPE
328 }SchBundlingType;
329
330 typedef enum
331 {
332    SCH_SET1_SIZE_N4,
333    SCH_SET1_SIZE_WIDEBAND,
334    SCH_SET1_SIZE_N2_WIDEBAND,
335    SCH_SET1_SIZE_N4_WIDEBAND
336 }SchBundlingSizeSet1;
337
338 typedef enum
339 {
340    SCH_SET2_SIZE_N4,
341    SCH_SET2_SIZE_WIDEBAND
342 }SchBundlingSizeSet2;
343
344 typedef enum
345 {
346    DUPLEX_MODE_FDD,
347    DUPLEX_MODE_TDD
348 }SchDuplexMode;
349
350 typedef enum
351 {
352    SSB_PRDCTY_MS5,
353    SSB_PRDCTY_MS10,
354    SSB_PRDCTY_MS20,
355    SSB_PRDCTY_MS40,
356    SSB_PRDCTY_MS80,
357    SSB_PRDCTY_MS160
358 }SchSSBPeriod;
359
360 typedef enum
361 {
362    RSP_OK,
363    RSP_NOK
364 }SchMacRsp;
365
366 typedef enum
367 {
368    SHORT_BSR,
369    LONG_BSR,
370    SHORT_TRUNCATED_BSR,
371    LONG_TRUNCATED_BSR
372 }BsrType;
373
374 typedef enum
375 {
376    FORMAT0_0,
377    FORMAT0_1,
378    FORMAT1_0,
379    FORMAT1_1
380 }FormatType;
381
382 typedef enum
383 {
384    SCH_MCS_TABLE_QAM_64,
385    SCH_MCS_TABLE_QAM_256,
386    SCH_MCS_TABLE_QAM_64_LOW_SE
387 }SchMcsTable;
388
389 /*structures*/
390 typedef struct timeDomainAlloc
391 {
392    uint16_t startSymb;
393    uint16_t numSymb;
394 }TimeDomainAlloc;
395
396 typedef struct freqDomainAlloc
397 {
398    uint16_t startPrb;
399    uint16_t numPrb;
400 }FreqDomainAlloc;
401
402
403 typedef struct
404 {
405    uint32_t    ssbPbchPwr;       /* SSB block power */
406    uint8_t     scsCommon;           /* subcarrier spacing for common [0-3]*/
407    uint8_t     ssbOffsetPointA;  /* SSB sub carrier offset from point A */
408    SchSSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
409    uint8_t     ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
410    uint32_t    nSSBMask[SCH_SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
411 }SchSsbCfg;
412
413 typedef struct bwpCfg
414 {
415    uint8_t         subcarrierSpacing;
416    uint8_t         cyclicPrefix;
417    FreqDomainAlloc freqAlloc;   
418 }BwpCfg;
419
420 typedef struct prg
421 {
422    uint16_t pmIdx;
423    uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
424 } Prg;
425
426 typedef struct beamformingInfo
427 {
428    uint16_t numPrgs;
429    uint16_t prgSize;
430    uint8_t  digBfInterfaces;
431    Prg  prg[MAX_NUM_PRG];
432 } BeamformingInfo;
433
434 /* SIB1 PDSCH structures */
435
436 typedef struct codewordinfo
437 {
438    uint16_t targetCodeRate;
439    uint8_t  qamModOrder;
440    uint8_t  mcsIndex;
441    uint8_t  mcsTable;
442    uint8_t  rvIndex;
443    uint32_t tbSize;
444 } CodewordInfo;
445
446 typedef struct dmrsInfo
447 {
448    uint16_t dlDmrsSymbPos;
449    uint8_t  dmrsConfigType;
450    uint16_t dlDmrsScramblingId;
451    uint8_t  scid;
452    uint8_t  numDmrsCdmGrpsNoData;
453    uint16_t dmrsPorts;
454    uint8_t mappingType;
455    uint8_t nrOfDmrsSymbols;
456    uint8_t dmrsAddPos;
457 } DmrsInfo;
458
459 typedef struct pdschFreqAlloc
460 {
461    uint8_t  resourceAllocType;
462    /* since we are using type-1, rbBitmap excluded */
463    FreqDomainAlloc freqAlloc;
464    uint8_t  vrbPrbMapping;
465 } PdschFreqAlloc;
466
467 typedef struct pdschTimeAlloc
468 {
469    uint8_t         rowIndex;
470    TimeDomainAlloc timeAlloc;
471 } PdschTimeAlloc;
472
473 typedef struct txPowerPdschInfo
474 {
475    uint8_t powerControlOffset;
476    uint8_t powerControlOffsetSS;
477 } TxPowerPdschInfo;
478
479 typedef struct pdschCfg
480 {
481    uint16_t         pduBitmap;
482    uint16_t         rnti;
483    uint16_t         pduIndex;
484    uint8_t          numCodewords;
485    CodewordInfo     codeword[MAX_CODEWORDS];
486    uint16_t         dataScramblingId;
487    uint8_t          numLayers;
488    uint8_t          transmissionScheme;
489    uint8_t          refPoint;
490    DmrsInfo         dmrs;
491    PdschFreqAlloc   pdschFreqAlloc;
492    PdschTimeAlloc   pdschTimeAlloc;
493    BeamformingInfo  beamPdschInfo;
494    TxPowerPdschInfo txPdschPower;
495 } PdschCfg;
496 /* SIB1 PDSCH structures end */
497
498 /* SIB1 interface structure */
499
500 typedef struct coresetCfg
501 {
502    uint8_t coreSetSize;
503    uint8_t startSymbolIndex;
504    uint8_t durationSymbols;
505    uint8_t freqDomainResource[6];
506    uint8_t cceRegMappingType;
507    uint8_t regBundleSize;
508    uint8_t interleaverSize;
509    uint8_t coreSetType;
510    uint16_t shiftIndex;
511    uint8_t precoderGranularity;
512    uint8_t cceIndex;
513    uint8_t aggregationLevel;
514 } CoresetCfg;
515
516 typedef struct txPowerPdcchInfo
517 {
518    uint8_t powerValue;
519    uint8_t powerControlOffsetSS;
520 } TxPowerPdcchInfo;
521
522 typedef struct dlDCI
523 {
524    uint16_t rnti;
525    uint16_t scramblingId;
526    uint16_t scramblingRnti;
527    uint8_t cceIndex;
528    uint8_t aggregLevel;
529    BeamformingInfo beamPdcchInfo;
530    TxPowerPdcchInfo txPdcchPower;
531    PdschCfg     *pdschCfg;
532 } DlDCI;
533
534 typedef struct pdcchCfg
535 {
536    /* coreset-0 configuration */
537    CoresetCfg coresetCfg;
538
539    uint16_t numDlDci;
540    DlDCI    dci; /* as of now its only one DCI, later it will be numDlCi */
541 } PdcchCfg;
542 /* end of SIB1 PDCCH structures */
543
544 typedef struct
545 {
546    /* parameters recieved from DU-APP */
547    uint16_t sib1PduLen;
548    uint16_t sib1RepetitionPeriod;
549    uint8_t  coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
550    uint8_t  searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
551    uint16_t sib1Mcs;
552
553    /* parameters derived in scheduler */
554    uint8_t n0;
555    BwpCfg bwp;
556    PdcchCfg sib1PdcchCfg;
557    PdschCfg sib1PdschCfg;
558 }SchSib1Cfg;
559
560 typedef struct schRachCfg
561 {
562    uint8_t      prachCfgIdx;       /* PRACH config idx */
563    uint8_t      prachSubcSpacing;  /* Subcarrier spacing of RACH */
564    uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
565    uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
566    uint8_t      rootSeqLen;        /* root sequence length */
567    uint16_t     rootSeqIdx;        /* Root sequence index */
568    uint8_t      numRootSeq;        /* Number of root sequences required for FD */
569    uint16_t     k1;                /* Frequency Offset for each FD */
570    uint8_t      ssbPerRach;        /* SSB per RACH occassion */
571    uint8_t      prachMultCarrBand; /* Presence of Multiple carriers in Band */
572    uint8_t      raContResTmr;      /* RA Contention Resoultion Timer */
573    uint8_t      rsrpThreshSsb;     /* RSRP Threshold SSB */
574    uint8_t      raRspWindow;       /* RA Response Window */
575 }SchRachCfg;
576
577 typedef struct schBwpParams
578 {
579    FreqDomainAlloc freqAlloc;
580    uint8_t         scs;
581    uint8_t         cyclicPrefix;
582 }SchBwpParams;
583
584 typedef struct schCandidatesInfo
585 {
586    uint8_t aggLevel1;
587    uint8_t aggLevel2;
588    uint8_t aggLevel4;
589    uint8_t aggLevel8;
590    uint8_t aggLevel16;
591 }SchCandidatesInfo;
592
593 typedef struct schSearchSpaceCfg
594 {
595    uint8_t searchSpaceId;
596    uint8_t coresetId;
597    uint16_t monitoringSlot;
598    uint16_t duration;
599    uint16_t monitoringSymbol;
600    SchCandidatesInfo candidate;
601 }SchSearchSpaceCfg;
602
603 typedef struct schPdcchCfgCmn
604 {
605    SchSearchSpaceCfg commonSearchSpace;
606    uint8_t raSearchSpaceId;
607 }SchPdcchCfgCmn;
608
609 typedef struct schPdschCfgCmn
610 {
611    uint8_t k0;
612    uint8_t mappingType;
613    uint8_t startSymbol;
614    uint8_t lengthSymbol;
615 }SchPdschCfgCmn;
616
617 typedef struct schPucchCfgCmn
618 {
619    uint8_t pucchResourceCommon;
620    uint8_t pucchGroupHopping;
621 }SchPucchCfgCmn;
622
623 typedef struct schPuschCfgCmn
624 {
625    uint8_t k2;
626    uint8_t mappingType;
627    uint8_t startSymbol;
628    uint8_t lengthSymbol;
629 }SchPuschCfgCmn;
630
631 typedef struct schBwpDlCfg
632 {
633    SchBwpParams   bwp;
634    SchPdcchCfgCmn pdcchCommon;
635    SchPdschCfgCmn pdschCommon;
636 }SchBwpDlCfg;
637
638 typedef struct schBwpUlCfg
639 {
640    SchBwpParams   bwp;
641    SchPucchCfgCmn pucchCommon;
642    SchPuschCfgCmn puschCommon;
643 }SchBwpUlCfg;
644
645 typedef struct schCellCfg
646 {
647    uint16_t       cellId;           /* Cell Id */
648    uint16_t       phyCellId;        /* Physical cell id */
649    uint8_t        numerology;       /* Supported numerology */
650    SchDuplexMode  dupMode;          /* Duplex type: TDD/FDD */
651    uint8_t        bandwidth;        /* Supported B/W */
652    uint32_t       dlFreq;           /* DL Frequency */
653    uint32_t       ulFreq;           /* UL Frequency */
654    SchSsbCfg      ssbSchCfg;        /* SSB config */
655    SchSib1Cfg     sib1SchCfg;       /* SIB1 config */
656    SchRachCfg     schRachCfg;       /* PRACH config */
657    SchBwpDlCfg    schInitialDlBwp;  /* Initial DL BWP */
658    SchBwpUlCfg    schInitialUlBwp;  /* Initial UL BWP */
659 #ifdef NR_TDD
660    TDDCfg         tddCfg;           /* TDD Cfg */ 
661 #endif
662 }SchCellCfg;
663
664 typedef struct schCellCfgCfm
665 {
666    uint16_t         cellId;     /* Cell Id */
667    SchMacRsp   rsp;   
668 }SchCellCfgCfm;
669
670 typedef struct ssbInfo
671 {
672    uint8_t         ssbIdx;          /* SSB Index */
673    TimeDomainAlloc tdAlloc; /* Time domain allocation */
674    FreqDomainAlloc fdAlloc; /* Freq domain allocation */
675 }SsbInfo;
676
677 typedef struct sib1AllocInfo
678 {
679    BwpCfg bwp;
680    PdcchCfg sib1PdcchCfg;
681    PdschCfg sib1PdschCfg;
682 } Sib1AllocInfo;
683
684 typedef struct prachSchInfo
685 {
686    uint8_t  numPrachOcas;   /* Num Prach Ocassions */
687    uint8_t  prachFormat;    /* PRACH Format */
688    uint8_t  numRa;          /* Freq domain ocassion */
689    uint8_t  prachStartSymb; /* Freq domain ocassion */
690 }PrachSchInfo;
691
692 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
693 typedef struct dlBrdcstAlloc
694 {
695    /* Ssb transmission is determined as follows:
696     * 0 : No tranamission
697     * 1 : SSB Transmission
698     * 2 : SSB Repetition */
699    uint8_t ssbTrans;
700    uint8_t ssbIdxSupported;
701    SsbInfo ssbInfo[MAX_SSB_IDX];
702    /* Sib1 transmission is determined as follows:
703     * 0 : No tranamission
704     * 1 : SIB1 Transmission
705     * 2 : SIB1 Repetition */
706    uint8_t sib1Trans;
707    Sib1AllocInfo sib1Alloc;
708 }DlBrdcstAlloc;
709
710 typedef struct rarInfo
711 {
712    uint16_t        raRnti;
713    uint8_t         RAPID;
714    uint16_t        ta;
715    FreqDomainAlloc msg3FreqAlloc;
716    uint16_t        tcrnti;
717    uint8_t         rarPdu[8];
718    uint8_t         rarPduLen;
719 }RarInfo;
720
721 typedef struct rarAlloc
722 {
723    RarInfo rarInfo;
724    BwpCfg  bwp;
725    PdcchCfg rarPdcchCfg;
726    PdschCfg rarPdschCfg;
727 }RarAlloc;
728
729 typedef struct dlMsgInfo
730 {
731    uint16_t crnti;
732    uint8_t  ndi;
733    uint8_t  harqProcNum;
734    uint8_t  dlAssignIdx;
735    uint8_t  pucchTpc;
736    uint8_t  pucchResInd;
737    uint8_t  harqFeedbackInd;
738    uint8_t  dciFormatId;
739    bool     isMsg4Pdu;
740    uint16_t  dlMsgPduLen;
741    uint8_t  *dlMsgPdu;
742 }DlMsgInfo;
743
744 typedef struct lcSchInfo
745 {
746    uint8_t   lcId;
747    uint32_t  schBytes; /* Number of scheduled bytes */
748 }LcSchInfo;
749
750 typedef struct dlMsgAlloc
751 {
752    uint16_t   crnti;
753    uint8_t    numLc;
754    LcSchInfo  lcSchInfo[MAX_NUM_LC]; /* Scheduled LC info */
755    BwpCfg     bwp;
756    PdcchCfg   dlMsgPdcchCfg;
757    PdschCfg   dlMsgPdschCfg;
758    DlMsgInfo  dlMsgInfo;
759 }DlMsgAlloc;
760
761 typedef struct schSlotValue
762 {
763    SlotIndInfo currentTime;
764    SlotIndInfo broadcastTime;
765    SlotIndInfo rarTime;
766    SlotIndInfo dlMsgTime;
767    SlotIndInfo ulDciTime;
768 }SchSlotValue;
769
770 typedef struct format0_0
771 {
772    uint8_t         resourceAllocType;
773    /* since we are using type-1, hence rbBitmap excluded */
774    FreqDomainAlloc freqAlloc;
775    TimeDomainAlloc timeAlloc;
776    uint16_t        rowIndex;
777    uint8_t         mcs;
778    uint8_t         harqProcId;   /* HARQ Process ID */
779    bool            puschHopFlag;
780    bool            freqHopFlag;
781    uint8_t         ndi;    /* NDI */
782    uint8_t         rv;     /* Redundancy Version */
783    uint8_t         tpcCmd;
784    bool            sUlCfgd;
785 }Format0_0;
786
787 typedef struct format0_1
788 {
789 /* TBD */
790
791 }Format0_1;
792
793 typedef struct format1_0
794 {
795 /* TBD */
796
797 }Format1_0;
798
799 typedef struct format1_1
800 {
801 /* TBD */
802 }Format1_1;
803
804 typedef struct dciInfo
805 {
806    uint16_t      cellId;   
807    uint16_t      crnti;          /* CRNI */
808    SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
809    BwpCfg        bwpCfg;         /* BWP Cfg */
810    CoresetCfg    coresetCfg;     /* Coreset1 Cfg */
811    FormatType    formatType;     /* DCI Format */
812    union
813    {
814       Format0_0  format0_0;      /* Format 0_0 */
815       Format0_1  format0_1;      /* Format 0_1 */
816       Format1_0  format1_0;      /* Format 1_0 */
817       Format1_1  format1_1;      /* Format 1_1 */
818    }format;
819    DlDCI    dciInfo;
820 }DciInfo;
821
822
823 typedef struct dlSchedInfo
824 {
825    uint16_t cellId;  /* Cell Id */
826    SchSlotValue schSlotValue;
827
828    /* Allocation for broadcast messages */
829    bool isBroadcastPres;
830    DlBrdcstAlloc brdcstAlloc;
831
832    /* Allocation for RAR message */
833    //uint8_t isRarPres;
834    RarAlloc *rarAlloc;
835
836    /* Allocation from MSG4 */
837    //Msg4Alloc *msg4Alloc;
838
839    /* UL grant in response to BSR */
840    DciInfo    *ulGrant;
841
842    /* Allocation from dedicated DL msg */
843    DlMsgAlloc *dlMsgAlloc;
844
845 }DlSchedInfo;
846
847 typedef struct tbInfo
848 {
849    uint8_t  qamOrder;  /* Modulation Order */
850    uint8_t  mcs;       /* MCS */
851    SchMcsTable  mcsTable;  /* MCS Table */
852    uint8_t  ndi;       /* NDI */
853    uint8_t  rv;        /* Redundancy Version */
854    uint16_t tbSize;    /* TB Size */
855 }TbInfo;
856
857 typedef struct schPuschInfo
858 {
859    uint16_t         crnti;
860    uint8_t          harqProcId;   /* HARQ Process ID */
861    uint8_t          resAllocType; /* Resource allocation type */
862    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
863    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
864    TbInfo           tbInfo;       /* TB info */
865    uint8_t          dmrsMappingType;
866    uint8_t          nrOfDmrsSymbols;
867    uint8_t          dmrsAddPos;
868 }SchPuschInfo;
869
870 typedef struct schPucchFormatCfg
871 {
872    uint8_t interSlotFreqHop;
873    uint8_t addDmrs;
874    uint8_t maxCodeRate;
875    uint8_t numSlots;
876    bool    pi2BPSK;
877    bool    harqAckCSI;
878 }SchPucchFormatCfg;
879
880 typedef struct schPucchInfo
881 {
882    uint16_t         rnti;
883    uint8_t          pucchFormat;
884    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
885    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
886    uint8_t          srFlag;
887    uint8_t          harqFlag;
888    uint8_t          numHarqBits;
889    uint8_t          uciFlag;
890    uint8_t          numUciBits;
891    uint8_t          intraFreqHop;
892    uint16_t         secondPrbHop;
893    uint8_t          initialCyclicShift;
894    uint8_t          occLen;
895    uint8_t          occIdx;
896    uint8_t          timeDomOCC;
897    SchPucchFormatCfg cmnFormatCfg;
898 }SchPucchInfo;
899
900 typedef struct ulSchedInfo
901 {
902    uint16_t      cellId;         /* Cell Id */
903    uint16_t      crnti;          /* CRNI */
904    SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
905    uint8_t       dataType;       /* Type of info being scheduled */
906    PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
907    SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
908    SchPucchInfo  schPucchInfo;   /* Pusch scheduling info */
909 }UlSchedInfo;
910
911 typedef struct rachIndInfo
912 {
913    uint16_t    cellId;
914    uint16_t    crnti;
915    SlotIndInfo timingInfo;
916    uint8_t     slotIdx;
917    uint8_t     symbolIdx;
918    uint8_t     freqIdx;
919    uint8_t     preambleIdx;
920    uint16_t    timingAdv;
921 }RachIndInfo;
922
923
924 typedef struct crcIndInfo
925 {
926    uint16_t    cellId;
927    uint16_t    crnti;
928    SlotIndInfo timingInfo;
929    uint16_t    numCrcInd;
930    uint8_t     crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
931 }CrcIndInfo;
932
933 typedef struct boInfo
934 {
935    uint8_t   lcId;
936    uint32_t  dataVolume;
937 }BOInfo;
938
939 typedef struct dlRlcBOInfo
940 {
941    uint16_t    cellId;
942    uint16_t    crnti;
943    uint8_t     lcId;
944    uint32_t    dataVolume;
945 }DlRlcBoInfo;
946
947 /* Info of Scheduling Request to Add/Modify */
948 typedef struct schSchedReqInfo
949 {
950    uint8_t              schedReqId;
951    SchSrProhibitTimer   srProhibitTmr;
952    SchSrTransMax        srTransMax;
953 }SchSchedReqInfo;
954
955 /* Scheduling Request Configuration */
956 typedef struct schSchedReqCfg
957 {
958    uint8_t          addModListCount;
959    SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
960    uint8_t          relListCount;
961    uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
962 }SchSchedReqCfg;
963
964 /* Info of Tag to Add/Modify */
965 typedef struct schTagInfo
966 {
967    uint8_t       tagId;
968    SchTimeAlignmentTimer  timeAlignmentTmr;
969 }SchTagInfo;
970
971 /* Timing Advance Group Configuration */
972 typedef struct schTagCfg
973 {
974    uint8_t      addModListCount;
975    SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
976    uint8_t      relListCount;
977    uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
978 }SchTagCfg;
979
980 /* Configuration for Power headroom reporting */
981 typedef struct schPhrCfg
982 {
983    SchPhrPeriodicTimer       periodicTmr;
984    SchPhrProhibitTimer       prohibitTmr;
985    SchPhrTxPwrFactorChange   txpowerFactorChange;
986    bool                      multiplePhr;
987    bool                      dummy;
988    bool                      type2OtherCell;
989    SchPhrModeOtherCG         modeOtherCG;
990 }SchPhrCfg;
991
992 /* MAC cell Group configuration */
993 typedef struct schMacCellGrpCfg
994 {
995    SchSchedReqCfg   schedReqCfg;
996    SchTagCfg        tagCfg;
997    SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
998 }SchMacCellGrpCfg;
999
1000 /* Physical Cell Group Configuration */
1001 typedef struct schPhyCellGrpCfg
1002 {
1003    SchPdschHarqAckCodebook    pdschHarqAckCodebook;
1004    int8_t     pNrFr1;
1005 }SchPhyCellGrpCfg;
1006
1007 /* Control resource set info */
1008 typedef struct schControlRsrcSet
1009 {
1010    uint8_t             cRSetId;                /* Control resource set id */
1011    uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
1012    uint8_t             duration;
1013    SchREGMappingType   cceRegMappingType;
1014    SchPrecoderGranul   precoderGranularity;
1015    uint16_t            dmrsScramblingId;
1016 }SchControlRsrcSet;
1017
1018 /* Search Space info */
1019 typedef struct schSearchSpace
1020 {
1021    uint8_t                  searchSpaceId;
1022    uint8_t                  cRSetId;
1023    SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1024    uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1025    SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1026    SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1027    SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1028    SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1029    SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1030    SchSearchSpaceType       searchSpaceType;
1031    uint8_t                  ueSpecificDciFormat;
1032 }SchSearchSpace;
1033
1034 /* PDCCH cofniguration */
1035 typedef struct schPdcchConfig
1036 {
1037    uint8_t           numCRsetToAddMod;
1038    SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1039    uint8_t           numCRsetToRel;
1040    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1041    uint8_t           numSearchSpcToAddMod;
1042    SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1043    uint8_t           numSearchSpcToRel;
1044    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1045 }SchPdcchConfig;
1046
1047 /* PDSCH time domain resource allocation */
1048 typedef struct schPdschTimeDomRsrcAlloc
1049 {
1050    SchTimeDomRsrcAllocMappingType    mappingType;
1051    uint8_t    startSymbol;
1052    uint8_t    symbolLength;
1053 }SchPdschTimeDomRsrcAlloc;
1054
1055
1056 typedef struct schPdschBundling
1057 {
1058    struct schStaticBundling
1059    {
1060      SchBundlingSizeSet2 size;
1061    }SchStaticBundling;
1062    struct schDynamicBundling
1063    {
1064      SchBundlingSizeSet1 sizeSet1;
1065      SchBundlingSizeSet2 sizeSet2;
1066    }SchDynamicBundling;
1067 }SchPdschBundling;
1068
1069 /* DMRS downlink configuration */
1070 typedef struct schDmrsDlCfg
1071 {
1072    SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
1073 }SchDmrsDlCfg;
1074
1075 /* PDSCH Configuration */
1076 typedef struct schPdschConfig
1077 {
1078    SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1079    SchResourceAllocType       resourceAllocType;
1080    uint8_t                    numTimeDomRsrcAlloc;
1081    SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1082    SchRBGSize                 rbgSize;
1083    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1084    SchBundlingType            bundlingType;
1085    SchPdschBundling           bundlingInfo;
1086 }SchPdschConfig;
1087
1088 /* Initial Downlink BWP */
1089 typedef struct schInitalDlBwp
1090 {
1091    bool             pdcchCfgPres;
1092    SchPdcchConfig   pdcchCfg;
1093    bool             pdschCfgPres;
1094    SchPdschConfig   pdschCfg;
1095 }SchInitalDlBwp;
1096
1097 /* BWP Downlink common */
1098 typedef struct schBwpDlCommon
1099 {
1100 }SchBwpDlCommon;
1101
1102 /* Downlink BWP information */
1103 typedef struct schDlBwpInfo
1104 {
1105    uint8_t          bwpId;
1106 }SchDlBwpInfo;
1107
1108 /* PDCCH Serving Cell configuration */
1109 typedef struct schPdschServCellCfg
1110 {
1111    uint8_t                  *maxMimoLayers;           
1112    SchNumHarqProcForPdsch   numHarqProcForPdsch;
1113    SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
1114    bool                     *codeBlkGrpFlushInd;
1115    SchPdschXOverhead        *xOverhead;
1116 }SchPdschServCellCfg;
1117
1118 /* PUCCH Configuration */
1119 typedef struct schPucchResrcSetInfo
1120 {
1121    uint8_t resrcSetId;
1122    uint8_t resrcListCount;
1123    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1124    uint8_t maxPayLoadSize;
1125 }SchPucchResrcSetInfo;
1126
1127 typedef struct schPucchResrcSetCfg
1128 {
1129    uint8_t resrcSetToAddModListCount;
1130    SchPucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1131    uint8_t resrcSetToRelListCount;
1132    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1133 }SchPucchResrcSetCfg;
1134
1135 typedef struct schPucchFormat0
1136 {
1137    uint8_t initialCyclicShift;
1138    uint8_t numSymbols;
1139    uint8_t startSymbolIdx;
1140 }SchPucchFormat0;
1141
1142 typedef struct schPucchFormat1
1143 {
1144    uint8_t initialCyclicShift;
1145    uint8_t numSymbols;
1146    uint8_t startSymbolIdx;
1147    uint8_t timeDomOCC;
1148 }SchPucchFormat1;
1149
1150 typedef struct schPucchFormat2_3
1151 {
1152    uint8_t numPrbs;
1153    uint8_t numSymbols;
1154    uint8_t startSymbolIdx;
1155 }SchPucchFormat2_3;
1156
1157 typedef struct schPucchFormat4
1158 {
1159    uint8_t numSymbols;
1160    uint8_t occLen;
1161    uint8_t occIdx;
1162    uint8_t startSymbolIdx;
1163 }SchPucchFormat4;
1164
1165 typedef struct schPucchResrcInfo
1166 {
1167    uint8_t  resrcId;
1168    uint16_t startPrb;
1169    uint8_t  intraFreqHop;
1170    uint16_t secondPrbHop;
1171    uint8_t  pucchFormat;
1172    union{
1173       SchPucchFormat0   *format0; 
1174       SchPucchFormat1   *format1;
1175       SchPucchFormat2_3 *format2;
1176       SchPucchFormat2_3 *format3;
1177       SchPucchFormat4   *format4;
1178    }SchPucchFormat;
1179 }SchPucchResrcInfo;
1180
1181 typedef struct schPucchResrcCfg
1182 {
1183    uint8_t resrcToAddModListCount;
1184    SchPucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1185    uint8_t resrcToRelListCount;
1186    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1187 }SchPucchResrcCfg;
1188
1189
1190 typedef struct schSchedReqResrcInfo
1191 {
1192    uint8_t resrcId;
1193    uint8_t requestId;
1194    uint8_t periodicity;
1195    uint16_t offset;
1196    uint8_t resrc;
1197 }SchSchedReqResrcInfo;
1198
1199 typedef struct schPucchSchedReqCfg
1200 {
1201    uint8_t           schedAddModListCount;
1202    SchSchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1203    uint8_t           schedRelListCount;
1204    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1205 }SchPucchSchedReqCfg;
1206
1207 typedef struct schSpatialRelationInfo
1208 {
1209    uint8_t spatialRelationId;
1210    uint8_t servCellIdx;
1211    uint8_t pathLossRefRSId;
1212    uint8_t p0PucchId;
1213    uint8_t closeLoopIdx;
1214 }SchSpatialRelationInfo;
1215
1216 typedef struct schPucchSpatialCfg
1217 {
1218    uint8_t spatialAddModListCount;
1219    SchSpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1220    uint8_t spatialRelListCount;
1221    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1222 }SchPucchSpatialCfg;
1223
1224 typedef struct schP0PucchCfg
1225 {
1226    uint8_t p0PucchId;
1227    int     p0PucchVal;
1228 }SchP0PucchCfg;
1229
1230 typedef struct schPathLossRefRSCfg
1231 {
1232    uint8_t pathLossRefRSId;
1233 }SchPathLossRefRSCfg;
1234
1235 typedef struct schPucchMultiCsiCfg
1236 {
1237    uint8_t  multiCsiResrcListCount;
1238    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1239 }SchPucchMultiCsiCfg;
1240
1241 typedef struct schPucchDlDataToUlAck
1242 {
1243    uint8_t  dlDataToUlAckListCount;
1244    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1245 }SchPucchDlDataToUlAck;
1246
1247 typedef struct schPucchPowerControl
1248 {
1249    int deltaF_Format0;
1250    int deltaF_Format1;
1251    int deltaF_Format2;
1252    int deltaF_Format3;
1253    int deltaF_Format4;
1254    uint8_t p0SetCount;
1255    SchP0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1256    uint8_t pathLossRefRSListCount;
1257    SchPathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1258 }SchPucchPowerControl;
1259
1260 typedef struct schPucchCfg
1261 {
1262    SchPucchResrcSetCfg   *resrcSet;
1263    SchPucchResrcCfg      *resrc;
1264    SchPucchFormatCfg     *format1; 
1265    SchPucchFormatCfg     *format2; 
1266    SchPucchFormatCfg     *format3; 
1267    SchPucchFormatCfg     *format4;
1268    SchPucchSchedReqCfg   *schedReq;
1269    SchPucchMultiCsiCfg   *multiCsiCfg;
1270    SchPucchSpatialCfg    *spatialInfo;
1271    SchPucchDlDataToUlAck *dlDataToUlAck;
1272    SchPucchPowerControl  *powerControl;
1273 }SchPucchCfg;
1274
1275 /* Transform precoding disabled */
1276 typedef struct schTransPrecodDisabled
1277 {
1278    uint16_t   scramblingId0;
1279 }SchTransPrecodDisabled;
1280
1281 /* DMRS Uplink configuration */
1282 typedef struct SchDmrsUlCfg
1283 {
1284    SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
1285    SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
1286 }SchDmrsUlCfg;
1287
1288 /* PUSCH Time Domain Resource Allocation */
1289 typedef struct schPuschTimeDomRsrcAlloc
1290 {
1291    uint8_t   k2;
1292    SchTimeDomRsrcAllocMappingType   mappingType;
1293    uint8_t   startSymbol;
1294    uint8_t   symbolLength;
1295 }SchPuschTimeDomRsrcAlloc;
1296
1297 /* PUSCH Configuration */
1298 typedef struct schPuschCfg
1299 {
1300    uint8_t                    dataScramblingId;
1301    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1302    SchResourceAllocType       resourceAllocType;
1303    uint8_t                    numTimeDomRsrcAlloc;
1304    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1305    SchTransformPrecoder       transformPrecoder;
1306 }SchPuschCfg;
1307
1308 /* Initial Uplink BWP */
1309 typedef struct schInitialUlBwp
1310 {
1311    bool          pucchCfgPres;
1312    SchPucchCfg   pucchCfg;
1313    bool          puschCfgPres;
1314    SchPuschCfg   puschCfg;
1315 }SchInitialUlBwp;
1316
1317 /* Uplink BWP information */
1318 typedef struct schUlBwpInfo
1319 {
1320    uint8_t        bwpId;
1321 }SchUlBwpInfo;
1322
1323 /* Serving cell configuration */
1324 typedef struct schServCellCfgInfo
1325 {
1326    SchInitalDlBwp        initDlBwp;
1327    uint8_t               numDlBwpToAdd;
1328    SchDlBwpInfo          DlBwpToAddList[MAX_NUM_BWP];
1329    uint8_t               firstActvDlBwpId;
1330    uint8_t               defaultDlBwpId;
1331    uint8_t               *bwpInactivityTmr;
1332    SchPdschServCellCfg   pdschServCellCfg;
1333    SchInitialUlBwp       initUlBwp;
1334    uint8_t               numUlBwpToAdd;
1335    SchUlBwpInfo          UlBwpToAddList[MAX_NUM_BWP];
1336    uint8_t               firstActvUlBwpId;
1337 }SchServCellCfgInfo;
1338
1339 typedef struct schNonDynFiveQi
1340 {
1341    uint16_t   fiveQi;
1342    uint8_t    priorLevel;
1343    uint16_t   avgWindow;
1344    uint16_t   maxDataBurstVol;
1345 }SchNonDynFiveQi;
1346
1347 typedef struct schDynFiveQi
1348 {
1349    uint8_t    priorLevel;
1350    uint16_t   packetDelayBudget;
1351    uint8_t    packetErrRateScalar;
1352    uint8_t    packetErrRateExp;
1353    uint16_t   fiveQi;
1354    uint8_t    delayCritical;
1355    uint16_t   avgWindow;
1356    uint16_t   maxDataBurstVol;
1357 }SchDynFiveQi;
1358
1359 typedef struct schNgRanAllocAndRetPri
1360 {
1361    uint8_t priorityLevel;
1362    uint8_t preEmptionCap;
1363    uint8_t preEmptionVul;
1364 }SchNgRanAllocAndRetPri;
1365
1366 typedef struct schGrbQosFlowInfo
1367 {
1368    uint32_t maxFlowBitRateDl;
1369    uint32_t maxFlowBitRateUl;
1370    uint32_t guarFlowBitRateDl;
1371    uint32_t guarFlowBitRateUl;
1372 }SchGrbQosFlowInfo;
1373
1374 /* DRB QoS */
1375 typedef struct schDrbQos
1376 {
1377    SchQosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1378    union
1379    {
1380       SchNonDynFiveQi   nonDyn5Qi;
1381       SchDynFiveQi      dyn5Qi;
1382    }u;
1383    SchNgRanAllocAndRetPri  ngRanRetPri;
1384    SchGrbQosFlowInfo       grbQosFlowInfo;
1385    uint16_t                pduSessionId;
1386    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
1387 }SchDrbQosInfo;
1388
1389 typedef struct schSnssai
1390 {
1391    uint8_t   sst;
1392    uint8_t   sd[SD_SIZE];
1393 }SchSnssai;
1394
1395 /* Special cell configuration */
1396 typedef struct schSpCellCfg
1397 {
1398    uint8_t           servCellIdx;
1399    SchServCellCfgInfo   servCellCfg;
1400 }SchSpCellCfg;
1401
1402 /* Uplink logical channel configuration */
1403 typedef struct SchUlLcCfg
1404 {
1405    uint8_t priority;
1406    uint8_t lcGroup;
1407    uint8_t schReqId;
1408    uint8_t pbr;        // prioritisedBitRate
1409    uint8_t bsd;        // bucketSizeDuration
1410 }SchUlLcCfg;
1411
1412 /* Downlink logical channel configuration */
1413 typedef struct schDlLcCfg
1414 {
1415    uint8_t lcp;      // logical Channel Prioritization
1416 }SchDlLcCfg;
1417
1418 /* Logical Channel configuration */
1419 typedef struct schLcCfg
1420 {
1421    ConfigType     configType;
1422    uint8_t        lcId;
1423    SchDrbQosInfo  *drbQos;
1424    SchSnssai      *snssai;
1425    SchDlLcCfg     dlLcCfg;
1426    SchUlLcCfg     ulLcCfg;
1427 }SchLcCfg;
1428
1429 /* Aggregate max bit rate */
1430 typedef struct schAmbrCfg
1431 {
1432    uint32_t   ulBr;   /* Ul BitRate */
1433 }SchAmbrCfg;
1434
1435 typedef struct schModulationInfo
1436 {
1437    uint8_t      modOrder;
1438    uint8_t      mcsIndex;
1439    SchMcsTable  mcsTable;
1440 }SchModulationInfo;
1441
1442 /* UE configuration */
1443 typedef struct schUeCfg
1444 {
1445    uint16_t        cellId;
1446    uint16_t        crnti;
1447    bool macCellGrpCfgPres;
1448    SchMacCellGrpCfg   macCellGrpCfg;
1449    bool phyCellGrpCfgPres;
1450    SchPhyCellGrpCfg   phyCellGrpCfg;
1451    bool spCellCfgPres;
1452    SchSpCellCfg       spCellCfg;
1453    SchAmbrCfg         *ambrCfg;
1454    SchModulationInfo  dlModInfo;
1455    SchModulationInfo  ulModInfo;
1456    uint8_t            numLcs;
1457    SchLcCfg           schLcCfg[MAX_NUM_LC];
1458 }SchUeCfg;
1459
1460 typedef struct schUeCfgRsp
1461 {
1462    uint16_t   ueIdx;
1463    uint16_t   cellId;
1464    uint16_t   crnti;
1465    SchMacRsp  rsp;
1466    SchFailureCause cause;
1467 }SchUeCfgRsp;
1468
1469 typedef struct schUeDelete
1470 {
1471    uint16_t   cellId;
1472    uint16_t   crnti;
1473 }SchUeDelete;
1474
1475 typedef struct schUeDeleteRsp
1476 {
1477    uint16_t   cellId;
1478    uint16_t   crnti;
1479    SchMacRsp  rsp;
1480    ErrorCause cause;
1481 }SchUeDeleteRsp;
1482
1483 typedef struct schCellDelete 
1484 {
1485    uint16_t   cellId;
1486 }SchCellDelete;
1487
1488
1489 typedef struct schCellDeleteRsp
1490 {
1491    uint16_t   cellId;
1492    SchMacRsp  rsp;
1493 }SchCellDeleteRsp;
1494
1495 typedef struct dataVolInfo
1496 {
1497    uint8_t  lcgId;
1498    uint32_t dataVol;
1499 }DataVolInfo;
1500
1501 typedef struct ulBufferStatusRptInd
1502 {
1503    uint16_t    cellId;
1504    uint16_t    crnti;
1505    BsrType     bsrType;
1506    uint8_t     numLcg;
1507    DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
1508 }UlBufferStatusRptInd;
1509
1510 typedef struct srUciIndInfo
1511 {
1512    uint16_t    cellId;
1513    uint16_t    crnti;
1514    SlotIndInfo slotInd;
1515    uint8_t     numSrBits;
1516    uint8_t     srPayload[MAX_SR_BITS_IN_BYTES];
1517 }SrUciIndInfo;
1518
1519 /* function pointers */
1520
1521 typedef uint8_t (*SchCellCfgCfmFunc)    ARGS((
1522          Pst            *pst,           /* Post Structure */                         
1523          SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
1524          ));
1525
1526 typedef uint8_t (*SchCellCfgFunc)    ARGS((
1527          Pst         *pst,           /* Post Structure */                         
1528          SchCellCfg  *schCellCfg     /* Cell Cfg  */
1529          ));
1530
1531 typedef uint8_t (*SchMacDlAllocFunc)     ARGS((                     
1532          Pst            *pst,          /* Post Structure */                         
1533          DlSchedInfo    *dlSchedInfo   /* dl allocation Info */                      
1534          ));
1535
1536 typedef uint8_t (*SchMacUlSchInfoFunc)     ARGS((                     
1537          Pst         *pst,           /* Post Structure */                         
1538          UlSchedInfo *ulSchedInfo    /* UL Alloc Sch  Info */                      
1539          ));
1540
1541 typedef uint8_t (*MacSchRachIndFunc) ARGS((
1542          Pst         *pst,         /* Post structure */
1543          RachIndInfo *rachInd));    /* Rach Indication Info */
1544
1545 typedef uint8_t (*MacSchCrcIndFunc) ARGS(( 
1546          Pst         *pst,         /* Post structure */
1547          CrcIndInfo  *crcInd));     /* CRC Info */
1548
1549 typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS((
1550          Pst         *pst,         /* Post structure */
1551          DlRlcBoInfo *dlBoInfo));   /* DL BO Info */
1552
1553 typedef uint8_t (*MacSchAddUeConfigReqFunc) ARGS((
1554          Pst         *pst,           /* Post structure */
1555          SchUeCfg    *ueCfgToSch));   /* Scheduler UE Cfg */
1556
1557 typedef uint8_t (*SchUeCfgRspFunc) ARGS((
1558          Pst         *pst,           /* Post structure */
1559          SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
1560
1561 typedef uint8_t (*MacSchSlotIndFunc) ARGS((
1562          Pst         *pst,          /* Post structure */
1563          SlotIndInfo *slotInd));    /* Slot Info */
1564
1565 typedef uint8_t (*MacSchBsrFunc)       ARGS((
1566    Pst                  *pst,
1567    UlBufferStatusRptInd *bsrInd
1568 ));
1569
1570 typedef uint8_t (*MacSchSrUciIndFunc) ARGS(( 
1571          Pst         *pst,         /* Post structure */
1572          SrUciIndInfo  *uciInd));    /* UCI IND Info */
1573
1574 typedef uint8_t (*MacSchModUeConfigReqFunc) ARGS((
1575          Pst         *pst,           /* Post structure */
1576          SchUeCfg    *ueCfgToSch));   /* Scheduler UE Cfg */
1577
1578 typedef uint8_t (*SchUeReCfgRspFunc) ARGS((
1579          Pst         *pst,           /* Post structure */
1580          SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
1581
1582 typedef uint8_t (*MacSchUeDeleteReqFunc) ARGS((
1583    Pst         *pst,           /* Post structure */
1584    SchUeDelete *schUeDel)); /*Scheduler UE Del*/
1585
1586 typedef uint8_t (*SchUeDeleteRspFunc) ARGS((
1587    Pst          *pst,           /* Post structure */
1588    SchUeDeleteRsp *delRsp));       /* Scheduler UE delete response */
1589
1590 typedef uint8_t (*MacSchCellDeleteReqFunc) ARGS((
1591    Pst         *pst,           /* Post structure */
1592    SchCellDelete *schCellDelete)); /*Scheduler UE Del*/
1593
1594 typedef uint8_t (*SchCellDeleteRspFunc) ARGS((
1595    Pst          *pst,           /* Post structure */
1596    SchCellDeleteRsp *schCellDeleteRsp));       /* Scheduler UE delete response */
1597
1598 /* function declarations */
1599 uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
1600 uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
1601 uint8_t packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
1602 uint8_t packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
1603 uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
1604 uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
1605 uint8_t MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
1606 uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
1607 uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
1608 uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
1609 uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
1610 uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
1611 uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
1612 uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd);
1613 uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
1614 uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
1615 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
1616 uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
1617 uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1618 uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1619 uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1620 uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1621 uint8_t MacSchSlotInd ARGS((Pst * pst, SlotIndInfo * slotInd));
1622 uint8_t packMacSchSlotInd(Pst * pst, SlotIndInfo * slotInd);
1623 uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer  *mBuf);
1624 uint8_t packMacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
1625 uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
1626 uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
1627 uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
1628 uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1629 uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1630 uint8_t packSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1631 uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1632 uint8_t packMacSchUeDeleteReq(Pst *pst,  SchUeDelete *schUeDel);
1633 uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete  *ueDelete);
1634 uint8_t packSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp  *delRsp);
1635 uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp);
1636 uint8_t packMacSchCellDeleteReq(Pst *pst,  SchCellDelete *schCellDelete);
1637 uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDelete  *schCellDelete);
1638 uint8_t packSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp  *schCellDeleteRsp);
1639 uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp);
1640
1641 /**********************************************************************
1642   End of file
1643  **********************************************************************/
1644