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