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