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