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