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