JIRA ID = ODUHIGH-298 RB configuration at MAC/SCH/RLC for ue modification
[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        numerology;       /* Supported numerology */
636    SchDuplexMode  dupMode;          /* Duplex type: TDD/FDD */
637    uint8_t        bandwidth;        /* Supported B/W */
638    uint32_t       dlFreq;           /* DL Frequency */
639    uint32_t       ulFreq;           /* UL Frequency */
640    SchSsbCfg      ssbSchCfg;        /* SSB config */
641    SchSib1Cfg     sib1SchCfg;       /* SIB1 config */
642    SchRachCfg     schRachCfg;       /* PRACH config */
643    SchBwpDlCfg    schInitialDlBwp;  /* Initial DL BWP */
644    SchBwpUlCfg    schInitialUlBwp;  /* Initial UL BWP */
645 #ifdef NR_TDD
646    TDDCfg         tddCfg;           /* TDD Cfg */ 
647 #endif
648 }SchCellCfg;
649
650 typedef struct schCellCfgCfm
651 {
652    uint16_t         cellId;     /* Cell Id */
653    SchMacRsp   rsp;   
654 }SchCellCfgCfm;
655
656 typedef struct ssbInfo
657 {
658    uint8_t         ssbIdx;          /* SSB Index */
659    TimeDomainAlloc tdAlloc; /* Time domain allocation */
660    FreqDomainAlloc fdAlloc; /* Freq domain allocation */
661 }SsbInfo;
662
663 typedef struct sib1AllocInfo
664 {
665    BwpCfg bwp;
666    PdcchCfg sib1PdcchCfg;
667    PdschCfg sib1PdschCfg;
668 } Sib1AllocInfo;
669
670 typedef struct prachSchInfo
671 {
672    uint8_t  numPrachOcas;   /* Num Prach Ocassions */
673    uint8_t  prachFormat;    /* PRACH Format */
674    uint8_t  numRa;          /* Freq domain ocassion */
675    uint8_t  prachStartSymb; /* Freq domain ocassion */
676 }PrachSchInfo;
677
678 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
679 typedef struct dlBrdcstAlloc
680 {
681    /* Ssb transmission is determined as follows:
682     * 0 : No tranamission
683     * 1 : SSB Transmission
684     * 2 : SSB Repetition */
685    uint8_t ssbTrans;
686    uint8_t ssbIdxSupported;
687    SsbInfo ssbInfo[MAX_SSB_IDX];
688    /* Sib1 transmission is determined as follows:
689     * 0 : No tranamission
690     * 1 : SIB1 Transmission
691     * 2 : SIB1 Repetition */
692    uint8_t sib1Trans;
693    Sib1AllocInfo sib1Alloc;
694 }DlBrdcstAlloc;
695
696 typedef struct rarInfo
697 {
698    uint16_t        raRnti;
699    uint8_t         RAPID;
700    uint16_t        ta;
701    FreqDomainAlloc msg3FreqAlloc;
702    uint16_t        tcrnti;
703    uint8_t         rarPdu[8];
704    uint8_t         rarPduLen;
705 }RarInfo;
706
707 typedef struct rarAlloc
708 {
709    RarInfo rarInfo;
710    BwpCfg  bwp;
711    PdcchCfg rarPdcchCfg;
712    PdschCfg rarPdschCfg;
713 }RarAlloc;
714
715 typedef struct dlMsgInfo
716 {
717    uint16_t crnti;
718    uint8_t  ndi;
719    uint8_t  harqProcNum;
720    uint8_t  dlAssignIdx;
721    uint8_t  pucchTpc;
722    uint8_t  pucchResInd;
723    uint8_t  harqFeedbackInd;
724    uint8_t  dciFormatId;
725    bool     isMsg4Pdu;
726    uint16_t  dlMsgPduLen;
727    uint8_t  *dlMsgPdu;
728 }DlMsgInfo;
729
730 typedef struct lcSchInfo
731 {
732    uint8_t   lcId;
733    uint32_t  schBytes; /* Number of scheduled bytes */
734 }LcSchInfo;
735
736 typedef struct dlMsgAlloc
737 {
738    uint16_t   crnti;
739    uint8_t    numLc;
740    LcSchInfo  lcSchInfo[MAX_NUM_LC]; /* Scheduled LC info */
741    BwpCfg     bwp;
742    PdcchCfg   dlMsgPdcchCfg;
743    PdschCfg   dlMsgPdschCfg;
744    DlMsgInfo  dlMsgInfo;
745 }DlMsgAlloc;
746
747 typedef struct schSlotValue
748 {
749    SlotIndInfo currentTime;
750    SlotIndInfo broadcastTime;
751    SlotIndInfo rarTime;
752    SlotIndInfo dlMsgTime;
753    SlotIndInfo ulDciTime;
754 }SchSlotValue;
755
756 typedef struct format0_0
757 {
758    uint8_t         resourceAllocType;
759    /* since we are using type-1, hence rbBitmap excluded */
760    FreqDomainAlloc freqAlloc;
761    TimeDomainAlloc timeAlloc;
762    uint16_t        rowIndex;
763    uint8_t         mcs;
764    uint8_t         harqProcId;   /* HARQ Process ID */
765    bool            puschHopFlag;
766    bool            freqHopFlag;
767    uint8_t         ndi;    /* NDI */
768    uint8_t         rv;     /* Redundancy Version */
769    uint8_t         tpcCmd;
770    bool            sUlCfgd;
771 }Format0_0;
772
773 typedef struct format0_1
774 {
775 /* TBD */
776
777 }Format0_1;
778
779 typedef struct format1_0
780 {
781 /* TBD */
782
783 }Format1_0;
784
785 typedef struct format1_1
786 {
787 /* TBD */
788 }Format1_1;
789
790 typedef struct dciInfo
791 {
792    uint16_t      cellId;   
793    uint16_t      crnti;          /* CRNI */
794    SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
795    BwpCfg        bwpCfg;         /* BWP Cfg */
796    CoresetCfg    coresetCfg;     /* Coreset1 Cfg */
797    FormatType    formatType;     /* DCI Format */
798    union
799    {
800       Format0_0  format0_0;      /* Format 0_0 */
801       Format0_1  format0_1;      /* Format 0_1 */
802       Format1_0  format1_0;      /* Format 1_0 */
803       Format1_1  format1_1;      /* Format 1_1 */
804    }format;
805    DlDCI    dciInfo;
806 }DciInfo;
807
808
809 typedef struct dlSchedInfo
810 {
811    uint16_t cellId;  /* Cell Id */
812    SchSlotValue schSlotValue;
813
814    /* Allocation for broadcast messages */
815    bool isBroadcastPres;
816    DlBrdcstAlloc brdcstAlloc;
817
818    /* Allocation for RAR message */
819    //uint8_t isRarPres;
820    RarAlloc *rarAlloc;
821
822    /* Allocation from MSG4 */
823    //Msg4Alloc *msg4Alloc;
824
825    /* UL grant in response to BSR */
826    DciInfo    *ulGrant;
827
828    /* Allocation from dedicated DL msg */
829    DlMsgAlloc *dlMsgAlloc;
830
831 }DlSchedInfo;
832
833 typedef struct tbInfo
834 {
835    uint8_t  qamOrder;  /* Modulation Order */
836    uint8_t  mcs;       /* MCS */
837    SchMcsTable  mcsTable;  /* MCS Table */
838    uint8_t  ndi;       /* NDI */
839    uint8_t  rv;        /* Redundancy Version */
840    uint16_t tbSize;    /* TB Size */
841 }TbInfo;
842
843 typedef struct schPuschInfo
844 {
845    uint16_t         crnti;
846    uint8_t          harqProcId;   /* HARQ Process ID */
847    uint8_t          resAllocType; /* Resource allocation type */
848    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
849    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
850    TbInfo           tbInfo;       /* TB info */
851    uint8_t          dmrsMappingType;
852    uint8_t          nrOfDmrsSymbols;
853    uint8_t          dmrsAddPos;
854 }SchPuschInfo;
855
856 typedef struct schPucchFormatCfg
857 {
858    uint8_t interSlotFreqHop;
859    uint8_t addDmrs;
860    uint8_t maxCodeRate;
861    uint8_t numSlots;
862    bool    pi2BPSK;
863    bool    harqAckCSI;
864 }SchPucchFormatCfg;
865
866 typedef struct schPucchInfo
867 {
868    uint16_t         rnti;
869    uint8_t          pucchFormat;
870    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
871    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
872    uint8_t          srFlag;
873    uint8_t          harqFlag;
874    uint8_t          numHarqBits;
875    uint8_t          uciFlag;
876    uint8_t          numUciBits;
877    uint8_t          intraFreqHop;
878    uint16_t         secondPrbHop;
879    uint8_t          initialCyclicShift;
880    uint8_t          occLen;
881    uint8_t          occIdx;
882    uint8_t          timeDomOCC;
883    SchPucchFormatCfg cmnFormatCfg;
884 }SchPucchInfo;
885
886 typedef struct ulSchedInfo
887 {
888    uint16_t      cellId;         /* Cell Id */
889    uint16_t      crnti;          /* CRNI */
890    SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
891    uint8_t       dataType;       /* Type of info being scheduled */
892    PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
893    SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
894    SchPucchInfo  schPucchInfo;   /* Pusch scheduling info */
895 }UlSchedInfo;
896
897 typedef struct rachIndInfo
898 {
899    uint16_t    cellId;
900    uint16_t    crnti;
901    SlotIndInfo timingInfo;
902    uint8_t     slotIdx;
903    uint8_t     symbolIdx;
904    uint8_t     freqIdx;
905    uint8_t     preambleIdx;
906    uint16_t    timingAdv;
907 }RachIndInfo;
908
909
910 typedef struct crcIndInfo
911 {
912    uint16_t    cellId;
913    uint16_t    crnti;
914    SlotIndInfo timingInfo;
915    uint16_t    numCrcInd;
916    uint8_t     crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
917 }CrcIndInfo;
918
919 typedef struct boInfo
920 {
921    uint8_t   lcId;
922    uint32_t  dataVolume;
923 }BOInfo;
924
925 typedef struct dlRlcBOInfo
926 {
927    uint16_t    cellId;
928    uint16_t    crnti;
929    uint8_t     lcId;
930    uint32_t    dataVolume;
931 }DlRlcBoInfo;
932
933 /* Info of Scheduling Request to Add/Modify */
934 typedef struct schSchedReqInfo
935 {
936    uint8_t              schedReqId;
937    SchSrProhibitTimer   srProhibitTmr;
938    SchSrTransMax        srTransMax;
939 }SchSchedReqInfo;
940
941 /* Scheduling Request Configuration */
942 typedef struct schSchedReqCfg
943 {
944    uint8_t          addModListCount;
945    SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
946    uint8_t          relListCount;
947    uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
948 }SchSchedReqCfg;
949
950 /* Info of Tag to Add/Modify */
951 typedef struct schTagInfo
952 {
953    uint8_t       tagId;
954    SchTimeAlignmentTimer  timeAlignmentTmr;
955 }SchTagInfo;
956
957 /* Timing Advance Group Configuration */
958 typedef struct schTagCfg
959 {
960    uint8_t      addModListCount;
961    SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
962    uint8_t      relListCount;
963    uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
964 }SchTagCfg;
965
966 /* Configuration for Power headroom reporting */
967 typedef struct schPhrCfg
968 {
969    SchPhrPeriodicTimer       periodicTmr;
970    SchPhrProhibitTimer       prohibitTmr;
971    SchPhrTxPwrFactorChange   txpowerFactorChange;
972    bool                      multiplePhr;
973    bool                      dummy;
974    bool                      type2OtherCell;
975    SchPhrModeOtherCG         modeOtherCG;
976 }SchPhrCfg;
977
978 /* MAC cell Group configuration */
979 typedef struct schMacCellGrpCfg
980 {
981    SchSchedReqCfg   schedReqCfg;
982    SchTagCfg        tagCfg;
983    SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
984 }SchMacCellGrpCfg;
985
986 /* Physical Cell Group Configuration */
987 typedef struct schPhyCellGrpCfg
988 {
989    SchPdschHarqAckCodebook    pdschHarqAckCodebook;
990    int8_t     pNrFr1;
991 }SchPhyCellGrpCfg;
992
993 /* Control resource set info */
994 typedef struct schControlRsrcSet
995 {
996    uint8_t             cRSetId;                /* Control resource set id */
997    uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
998    uint8_t             duration;
999    SchREGMappingType   cceRegMappingType;
1000    SchPrecoderGranul   precoderGranularity;
1001    uint16_t            dmrsScramblingId;
1002 }SchControlRsrcSet;
1003
1004 /* Search Space info */
1005 typedef struct schSearchSpace
1006 {
1007    uint8_t                  searchSpaceId;
1008    uint8_t                  cRSetId;
1009    SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1010    uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1011    SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1012    SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1013    SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1014    SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1015    SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1016    SchSearchSpaceType       searchSpaceType;
1017    uint8_t                  ueSpecificDciFormat;
1018 }SchSearchSpace;
1019
1020 /* PDCCH cofniguration */
1021 typedef struct schPdcchConfig
1022 {
1023    uint8_t           numCRsetToAddMod;
1024    SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1025    uint8_t           numCRsetToRel;
1026    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1027    uint8_t           numSearchSpcToAddMod;
1028    SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1029    uint8_t           numSearchSpcToRel;
1030    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1031 }SchPdcchConfig;
1032
1033 /* PDSCH time domain resource allocation */
1034 typedef struct schPdschTimeDomRsrcAlloc
1035 {
1036    SchTimeDomRsrcAllocMappingType    mappingType;
1037    uint8_t    startSymbol;
1038    uint8_t    symbolLength;
1039 }SchPdschTimeDomRsrcAlloc;
1040
1041
1042 typedef struct schPdschBundling
1043 {
1044    struct schStaticBundling
1045    {
1046      SchBundlingSizeSet2 size;
1047    }SchStaticBundling;
1048    struct schDynamicBundling
1049    {
1050      SchBundlingSizeSet1 sizeSet1;
1051      SchBundlingSizeSet2 sizeSet2;
1052    }SchDynamicBundling;
1053 }SchPdschBundling;
1054
1055 /* DMRS downlink configuration */
1056 typedef struct schDmrsDlCfg
1057 {
1058    SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
1059 }SchDmrsDlCfg;
1060
1061 /* PDSCH Configuration */
1062 typedef struct schPdschConfig
1063 {
1064    SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1065    SchResourceAllocType       resourceAllocType;
1066    uint8_t                    numTimeDomRsrcAlloc;
1067    SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1068    SchRBGSize                 rbgSize;
1069    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1070    SchBundlingType            bundlingType;
1071    SchPdschBundling           bundlingInfo;
1072 }SchPdschConfig;
1073
1074 /* Initial Downlink BWP */
1075 typedef struct schInitalDlBwp
1076 {
1077    bool             pdcchCfgPres;
1078    SchPdcchConfig   pdcchCfg;
1079    bool             pdschCfgPres;
1080    SchPdschConfig   pdschCfg;
1081 }SchInitalDlBwp;
1082
1083 /* BWP Downlink common */
1084 typedef struct schBwpDlCommon
1085 {
1086 }SchBwpDlCommon;
1087
1088 /* Downlink BWP information */
1089 typedef struct schDlBwpInfo
1090 {
1091    uint8_t          bwpId;
1092 }SchDlBwpInfo;
1093
1094 /* PDCCH Serving Cell configuration */
1095 typedef struct schPdschServCellCfg
1096 {
1097    uint8_t                  *maxMimoLayers;           
1098    SchNumHarqProcForPdsch   numHarqProcForPdsch;
1099    SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
1100    bool                     *codeBlkGrpFlushInd;
1101    SchPdschXOverhead        *xOverhead;
1102 }SchPdschServCellCfg;
1103
1104 /* PUCCH Configuration */
1105 typedef struct schPucchResrcSetInfo
1106 {
1107    uint8_t resrcSetId;
1108    uint8_t resrcListCount;
1109    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1110    uint8_t maxPayLoadSize;
1111 }SchPucchResrcSetInfo;
1112
1113 typedef struct schPucchResrcSetCfg
1114 {
1115    uint8_t resrcSetToAddModListCount;
1116    SchPucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1117    uint8_t resrcSetToRelListCount;
1118    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1119 }SchPucchResrcSetCfg;
1120
1121 typedef struct schPucchFormat0
1122 {
1123    uint8_t initialCyclicShift;
1124    uint8_t numSymbols;
1125    uint8_t startSymbolIdx;
1126 }SchPucchFormat0;
1127
1128 typedef struct schPucchFormat1
1129 {
1130    uint8_t initialCyclicShift;
1131    uint8_t numSymbols;
1132    uint8_t startSymbolIdx;
1133    uint8_t timeDomOCC;
1134 }SchPucchFormat1;
1135
1136 typedef struct schPucchFormat2_3
1137 {
1138    uint8_t numPrbs;
1139    uint8_t numSymbols;
1140    uint8_t startSymbolIdx;
1141 }SchPucchFormat2_3;
1142
1143 typedef struct schPucchFormat4
1144 {
1145    uint8_t numSymbols;
1146    uint8_t occLen;
1147    uint8_t occIdx;
1148    uint8_t startSymbolIdx;
1149 }SchPucchFormat4;
1150
1151 typedef struct schPucchResrcInfo
1152 {
1153    uint8_t  resrcId;
1154    uint16_t startPrb;
1155    uint8_t  intraFreqHop;
1156    uint16_t secondPrbHop;
1157    uint8_t  pucchFormat;
1158    union{
1159       SchPucchFormat0   *format0; 
1160       SchPucchFormat1   *format1;
1161       SchPucchFormat2_3 *format2;
1162       SchPucchFormat2_3 *format3;
1163       SchPucchFormat4   *format4;
1164    }SchPucchFormat;
1165 }SchPucchResrcInfo;
1166
1167 typedef struct schPucchResrcCfg
1168 {
1169    uint8_t resrcToAddModListCount;
1170    SchPucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1171    uint8_t resrcToRelListCount;
1172    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1173 }SchPucchResrcCfg;
1174
1175
1176 typedef struct schSchedReqResrcInfo
1177 {
1178    uint8_t resrcId;
1179    uint8_t requestId;
1180    uint8_t periodicity;
1181    uint16_t offset;
1182    uint8_t resrc;
1183 }SchSchedReqResrcInfo;
1184
1185 typedef struct schPucchSchedReqCfg
1186 {
1187    uint8_t           schedAddModListCount;
1188    SchSchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1189    uint8_t           schedRelListCount;
1190    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1191 }SchPucchSchedReqCfg;
1192
1193 typedef struct schSpatialRelationInfo
1194 {
1195    uint8_t spatialRelationId;
1196    uint8_t servCellIdx;
1197    uint8_t pathLossRefRSId;
1198    uint8_t p0PucchId;
1199    uint8_t closeLoopIdx;
1200 }SchSpatialRelationInfo;
1201
1202 typedef struct schPucchSpatialCfg
1203 {
1204    uint8_t spatialAddModListCount;
1205    SchSpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1206    uint8_t spatialRelListCount;
1207    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1208 }SchPucchSpatialCfg;
1209
1210 typedef struct schP0PucchCfg
1211 {
1212    uint8_t p0PucchId;
1213    int     p0PucchVal;
1214 }SchP0PucchCfg;
1215
1216 typedef struct schPathLossRefRSCfg
1217 {
1218    uint8_t pathLossRefRSId;
1219 }SchPathLossRefRSCfg;
1220
1221 typedef struct schPucchMultiCsiCfg
1222 {
1223    uint8_t  multiCsiResrcListCount;
1224    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1225 }SchPucchMultiCsiCfg;
1226
1227 typedef struct schPucchDlDataToUlAck
1228 {
1229    uint8_t  dlDataToUlAckListCount;
1230    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1231 }SchPucchDlDataToUlAck;
1232
1233 typedef struct schPucchPowerControl
1234 {
1235    int deltaF_Format0;
1236    int deltaF_Format1;
1237    int deltaF_Format2;
1238    int deltaF_Format3;
1239    int deltaF_Format4;
1240    uint8_t p0SetCount;
1241    SchP0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1242    uint8_t pathLossRefRSListCount;
1243    SchPathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1244 }SchPucchPowerControl;
1245
1246 typedef struct schPucchCfg
1247 {
1248    SchPucchResrcSetCfg   *resrcSet;
1249    SchPucchResrcCfg      *resrc;
1250    SchPucchFormatCfg     *format1; 
1251    SchPucchFormatCfg     *format2; 
1252    SchPucchFormatCfg     *format3; 
1253    SchPucchFormatCfg     *format4;
1254    SchPucchSchedReqCfg   *schedReq;
1255    SchPucchMultiCsiCfg   *multiCsiCfg;
1256    SchPucchSpatialCfg    *spatialInfo;
1257    SchPucchDlDataToUlAck *dlDataToUlAck;
1258    SchPucchPowerControl  *powerControl;
1259 }SchPucchCfg;
1260
1261 /* Transform precoding disabled */
1262 typedef struct schTransPrecodDisabled
1263 {
1264    uint16_t   scramblingId0;
1265 }SchTransPrecodDisabled;
1266
1267 /* DMRS Uplink configuration */
1268 typedef struct SchDmrsUlCfg
1269 {
1270    SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
1271    SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
1272 }SchDmrsUlCfg;
1273
1274 /* PUSCH Time Domain Resource Allocation */
1275 typedef struct schPuschTimeDomRsrcAlloc
1276 {
1277    uint8_t   k2;
1278    SchTimeDomRsrcAllocMappingType   mappingType;
1279    uint8_t   startSymbol;
1280    uint8_t   symbolLength;
1281 }SchPuschTimeDomRsrcAlloc;
1282
1283 /* PUSCH Configuration */
1284 typedef struct schPuschCfg
1285 {
1286    uint8_t                    dataScramblingId;
1287    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1288    SchResourceAllocType       resourceAllocType;
1289    uint8_t                    numTimeDomRsrcAlloc;
1290    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1291    SchTransformPrecoder       transformPrecoder;
1292 }SchPuschCfg;
1293
1294 /* Initial Uplink BWP */
1295 typedef struct schInitialUlBwp
1296 {
1297    bool          pucchCfgPres;
1298    SchPucchCfg   pucchCfg;
1299    bool          puschCfgPres;
1300    SchPuschCfg   puschCfg;
1301 }SchInitialUlBwp;
1302
1303 /* Uplink BWP information */
1304 typedef struct schUlBwpInfo
1305 {
1306    uint8_t        bwpId;
1307 }SchUlBwpInfo;
1308
1309 /* Serving cell configuration */
1310 typedef struct schServCellCfgInfo
1311 {
1312    SchInitalDlBwp        initDlBwp;
1313    uint8_t               numDlBwpToAdd;
1314    SchDlBwpInfo          DlBwpToAddList[MAX_NUM_BWP];
1315    uint8_t               firstActvDlBwpId;
1316    uint8_t               defaultDlBwpId;
1317    uint8_t               *bwpInactivityTmr;
1318    SchPdschServCellCfg   pdschServCellCfg;
1319    SchInitialUlBwp       initUlBwp;
1320    uint8_t               numUlBwpToAdd;
1321    SchUlBwpInfo          UlBwpToAddList[MAX_NUM_BWP];
1322    uint8_t               firstActvUlBwpId;
1323 }SchServCellCfgInfo;
1324
1325 typedef struct schNonDynFiveQi
1326 {
1327    uint16_t   fiveQi;
1328    uint8_t    priorLevel;
1329    uint16_t   avgWindow;
1330    uint16_t   maxDataBurstVol;
1331 }SchNonDynFiveQi;
1332
1333 typedef struct schDynFiveQi
1334 {
1335    uint8_t    priorLevel;
1336    uint16_t   packetDelayBudget;
1337    uint8_t    packetErrRateScalar;
1338    uint8_t    packetErrRateExp;
1339    uint16_t   fiveQi;
1340    uint8_t    delayCritical;
1341    uint16_t   avgWindow;
1342    uint16_t   maxDataBurstVol;
1343 }SchDynFiveQi;
1344
1345 typedef struct schNgRanAllocAndRetPri
1346 {
1347    uint8_t priorityLevel;
1348    uint8_t preEmptionCap;
1349    uint8_t preEmptionVul;
1350 }SchNgRanAllocAndRetPri;
1351
1352 typedef struct schGrbQosFlowInfo
1353 {
1354    uint32_t maxFlowBitRateDl;
1355    uint32_t maxFlowBitRateUl;
1356    uint32_t guarFlowBitRateDl;
1357    uint32_t guarFlowBitRateUl;
1358 }SchGrbQosFlowInfo;
1359
1360 /* DRB QoS */
1361 typedef struct schDrbQos
1362 {
1363    SchQosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1364    union
1365    {
1366       SchNonDynFiveQi   nonDyn5Qi;
1367       SchDynFiveQi      dyn5Qi;
1368    }u;
1369    SchNgRanAllocAndRetPri  ngRanRetPri;
1370    SchGrbQosFlowInfo       grbQosFlowInfo;
1371    uint16_t                pduSessionId;
1372    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
1373 }SchDrbQosInfo;
1374
1375 typedef struct schSnssai
1376 {
1377    uint8_t   sst;
1378    uint8_t   sd[SD_SIZE];
1379 }SchSnssai;
1380
1381 /* Special cell configuration */
1382 typedef struct schSpCellCfg
1383 {
1384    uint8_t           servCellIdx;
1385    SchServCellCfgInfo   servCellCfg;
1386 }SchSpCellCfg;
1387
1388 /* Uplink logical channel configuration */
1389 typedef struct SchUlLcCfg
1390 {
1391    uint8_t priority;
1392    uint8_t lcGroup;
1393    uint8_t schReqId;
1394    uint8_t pbr;        // prioritisedBitRate
1395    uint8_t bsd;        // bucketSizeDuration
1396 }SchUlLcCfg;
1397
1398 /* Downlink logical channel configuration */
1399 typedef struct schDlLcCfg
1400 {
1401    uint8_t lcp;      // logical Channel Prioritization
1402 }SchDlLcCfg;
1403
1404 /* Logical Channel configuration */
1405 typedef struct schLcCfg
1406 {
1407    ConfigType     configType;
1408    uint8_t        lcId;
1409    SchDrbQosInfo  *drbQos;
1410    SchSnssai      *snssai;
1411    SchDlLcCfg     dlLcCfg;
1412    SchUlLcCfg     ulLcCfg;
1413 }SchLcCfg;
1414
1415 /* Aggregate max bit rate */
1416 typedef struct schAmbrCfg
1417 {
1418    uint32_t   ulBr;   /* Ul BitRate */
1419 }SchAmbrCfg;
1420
1421 typedef struct schModulationInfo
1422 {
1423    uint8_t      modOrder;
1424    uint8_t      mcsIndex;
1425    SchMcsTable  mcsTable;
1426 }SchModulationInfo;
1427
1428 /* UE configuration */
1429 typedef struct schUeCfg
1430 {
1431    uint16_t        cellId;
1432    uint16_t        crnti;
1433    bool macCellGrpCfgPres;
1434    SchMacCellGrpCfg   macCellGrpCfg;
1435    bool phyCellGrpCfgPres;
1436    SchPhyCellGrpCfg   phyCellGrpCfg;
1437    bool spCellCfgPres;
1438    SchSpCellCfg       spCellCfg;
1439    SchAmbrCfg         *ambrCfg;
1440    SchModulationInfo  dlModInfo;
1441    SchModulationInfo  ulModInfo;
1442    uint8_t            numLcs;
1443    SchLcCfg           schLcCfg[MAX_NUM_LC];
1444 }SchUeCfg;
1445
1446 typedef struct schUeCfgRsp
1447 {
1448    uint16_t   ueIdx;
1449    uint16_t   cellId;
1450    uint16_t   crnti;
1451    SchMacRsp  rsp;
1452    SchFailureCause cause;
1453 }SchUeCfgRsp;
1454
1455 typedef struct dataVolInfo
1456 {
1457    uint8_t  lcgId;
1458    uint32_t dataVol;
1459 }DataVolInfo;
1460
1461 typedef struct ulBufferStatusRptInd
1462 {
1463    uint16_t    cellId;
1464    uint16_t    crnti;
1465    BsrType     bsrType;
1466    uint8_t     numLcg;
1467    DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
1468 }UlBufferStatusRptInd;
1469
1470 typedef struct srUciIndInfo
1471 {
1472    uint16_t    cellId;
1473    uint16_t    crnti;
1474    SlotIndInfo slotInd;
1475    uint8_t     numSrBits;
1476    uint8_t     srPayload[MAX_SR_BITS_IN_BYTES];
1477 }SrUciIndInfo;
1478
1479 /* function pointers */
1480
1481 typedef uint8_t (*SchCellCfgCfmFunc)    ARGS((
1482          Pst            *pst,           /* Post Structure */                         
1483          SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
1484          ));
1485
1486 typedef uint8_t (*SchCellCfgFunc)    ARGS((
1487          Pst         *pst,           /* Post Structure */                         
1488          SchCellCfg  *schCellCfg     /* Cell Cfg  */
1489          ));
1490
1491 typedef uint8_t (*SchMacDlAllocFunc)     ARGS((                     
1492          Pst            *pst,          /* Post Structure */                         
1493          DlSchedInfo    *dlSchedInfo   /* dl allocation Info */                      
1494          ));
1495
1496 typedef uint8_t (*SchMacUlSchInfoFunc)     ARGS((                     
1497          Pst         *pst,           /* Post Structure */                         
1498          UlSchedInfo *ulSchedInfo    /* UL Alloc Sch  Info */                      
1499          ));
1500
1501 typedef uint8_t (*MacSchRachIndFunc) ARGS((
1502          Pst         *pst,         /* Post structure */
1503          RachIndInfo *rachInd));    /* Rach Indication Info */
1504
1505 typedef uint8_t (*MacSchCrcIndFunc) ARGS(( 
1506          Pst         *pst,         /* Post structure */
1507          CrcIndInfo  *crcInd));     /* CRC Info */
1508
1509 typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS((
1510          Pst         *pst,         /* Post structure */
1511          DlRlcBoInfo *dlBoInfo));   /* DL BO Info */
1512
1513 typedef uint8_t (*MacSchAddUeConfigReqFunc) ARGS((
1514          Pst         *pst,           /* Post structure */
1515          SchUeCfg    *ueCfgToSch));   /* Scheduler UE Cfg */
1516
1517 typedef uint8_t (*SchUeCfgRspFunc) ARGS((
1518          Pst         *pst,           /* Post structure */
1519          SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
1520
1521 typedef uint8_t (*MacSchSlotIndFunc) ARGS((
1522          Pst         *pst,          /* Post structure */
1523          SlotIndInfo *slotInd));    /* Slot Info */
1524
1525 typedef uint8_t (*MacSchBsrFunc)       ARGS((
1526    Pst                  *pst,
1527    UlBufferStatusRptInd *bsrInd
1528 ));
1529
1530 typedef uint8_t (*MacSchSrUciIndFunc) ARGS(( 
1531          Pst         *pst,         /* Post structure */
1532          SrUciIndInfo  *uciInd));    /* UCI IND Info */
1533
1534 typedef uint8_t (*MacSchModUeConfigReqFunc) ARGS((
1535          Pst         *pst,           /* Post structure */
1536          SchUeCfg    *ueCfgToSch));   /* Scheduler UE Cfg */
1537
1538 typedef uint8_t (*SchUeReCfgRspFunc) ARGS((
1539          Pst         *pst,           /* Post structure */
1540          SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
1541
1542 /* function declarations */
1543 uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
1544 uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
1545 uint8_t packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
1546 uint8_t packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
1547 uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
1548 uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
1549 uint8_t MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
1550 uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
1551 uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
1552 uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
1553 uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
1554 uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
1555 uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
1556 uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd);
1557 uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
1558 uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
1559 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
1560 uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
1561 uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1562 uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1563 uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1564 uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1565 uint8_t MacSchSlotInd ARGS((Pst * pst, SlotIndInfo * slotInd));
1566 uint8_t packMacSchSlotInd(Pst * pst, SlotIndInfo * slotInd);
1567 uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer  *mBuf);
1568 uint8_t packMacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
1569 uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
1570 uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
1571 uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
1572 uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1573 uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
1574 uint8_t packSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1575 uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1576
1577 /**********************************************************************
1578   End of file
1579  **********************************************************************/
1580