1 /******************************************************************************
\r
3 * Copyright (c) 2019 Intel.
\r
5 * Licensed under the Apache License, Version 2.0 (the "License");
\r
6 * you may not use this file except in compliance with the License.
\r
7 * You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 *******************************************************************************/
\r
23 * @author Intel Corporation
\r
26 #include "rte_common.h"
\r
31 #include <rte_ethdev.h>
\r
33 #define MAX_LINE_SIZE 512
\r
34 /* Configuration file maximum supported line length */
\r
36 #define KEY_APP_MODE "appMode"
\r
37 #define KEY_XRAN_MODE "xranMode"
\r
38 #define KEY_MU_NUMBER "mu"
\r
39 #define KEY_NDLABSFREPOINTA "nDLAbsFrePointA"
\r
40 #define KEY_NULABSFREPOINTA "nULAbsFrePointA"
\r
41 #define KEY_NDLBANDWIDTH "nDLBandwidth"
\r
42 #define KEY_NULBANDWIDTH "nULBandwidth"
\r
43 #define KEY_NDLFFTSIZE "nDLFftSize"
\r
44 #define KEY_NULFFTSIZE "nULFftSize"
\r
46 #define KEY_NFRAMEDUPLEXTYPE "nFrameDuplexType"
\r
47 #define KEY_NTDDPERIOD "nTddPeriod"
\r
49 #define KEY_SSLOTCONFIG "sSlotConfig"
\r
51 #define KEY_CC_PER_PORT_NUM "ccNum"
\r
52 #define KEY_ANT_NUM "antNum"
\r
53 #define KEY_UL_ANT_NUM "antNumUL"
\r
55 #define KEY_ANT_ELM_TRX_NUM "antElmTRx"
\r
57 #define KEY_MU_MIMO_UES_NUM "muMimoUEs"
\r
58 #define KEY_DLLAYERS_PER_UE "DlLayersPerUe"
\r
59 #define KEY_ULLAYERS_PER_UE "UlLayersPerUe"
\r
60 #define KEY_FILE_DLBFWUE "DlBfwUe"
\r
61 #define KEY_FILE_ULBFWUE "UlBfwUe"
\r
63 #define KEY_FILE_ULSRS "antSrsC"
\r
66 #define KEY_TTI_PERIOD "ttiPeriod"
\r
68 #define KEY_MTU_SIZE "MTUSize"
\r
69 #define KEY_IO_CORE "ioCore"
\r
70 #define KEY_INSTANCE_ID "instanceId"
\r
72 #define KEY_LLS_CU_MAC "llsCUMac"
\r
73 #define KEY_RU_MAC "ruMac"
\r
75 #define KEY_FILE_NUMSLOTS "numSlots"
\r
76 #define KEY_FILE_AxC "antC"
\r
77 #define KEY_FILE_PRACH_AxC "antPrachC"
\r
79 #define KEY_PRACH_ENABLE "rachEanble"
\r
80 #define KEY_SRS_ENABLE "srsEanble"
\r
82 #define KEY_PRACH_CFGIDX "prachConfigIndex"
\r
83 #define KEY_SRS_SYM_IDX "srsSym"
\r
85 #define KEY_MAX_FRAME_ID "maxFrameId"
\r
88 #define KEY_IQ_SWAP "iqswap"
\r
89 #define KEY_HTONS_SWAP "nebyteorderswap"
\r
90 #define KEY_COMPRESSION "compression"
\r
92 #define KEY_BFW_NUM "totalBFWeights"
\r
94 #define KEY_TADV_CP_DL "Tadv_cp_dl"
\r
95 #define KEY_T2A_MIN_CP_DL "T2a_min_cp_dl"
\r
96 #define KEY_T2A_MAX_CP_DL "T2a_max_cp_dl"
\r
97 #define KEY_T2A_MIN_CP_UL "T2a_min_cp_ul"
\r
98 #define KEY_T2A_MAX_CP_UL "T2a_max_cp_ul"
\r
99 #define KEY_T2A_MIN_UP "T2a_min_up"
\r
100 #define KEY_T2A_MAX_UP "T2a_max_up"
\r
101 #define KEY_TA3_MIN "Ta3_min"
\r
102 #define KEY_TA3_MAX "Ta3_max"
\r
103 #define KEY_T1A_MIN_CP_DL "T1a_min_cp_dl"
\r
104 #define KEY_T1A_MAX_CP_DL "T1a_max_cp_dl"
\r
105 #define KEY_T1A_MIN_CP_UL "T1a_min_cp_ul"
\r
106 #define KEY_T1A_MAX_CP_UL "T1a_max_cp_ul"
\r
107 #define KEY_T1A_MIN_UP "T1a_min_up"
\r
108 #define KEY_T1A_MAX_UP "T1a_max_up"
\r
109 #define KEY_TA4_MIN "Ta4_min"
\r
110 #define KEY_TA4_MAX "Ta4_max"
\r
113 #define KEY_CP_ENABLE "CPenable"
\r
114 #define KEY_CP_VTAG "c_plane_vlan_tag"
\r
115 #define KEY_UP_VTAG "u_plane_vlan_tag"
\r
116 #define KEY_DEBUG_STOP "debugStop"
\r
117 #define KEY_DEBUG_STOP_CNT "debugStopCount"
\r
118 #define KEY_BBDEV_MODE "bbdevMode"
\r
119 #define KEY_DYNA_SEC_ENA "DynamicSectionEna"
\r
120 #define KEY_ALPHA "Gps_Alpha"
\r
121 #define KEY_BETA "Gps_Beta"
\r
123 #define KEY_NPRBELEM_DL "nPrbElemDl"
\r
124 #define KEY_PRBELEM_DL "PrbElemDl"
\r
126 #define KEY_NPRBELEM_UL "nPrbElemUl"
\r
127 #define KEY_PRBELEM_UL "PrbElemUl"
\r
130 * Set runtime configuration parameters to their defaults.
\r
132 * @todo Initialize missing parameters.
\r
134 static void init_config(RuntimeConfig* config)
\r
136 memset(config , 0, sizeof(RuntimeConfig));
\r
139 /** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - **/
\r
141 static void trim(char* input)
\r
144 for (i = 0; i<strlen(input); i++)
\r
145 if (input[i] == ' ' || input[i] == '\n' || input[i] == '\t')
\r
149 static int fillConfigStruct(RuntimeConfig *config, const char *key, const char *value)
\r
151 int32_t parse_res = 0;
\r
153 if (strcmp(key, KEY_APP_MODE) == 0){
\r
154 config->appMode = atoi(value);
\r
155 } else if (strcmp(key, KEY_XRAN_MODE) == 0) {
\r
156 config->xranCat = atoi(value);
\r
157 } else if (strcmp(key, KEY_CC_PER_PORT_NUM) == 0) {
\r
158 config->numCC= atoi(value);
\r
159 } else if (strcmp(key, KEY_MU_NUMBER) == 0) {
\r
160 config->mu_number= atoi(value);
\r
161 printf("mu_number: %d\n",config->mu_number);
\r
162 } else if (strcmp(key, KEY_NDLABSFREPOINTA) == 0) {
\r
163 config->nDLAbsFrePointA = atoi(value);
\r
164 printf("nDLAbsFrePointA: %d\n",config->nDLAbsFrePointA);
\r
165 } else if (strcmp(key, KEY_NULABSFREPOINTA) == 0) {
\r
166 config->nULAbsFrePointA = atoi(value);
\r
167 printf("nULAbsFrePointA: %d\n",config->nULAbsFrePointA);
\r
168 } else if (strcmp(key, KEY_NDLBANDWIDTH) == 0) {
\r
169 config->nDLBandwidth = atoi(value);
\r
170 printf("nDLBandwidth: %d\n",config->nDLBandwidth);
\r
171 } else if (strcmp(key, KEY_NULBANDWIDTH) == 0) {
\r
172 config->nULBandwidth = atoi(value);
\r
173 printf("nULBandwidth: %d\n",config->nULBandwidth);
\r
174 } else if (strcmp(key, KEY_NDLFFTSIZE) == 0) {
\r
175 config->nDLFftSize = atoi(value);
\r
176 printf("nDLFftSize: %d\n",config->nDLFftSize);
\r
177 } else if (strcmp(key, KEY_NULFFTSIZE) == 0) {
\r
178 config->nULFftSize = atoi(value);
\r
179 printf("nULFftSize: %d\n",config->nULFftSize);
\r
180 } else if (strcmp(key, KEY_NFRAMEDUPLEXTYPE) == 0) {
\r
181 config->nFrameDuplexType = atoi(value);
\r
182 printf("nFrameDuplexType: %d\n",config->nFrameDuplexType);
\r
183 } else if (strcmp(key, KEY_NTDDPERIOD) == 0) {
\r
184 config->nTddPeriod = atoi(value);
\r
185 printf("nTddPeriod: %d\n",config->nTddPeriod);
\r
186 if (config->nTddPeriod > XRAN_MAX_TDD_PERIODICITY)
\r
188 printf("nTddPeriod is larger than max allowed, invalid!\n");
\r
189 config->nTddPeriod = XRAN_MAX_TDD_PERIODICITY;
\r
191 } else if (strncmp(key, KEY_SSLOTCONFIG, strlen(KEY_SSLOTCONFIG)) == 0) {
\r
192 unsigned int slot_num = 0;
\r
194 sscanf(key,"sSlotConfig%u",&slot_num);
\r
195 if (slot_num >= config->nTddPeriod){
\r
196 printf("slot_num %d exceeds TddPeriod\n",slot_num);
\r
199 sscanf(value, "%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x",
\r
200 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[0],
\r
201 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[1],
\r
202 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[2],
\r
203 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[3],
\r
204 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[4],
\r
205 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[5],
\r
206 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[6],
\r
207 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[7],
\r
208 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[8],
\r
209 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[9],
\r
210 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[10],
\r
211 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[11],
\r
212 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[12],
\r
213 (uint32_t*)&config->sSlotConfig[slot_num].nSymbolType[13]);
\r
214 printf("sSlotConfig%d: ",slot_num);
\r
215 for (i = 0; i< 14; i++){
\r
216 printf("%d ",config->sSlotConfig[slot_num].nSymbolType[i]);
\r
220 } else if (strcmp(key, KEY_ANT_NUM) == 0) {
\r
221 config->numAxc = atoi(value);
\r
222 } else if (strcmp(key, KEY_UL_ANT_NUM) == 0) {
\r
223 config->numUlAxc = atoi(value);
\r
224 }else if (strcmp(key, KEY_ANT_ELM_TRX_NUM) == 0) {
\r
225 config->antElmTRx = atoi(value);
\r
226 printf("antElmTRx %d\n", config->antElmTRx);
\r
227 } else if (strcmp(key, KEY_MU_MIMO_UES_NUM) == 0) {
\r
228 config->muMimoUEs = atoi(value);
\r
229 } else if (strcmp(key, KEY_DLLAYERS_PER_UE) == 0) {
\r
230 config->DlLayersPerUe = atoi(value);
\r
231 } else if (strcmp(key, KEY_ULLAYERS_PER_UE) == 0) {
\r
232 config->UlLayersPerUe = atoi(value);
\r
233 } else if (strcmp(key, KEY_TTI_PERIOD) == 0) {
\r
234 config->ttiPeriod = atoi(value);
\r
235 } else if (strcmp(key, KEY_IQ_SWAP) == 0) {
\r
236 config->iqswap = atoi(value);
\r
237 } else if (strcmp(key, KEY_HTONS_SWAP) == 0) {
\r
238 config->nebyteorderswap = atoi(value);
\r
239 } else if (strcmp(key, KEY_COMPRESSION) == 0) {
\r
240 config->compression = atoi(value);
\r
241 } else if (strcmp(key, KEY_MTU_SIZE) == 0) {
\r
242 config->mtu = atoi(value);
\r
243 printf("mtu %d\n", config->mtu);
\r
244 } else if (strcmp(key, KEY_IO_CORE) == 0) {
\r
245 config->io_core = atoi(value);
\r
246 printf("io_core %d\n", config->io_core);
\r
247 }else if (strcmp(key, KEY_INSTANCE_ID) == 0) {
\r
248 config->instance_id = atoi(value);
\r
249 printf("instance_id %d\n", config->instance_id);
\r
250 }else if (strcmp(key, KEY_LLS_CU_MAC) == 0) {
\r
251 sscanf(value, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t*)&config->o_du_addr.addr_bytes[0],
\r
252 (uint32_t*)&config->o_du_addr.addr_bytes[1],
\r
253 (uint32_t*)&config->o_du_addr.addr_bytes[2],
\r
254 (uint32_t*)&config->o_du_addr.addr_bytes[3],
\r
255 (uint32_t*)&config->o_du_addr.addr_bytes[4],
\r
256 (uint32_t*)&config->o_du_addr.addr_bytes[5]);
\r
258 printf("lls-CU MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n",
\r
259 config->o_du_addr.addr_bytes[0],
\r
260 config->o_du_addr.addr_bytes[1],
\r
261 config->o_du_addr.addr_bytes[2],
\r
262 config->o_du_addr.addr_bytes[3],
\r
263 config->o_du_addr.addr_bytes[4],
\r
264 config->o_du_addr.addr_bytes[5]);
\r
266 } else if (strcmp(key, KEY_RU_MAC) == 0) {
\r
267 sscanf(value, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t*)&config->o_ru_addr.addr_bytes[0],
\r
268 (uint32_t*)&config->o_ru_addr.addr_bytes[1],
\r
269 (uint32_t*)&config->o_ru_addr.addr_bytes[2],
\r
270 (uint32_t*)&config->o_ru_addr.addr_bytes[3],
\r
271 (uint32_t*)&config->o_ru_addr.addr_bytes[4],
\r
272 (uint32_t*)&config->o_ru_addr.addr_bytes[5]);
\r
274 printf("RU MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n",
\r
275 config->o_ru_addr.addr_bytes[0],
\r
276 config->o_ru_addr.addr_bytes[1],
\r
277 config->o_ru_addr.addr_bytes[2],
\r
278 config->o_ru_addr.addr_bytes[3],
\r
279 config->o_ru_addr.addr_bytes[4],
\r
280 config->o_ru_addr.addr_bytes[5]);
\r
281 } else if (strcmp(key, KEY_FILE_NUMSLOTS) == 0) {
\r
282 config->numSlots = atoi(value);
\r
283 printf("numSlots: %d\n",config->numSlots);
\r
284 }else if (strncmp(key, KEY_FILE_AxC, strlen(KEY_FILE_AxC)) == 0) {
\r
285 unsigned int ant_num = 0;
\r
286 sscanf(key,"antC%02u",&ant_num);
\r
287 if (ant_num >= MAX_ANT_CARRIER_SUPPORTED) {
\r
288 printf("antC%d exceeds max antenna supported\n",ant_num);
\r
290 strncpy(&config->ant_file[ant_num][0], value, strlen(value));
\r
291 printf("antC%d: %s\n",ant_num, config->ant_file[ant_num]);
\r
293 } else if (strncmp(key, KEY_FILE_DLBFWUE, strlen(KEY_FILE_DLBFWUE)) == 0) {
\r
294 unsigned int ue_num = 0;
\r
295 sscanf(key,"DlBfwUe%02u",&ue_num);
\r
296 if (ue_num >= MAX_ANT_CARRIER_SUPPORTED) {
\r
297 printf("DlBfwUe%d exceeds max streams supported\n",ue_num);
\r
299 strncpy(&config->dl_bfw_file[ue_num][0], value, strlen(value));
\r
300 printf("DlBfwUe%d: %s\n",ue_num, config->dl_bfw_file[ue_num]);
\r
302 }else if (strncmp(key, KEY_FILE_ULBFWUE, strlen(KEY_FILE_ULBFWUE)) == 0) {
\r
303 unsigned int ue_num = 0;
\r
304 sscanf(key,"UlBfwUe%02u",&ue_num);
\r
305 if (ue_num >= MAX_ANT_CARRIER_SUPPORTED) {
\r
306 printf("UlBfwUe%d exceeds max streams supported\n",ue_num);
\r
308 strncpy(&config->ul_bfw_file[ue_num][0], value, strlen(value));
\r
309 printf("UlBfwUe%d: %s\n",ue_num, config->ul_bfw_file[ue_num]);
\r
311 }else if (strncmp(key, KEY_FILE_ULSRS, strlen(KEY_FILE_ULSRS)) == 0) {
\r
312 unsigned int srs_ant = 0;
\r
313 sscanf(key,"antSrsC%02u",&srs_ant);
\r
314 if (srs_ant >= MAX_ANT_CARRIER_SUPPORTED_CAT_B) {
\r
315 printf("antSrsC%d exceeds max ant elemnets supported [%d]\n", srs_ant, MAX_ANT_CARRIER_SUPPORTED_CAT_B);
\r
317 strncpy(&config->ul_srs_file[srs_ant][0], value, strlen(value));
\r
318 printf("antSrsC%d: %s\n",srs_ant, config->ul_srs_file[srs_ant]);
\r
320 } else if (strcmp(key, KEY_PRACH_ENABLE) == 0) {
\r
321 config->enablePrach = atoi(value);
\r
322 printf("Prach enable: %d\n",config->enablePrach);
\r
323 }else if (strcmp(key, KEY_MAX_FRAME_ID) == 0) {
\r
324 config->maxFrameId = atoi(value);
\r
325 printf("maxFrameId: %d\n",config->maxFrameId);
\r
326 } else if (strcmp(key, KEY_SRS_ENABLE) == 0) {
\r
327 config->enableSrs = atoi(value);
\r
328 printf("Srs enable: %d\n",config->enablePrach);
\r
329 } else if (strcmp(key, KEY_PRACH_CFGIDX) == 0) {
\r
330 config->prachConfigIndex = atoi(value);
\r
331 printf("Prach config index: %d\n",config->prachConfigIndex);
\r
332 } else if (strcmp(key, KEY_SRS_SYM_IDX) == 0) {
\r
333 config->srsSymMask = atoi(value);
\r
334 printf("Srs symbol [0-13]: %d\n",config->srsSymMask);
\r
335 } else if (strncmp(key, KEY_FILE_PRACH_AxC, strlen(KEY_FILE_PRACH_AxC)) == 0) {
\r
336 unsigned int ant_num = 0;
\r
337 sscanf(key,"antPrachC%02u",&ant_num);
\r
338 if (ant_num >= MAX_ANT_CARRIER_SUPPORTED)
\r
340 printf("antC%d exceeds max antenna supported\n",ant_num);
\r
343 strncpy(&config->prach_file[ant_num][0], value, strlen(value));
\r
344 printf("antPrachC%d: %s\n",ant_num, config->prach_file[ant_num]);
\r
346 } else if (strcmp(key, KEY_BFW_NUM) == 0) {
\r
347 config->totalBfWeights = atoi(value);
\r
348 printf("%s : %d\n",KEY_BFW_NUM, config->totalBfWeights);
\r
350 } else if (strcmp(key, KEY_TADV_CP_DL ) == 0) {
\r
351 config->Tadv_cp_dl = atoi(value);
\r
352 printf("Tadv_cp_dl: %d\n",config->Tadv_cp_dl);
\r
353 } else if (strcmp(key, KEY_T2A_MIN_CP_DL ) == 0) {
\r
354 config->T2a_min_cp_dl = atoi(value);
\r
355 printf("T2a_min_cp_dl: %d\n",config->T2a_min_cp_dl);
\r
356 } else if (strcmp(key, KEY_T2A_MAX_CP_DL ) == 0) {
\r
357 config->T2a_max_cp_dl = atoi(value);
\r
358 printf("T2a_max_cp_dl: %d\n",config->T2a_max_cp_dl);
\r
359 } else if (strcmp(key, KEY_T2A_MIN_CP_UL ) == 0) {
\r
360 config->T2a_min_cp_ul = atoi(value);
\r
361 printf("T2a_min_cp_ul: %d\n",config->T2a_min_cp_ul);
\r
362 } else if (strcmp(key, KEY_T2A_MAX_CP_UL ) == 0) {
\r
363 config->T2a_max_cp_ul = atoi(value);
\r
364 printf("T2a_max_cp_ul: %d\n",config->T2a_max_cp_ul);
\r
365 } else if (strcmp(key, KEY_T2A_MIN_UP ) == 0) {
\r
366 config->T2a_min_up = atoi(value);
\r
367 printf("T2a_min_up: %d\n",config->T2a_min_up);
\r
368 } else if (strcmp(key, KEY_T2A_MAX_UP ) == 0) {
\r
369 config->T2a_max_up = atoi(value);
\r
370 printf("T2a_max_up: %d\n",config->T2a_max_up);
\r
371 } else if (strcmp(key, KEY_TA3_MIN ) == 0) {
\r
372 config->Ta3_min = atoi(value);
\r
373 printf("Ta3_min: %d\n",config->Ta3_min);
\r
374 } else if (strcmp(key, KEY_TA3_MAX ) == 0) {
\r
375 config->Ta3_max = atoi(value);
\r
376 printf("Ta3_max: %d\n",config->Ta3_max);
\r
377 } else if (strcmp(key, KEY_T1A_MIN_CP_DL ) == 0) {
\r
378 config->T1a_min_cp_dl = atoi(value);
\r
379 printf("T1a_min_cp_dl: %d\n",config->T1a_min_cp_dl);
\r
380 } else if (strcmp(key, KEY_T1A_MAX_CP_DL ) == 0) {
\r
381 config->T1a_max_cp_dl = atoi(value);
\r
382 printf("T1a_max_cp_dl: %d\n",config->T1a_max_cp_dl);
\r
383 } else if (strcmp(key, KEY_T1A_MIN_CP_UL ) == 0) {
\r
384 config->T1a_min_cp_ul = atoi(value);
\r
385 printf("T1a_min_cp_ul: %d\n",config->T1a_min_cp_ul);
\r
386 } else if (strcmp(key, KEY_T1A_MAX_CP_UL ) == 0) {
\r
387 config->T1a_max_cp_ul = atoi(value);
\r
388 printf("T1a_max_cp_ul: %d\n",config->T1a_max_cp_ul);
\r
389 } else if (strcmp(key, KEY_T1A_MIN_UP ) == 0) {
\r
390 config->T1a_min_up = atoi(value);
\r
391 printf("T1a_min_up: %d\n",config->T1a_min_up);
\r
392 } else if (strcmp(key, KEY_T1A_MAX_UP ) == 0) {
\r
393 config->T1a_max_up = atoi(value);
\r
394 printf("T1a_max_up: %d\n",config->T1a_max_up);
\r
395 } else if (strcmp(key, KEY_TA4_MIN ) == 0) {
\r
396 config->Ta4_min = atoi(value);
\r
397 printf("Ta4_min: %d\n",config->Ta4_min);
\r
398 } else if (strcmp(key, KEY_TA4_MAX ) == 0) {
\r
399 config->Ta4_max = atoi(value);
\r
400 printf("Ta4_max: %d\n",config->Ta4_max);
\r
401 /* end of timing */
\r
402 } else if (strcmp(key, KEY_CP_ENABLE ) == 0) {
\r
403 config->enableCP = atoi(value);
\r
404 printf("CPenable: %d\n",config->enableCP);
\r
405 } else if (strcmp(key, KEY_DEBUG_STOP ) == 0) {
\r
406 config->debugStop = atoi(value);
\r
407 printf("debugStop: %d\n",config->debugStop);
\r
408 } else if (strcmp(key, KEY_DEBUG_STOP_CNT) == 0) {
\r
409 config->debugStopCount = atoi(value);
\r
410 printf("debugStopCount: %d\n",config->debugStopCount);
\r
411 } else if (strcmp(key, KEY_BBDEV_MODE) == 0) {
\r
412 config->bbdevMode = atoi(value);
\r
413 printf("bbdevMode: %d\n",config->debugStopCount);
\r
414 } else if (strcmp(key, KEY_DYNA_SEC_ENA) == 0) {
\r
415 config->DynamicSectionEna = atoi(value);
\r
416 printf("DynamicSectionEna: %d\n",config->DynamicSectionEna);
\r
417 } else if (strcmp(key, KEY_ALPHA) == 0) {
\r
418 config->GPS_Alpha = atoi(value);
\r
419 printf("GPS_Alpha: %d\n",config->GPS_Alpha);
\r
420 } else if (strcmp(key, KEY_BETA) == 0) {
\r
421 config->GPS_Beta = atoi(value);
\r
422 printf("GPS_Beta: %d\n",config->GPS_Beta);
\r
423 } else if (strcmp(key, KEY_CP_VTAG ) == 0) {
\r
424 config->cp_vlan_tag = atoi(value);
\r
425 printf("cp_vlan_tag: %d\n",config->cp_vlan_tag);
\r
426 } else if (strcmp(key, KEY_UP_VTAG ) == 0) {
\r
427 config->up_vlan_tag = atoi(value);
\r
428 printf("up_vlan_tag: %d\n",config->up_vlan_tag);
\r
429 } else if (strcmp(key, KEY_NPRBELEM_UL ) == 0) {
\r
430 config->PrbMapUl.nPrbElm = atoi(value);
\r
431 if (config->PrbMapUl.nPrbElm > XRAN_MAX_PRBS)
\r
433 printf("nTddPeriod is larger than max allowed, invalid!\n");
\r
434 config->PrbMapUl.nPrbElm = XRAN_MAX_PRBS;
\r
436 printf("nPrbElemUl: %d\n",config->PrbMapUl.nPrbElm);
\r
437 } else if (strncmp(key, KEY_PRBELEM_UL, strlen(KEY_PRBELEM_UL)) == 0) {
\r
438 unsigned int section_idx = 0;
\r
439 sscanf(key,"PrbElemUl%u",§ion_idx);
\r
440 if (section_idx >= config->PrbMapUl.nPrbElm){
\r
441 printf("section_idx %d exceeds nPrbElem\n",section_idx);
\r
444 struct xran_prb_elm *pPrbElem = &config->PrbMapUl.prbMap[section_idx];
\r
445 sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd",
\r
446 (int16_t*)&pPrbElem->nRBStart,
\r
447 (int16_t*)&pPrbElem->nRBSize,
\r
448 (int16_t*)&pPrbElem->nStartSymb,
\r
449 (int16_t*)&pPrbElem->numSymb,
\r
450 (int16_t*)&pPrbElem->nBeamIndex,
\r
451 (int16_t*)&pPrbElem->bf_weight_update,
\r
452 (int16_t*)&pPrbElem->compMethod,
\r
453 (int16_t*)&pPrbElem->iqWidth,
\r
454 (int16_t*)&pPrbElem->BeamFormingType);
\r
455 printf("nPrbElemUl%d: ",section_idx);
\r
456 printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n",
\r
457 pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType);
\r
459 }else if (strcmp(key, KEY_NPRBELEM_DL ) == 0) {
\r
460 config->PrbMapDl.nPrbElm = atoi(value);
\r
461 if (config->PrbMapDl.nPrbElm > XRAN_MAX_PRBS)
\r
463 printf("nTddPeriod is larger than max allowed, invalid!\n");
\r
464 config->PrbMapDl.nPrbElm = XRAN_MAX_PRBS;
\r
466 printf("nPrbElemDl: %d\n",config->PrbMapDl.nPrbElm);
\r
467 } else if (strncmp(key, KEY_PRBELEM_DL, strlen(KEY_PRBELEM_DL)) == 0) {
\r
468 unsigned int section_idx = 0;
\r
469 sscanf(key,"PrbElemDl%u",§ion_idx);
\r
470 if (section_idx >= config->PrbMapDl.nPrbElm){
\r
471 printf("section_idx %d exceeds nPrbElem\n",section_idx);
\r
474 struct xran_prb_elm *pPrbElem = &config->PrbMapDl.prbMap[section_idx];
\r
475 sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd",
\r
476 (int16_t*)&pPrbElem->nRBStart,
\r
477 (int16_t*)&pPrbElem->nRBSize,
\r
478 (int16_t*)&pPrbElem->nStartSymb,
\r
479 (int16_t*)&pPrbElem->numSymb,
\r
480 (int16_t*)&pPrbElem->nBeamIndex,
\r
481 (int16_t*)&pPrbElem->bf_weight_update,
\r
482 (int16_t*)&pPrbElem->compMethod,
\r
483 (int16_t*)&pPrbElem->iqWidth,
\r
484 (int16_t*)&pPrbElem->BeamFormingType);
\r
485 printf("nPrbElemDl%d: ",section_idx);
\r
486 printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n",
\r
487 pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType);
\r
490 printf("Unsupported configuration key [%s]\n", key);
\r
497 int parseConfigFile(char *filename, RuntimeConfig *config)
\r
499 char inputLine[MAX_LINE_SIZE] = {0};
\r
503 char key[MAX_LINE_SIZE] = {0};
\r
504 char value[MAX_LINE_SIZE] = {0};
\r
505 FILE *file = fopen(filename, "r");
\r
507 if (NULL == file) {
\r
508 log_err("Error while opening config file from: %s", filename);
\r
512 // init_config(config);
\r
515 if (fgets(inputLine, MAX_LINE_SIZE, file) == NULL) {
\r
517 printf("%d lines of config file has been read.\n", lineNum);
\r
520 printf("Configuration file reading error has occurred.\n");
\r
526 if (inputLine[strlen(inputLine)-1] == '\n')
\r
527 inputLine[strlen(inputLine)-1] == '\0';
\r
530 inputLen = strlen(inputLine);
\r
532 for (i=0; i<inputLen; i++)
\r
533 if (inputLine[i] == '#') {
\r
534 inputLine[i] = '\0';
\r
539 for (i=0; i<inputLen; i++)
\r
540 if (inputLine[i] == '=') {
\r
541 strncpy(key, inputLine, i);
\r
544 if ((i + 1 > inputLen - 1) || (i - 2 > inputLen)) {
\r
545 log_err("Parsing config file error at line %d", lineNum);
\r
549 strncpy(value, &inputLine[i+1], (sizeof(value) - 1));
\r
550 value[inputLen-i-2] = '\0';
\r
553 if (strlen(key) == 0 || strlen(value) == 0) {
\r
554 printf("Parsing config file error at line %d", lineNum);
\r
559 if (fillConfigStruct(config, key, value) != 0) {
\r
567 memset(&inputLine[0], 0, sizeof(MAX_LINE_SIZE));
\r
568 memset(&key[0], 0, sizeof(MAX_LINE_SIZE));
\r
569 memset(&value[0], 0, sizeof(MAX_LINE_SIZE));
\r