[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-423] UE context setup request from CU to...
[o-du/l2.git] / src / cu_stub / cu_f1ap_msg_hdl.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 /* This file contains all F1AP message handler related functionality */
20 #define ENCODE_FAIL -1
21 #define TRANS_ID 1
22 #define RRC_SIZE 1
23 #define SUL_BAND_COUNT 0
24 #define UL_SRBID        1
25 #define DL_SRBID        0
26 #define DU_ID           1
27 #define CU_ID           1
28 #define CRNTI           17017
29 #define CELL_INDEX      0
30 #define SRB0 0
31 #define SRB1 1
32 #define SRB2 2
33 #define DRB1 1
34 #define DRB2 2
35 #define DRB3 3
36 #define QCI  9
37 #define MAX_DRB_SET_UE_CONTEXT_SETUP_REQ 2  /*Number of DRBs to be added using UE CONTEXT SETUP procedure*/
38 #define MAX_DRB_SET_UE_CONTEXT_MOD_REQ 1     /*Number of DRBs to be added/setup via UE CONTEXT MODIFICATION procedure*/
39 #define MAX_DRB_MODIFIED_UE_MOD_REQ 1        /*Currently CU trigger Modification of 2DRBs*/
40 #define DRB_ID_TO_ADD_MOD MAX_DRB_SET_UE_CONTEXT_SETUP_REQ+1 /*The DRB ID: which will be added using Modification Procedure*/
41
42 /*Total num of DRBs added using UE COntext Setup and Modification procedures*/
43 #define MAX_NUM_DRB_ADDED_PER_UE (MAX_DRB_SET_UE_CONTEXT_SETUP_REQ + MAX_DRB_SET_UE_CONTEXT_MOD_REQ)
44
45 #define CU_UE_F1AP_ID 0
46 #define DU_UE_F1AP_ID 1
47 #define SP_CELL_ID     2
48 #define SERV_CELL_IDX 3
49 #define CU_TO_DU_RRC_INF 4
50 #define NUM_QOS_EXT 1
51
52 /* MACRO for CUtoDURRCInformation */
53 #define CELL_GRP_ID 1
54 #define FREQ_DOM_RSRC_SIZE 6
55 #define CORESET0_END_PRB   48
56 #define CORESET1_NUM_PRB   24
57 #define PDCCH_CTRL_RSRC_SET_ONE_ID  1
58 #define PDCCH_CTRL_RSRC_SET_ONE_DURATION 2  /* Duration for control resource set id i */
59 #define PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY 1   /* Precoded granularity */
60 #define PDCCH_SRCH_SPC_TWO_ID 2
61 #define NR_PCI 1
62 #define SCRAMBLING_ID  NR_PCI
63 #define DMRS_ADDITIONAL_POS  0          /* DMRS Additional poistion */
64 #define PDCCH_SYMBOL_WITHIN_SLOT 128     /* Symbol within Slot Value */
65 #define PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE 7   /* Num of candidate at aggregation level 1 */
66 #define PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE 7   /* Num of candidate at aggregation level 2 */
67 #define PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE 4   /* Num of candidate at aggregation level 4 */
68 #define PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE 2   /* Num of candidate at aggregation level 8 */
69 #define PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE 1  /* Num of candidate at aggregation level 16 */
70 #define PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT  0  /* format 0-0 and 1-0 */
71 #define PDCCH_SERACH_SPACE_DCI_FORMAT 0
72
73 /* MACRO Ddefine for PDSCH Configuration */
74 #define PDSCH_K0  0
75 #define PDSCH_RES_ALLOC_TYPE       1          /* Resource allocation type */
76 #define PDSCH_MAX_CODEWORD_SCH_BY_DCI 0       /* Max num of codewords scheduled by DCI */
77 #define PDSCH_RBG_SIZE   0                    /* 0: config1 */
78 #define PDSCH_NUM_HARQ_PROC 5
79 #define PDSCH_MAPPING_TYPE_A 0
80 #define PDSCH_MAPPING_TYPE_B 1
81
82 /* MACRO Define for PUSCH Configuration */
83 #define PUSCH_K2_CFG1  1
84 #define PUSCH_K2_CFG2  2
85 #define PUSCH_START_SYMBOL 3
86
87 #define PUSCH_MSG3_DELTA_PREAMBLE 0
88 #define PUSCH_P0_NOMINAL_WITH_GRANT -70
89 #define PUSCH_TRANSFORM_PRECODER    1      /* 1: Disabled */
90 #define PUSCH_MAX_MIMO_LAYERS       1
91 #define PUSCH_PROCESS_TYPE2_ENABLED false
92 #define PUSCH_MAPPING_TYPE_A        0
93 #define PUSCH_MAPPING_TYPE_B        1
94
95 /* MACRO defines for SRC config */
96 #define SRS_RSRC_ID  1
97 #define SRS_RSET_ID  1
98 #define SRS_COMB_OFFSET_N2   0
99 #define SRS_CYCLIC_SHIFT_N2  0
100 #define SRS_FREQ_DOM_POS     0
101 #define SRS_FREQ_DOM_SHIFT   0
102 #define C_SRS 0
103 #define B_SRS 0
104 #define B_HOP 0
105 #define SRS_SEQ_ID 0
106 #define APERIODIC_SRS_RESRC_TRIGGER 1 
107
108 /* Macro definitions for DUtoCuRrcContainer */
109 #define CELL_GRP_ID 1
110 #define SCH_REQ_ID  0
111 #define SR_PROHIBIT_TMR 5
112 #define SR_TRANS_MAX 2
113 #define PERIODIC_BSR_TMR 2
114 #define RETX_BSR_TMR     5
115 #define SR_DELAY_TMR     6
116 #define TAG_ID 0
117 #define TIME_ALIGNMENT_TMR 7
118 #define PHR_PERIODIC_TMR 7
119 #define PHR_PROHIBHIT_TMR 0
120 #define PHR_PWR_FACTOR_CHANGE 3
121 #define PHR_MODE_OTHER_CG 0
122 #define RLC_LCID 1 
123 #define SRB_ID_1 1
124 #define SN_FIELD_LEN 0
125 #define T_POLL_RETRANSMIT 8 
126 #define POLL_PDU 0
127 #define POLL_BYTE 43
128 #define MAX_RETX_THRESHOLD 5
129 #define T_REASSEMBLY 8
130 #define T_STATUS_PROHIBHIT 7
131 #define MAC_LC_PRIORITY 1
132 #define PRIORTISIED_BIT_RATE 15
133 #define BUCKET_SIZE_DURATION 5
134 #define LC_GRP 0
135 #define P_NR_FR1 0
136 #define PDSCH_HARQ_ACK_CODEBOOK 1
137 #define SERV_CELL_IDX 0
138 #define RLM_SYNC_OUT_SYNC_THRESHOLD 0
139 #define ACTIVE_DL_BWP_ID 0
140 #define ACTIVE_UL_BWP_ID 0
141 #define SCRAMBLING_ID  NR_PCI
142 #define DMRS_ADDITIONAL_POS  0          /* DMRS Additional poistion */
143 #define RES_ALLOC_TYPE       1          /* Resource allocation type */
144 #define FIVE_QI_VALUE9 9  /*spec 23.501, Table 5.7.4-1*/
145 #define FIVE_QI_VALUE8 8  /*spec 23.501, Table 5.7.4-1*/
146 #define PDU_SESSION_ID_1 1
147 #define PDU_SESSION_ID_2 2
148 #define INVALID_PDU_SESSION_ID -1
149
150 typedef enum
151 {
152    RRC_SETUP=1,
153    REGISTRATION_ACCEPT,
154    UE_CONTEXT_SETUP_REQ,
155    UE_CONTEXT_SETUP_RSP,
156    SECURITY_MODE_COMPLETE,
157    RRC_RECONFIG,
158    RRC_RECONFIG_COMPLETE,
159    UE_CONTEXT_MOD_REQ
160 }RrcMsgType;
161
162 /* Defines action to be performed via UE Context Modification request */
163 typedef enum
164 {
165    MODIFY_UE,        /* Modify UE configuration at DU */
166    RRC_RECONFIG_COMPLETE_IND, /* Indicate to DU that RRC Reconfiguration is complete */
167    QUERY_CONFIG,     /* Query DU for its configurations */
168    STOP_DATA_TX      /* Stop data transmission from DU to a particular UE */
169 }UeCtxtModAction;
170
171 typedef struct f1apDb
172 {
173    uint8_t dlRrcMsgCount;
174    OCTET_STRING_t duToCuContainer;
175 }F1apMsgDb;
176   
177 void F1APMsgHdlr(uint32_t *destDuId, Buffer *mBuf);
178 uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *ueCb, UeCtxtModAction action);
179 uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, uint8_t duUeF1apId);
180 uint8_t BuildAndSendF1ResetReq();
181
182 /**********************************************************************
183          End of file
184 **********************************************************************/