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