Merge "SIB1 optional parameters, Cell start request, stop request and slot indication"
[o-du/l2.git] / src / du_app / du_cfg.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 #ifndef __DU_CONFIG_H_
20 #define __DU_CONFIG_H__
21
22 #include "stdbool.h"
23 #include "du_app_mac_inf.h"
24 #include "du_log.h"
25 #include "odu_common_codec.h"
26
27 /* MACROS */
28 #define DU_INST 0
29 #define DU_ID 1
30 #define DU_IP_V4_ADDR "10.0.2.20"
31 #define CU_IP_V4_ADDR "10.0.2.25"
32 #define RIC_IP_V4_ADDR "10.0.2.30"
33 #define DU_PORT 38472
34 #define CU_PORT 38472
35 #define RIC_PORT 38482
36 #define DU_EGTP_PORT  39001
37 #define CU_EGTP_PORT  39002
38 #define NR_PCI 1
39 #define NR_CELL_ID 1
40 #define DU_NAME "ORAN_OAM_DU"
41 #define CELL_TYPE SMALL
42 #define DUPLEX_MODE DUP_MODE_FDD
43 #define DU_TAC 1
44 #define PLMN_MCC0 3
45 #define PLMN_MCC1 1
46 #define PLMN_MCC2 1
47 #define PLMN_MNC0 4
48 #define PLMN_MNC1 8
49 #define PLMN_MNC2 0
50 #define PLMN_SIZE 3
51 #define NR_ARFCN  2079427
52 #define SUL_ARFCN 100
53 #define NR_FREQ_BAND 257
54 #define NR_FREQ_BAND_IND 78
55 #define SUL_BAND 2
56 #define TIME_CFG 0
57 #define CARRIER_IDX 1
58 #define NUM_TX_ANT 2
59 #define NUM_RX_ANT 2
60 #define FREQ_SHIFT_7P5KHZ FALSE
61 #define SSB_PBCH_PWR -5
62 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD
63 #define SUBCARRIER_SPACING 1
64 #define SCS_CARRIER_BANDWIDTH 273         /* Subcarrier spacing- carrier bandwidth */
65 #define OFFSET_TO_POINT_A 24                     /* PRB Offset to Point A */
66 #define BETA_PSS BETA_PSS_0DB  
67 #define SSB_PERIODICITY 2
68 #define SSB_SUBCARRIER_OFFSET 0               
69 #define SSB_MULT_CARRIER_BAND FALSE
70 #define MULT_CELL_CARRIER FALSE
71 #define FREQ_LOC_BW  1099              /* DL frequency location and bandwidth */
72 #define UL_P_MAX  23
73 #define BANDWIDTH 20
74
75 /* MACRO defines for PRACH Configuration */
76 #define PRACH_CONFIG_IDX   147
77 #define PRACH_FREQ_START   0
78 #define PRACH_SEQ_LEN SHORT_SEQUENCE
79 #define PRACH_SUBCARRIER_SPACING 1
80 #define PRACH_RESTRICTED_SET_CFG 0
81 #define NUM_PRACH_FDM 1
82 #define ROOT_SEQ_IDX 0
83 #define NUM_ROOT_SEQ 1
84 #define ZERO_CORRELATION_ZONE_CFG 6
85 #define NUM_UNUSED_ROOT_SEQ 1
86 #define UNUSED_ROOT_SEQ 1
87 #define SSB_PER_RACH 0
88 #define PRACH_MULT_CARRIER_BAND FALSE
89 #define PRACH_PREAMBLE_RCVD_TGT_PWR  -74   
90 #define NUM_RA_PREAMBLE  63
91 #define RSRP_THRESHOLD_SSB   31
92 #define TDD_PERIODICITY TX_PRDCTY_MS_2P5
93 #define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI
94
95
96 /* MACRCO Ddefine for PDCCH Configuration */
97 #define PDCCH_CTRL_RSRC_SET_ZERO   13   /* Control resouce set zero */
98 #define PDCCH_SEARCH_SPACE_ZERO    0    /* Search space zero */
99 #define PDCCH_SEARCH_SPACE_ID      1    /* Common search space id */
100 #define PDCCH_CTRL_RSRC_SET_ID     0    /* Control resource set id */
101 #define PDCCH_SEARCH_SPACE_ID_SIB1 0    /* Search space id for sib1 */
102 #define PDCCH_SEARCH_SPACE_ID_PAGING 1  /* Search space id for paging */
103 #define PDCCH_SEARCH_SPACE_ID_RA   1    /* Search spaced id for random access */
104 #define PDCCH_SERACH_SPACE_DCI_FORMAT 0
105 #define SIB1_VALUE_TAG 10
106
107 /* MACRCO Ddefine for PDSCH Configuration */
108 #define PDSCH_K0  0
109 #define PDSCH_START_SYMB_AND_LEN 53    
110
111 /* MACRO Define for PUSCH Configuration */
112 #define PUSCH_K0  3
113 #define PUSCH_START_SYMB_AND_LEN 55
114 #define PUSCH_MSG3_DELTA_PREAMBLE 0
115 #define PUSCH_P0_NOMINAL_WITH_GRANT -70
116
117 /* Macro define for PUCCH Configuration */
118 #define PUCCH_RSRC_COMMON  0
119 #define PUCCH_P0_NOMINAL   -74
120
121 /* MACRO defines for TDD DL-UL Configuration */
122 #define NUM_DL_SLOTS 3
123 #define NUM_DL_SYMBOLS 12
124 #define NUM_UL_SLOTS 1
125 #define NUM_UL_SYMBOLS 0
126
127 #define DU_PROC  0
128 #define DU_INST 0
129 #define DU_POOL  1
130 #define MAX_DU_PORT 2
131 #define F1_INTERFACE 0
132 #define E2_INTERFACE 1
133
134 #define SCTP_INST 0
135 #define EGTP_INST 0
136
137 /* Events */
138 #define EVTCFG 0
139
140 /* Selector */
141 #define DU_SELECTOR_LC   0
142 #define DU_SELECTOR_TC   1
143 #define DU_SELECTOR_LWLC 2
144
145 #ifdef EGTP_TEST
146 /* Macro definitions for EGTP procedures */
147 #define EGTP_LCL_TEID 1     /* EGTP local tunnel id */
148 #define EGTP_REM_TEID 10    /* EGTP remote tinnel id */
149 #endif
150
151
152 /* Macro definitions for F1 procedures */
153 #define CU_DU_NAME_LEN_MAX 30      /* Max length of CU/DU name string */
154 #define MAX_F1_CONNECTIONS 65536    /* Max num of F1 connections */
155 #define DU_MAX_CELLS       1      /* Max num of cells served by gNB-DU */
156 #define MAX_PLMN           6        /* Max num of broadcast PLMN ids */
157 #define MAXNRARFCN         3279165  /* Maximum values of NRAFCN */
158 #define MAXNRCELLBANDS     2       /* Maximum number of frequency bands */
159 #define MAX_NUM_OF_SLICE_ITEMS 1024     /* Maximum number of signalled slice support items */
160 #define MAXBPLMNNRMINUS1   1       /* Maximum number of PLMN Ids broadcast in an NR cell minus 1 */
161 #define MAXNUMOFSIBTYPES   32       /* Maximum number of SIB types */
162 #define MAX_UEID           512      /* Maximum number of UE Ids */
163 #define MAX_TNL_ASSOC      32       /* Max num of TNL Assoc between CU and DU */
164 #define MAXCELLINENB       256      /* Max num of cells served by eNB */
165 #define MAX_NUM_OF_UE_ID       65536    /* Max num of UEs served by DU */
166 #define MAXNUMOFUACPLMN    12       /* Maximum number of PLMN ids*/
167 #define MAXNUMOFUACPERPLMN 64       /* Maximum number of signalled categories per PLMN */
168 #define NR_RANAC           150      /* RANAC */
169 #define DEFAULT_CELLS      1        /* Max num of broadcast PLMN ids */
170
171
172 /* Macro definitions for MIB/SIB1 */
173 #define SYS_FRAME_NUM 0
174 #define SPARE 0
175 #define SSB_SC_OFFSET 8
176 #define CORESET_ZERO 1
177 #define SEARCH_SPACE_ZERO 8
178 #define DU_RANAC 1
179 #define CELL_IDENTITY 32
180
181 #ifdef EGTP_TEST
182 #define UE_ID 1
183 #define RB_ID 1
184 #define LC_ID 1
185 #endif
186
187 typedef enum
188 {
189    GNBDU,
190    GNBCU 
191 }F1Entity;
192
193 typedef enum
194 {
195    UNSPECIFIED,
196    RL_FAILURE_RLC,
197    INVALID_CU_UE_F1AP_ID,
198    INVALID_DU_UE_F1AP_ID,
199    INTERACTION_WITH_OTHER_PROC,
200    INVALID_QCI_VALUE,
201    RADIO_RELATED_REASON,
202    INSUFFICIENT_RADIO_RESOURCE,
203    PROCEDURE_CANCELLED,
204    NORMAL_RELEASE,
205    UNAVAILABLE_CELL,
206    RL_FAILURE_OTHERS,
207    UE_ACCESS_REJECTED,
208    SLICE_RESOURCE_UNAVAILABLE,
209    AMF_ABNORMAL_RELEASE,
210    INVALID_PLMN
211 }RadioNwCause;
212
213 typedef enum
214 {
215    TRANS_CAUSE_UNSPECIFIED,
216    TRANSPORT_RESOURCE_UNAVAIL
217 }TransLayerCause;
218
219 typedef enum
220 {
221    TRANSFER_SYNTAX_ERR,
222    ABSTRACT_SYNTAX_ERR_REJECT,
223    ABSTRACT_SYNTAX_ERR_NOTIFY,
224    INCOMPATIBLE_MESSAGE,
225    SEMANTIC_ERROR,
226    ABSTRACT_SYNTAX_ERR_MSG_CONSTRUCT,
227    PROTOCOL_CAUSE_UNSPECIFIED
228 }ProtocolCause;
229
230 typedef enum
231 {
232    CONTROL_PROC_OVERLOAD,
233    INSUFF_USER_PLANE_RESOURCE,
234    HARDWARE_FAILURE,
235    O_AND_M_INTERVENTION,
236    MISC_CAUSE_UNSPECIFIED
237 }MiscCause;
238
239 typedef enum
240 {
241   ALL
242 }F1ResetAll;
243
244 typedef enum 
245 {
246   IN_SERVICE,
247   OUT_OF_SERVICE
248 }SrvState;
249
250 typedef enum
251 {
252    INITIATING_MSG,
253    SUCCESSFUL_OUTCOME,
254    UNSUCCESSFUL_OUTCOME
255 }F1TriggMsgVal;
256
257 typedef enum
258 {
259    CRIT_REJECT,
260    CRIT_IGNORE,
261    CRIT_NOTIFY
262 }F1ProcCritVal;
263
264 typedef enum
265 {
266    NOT_UNDERSTOOD,
267    MISSING_IE
268 }F1ErrorType;
269
270 typedef enum
271 {
272    SCS_15,
273    SCS_30,
274    SCS_60,
275    SCS_120
276 }F1NrScs;
277
278 typedef enum
279 {
280    NRB_11,
281    NRB_18,
282    NRB_24,
283    NRB_25,
284    NRB_31,
285    NRB_32,
286    NRB_38,
287    NRB_51,
288    NRB_52,
289    NRB_65,
290    NRB_66,
291    NRB_78,
292    NRB_79,
293    NRB_93,
294    NRB_106,
295    NRB_107,
296    NRB_121,
297    NRB_132,
298    NRB_133,
299    NRB_135,
300    NRB_160,
301    NRB_162,
302    NRB_189,
303    NRB_216,
304    NRB_217,
305    NRB_245,
306    NRB_264,
307    NRB_270,
308    NRB_273
309 }F1Nrb;
310
311 typedef enum
312 {
313    VERY_SMALL,
314    SMALL,
315    MEDIUM,
316    LARGE
317 }F1CellType;
318
319 typedef enum
320 {
321    DL,
322    UL,
323    DL_UL
324 }F1CellDir;
325
326 typedef enum
327 {
328    UE_USAGE,
329    NON_UE_USAGE,
330    BOTH
331 }F1AssocUsage;
332
333 typedef enum
334 {
335    BARRED,
336    NOT_BARRED
337 }CellBarred;
338
339 typedef enum
340 {
341    OFFER,
342    EXECUTION
343 }F1ReqType;
344
345 typedef enum
346 {
347    IGNORE_YES,
348    IGNORE_NO
349 }F1IgnoreReq;
350
351 typedef enum
352 {
353    OVERLOADED,
354    NOT_OVERLOADED
355 }F1GnbDuOvrloadInfo;
356
357 typedef enum
358 {
359    REJECT_RRC_CONN_NON_EMERG_MODT,
360    REJECT_RRC_CONN_SIGNALLING,
361    PERMIT_EMERG_SESSION_AND_MOBILE_TERM_SERVICE,
362    PERMIT_HIGH_PRIOR_SESSION_AND_MOBILE_TERM_SERVICE
363 }F1UacStandardAction;
364
365 typedef struct f1RrcVersion
366 {
367    char    rrcVer[30];     /* Latest RRC Version */
368    uint32_t   extRrcVer;  /* Latest RRC version extended */
369 }F1RrcVersion;
370
371 typedef struct f1FailCause
372 {
373    union
374    {
375       RadioNwCause      radioNwCause;     /* Radio Network Layer Cause */
376       TransLayerCause   transLayerCause;  /* Transport Layer Cause */
377       ProtocolCause     protCause;        /* Protocol Cause */
378       MiscCause         miscCause;        /* Miscellaneous Cause */
379    }cause;
380 }F1FailCause;
381
382 typedef struct f1ProcCode
383 {
384    bool   pres;
385    uint8_t     value;
386 }F1ProcCode;
387
388 typedef struct f1TriggMsg
389 {
390    bool   pres;
391    F1TriggMsgVal   value;
392 }F1TriggMsg;
393
394 typedef struct f1ProcCrit
395 {
396    bool   pres;
397    F1ProcCritVal   value;
398 }F1ProcCrit;
399
400 typedef struct f1CritDignosIE
401 {
402    F1ProcCritVal   ieCritVal;
403    uint16_t             ieId;
404    F1ErrorType       type;
405 }F1CritDignosIE;
406
407 typedef struct f1CritDiagnostic
408 {
409    bool         pres;
410    F1ProcCode   procCode;      /* Procedure Code */
411    F1TriggMsg   triggeringMsg; /* Triggering Message */
412    F1ProcCrit   procCrit;      /* Criticality of Triggering msg/proc */
413    uint32_t          transId;
414    F1CritDignosIE diagnosIE;
415 }F1CritDiagnostic;
416
417 typedef struct f1FailureIE
418 {
419    uint32_t                transId;        /* Uniquely identify transaction */
420    F1FailCause        cause;          /* Failure cause */
421    uint8_t                 timeToWait;     /* Seconds to be waited before retry */
422    F1CritDiagnostic   critDiagnostic; /* Critical diagnostics */
423 }F1FailureIE;
424
425 typedef struct f1LogicalConnUeAssoc
426 {
427    uint32_t   gnbCuUeF1apId;
428    uint32_t   gnbDuUeF1apId;
429 }F1LogicalConnUeAssoc;
430
431 typedef struct f1ResetType
432 {
433    union
434    {
435       F1ResetAll             resetAll; /* Reset All */
436       F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* In case of Partial Reset : UE associated logical F1 conn list*/
437    }type;
438 }F1ResetType;
439
440 typedef struct nrEcgi
441 {
442   Plmn  plmn;
443   uint16_t     cellId;
444 }NrEcgi;
445
446 typedef struct f1SibType
447 {
448    uint8_t   sibType;
449    uint8_t   sibMsg;
450    uint8_t   value;
451 }F1SibType;
452
453 typedef struct f1TxBw
454 {
455    F1NrScs   nrScs; /* NR subcarrier spacing */
456    F1Nrb     nrb;   /* Transmission bandwidth expressed in units of RBs */
457 }F1TxBw;
458
459 typedef struct f1SulInfo
460 {
461    uint32_t      sulArfcn; /* SUL ARFCN */
462    F1TxBw   sulTxBw;  /* SUL transmission bandwidth */ 
463 }F1SulInfo;
464
465 typedef struct f1FreqBand
466 {
467   uint16_t   nrFreqBand;
468   uint16_t   sulBand[MAXNRCELLBANDS];
469 }F1FreqBand;
470
471 typedef struct f1NrFreqInfo
472 {
473    uint32_t        nrArfcn;
474    F1SulInfo  sulInfo;
475    F1FreqBand freqBand[MAXNRCELLBANDS];
476 }F1NrFreqInfo;
477
478 typedef struct f1NrFddInfo
479 {
480    F1NrFreqInfo   ulNrFreqInfo;  /* UL NR Frequency Info */
481    F1NrFreqInfo   dlNrFreqInfo;  /* DL NR Frequency Info */
482    F1TxBw         ulTxBw;        /* UL Transmission bandwidth */
483    F1TxBw         dlTxBw;        /* DL Transmission bandwidth */
484 }F1NrFddInfo;
485
486 typedef struct f1NrTddInfo
487 {
488    F1NrFreqInfo   nrFreqInfo;   /* NR Frequency Info */
489    F1TxBw       nrTxBw;       /* NR Transmission Bandwidth */
490 }F1NrTddInfo;
491
492 typedef struct f1NrModeInfo
493 {
494    union
495    {
496       F1NrFddInfo  fdd;
497       F1NrTddInfo  tdd;
498    }mode;
499 }NrModeInfo;
500
501 typedef struct f1EutraFddInfo
502 {
503    uint16_t   ulOffset;   /* UL offset to Point A */
504    uint16_t   dlOffset;   /* DL offset to Point A */
505 }F1EutraFDDInfo;
506
507 typedef struct f1EutraTddInfo
508 {
509    uint16_t   tddOffset;  /* Offset to Point A */
510 }F1EutraTDDInfo;
511
512 typedef struct f1EutraModeInfo
513 {
514    union
515    {
516       F1EutraFDDInfo  fdd;
517       F1EutraTDDInfo  tdd;
518    }mode;
519 }F1EutraModeInfo;
520
521 typedef struct f1Snsaai
522 {
523    uint8_t   sst;
524    uint32_t  sd;
525 }F1Snsaai;
526
527 typedef struct epIpAddr
528 {
529    char transportAddr[20]; /* Transport Layer Address */
530 }EpIpAddr;
531
532 typedef struct epIpAddrPort
533 {
534     EpIpAddr epIpAddr;
535     char   port[2];
536 }EpIpAddrPort;
537
538 typedef struct f1TaiSliceSuppLst
539 {
540    bool       pres;
541    F1Snsaai   snssai[MAX_NUM_OF_SLICE_ITEMS];   
542 }F1TaiSliceSuppLst;
543
544 typedef struct f1SrvdPlmn
545 {
546    Plmn              plmn;
547    F1TaiSliceSuppLst   taiSliceSuppLst;
548 }F1SrvdPlmn;
549
550 typedef struct f1BrdcstPlmnInfo
551 {
552    Plmn   plmn[MAX_PLMN];     /* PLMN id list */
553    Plmn   extPlmn[MAX_PLMN];   /* Extended PLMN id list */
554    uint16_t      tac;                     /* 5GS-TAC */
555    uint32_t      nrCellId;                /* NR Cell id */
556    uint8_t       ranac;                   /* RAN Area code */
557 }F1BrdcstPlmnInfo;
558
559 typedef struct f1CellInfo
560 {
561    NrEcgi   nrCgi;                   /* Cell global Identity */
562    uint32_t      nrPci;                   /* Physical Cell Identity */
563    Plmn   plmn[MAX_PLMN];     /* Available PLMN list */
564    Plmn   extPlmn[MAX_PLMN];  /* Extended available PLMN list */
565 }F1CellInfo;
566
567 typedef struct f1DuCellInfo
568 {
569    F1CellInfo         cellInfo;     /* cell info */
570    uint16_t                tac;          /* tracking area code */
571    uint16_t                epsTac;       /* Configured EPS TAC */
572    NrModeInfo         f1Mode;       /* NR mode info : FDD/TDD */
573    uint8_t                 measTimeCfg;  /* Measurement timing configuration */
574    F1CellDir          cellDir;      /* Cell Direction */
575    F1CellType         cellType;     /* Cell Type */
576    F1BrdcstPlmnInfo   brdcstPlmnInfo[MAXBPLMNNRMINUS1]; /* Broadcast PLMN Identity Info List */
577 }F1DuCellInfo;
578
579 typedef struct f1DuSysInfo
580 {
581    uint8_t   *mibMsg;   /* MIB message */
582    uint16_t  mibLen;
583    uint8_t   *sib1Msg;  /* SIB1 message */
584    uint16_t  sib1Len;
585 }F1DuSysInfo;
586
587 typedef struct f1CuSysInfo
588 {
589    F1SibType   sibTypeToUpd[MAXNUMOFSIBTYPES];   /* SIB types to be updated */
590 }F1CuSysInfo;
591
592 typedef struct f1DuSrvdCellInfo
593 {
594    F1DuCellInfo   duCellInfo;   /* gNB-DU served cell info */
595    F1DuSysInfo    duSysInfo;    /* gNB-DU System Information */
596 }F1DuSrvdCellInfo;
597
598 typedef struct f1DuSrvdCellToDel
599 {
600    NrEcgi             oldNrCgi;     /* Old NR CGI */
601    F1DuSrvdCellInfo   srvdCellInfo; /* Info of served cell to be deleted */ 
602 }F1DuSrvdCellToDel;
603
604 typedef struct f1CuActCellInfo
605 {
606    F1CellInfo    cuCellInfo;   /* gNB-CU available cell info */
607    F1CuSysInfo   cuSysInfo;    /* gNB-CU System Information */
608 }F1CuActCellInfo;
609
610 typedef struct f1ActCellFail
611 {
612    NrEcgi        nrCgi;
613    F1FailCause   cause;
614 }F1ActCellFail;
615
616 typedef struct srvStatus
617 {
618   SrvState    state;
619   bool        switchOffOngoing;
620 }SrvStatus;
621
622 typedef struct f1CellStatus
623 {
624    NrEcgi      nrEcgi;
625    SrvStatus   status;   /* Service status */
626 }F1CellStatus;
627
628 typedef struct f1DedSIDelUE
629 {
630    uint32_t      gnbCuUeF1apId;
631    NrEcgi   nrEcgi;
632 }F1DedSIDelUE;
633
634 typedef struct tnlAssocInfo
635 {
636    bool           pres;
637    EpIpAddr       epIpAddr;      /* Endpoint-IP Address */
638    EpIpAddrPort   epIpAddrport;  /* Endpoint-IP Address and Port */
639 }F1TnlAssocAddr;
640
641 typedef struct f1TnlAssocUsage
642 {
643     bool           pres;
644     F1AssocUsage   usage;
645 }F1TnlAssocUsage;
646
647 typedef struct f1TnlAssoc
648 {
649    F1TnlAssocAddr   assocInfo;    /* TNL Assoc Transport Layer Info */
650    F1TnlAssocUsage  assocUsage;   /* TNL Assoc usage */
651 }F1TnlAssoc;
652
653 typedef struct f1TnlAssocToRmv
654 {
655    F1TnlAssocAddr   assocInfoCu;   /* TNL Assoc Transport Layer Info of CU */
656    F1TnlAssocAddr   assocInfoDu;   /* TNL Assoc Transport Layer Info of DU */
657 }F1TnlAssocToRmv;
658
659 typedef struct f1TnlAssocSetupFail
660 {
661    F1TnlAssocAddr   assocInfo;
662    F1FailCause      cause;
663 }F1TnlAssocSetupFail;
664
665
666 typedef struct f1CellBarred
667 {
668    NrEcgi       nrcgi;
669    CellBarred   cellBarred;
670 }F1CellBarred;
671
672 typedef struct f1EutraCell
673 {
674    uint32_t                eutraCellId; /* EUTRA cell id */
675    F1EutraModeInfo    mode;        /* EUTRA mode info : FDD/TDD */
676    uint8_t                 rsrcInd;     /* Protected EUTRA resource Indication */
677 }F1EutraCell;
678
679 typedef struct f1ProtectEUTRARsrc
680 {
681    uint32_t           specShareGrpId;               /* Spectrum sharing group id */
682    F1EutraCell   eutraCellList[MAXCELLINENB];  /* EUTRA cells list */
683 }F1ProtectEUTRARsrc;
684
685 typedef struct f1UacOperatorDefined
686 {
687    uint8_t   accessCategory;
688    uint8_t   accessId; 
689 }F1UacOperatorDefined;
690
691 typedef struct f1UacCategoryType
692 {
693    union
694    {
695       F1UacStandardAction    action;      /* UAC standardized action */
696       F1UacOperatorDefined   operatorDef; /* UAC operator defined */
697    }type;
698 }F1UacCategoryType;
699
700 typedef struct f1UacType
701 {
702    uint8_t                  uacReducInd;     /* Value 0 means no access rate reduction. Value 100 means full access rate reduction */
703    F1UacCategoryType   uacCategoryType; /* UAC Category type */
704 }F1UacType;
705
706 /* Unified Access Class Assistance Information */
707 typedef struct f1UacAssistInfo
708 {
709    Plmn      plmn[MAXNUMOFUACPLMN];        /* UAC PLMN list */
710    F1UacType   uacType[MAXNUMOFUACPERPLMN];  /* UAC Type list */
711 }F1UacAssistInfo;
712
713 /* F1 setup related structures */
714
715 typedef struct f1SetupReq
716 {
717   uint32_t                transId;                       /* Uniquely identify transaction */
718   uint32_t                duId;                          /* DU ID */ 
719   char               duName[CU_DU_NAME_LEN_MAX];    /* DU name */
720   F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];   /* Serving cell list */
721   F1RrcVersion       rrcVersion;                    /* RRC version */
722 }F1SetupReq;
723
724 typedef struct f1setupRsp
725 {
726   uint32_t               transId;                      /* Uniquely identify transaction */
727   char              cuName[CU_DU_NAME_LEN_MAX];   /* CU Name */
728   F1CuActCellInfo   actCellInfo;                  /* cells to be activated */
729   F1RrcVersion      rrcVersion;                   /* RRC version */
730 }F1SetupRsp;
731
732 typedef struct f1SetupFail
733 {
734    F1FailureIE   setupFail;
735 }F1SetupFail;
736
737 /* At reception of the RESET message the gNB-DU shall release all allocated resources on F1 
738  * and radio resources related to the UE association(s) indicated explicitly or implicitly in 
739  * the RESET message and remove the indicated UE contexts including F1AP ID. */
740 typedef struct f1Reset
741 {
742   uint32_t              transId;   /* Uniquely identify transaction */
743   F1FailCause      cause;     /* Failure cause */
744   F1ResetType      resetType; /* type of reset */
745 }F1Reset;
746
747 /* After the gNB-CU has released all assigned F1 resources and the UE F1AP IDs for all indicated
748  * UE associations which can be used for new UE-associated logical F1-connections over the F1 interface,
749  *  the gNB-CU shall respond with the RESET ACKNOWLEDGE message. */
750 typedef struct f1ResetAck
751 {
752   uint32_t                    transId;         /* Uniquely identify transaction */
753   F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */
754   F1CritDiagnostic       critDiagnostic;  /* Critical diagnostics */
755 }F1ResetAck;
756
757 typedef struct f1ErrorInd
758 {
759   uint32_t                transId;         /* Uniquely identify transaction */
760   F1Entity           errorOrigin;     /* Specifies if error is originated at DU or CU */
761   F1FailCause        cause;           /* Failure cause */
762 /* If failure is due to Ue related message. */
763   uint32_t                gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
764   uint32_t                gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
765   F1CritDiagnostic   critDiagnostic;  /* Critical diagnostics */
766 }F1ErrorInd;
767
768 typedef struct f1GnbDuCfgUpd
769 {
770   uint32_t                 transId;                             /* Uniquely identify transaction */
771   F1DuSrvdCellInfo    srvdCellLstAdd[DU_MAX_CELLS];      /* Served cell list to be added */
772   F1DuSrvdCellToDel   srvdCellLstMod[DU_MAX_CELLS];      /* Served cell list to be modified */
773   NrEcgi              srvdCellLstDel[DU_MAX_CELLS];      /* Served cell list to be deleted */
774   F1CellStatus        cellStatus[DU_MAX_CELLS];          /* Cell status */
775   F1DedSIDelUE        ueLst[MAX_UEID];                     /* Ue list that requires dedicated SI delivery */
776   uint32_t            gnbDuId;
777   F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
778 }F1GnbDuCfgUpd;
779
780 typedef struct f1GnbDuCfgUpdAck
781 {
782    uint32_t           transId;                      /* Uniquely identify transaction */
783    F1CuActCellInfo    cellLstAct[DU_MAX_CELLS];    /* List of cells to be activated */   
784    F1CritDiagnostic   critDiagnostic;               /* Critical diagnostics */
785    NrEcgi             cellLstDeact[DU_MAX_CELLS]; /* List of cells to be deactivated */
786 }F1GnbDuCfgUpdAck;
787
788 typedef struct f1GnbDuCfgUpdFail
789 {
790    F1FailureIE   gnbDuCfgUpdFail;
791 }F1GnbDuCfgUpdFail;
792
793 /* Sent by the gNB-CU to transfer updated information associated to an F1-C interface instance */
794 typedef struct f1GnbCuCfgUpd
795 {
796     uint32_t            transId;                            /* Uniquely identifies transaction */
797     F1CuActCellInfo     cellLstAct[DU_MAX_CELLS];         /* List of cells to be activated */
798     NrEcgi              cellLstDeact[DU_MAX_CELLS];       /* List of cells to be deactivated */
799     F1TnlAssoc          assocLstAdd[MAX_TNL_ASSOC];     /* List of TNL assocs to be added */
800     F1TnlAssoc          assocLstUpd[MAX_TNL_ASSOC];     /* List of TNL assocs to be updated */
801     F1TnlAssocToRmv     assocLstRmv[MAX_TNL_ASSOC];     /* List of TNL assocs to be removed */
802     F1CellBarred        cellToBarList[DU_MAX_CELLS];      /* List of Cells to be barred */
803     F1ProtectEUTRARsrc  protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */
804 }F1GnbCuCfgUpd;
805
806 /* Sent by a gNB-DU to a gNB-CU to acknowledge update of information
807  * associated to an F1-C interface instance */
808 typedef struct f1GnbCuCfgUpdAck
809 {
810     uint32_t              transId;                              /* Uniquely identify transaction */
811     F1ActCellFail         actCellFailList[DU_MAX_CELLS];      /* Cells failed to be activated list */
812     F1CritDiagnostic      critDiagnostic;                       /* Critical diagnostics */
813     F1TnlAssocAddr        assocSetupList[MAX_TNL_ASSOC];     /* TNL Assoc Setup list */
814     F1TnlAssocSetupFail   assocSetupFailList[MAX_TNL_ASSOC]; /* TNL Assoc Setup fail list */
815     F1DedSIDelUE          dedSiDelUelist[MAX_NUM_OF_UE_ID];          /* Dedicated SI delivery needed UE list */
816 }F1GnbCuCfgUpdAck;
817
818 typedef struct f1GnbCuCfgUpdFail
819 {
820     F1FailureIE   gnbCuCfgUpdFail;
821 }F1GnbCuCfgUpdFail;
822
823 /* This procedure enables coordination of radio resource allocation between a gNB-CU and
824  * a gNB-DU. Coordination request is sent by CU to DU */
825 typedef struct f1GnbDuRsrcCoordReq
826 {
827    uint32_t      transId;              /* Uniquely identifies transaction */
828    F1ReqType     reqType;              /* Request type */
829    uint8_t       cellResCoordReqCont;  /* Container for X2AP E-UTRA - NR cell resource coordination request */
830    F1IgnoreReq   ignoreReq;            /* Ignore coordination request */
831 }F1GnbDuRsrcCoordReq;
832
833 /* This message is sent by a gNB-DU to a gNB-CU, to express the desired resource allocation
834  * for data traffic, as a response to the GNB-DU RESOURCE COORDINATION REQUEST. */
835 typedef struct f1GnbDuRsrcCoordRsp
836 {
837     uint32_t   transId;               /* Uniquely identifies transaction */
838     uint8_t    cellResCoordRspCont;   /* Container for X2AP E-UTRA - NR cell resource coordination response */
839 }F1GnbDuRsrcCoordRsp;
840
841 /* This message is sent by the gNB-DU to indicate to the gNB-CU its status of overload */
842 typedef struct f1GnbDuStatusInd
843 {
844    uint32_t                  transId;      /* Uniquely identifies transaction */
845    F1GnbDuOvrloadInfo   ovrloadInfo;  /* gNB-DU overloaded information */
846 }F1GnbDuStatusInd;
847
848 /* This message is sent by either the gNB-DU or the gNB-CU to intiate the removal
849  * of the interface instance and the related resources */
850 typedef struct f1RmvReq
851 {
852    uint32_t   transId; /* Uniquely identifies transaction */
853 }F1RmvReq;
854
855 /* This message acknowledges the initiation of removal of the interface
856  * instance and the related resources */
857 typedef struct f1RmvRsp
858 {
859    uint32_t           transId;     /* Uniquely identifies transaction */
860    F1CritDiagnostic   critDiagnos; /* Crititcality diagnostics */
861 }F1RmvRsp;
862
863 /* This message indicates that removing the interface instance and the related
864  * resources cannot be accepted */
865 typedef struct f1RmvFail
866 {
867    uint32_t           transId;         /* Uniquely identifies transaction */
868    F1FailCause        cause;          /* Failure cause */
869    F1CritDiagnostic   critDiagnostic; /* Criticality diagnostics */
870 }F1RmvFail;
871
872 /* This message is sent by the gNB-CU to indicate to the gNB-DU a need to reduce
873  * the rate at which UEs access the network. */
874 typedef struct f1NwkAccessRateRed
875 {
876    uint32_t          transId;        /* Uniquely identifies transaction */
877    F1UacAssistInfo   uacAssistInfo;  /* UAC Assistance Information */
878 }F1NwkAccessRateRed;
879
880 typedef struct f1Ipaddr
881 {
882  bool ipV4Pres;
883  uint32_t  ipV4Addr; 
884 }F1IpAddr;
885
886 typedef struct sctpParams
887 {
888    F1IpAddr  duIpAddr;
889    U16       duPort[MAX_DU_PORT];
890    F1IpAddr  cuIpAddr;
891    U16       cuPort;
892    F1IpAddr  ricIpAddr;
893    U16       ricPort;
894 }SctpParams;
895
896 typedef struct f1EgtpParams
897 {
898    F1IpAddr  localIp;      /* Ip address of local node */
899    uint16_t  localPort;    /* Sender Port at local node */
900    F1IpAddr  destIp;       /* Ip address of peer node */
901    uint16_t  destPort;     /* Sender port at peer node */
902    uint32_t  minTunnelId;
903    uint32_t  maxTunnelId;
904 }F1EgtpParams;
905
906 typedef struct schedulerCfg
907 {
908    uint8_t         numTxAntPorts;    /*!< Number of Tx antenna ports */
909    uint8_t         ulSchdType;     /*!< Indicates which UL scheduler to use, range
910                                * is 0..(number of schedulers - 1) */
911    uint8_t         dlSchdType;     /*!< Indicates which DL scheduler to use, range
912                                * is 0..(number of schedulers - 1) */
913    uint8_t         numCells;       /*!< Max number of cells */
914    uint8_t         maxUlUePerTti;  /*!< Max number of UE in UL per TTI */
915    uint8_t         maxDlUePerTti;  /*!< Max number of UE in DL per TTI */
916 }SchedulerCfg;
917
918 typedef struct mibParams
919 {
920         uint8_t sysFrmNum;
921         long    subCarrierSpacingCommon;
922         long    ssb_SubcarrierOffset;
923         long    dmrs_TypeA_Position;
924         long    controlResourceSetZero;
925         long    searchSpaceZero;
926         long    cellBarred;
927         long    intraFreqReselection;
928 }MibParams;
929
930 typedef struct siSchedInfo
931 {
932    long     winLen;         /* SI Window Length */
933    long     broadcastSta;   /* Broadcast status */
934    long     preiodicity;    /* si periodicity */
935    long     sibType;
936    long     sibValTag;      /* Value tag */
937 }SiSchedInfo;
938
939 typedef struct pdcchCfgCommon
940 {
941    uint8_t  present;
942    long     ctrlRsrcSetZero;  /* Control resource set zero */
943    long     searchSpcZero;    /* Search space zero */
944    long     searchSpcId;      /* Search space id */
945    long     ctrlRsrcSetId;    /* Control resource set id */
946    uint8_t  monitorSlotPrdAndOffPresent;
947    long     monitorSlotPrdAndOff;     /* Monitoring slot periodicity and offset */
948    uint8_t  monitorSymbolsInSlot[2];  /* Monitoring symbols within slot */
949    long     numCandAggLvl1;        /* Number of candiates at aggregation level 1 */
950    long     numCandAggLvl2;        /* Number of candiates at aggregation level 2 */
951    long     numCandAggLvl4;        /* Number of candiates at aggregation level 4 */
952    long     numCandAggLvl8;        /* Number of candiates at aggregation level 8 */
953    long     numCandAggLvl16;       /* Number of candiates at aggregation level 16 */
954    uint8_t  searchSpcType;        /*  Search Space type */
955    uint8_t  commSrchSpcDciFrmt;    /* DCI format of common search space type */
956    long     searchSpcSib1;         /* Id of serch space for SIB1 */
957    long     pagingSearchSpc;       /* Id of search space for paging */
958    long     raSearchSpc;           /* Id of search space for Random Access proc */
959 }PdcchCfgCommon;
960
961 typedef struct pdschCfgCommon
962 {
963    uint8_t  present;
964    long   k0;
965    long   mapType;              /* Mapping Type */
966    long   startSymbAndLen;      /* Start Symbol and Length */
967 }PdschCfgCommon;
968
969 typedef struct bcchCfg
970 {
971    long   modPrdCoeff;          /* Modification period co-efficient */
972 }BcchCfg;
973
974 typedef struct pcchCfg
975 {
976    long   dfltPagingCycle;      /* Default paging cycle */
977    long   nAndPagingFrmOffPresent;
978    long   nAndPagingFrmOff;     /* n and Paging Frame offset */
979    long   numPagingOcc;         /* Number of paging occassions in paging frame */
980 }PcchCfg;
981
982 typedef struct scsSpecCarrier
983 {
984     long   scsOffset;    /* Offset to point A considering subcarrier spacing */
985     long   scs;          /* subcarrier spacing */
986     long   scsBw;        /* Carrier bandwidth considering subcarrier spacing */
987
988 }ScsSpecCarrier;
989
990 typedef struct dlCfgCommon
991 {
992    long   freqBandInd;  /* Downlink frequency band indicator */
993    long   offsetToPointA;       /* DL ofset to point A */
994    long   locAndBw;     /* Frequency location and bandwidth */
995    ScsSpecCarrier   dlScsCarrier;  /* SCS Specific carrier */
996    PdcchCfgCommon   pdcchCfg;
997    PdschCfgCommon   pdschCfg;
998    BcchCfg          bcchCfg;
999    PcchCfg          pcchCfg;
1000 }DlCfgCommon;
1001
1002 typedef struct rachCfgCommon
1003 {
1004    uint8_t present;
1005    long   prachCfgIdx;       /* PRACH configuration index */
1006    long   msg1Fdm;           /* Num of PRACH transmission occassions */
1007    long   msg1FreqStart;     /* Offset of lowest msg1 transmission occassion */
1008    long   zeroCorrZoneCfg;   /* Zero correlation zone configuration */
1009    long   preambleRcvdTgtPwr; /* Traget power level */
1010    long   preambleTransMax;  /* Max num of preamble transmission */
1011    long   pwrRampingStep;    /* Power ramping steps for PRACH */
1012    long   raRspWindow;       /* RA response window */
1013    long   numRaPreamble;     /* Total num of preamble used in random access */
1014    uint8_t ssbPerRachOccPresent;
1015    long   numSsbPerRachOcc;  /* Numer of SSBs per RACH Occassion */
1016    long   contResTimer;      /* Contention resolution timer */
1017    long   rsrpThreshSsb;
1018    uint8_t rootSeqIdxPresent;
1019    long   rootSeqIdx;        /* PRACH root sequence index */
1020    long   msg1Scs;           /* Msg1 subcarrier spacing */
1021    long   restrictedSetCfg;  /* Restricted set configuration */
1022 }RachCfgCommon;
1023
1024 typedef struct  puschCfgCommon
1025 {
1026    uint8_t present;
1027    long   k2;
1028    long   mapType;
1029    long   startSymbAndLen;
1030    long   msg3DeltaPreamble;
1031    long   p0NominalWithGrant;
1032 }PuschCfgCommon;
1033
1034 typedef struct pucchCfgCommon
1035 {
1036    uint8_t present;
1037    long   rsrcComm;
1038    long   grpHop;
1039    long   p0Nominal;
1040 }PucchCfgCommon;
1041
1042 typedef struct ulCfgCommon
1043 {
1044    long   pMax;         /* Max UL transmission power that UE applies */
1045    long   locAndBw;     /* Frequency location and bandwidth */
1046    ScsSpecCarrier   ulScsCarrier; /* SCS Specific carrier */
1047    RachCfgCommon    rachCfg;
1048    PuschCfgCommon   puschCfg;
1049    PucchCfgCommon   pucchCfg;
1050    long   timeAlignTimerComm;
1051 }UlCfgCommon;
1052
1053 typedef struct tddUlDlCfgCommon
1054 {
1055    long   refScs;     /* Reference subcarrier spacing */
1056    long   txPrd;      /* Transmission periodicity */
1057    long   numDlSlots;
1058    long   numDlSymbols;
1059    long   numUlSlots;
1060    long   numUlSymbols;
1061 }TddUlDlCfgCommon;
1062
1063 typedef struct srvCellCfgCommSib
1064
1065    DlCfgCommon        dlCfg;
1066    UlCfgCommon        ulCfg;
1067    uint8_t            ssbPosInBurst;
1068    long               ssbPrdServingCell;
1069    TddUlDlCfgCommon   tddCfg;
1070    long               ssPbchBlockPwr;
1071 }SrvCellCfgCommSib;
1072
1073 typedef struct sib1Params
1074 {
1075         Plmn    plmn;
1076         uint8_t   tac;
1077         long      ranac;
1078         uint8_t   cellIdentity;
1079         long      cellResvdForOpUse;
1080    long      connEstFailCnt;
1081    long      connEstFailOffValidity;
1082    SiSchedInfo           siSchedInfo;
1083    SrvCellCfgCommSib     srvCellCfgCommSib;
1084 }Sib1Params;
1085
1086 typedef struct duCfgParams
1087 {
1088    SctpParams         sctpParams;                  /* SCTP Params */
1089    F1EgtpParams       egtpParams;                  /* EGTP Params */
1090    uint32_t           maxUe;
1091    uint32_t           duId;
1092    uint8_t            duName[CU_DU_NAME_LEN_MAX];
1093    SchedulerCfg       schedCfg;
1094    F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];  /* Serving cell list *///TODO: this must be removed eventually
1095    F1RrcVersion       rrcVersion;                 /* RRC version */
1096    MacCellCfg          macCellCfg;                    /* MAC cell configuration */
1097    MibParams          mibParams;                  /* MIB Params */
1098    Sib1Params         sib1Params;                 /* SIB1 Params */
1099 }DuCfgParams;
1100
1101 /*function declarations */
1102 void FillSlotConfig();
1103 S16 readClCfg();
1104 S16 readCfg();
1105 S16 duReadCfg(); 
1106 S16 bitStringToInt(BIT_STRING_t *bitString, uint16_t *val);
1107
1108 #endif /* __DU_CONFIG_H__ */
1109
1110 /**********************************************************************
1111          End of file
1112 **********************************************************************/