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