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