1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /* This file contains all F1AP message handler related functionality */
20 #define ENCODE_FAIL -1
23 #define SUL_BAND_COUNT 0
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*/
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)
45 #define CU_UE_F1AP_ID 0
46 #define DU_UE_F1AP_ID 1
48 #define SERV_CELL_IDX 3
49 #define CU_TO_DU_RRC_INF 4
52 /* MACRO for CUtoDURRCInformation */
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
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
73 /* MACRO Ddefine for PDSCH Configuration */
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
82 /* MACRO Define for PUSCH Configuration */
83 #define PUSCH_K2_CFG1 1
84 #define PUSCH_K2_CFG2 2
85 #define PUSCH_START_SYMBOL 3
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
95 /* MACRO defines for SRC config */
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
106 #define APERIODIC_SRS_RESRC_TRIGGER 1
108 /* Macro definitions for DUtoCuRrcContainer */
109 #define CELL_GRP_ID 1
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
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
124 #define SN_FIELD_LEN 0
125 #define T_POLL_RETRANSMIT 8
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
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
154 NAS_AUTHENTICATION_RSP,
155 NAS_SECURITY_MODE_COMPLETE,
156 RRC_SECURITY_MODE_COMPLETE,
157 REGISTRATION_COMPLETE,
158 UE_CONTEXT_SETUP_RSP,
159 RRC_RECONFIG_COMPLETE,
162 /* Defines action to be performed via UE Context Modification request */
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 RESTART_DATA_TX /* Restart data transmission from DU to a particular UE */
172 typedef struct f1apDb
174 uint8_t dlRrcMsgCount;
175 OCTET_STRING_t duToCuContainer;
178 void F1APMsgHdlr(uint32_t *destDuId, Buffer *mBuf);
179 uint8_t BuildAndSendUeContextModificationReq(uint32_t duId, void *ueCb, UeCtxtModAction action);
180 uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, uint8_t duUeF1apId);
181 uint8_t BuildAndSendF1ResetReq();
182 uint8_t BuildAndSendPagingMsg(uint64_t gsTmsi, uint8_t duId);
184 /**********************************************************************
186 **********************************************************************/