Moving all common header file into common_def.h file
[o-du/l2.git] / src / cm / du_app_mac_inf.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 /* Defines APIs exchanged between du_app and cl module of MAC */
20 #ifndef __MACINT_H__
21 #define __MACINT_H__
22
23 #include <stdbool.h>
24
25 #define NUM_NUMEROLOGY 5  /* Number of numerology */
26 #define MAXIMUM_TDD_PERIODICITY 5
27 #define MAX_SYMB_PER_SLOT 14 
28
29 #define NUM_SSB         1       /* max value is 64 */
30 #define SSB_MASK_SIZE   1       /* SSB mask size is 32bit for sub6 */
31 #define SIB1_NEW_TX_PERIOD      160
32 #define SIB1_REPETITION_PERIOD   20
33 #define CORESET_0_INDEX      0
34 #define CORESET_1_INDEX      1
35 #define CORESET_2_INDEX      2
36 #define CORESET_3_INDEX      3
37 #define CORESET_4_INDEX      4
38 #define SEARCHSPACE_0_INDEX   0
39 #define SEARCHSPACE_1_INDEX   1
40 #define SEARCHSPACE_2_INDEX   2
41 #define SEARCHSPACE_3_INDEX   3
42 #define SEARCHSPACE_4_INDEX   4
43 #define SS_MONITORING_SLOT_SL1   0 /* all slots */
44 #define SS_MONITORING_SYMBOL     0x2000; /* symbol-0, set 14th bit */
45 #define SIB1_MCS  4
46
47 #define SRB_ID_0 0
48 #define SRB_ID_1 1
49
50 /* Macro for Ue Context */
51 #define MAX_NUM_LOGICAL_CHANNELS 11
52 #define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
53 #define MAC_NUM_TAGS 4                  /* Max number of timing advance groups */
54 #define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
55 #define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
56 #define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
57 #define FREQ_DOM_RSRC_SIZE  6           /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
58 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
59 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
60 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
61 #define SD_SIZE   3                     /* Max size of Slice Differentiator in S-NSSAI */
62 #define PDSCH_START_SYMBOL_LEN 53
63 #define PUSCH_START_SYMBOL_LEN 41
64
65 /* Event IDs */
66 #define EVENT_MAC_CELL_CONFIG_REQ    200
67 #define EVENT_MAC_CELL_CONFIG_CFM    201
68 #define EVENT_MAC_CELL_START_REQ     202
69 #define EVENT_MAC_CELL_STOP_REQ      203
70 #define EVENT_MAC_SLOT_IND           204
71 #define EVENT_MAC_STOP_IND           205
72 #define EVENT_MAC_UL_CCCH_IND        206
73 #define EVENT_MAC_DL_CCCH_IND        207
74 #define EVENT_MAC_UE_CREATE_REQ      208
75
76 typedef enum
77 {
78    DUP_MODE_FDD,
79    DUP_MODE_TDD
80 }DuplexMode;
81
82 typedef enum
83 {
84    MAC_GEN_FULL_PBCH_PAYLD,   /* MAC generated the full PBCH Payload */
85    PHY_GEN_TIMING_PBCH_BIT,   /* PHY generates the timing PBCH bits */
86    PHY_GEN_FULL_PBCH_PAYLD    /* PHY generates full PBCH payload */
87 }BchPduOpt;
88
89 typedef enum
90 {
91    LONG_SEQUENCE,
92    SHORT_SEQUENCE
93 }PrachSeqLen;
94
95 typedef enum
96 {
97    UNRESTRICTED,
98    RESTRICTED_SET_TYPE_A,
99    RESTRICTED_SET_TYPE_B
100 }RstSetCfg;
101
102 typedef enum
103 {
104    DONT_REPORT_RSSI,
105    RSSI_UNIT_DBM,
106    RSSI_UNIT_DBFS
107 }RSSIMeasUnit;
108
109 typedef enum
110 {
111    DL_SLOT,
112    UL_SLOT,
113    GUARD_SLOT
114 }SlotConfig;
115
116 typedef enum
117 {
118    TX_PRDCTY_MS_0P5,
119    TX_PRDCTY_MS_0P625,
120    TX_PRDCTY_MS_1,
121    TX_PRDCTY_MS_1P25,
122    TX_PRDCTY_MS_2,
123    TX_PRDCTY_MS_2P5,
124    TX_PRDCTY_MS_5,
125    TX_PRDCTY_MS_10
126 }DlUlTxPeriodicity;
127
128 typedef enum
129 {
130    BETA_PSS_0DB,
131    BETA_PSS_1DB
132 }BetaPss;
133
134 typedef enum 
135 {
136    SSB_PRDCTY_MS_5,
137    SSB_PRDCTY_MS_10,
138    SSB_PRDCTY_MS_20,
139    SSB_PRDCTY_MS_40,
140    SSB_PRDCTY_MS_80,
141    SSB_PRDCTY_MS_160
142 }SSBPeriod;
143
144 typedef enum
145 {
146    RRC_REJECT,
147    RRC_SETUP
148 }DlCcchMsgType;
149
150 /* Enums for Ue Create Request */
151
152 /* SR PROHIBIT TIMER */
153 typedef enum
154 {
155    SR_PROHIBIT_MS_1,
156    SR_PROHIBIT_MS_2,
157    SR_PROHIBIT_MS_4,
158    SR_PROHIBIT_MS_8,
159    SR_PROHIBIT_MS_16,
160    SR_PROHIBIT_MS_32,
161    SR_PROHIBIT_MS_64,
162    SR_PROHIBIT_MS_128
163 }SrProhibitTimer;
164
165 typedef enum
166 {
167    SR_TRANS_MAX_N_4,
168    SR_TRANS_MAX_N_8,
169    SR_TRANS_MAX_N_16,
170    SR_TRANS_MAX_N_32,
171    SR_TRANS_MAX_N_64,
172    SR_TRANS_MAX_spare3,
173    SR_TRANS_MAX_spare2,
174    SR_TRANS_MAX_spare1
175 }SrTransMax;
176
177 typedef enum
178 {
179    TIME_ALIGNMENT_TIMER_MS_500,
180    TIME_ALIGNMENT_TIMER_MS_750,
181    TIME_ALIGNMENT_TIMER_MS_1280,
182    TIME_ALIGNMENT_TIMER_MS_1920,
183    TIME_ALIGNMENT_TIMER_MS_2560,
184    TIME_ALIGNMENT_TIMER_MS_5120,
185    TIME_ALIGNMENT_TIMER_MS_10240,
186    TIME_ALIGNMENT_TIMER_INFINITY
187 }TimeAlignmentTimer;
188
189 typedef enum
190 {
191    PHR_PERIODIC_TIMER_SF_10,
192    PHR_PERIODIC_TIMER_SF_20,
193    PHR_PERIODIC_TIMER_SF_50,
194    PHR_PERIODIC_TIMER_SF_100,
195    PHR_PERIODIC_TIMER_SF_200,
196    PHR_PERIODIC_TIMER_SF_500,
197    PHR_PERIODIC_TIMER_SF_1000,
198    PHR_PERIODIC_TIMER_INFINITY
199 }PhrPeriodicTimer;
200
201 typedef enum
202 {
203    PHR_PROHIBIT_TIMER_SF_0,
204    PHR_PROHIBIT_TIMER_SF_10,
205    PHR_PROHIBIT_TIMER_SF_20,
206    PHR_PROHIBIT_TIMER_SF_50,
207    PHR_PROHIBIT_TIMER_SF_100,
208    PHR_PROHIBIT_TIMER_SF_200,
209    PHR_PROHIBIT_TIMER_SF_500,
210    PHR_PROHIBIT_TIMER_SF_1000
211 }PhrProhibitTimer;
212
213 typedef enum
214 {
215    PHR_TX_PWR_FACTOR_CHANGE_DB_1,
216    PHR_TX_PWR_FACTOR_CHANGE_DB_3,
217    PHR_TX_PWR_FACTOR_CHANGE_DB_6,
218    PHR_TX_PWR_FACTOR_CHANGE_INFINITY
219 }PhrTxPwrFactorChange;
220
221 typedef enum
222 {
223    PHR_MODE_OTHER_CG_REAL,
224    PHR_MODE_OTHER_CG_VIRTUAL
225 }PhrModeOtherCG;
226
227 typedef enum
228 {
229    PDSCH_HARQ_ACK_CODEBOOK_SEMISTATIC,
230    PDSCH_HARQ_ACK_CODEBOOK_DYNAMIC
231 }PdschHarqAckCodebook;
232
233 typedef enum
234 {
235    NUM_HARQ_PROC_FOR_PDSCH_N_2,
236    NUM_HARQ_PROC_FOR_PDSCH_N_4,
237    NUM_HARQ_PROC_FOR_PDSCH_N_6,
238    NUM_HARQ_PROC_FOR_PDSCH_N_10,
239    NUM_HARQ_PROC_FOR_PDSCH_N_16
240 }NumHarqProcForPdsch;
241
242 typedef enum
243 {
244    MAX_CODE_BLOCK_GROUP_PER_TB_N_2,
245    MAX_CODE_BLOCK_GROUP_PER_TB_N_4,
246    MAX_CODE_BLOCK_GROUP_PER_TB_N_6,
247    MAX_CODE_BLOCK_GROUP_PER_TB_N_8
248 }MaxCodeBlkGrpPerTB;
249
250 typedef enum
251 {
252    PDSCH_X_OVERHEAD_6,
253         PDSCH_X_OVERHEAD_12,
254         PDSCH_X_OVERHEAD_18
255 }PdschXOverhead;
256
257 typedef enum
258 {
259    TRANSFORM_PRECODER_ENABLED,
260    TRANSFORM_PRECODER_DISABLED
261 }TransformPrecoder;
262
263 typedef enum 
264 {
265    CCE_REG_MAPPINGTYPE_PR_INTERLEAVED,
266    CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED
267 }REGMappingType;
268
269 typedef enum
270 {
271    SLOTPERIODICITYANDOFFSET_PR_SL1,
272    SLOTPERIODICITYANDOFFSET_PR_SL2,
273    SLOTPERIODICITYANDOFFSET_PR_SL4,
274    SLOTPERIODICITYANDOFFSET_PR_SL5,
275    SLOTPERIODICITYANDOFFSET_PR_SL8,
276    SLOTPERIODICITYANDOFFSET_PR_SL10,
277    SLOTPERIODICITYANDOFFSET_PR_SL16,
278    SLOTPERIODICITYANDOFFSET_PR_SL20,
279    SLOTPERIODICITYANDOFFSET_PR_SL40,
280    SLOTPERIODICITYANDOFFSET_PR_SL80,
281    SLOTPERIODICITYANDOFFSET_PR_SL160,
282    SLOTPERIODICITYANDOFFSET_PR_SL320,
283    SLOTPERIODICITYANDOFFSET_PR_SL640,
284    SLOTPERIODICITYANDOFFSET_PR_SL1280,
285    SLOTPERIODICITYANDOFFSET_PR_SL2560
286 }MSlotPeriodAndOffset;
287
288 typedef enum
289 {
290   SAMEASREG_BUNDLE,
291   ALL_CONTIGUOUS_RBS
292 }PrecoderGranul;
293
294 typedef enum
295 {
296    SEARCHSPACETYPE_PR_COMMON,
297    SEARCHSPACETYPE_PR_UE_SPECIFIC
298 }SearchSpaceType;
299
300 typedef enum
301 {
302    AGGREGATIONLEVEL_N0  = 0,  
303    AGGREGATIONLEVEL_N1  = 1,
304    AGGREGATIONLEVEL_N2  = 2,
305    AGGREGATIONLEVEL_N3  = 3,
306    AGGREGATIONLEVEL_N4  = 4,
307    AGGREGATIONLEVEL_N5  = 5,
308    AGGREGATIONLEVEL_N6  = 6,
309    AGGREGATIONLEVEL_N8  = 7
310 }AggrLevel;
311
312 typedef enum
313 {
314    ADDITIONALPOSITION_POS0,
315    ADDITIONALPOSITION_POS1,
316    ADDITIONALPOSITION_POS3
317 }AddPosType;
318
319 typedef enum
320 {
321    MAPPING_TYPEA,
322    MAPPING_TYPEB
323 }CommonMappingType;
324
325 typedef enum
326 {
327    RESOURCEALLOCATION_TYPE0,
328    RESOURCEALLOCATION_TYPE1,
329    RESOURCEALLOCATION_DYNAMICSWITCH
330 }ResAllocType;
331
332 typedef enum
333 {
334    RBG_SIZE_CONFIG1,
335    RBG_SIZE_CONFIG2
336 }RBGSize;
337
338 typedef enum
339 {
340    CODEWORDS_SCHED_BY_DCI_N1,
341    CODEWORDS_SCHED_BY_DCI_N2
342 }CodeWordsSchedDci;
343
344 typedef enum
345 {
346    TYPE_STATIC_BUNDLING,
347    TYPE_DYNAMIC_BUNDLING
348 }BundlingType;
349
350 typedef enum
351 {
352   LC_PRIORITY_1 = 1,
353   LC_PRIORITY_2,
354   LC_PRIORITY_3
355 }LcPriority;
356
357 typedef struct carrierCfg
358 {
359    Bool  pres;
360    U16   bw;             /* DL/UL bandwidth */
361    U32   freq;           /* Absolute frequency of DL/UL point A in KHz */
362    U16   k0[NUM_NUMEROLOGY];          /* K0 for DL/UL */
363    U16   gridSize[NUM_NUMEROLOGY];    /* DL/UL Grid size for each numerologies */
364    U16   numAnt;         /* Number of Tx/Rx antennas */
365 }CarrierCfg;
366
367 typedef struct ssbCfg
368 {
369    uint32_t    ssbPbchPwr;       /* SSB block power */
370    BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
371    uint8_t     scsCmn;           /* subcarrier spacing for common */
372    uint16_t    ssbOffsetPointA;  /* SSB subcarrier offset from point A */
373    BetaPss     betaPss;
374    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
375    uint8_t     ssbScOffset;       /* Subcarrier Offset */
376    uint8_t     mibPdu[3];           /* MIB payload */
377    uint32_t    ssbMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
378    uint8_t     beamId[NUM_SSB];
379    Bool        multCarrBand;     /* Multiple carriers in a band */
380    Bool        multCellCarr;     /* Multiple cells in single carrier */
381 }SsbCfg;
382
383 typedef struct fdmInfo
384 {
385    U16   rootSeqIdx;        /* Root sequence index */
386    U8    numRootSeq;        /* Number of root sequences required for FD */
387    U16   k1;                /* Frequency Offset for each FD */
388    U8    zeroCorrZoneCfg;   /* Zero correlation zone cofig */
389    U8    numUnusedRootSeq;  /* Number of unused root sequence */
390    U8    *unsuedRootSeq;     /* Unused root sequence per FD */
391 }PrachFdmInfo;
392
393 typedef struct prachCfg
394 {
395    Bool          pres;
396         uint8_t       prachCfgIdx;         /* PRACH Cfg Index */
397    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
398    uint8_t       prachSubcSpacing;    /* Subcarrier spacing of RACH */
399    RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
400         uint16_t      msg1FreqStart;       /* Msg1-FrequencyStart */
401    uint8_t       msg1Fdm;             /* PRACH FDM (1,2,4,8) */
402         uint8_t       rootSeqLen;          /* Root sequence length */
403    PrachFdmInfo  fdm[8];              /* FDM info */
404    uint8_t       ssbPerRach;          /* SSB per RACH occassion */
405    Bool          prachMultCarrBand;   /* Multiple carriers in Band */
406    uint8_t       prachRestrictedSet; /* Support for PRACH restricted set */
407         uint8_t       raContResTmr;        /* RA Contention Resoultion Timer */
408         uint8_t       rsrpThreshSsb;       /* RSRP Threshold SSB */
409    uint8_t       raRspWindow;         /* RA Response Window */
410 }PrachCfg;
411
412 typedef struct tddCfg
413 {
414    Bool               pres;
415    DlUlTxPeriodicity  tddPeriod;      /* DL UL Transmission periodicity */
416    SlotConfig         slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; 
417 }TDDCfg;
418
419 typedef struct sib1CellCfg
420 {
421    uint8_t  *sib1Pdu;
422    uint16_t sib1PduLen;
423    uint16_t sib1NewTxPeriod;
424    uint16_t sib1RepetitionPeriod;
425    uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
426    uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
427    uint16_t sib1Mcs;
428 } Sib1CellCfg; 
429
430 typedef struct bwpParams
431 {
432    uint16_t firstPrb;
433    uint16_t numPrb;
434         uint8_t  scs;
435         uint8_t  cyclicPrefix;
436 }BwpParams;
437
438 typedef struct candidatesInfo
439 {
440    uint8_t aggLevel1;
441    uint8_t aggLevel2;
442    uint8_t aggLevel4;
443    uint8_t aggLevel8;
444    uint8_t aggLevel16;
445 }CandidatesInfo;
446
447 typedef struct searchSpaceCfg
448 {
449    uint8_t searchSpaceId;
450         uint8_t coresetId;
451         uint16_t monitoringSlot;
452         uint16_t duration;
453         uint16_t monitoringSymbol;
454         CandidatesInfo candidate;
455 }SearchSpaceCfg;
456
457 typedef struct pdcchConfigCommon
458 {
459    /* only one search space is configured during SIB1 */
460    SearchSpaceCfg commonSearchSpace;
461    uint8_t raSearchSpaceId;
462 }PdcchConfigCommon;
463
464 typedef struct pdschConfigCommon
465 {
466    uint8_t k0;
467         uint8_t mappingType;
468         uint8_t startSymbol;
469         uint8_t lengthSymbol;
470 }PdschConfigCommon;
471
472 typedef struct pucchConfigCommon
473 {
474    uint8_t pucchResourceCommon;
475         uint8_t pucchGroupHopping;
476 }PucchConfigCommon;
477
478 typedef struct puschConfigCommon
479 {
480    /* PUSCH-TimeDomainResourceAllocation info */
481    uint8_t k2;
482         uint8_t mappingType;
483         uint8_t startSymbol;
484         uint8_t lengthSymbol;
485 }PuschConfigCommon;
486
487 typedef struct bwpDlConfig
488 {
489    BwpParams      bwp;
490         PdcchConfigCommon pdcchCommon;
491         PdschConfigCommon pdschCommon;
492 }BwpDlConfig;
493
494 typedef struct bwpUlConfig
495 {
496    BwpParams      bwp;
497         // rach config common sent in PrachCfg
498         PucchConfigCommon pucchCommon;
499         PuschConfigCommon puschCommon;
500 }BwpUlConfig;
501
502 typedef struct macCellCfg
503 {
504         U16            transId;          /* Trans Id */
505         U16            cellId;           /* Cell Id */
506         U8             numTlv;           /* Number of configuration TLVs */
507         U8             carrierId;        /* Carrired Index */
508         U16            phyCellId;        /* Physical cell id */
509         DuplexMode     dupType;          /* Duplex type: TDD/FDD */
510         CarrierCfg     dlCarrCfg;        /* DL Carrier configuration */
511         CarrierCfg     ulCarrCfg;        /* UL Carrier configuration */
512         Bool           freqShft;         /* Indicates presence of 7.5kHz frequency shift */
513    SsbCfg         ssbCfg;           /* SSB configuration */          
514    PrachCfg       prachCfg;         /* PRACH Configuration */
515    TDDCfg         tddCfg;           /* TDD periodicity and slot configuration */
516    RSSIMeasUnit   rssiUnit;         /* RSSI measurement unit */
517    Sib1CellCfg    sib1Cfg;          /* SIB1 config */
518         BwpDlConfig    initialDlBwp;     /* Initial DL BWP */
519         BwpUlConfig    initialUlBwp;     /* Initial UL BWP */
520         uint8_t        dmrsTypeAPos;     /* DMRS Type A position */
521 }MacCellCfg;
522
523 typedef struct macCellCfgCfm
524 {
525         uint8_t        rsp; 
526    U16            transId;
527 }MacCellCfgCfm;
528
529 typedef struct slotInfo
530 {
531    uint16_t cellId;
532    uint16_t sfn;
533    uint16_t slot;
534 }SlotInfo;
535
536 typedef struct macCellStartInfo
537 {
538    uint16_t cellId;
539 }MacCellStartInfo;
540
541 typedef struct macCellStopInfo
542 {
543    uint16_t cellId;
544 }MacCellStopInfo;
545
546 typedef struct ulCcchInd
547 {
548    uint16_t cellId;
549    uint16_t crnti;
550    uint8_t  *ulCcchMsg;
551 }UlCcchIndInfo;
552
553 typedef struct dlCcchInd
554 {
555    uint16_t      cellId;
556    uint16_t      crnti;
557    DlCcchMsgType msgType;
558    uint16_t      dlCcchMsgLen;
559    uint8_t       *dlCcchMsg;
560 }DlCcchIndInfo;
561
562 typedef struct bsrCfg
563 {
564    uint8_t periodicTimer;
565    uint8_t retxTimer;
566    uint8_t srDelayTimer;
567 }BsrCfg;
568
569
570 /* Info of Scheduling Request to Add/Modify */
571 typedef struct schedReqInfo
572 {
573    uint8_t         schedReqId;
574    SrProhibitTimer srProhibitTmr;
575    SrTransMax      srTransMax;
576 }SchedReqInfo;
577
578 /* Scheduling Request Configuration */
579 typedef struct schedReqCfg
580 {
581    uint8_t       addModListCount;
582    SchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
583    uint8_t       relListCount;
584    uint8_t       relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
585 }SchedReqCfg;
586
587 typedef struct tagInfo
588 {
589    uint8_t tagId;
590    TimeAlignmentTimer timeAlignTimer;
591 }TagInfo;
592
593 typedef struct tagCfg
594 {
595    uint8_t      addModListCount;
596    TagInfo      addModList[MAC_NUM_TAGS];  /* List of Tag to Add/Modify */
597    uint8_t      relListCount;
598    uint8_t      relList[MAC_NUM_TAGS];     /* list of Tag Id to release */
599 }TagCfg;
600
601 typedef struct phrCfg
602 {
603    PhrPeriodicTimer periodicTimer;
604    PhrProhibitTimer prohibitTimer; 
605    PhrTxPwrFactorChange txPowerFactor;
606    bool     multiplePHR;       
607    bool     dummy;
608    bool     phrType2OtherCell;
609    PhrModeOtherCG phrOtherCG;
610 }PhrCfg;
611
612 typedef struct macCellGrpCfg
613 {
614    SchedReqCfg schReqCfg;
615    TagCfg tagCfg;
616    //BsrCfg bsrCfg;
617    bool   phrCfgSetupPres;   /* true/false: phrCfgSetup/phrCfgRelease */
618    PhrCfg phrCfg;
619 }MacCellGrpCfg;
620
621 typedef struct phyCellGrpCfg
622 {
623    PdschHarqAckCodebook  pdschHarqAckCodebook;
624    uint8_t    pNrFr1;
625 }PhyCellGrpCfg;
626
627 /* Control resource set info */
628 typedef struct controlRsrcSet
629 {
630    uint8_t     cRSetId;                /* Control resource set id */
631    uint8_t     freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
632    uint8_t     duration;
633    REGMappingType cceRegMappingType;
634    PrecoderGranul precoderGranularity;
635    uint16_t    dmrsScramblingId;
636 }ControlRsrcSet;
637
638 /* Search Space info */
639 typedef struct searchSpace
640 {
641    uint8_t     searchSpaceId;
642    uint8_t     cRSetId;
643    MSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
644    uint8_t     mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
645    AggrLevel   numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
646    AggrLevel   numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
647    AggrLevel   numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
648    AggrLevel   numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
649    AggrLevel   numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
650    SearchSpaceType searchSpaceType;
651    uint8_t     ueSpecificDciFormat;
652 }SearchSpace;
653
654 /* PDCCH cofniguration */
655 typedef struct pdcchConfig
656 {
657    uint8_t           numCRsetToAddMod;
658    ControlRsrcSet    cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
659    uint8_t           numCRsetToRel;
660    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
661    uint8_t           numSearchSpcToAddMod;
662    SearchSpace       searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
663    uint8_t           numSearchSpcToRel;
664    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
665 }PdcchConfig;
666
667 /* PDSCH time domain resource allocation */
668 typedef struct pdschTimeDomRsrcAlloc
669 {
670    CommonMappingType mappingType;
671    uint8_t           startSymbolAndLength;
672 }PdschTimeDomRsrcAlloc;
673
674 /* DMRS downlink configuration */
675 typedef struct dmrsDlCfg
676 {
677    AddPosType  addPos;       /* DMRS additional position */
678 }DmrsDlCfg;
679
680 /* PDSCH Configuration */
681 typedef struct pdschConfig
682 {
683    DmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
684    ResAllocType            resourceAllocType;
685    uint8_t                 numTimeDomRsrcAlloc;
686    PdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
687    RBGSize                 rbgSize;
688    CodeWordsSchedDci       numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
689    BundlingType            bundlingType;
690 }PdschConfig;
691
692 /* Initial Downlink BWP */
693 typedef struct initialDlBwp
694 {
695    bool          pdcchPresent;
696    PdcchConfig   pdcchCfg;
697    bool          pdschPresent;
698    PdschConfig   pdschCfg;
699 }InitialDlBwp;
700
701 /* BWP Downlink common */
702 typedef struct bwpDlCommon
703 {
704 }BwpDlCommon;
705
706 /* Downlink BWP information */
707 typedef struct dlBwpInfo
708 {
709    uint8_t          bwpId;
710 }DlBwpInfo;
711
712 /* PDCCH Serving Cell configuration */
713 typedef struct pdschServCellCfg
714 {
715    uint8_t              *maxMimoLayers;           
716    NumHarqProcForPdsch  numHarqProcForPdsch;
717    MaxCodeBlkGrpPerTB   *maxCodeBlkGrpPerTb;
718    bool                 *codeBlkGrpFlushInd;
719    PdschXOverhead       *xOverhead;
720 }PdschServCellCfg;
721
722 /* PUCCH Configuration */
723 typedef struct pucchCfg
724 {
725   /* TODO : Not used currently */ 
726 }PucchCfg;
727
728 /* Transform precoding disabled */
729 typedef struct transPrecodDisabled
730 {
731    uint16_t   scramblingId0;
732 }TransPrecodDisabled;
733
734 /* DMRS Uplink configuration */
735 typedef struct dmrsUlCfg
736 {
737    AddPosType            addPos;               /* DMRS additional position */
738    TransPrecodDisabled   transPrecodDisabled;  /* Transform precoding disabled */
739 }DmrsUlCfg;
740
741 /* PUSCH Time Domain Resource Allocation */
742 typedef struct puschTimeDomRsrcAlloc
743 {
744    uint8_t   k2;
745    CommonMappingType   mappingType;
746    uint8_t   startSymbolAndLength;
747 }PuschTimeDomRsrcAlloc;
748
749 /* PUSCH Configuration */
750 typedef struct puschCfg
751 {
752    DmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
753    ResAllocType            resourceAllocType;
754    uint8_t                 numTimeDomRsrcAlloc;
755    PuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
756    TransformPrecoder       transformPrecoder;
757 }PuschCfg;
758
759 /* Initial Uplink BWP */
760 typedef struct initialUlBwp
761 {
762    bool       pucchPresent;
763    PucchCfg   pucchCfg; 
764    bool       puschPresent;
765    PuschCfg   puschCfg;
766 }InitialUlBwp;
767
768 /* Uplink BWP information */
769 typedef struct ulBwpInfo
770 {
771    uint8_t        bwpId;
772 }UlBwpInfo;
773
774 /* Serving cell configuration */
775 typedef struct servCellCfgInfo
776 {
777    InitialDlBwp       initDlBwp;
778    uint8_t            numDlBwpToAdd;
779    DlBwpInfo          DlBwpToAddList[MAX_NUM_BWP];
780    uint8_t            firstActvDlBwpId;
781    uint8_t            defaultDlBwpId;
782    uint8_t            *bwpInactivityTmr;
783    PdschServCellCfg   pdschServCellCfg;
784    InitialUlBwp       initUlBwp;
785    uint8_t            numUlBwpToAdd;
786    UlBwpInfo          UlBwpToAddList[MAX_NUM_BWP];
787    uint8_t            firstActvUlBwpId;
788 }ServCellCfgInfo;
789
790 /* Special cell configuration */
791 typedef struct spCellCfg
792 {
793    uint8_t           servCellIdx;
794    ServCellCfgInfo   servCellCfg;
795 }SpCellCfg;
796
797 typedef struct maxAggrBitRate
798 {
799    uint32_t ulBits;
800    uint32_t dlBits;
801 }MaxAggrBitRate;
802
803 /* Single Network Slice Selection assistance Info */
804 typedef struct snssai
805 {
806    uint8_t sst;                /* Slice Type */
807    uint8_t sd[SD_SIZE];        /* Slice Differentiator */
808 }Snssai;
809
810 typedef struct nonDynFiveQi
811 {
812    uint16_t   fiveQi;
813    uint8_t    priorLevel;
814    uint16_t   avgWindow;
815    uint16_t   maxDataBurstVol;
816 }NonDynFiveQi;
817
818 typedef struct dynFiveQi
819 {
820    uint8_t    priorLevel;
821    uint16_t   packetDelayBudget;
822    uint8_t    packetErrRateScalar;
823    uint8_t    packetErrRateExp;
824    uint16_t   fiveQi;
825    uint8_t    delayCritical;
826    uint16_t   avgWindow;
827    uint16_t   maxDataBurstVol;
828 }DynFiveQi;
829
830 typedef struct ngRanAllocAndRetPri
831 {
832   uint8_t priorityLevel;
833   uint8_t preEmptionCap;
834   uint8_t preEmptionVul;
835 }NgRanAllocAndRetPri;
836
837 typedef struct grbQosInfo
838 {
839   uint32_t maxFlowBitRateDl;
840   uint32_t maxFlowBitRateUl;
841   uint32_t guarFlowBitRateDl;
842   uint32_t guarFlowBitRateUl;
843 }GrbQosInfo;
844
845 typedef struct drbQos
846 {
847    uint8_t  fiveQiType;   /* Dynamic or non-dynamic */ 
848    union
849    {
850       NonDynFiveQi   nonDyn5Qi;
851       DynFiveQi      dyn5Qi;
852    }u;
853    NgRanAllocAndRetPri ngRanRetPri;
854    GrbQosInfo grbQosInfo;
855    uint16_t             pduSessionId;
856    uint32_t             ulPduSessAggMaxBitRate;
857 }DrbQosInfo;
858
859 typedef struct ulLcCfg
860 {
861    uint8_t priority;
862    uint8_t lcGroup;
863    uint8_t schReqId;
864    uint8_t pbr;        // prioritisedBitRate
865    uint8_t bsd;        // bucketSizeDuration
866 }UlLcCfg;
867
868 typedef struct duLcCfg
869 {
870    LcPriority lcp;      // logical Channel Prioritization
871 }DlLcCfg;
872
873 typedef struct lcCfg
874 {
875    uint8_t lcId;
876    DrbQosInfo *drbQos; 
877    Snssai  *snssai;
878    UlLcCfg *ulLcCfg;
879    DlLcCfg dlLcCfg;
880
881 }LcCfg;
882
883 typedef struct macUeCfg
884 {
885    uint16_t cellIdx;
886    uint8_t  ueIdx;
887    uint16_t crnti;
888    MacCellGrpCfg macCellGrpCfg;
889    PhyCellGrpCfg phyCellGrpCfg;
890    SpCellCfg spCellCfg;
891    MaxAggrBitRate *maxAggrBitRate;
892    uint8_t numLcs;
893    LcCfg lcCfgList[MAX_NUM_LOGICAL_CHANNELS];
894 }MacUeCfg;
895
896 /* Functions for slot Ind from MAC to DU APP*/
897 typedef uint16_t (*DuMacSlotInd) ARGS((
898    Pst       *pst,
899    SlotInfo  *slotInfo ));
900
901 /* Functions for stop Ind from MAC to DU APP*/
902 typedef uint16_t (*DuMacStopInd) ARGS((
903    Pst       *pst,
904    MacCellStopInfo  *cellId ));
905
906 /* Functions for mac cell start req */
907 typedef uint16_t (*DuMacCellStartReq) ARGS((
908    Pst               *pst, 
909    MacCellStartInfo  *cellStartInfo ));
910
911 /* Functions for mac cell stop request */
912 typedef uint16_t (*DuMacCellStopReq) ARGS((
913    Pst               *pst,
914    MacCellStopInfo  *cellStopInfo ));
915  
916 /* Function pointers for packing macCellCfg Request and Confirm */
917 typedef int (*packMacCellCfgReq) ARGS((
918    Pst           *pst,
919    MacCellCfg    *macCellCfg ));
920
921 typedef int (*packMacCellCfgConfirm) ARGS((
922    Pst              *pst,
923    MacCellCfgCfm    *macCellCfgCfm ));
924
925 typedef int (*DuMacCellCfgReq) ARGS((
926    Pst        *pst,        
927    MacCellCfg *macCellCfg));
928
929 typedef int (*DuMacCellCfgCfm) ARGS((
930    Pst        *pst,        
931    MacCellCfgCfm *macCellCfgCfm ));
932
933 /* Functions for UL CCCH Ind from MAC to DU APP*/
934 typedef uint16_t (*DuMacUlCcchInd) ARGS((
935    Pst           *pst,
936    UlCcchIndInfo *ulCcchIndInfo ));
937
938 /* Functions for DL CCCH Ind from DU APP to MAC*/
939 typedef uint16_t (*DuMacDlCcchInd) ARGS((
940    Pst           *pst,
941    DlCcchIndInfo *dlCcchIndInfo ));
942
943 /* UE create Request from DU APP to MAC*/
944 typedef uint8_t (*DuMacUeCreateReq) ARGS((
945    Pst           *pst,
946    MacUeCfg      *ueCfg ));
947
948 extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
949 extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
950 extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
951 extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
952 extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
953 extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo);
954 extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
955 extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
956 extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
957 extern int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
958 extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
959 extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
960 extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
961 extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
962 extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
963 extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
964 extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
965 extern uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
966 extern uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
967 extern uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
968 extern uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
969 extern uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
970 extern uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
971 extern uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
972 extern uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf);
973 extern uint8_t MacHdlUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
974 uint8_t sendStopIndMacToDuApp();
975 #endif
976
977 /**********************************************************************
978          End of file
979 **********************************************************************/