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