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