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