X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=fhi_lib%2Fapp%2Fsrc%2Fconfig.c;h=deec5a1458ffccf89ef76007a364a9c802fd96bc;hb=70d9d920dd4e575f085f1f1a9050fefd1c10e127;hp=1564c8d28f7215f56c071d827844323355c34524;hpb=4745e5c88ba931c6d71cb6d8c681f76cf364eac5;p=o-du%2Fphy.git diff --git a/fhi_lib/app/src/config.c b/fhi_lib/app/src/config.c index 1564c8d..deec5a1 100644 --- a/fhi_lib/app/src/config.c +++ b/fhi_lib/app/src/config.c @@ -1,6 +1,6 @@ /****************************************************************************** * -* Copyright (c) 2019 Intel. +* Copyright (c) 2020 Intel. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ * *******************************************************************************/ - /** * @brief * @file @@ -26,45 +25,84 @@ #include "rte_common.h" #include "config.h" +#include "common.h" +#include "debug.h" #include #define MAX_LINE_SIZE 512 /* Configuration file maximum supported line length */ - #define KEY_APP_MODE "appMode" #define KEY_XRAN_MODE "xranMode" +#define KEY_XRAN_TECH "xranRanTech" #define KEY_MU_NUMBER "mu" +#define KEY_NDLABSFREPOINTA "nDLAbsFrePointA" +#define KEY_NULABSFREPOINTA "nULAbsFrePointA" +#define KEY_NDLBANDWIDTH "nDLBandwidth" +#define KEY_NULBANDWIDTH "nULBandwidth" +#define KEY_NDLFFTSIZE "nDLFftSize" +#define KEY_NULFFTSIZE "nULFftSize" + +#define KEY_DU_PORT_ID_BITWIDTH "DU_Port_ID_bitwidth" +#define KEY_BANDSECTOR_ID_BITWIDTH "BandSector_ID_bitwidth" +#define KEY_CC_ID_BITWIDTH "CC_ID_bitwidth" +#define KEY_RU_PORT_ID_BITWIDTH "RU_Port_ID_bitwidth" + +#define KEY_NFRAMEDUPLEXTYPE "nFrameDuplexType" +#define KEY_NTDDPERIOD "nTddPeriod" + +#define KEY_SSLOTCONFIG "sSlotConfig" + #define KEY_CC_PER_PORT_NUM "ccNum" #define KEY_ANT_NUM "antNum" +#define KEY_UL_ANT_NUM "antNumUL" + +#define KEY_ANT_ELM_TRX_NUM "antElmTRx" + +#define KEY_MU_MIMO_UES_NUM "muMimoUEs" +#define KEY_DLLAYERS_PER_UE "DlLayersPerUe" +#define KEY_ULLAYERS_PER_UE "UlLayersPerUe" +#define KEY_FILE_DLBFWUE "DlBfwUe" +#define KEY_FILE_ULBFWUE "UlBfwUe" + +#define KEY_FILE_ULSRS "antSrsC" + + #define KEY_TTI_PERIOD "ttiPeriod" -#define KEY_LLS_CU_MAC "llsCUMac" + +#define KEY_MTU_SIZE "MTUSize" +#define KEY_IO_CORE "ioCore" +#define KEY_IO_WORKER "ioWorker" +#define KEY_IO_SLEEP "ioSleep" +#define KEY_SYSTEM_CORE "systemCore" +#define KEY_IOVA_MODE "iovaMode" + +#define KEY_INSTANCE_ID "instanceId" + +#define KEY_DU_MAC "duMac" #define KEY_RU_MAC "ruMac" -#define KEY_FILE_AxC0 "antC0" -#define KEY_FILE_AxC1 "antC1" -#define KEY_FILE_AxC2 "antC2" -#define KEY_FILE_AxC3 "antC3" -#define KEY_FILE_AxC4 "antC4" -#define KEY_FILE_AxC5 "antC5" -#define KEY_FILE_AxC6 "antC6" -#define KEY_FILE_AxC7 "antC7" -#define KEY_FILE_AxC8 "antC8" -#define KEY_FILE_AxC9 "antC9" -#define KEY_FILE_AxC10 "antC10" -#define KEY_FILE_AxC11 "antC11" -#define KEY_FILE_AxC12 "antC12" -#define KEY_FILE_AxC13 "antC13" -#define KEY_FILE_AxC14 "antC14" -#define KEY_FILE_AxC15 "antC15" +#define KEY_FILE_NUMSLOTS "numSlots" +#define KEY_FILE_AxC "antC" +#define KEY_FILE_PRACH_AxC "antPrachC" #define KEY_PRACH_ENABLE "rachEanble" -#define KEY_PRACH_OFFSET "rachOffset" -#define KEY_PRACH_CFG_IDX "rachCfgIdx" +#define KEY_SRS_ENABLE "srsEanble" + +#define KEY_PRACH_CFGIDX "prachConfigIndex" +#define KEY_SRS_SYM_IDX "srsSym" + +#define KEY_MAX_FRAME_ID "maxFrameId" + #define KEY_IQ_SWAP "iqswap" #define KEY_HTONS_SWAP "nebyteorderswap" +#define KEY_COMPRESSION "compression" +#define KEY_COMP_TYPE "compType" + + +#define KEY_BFW_NUM "totalBFWeights" #define KEY_TADV_CP_DL "Tadv_cp_dl" #define KEY_T2A_MIN_CP_DL "T2a_min_cp_dl" @@ -89,6 +127,17 @@ #define KEY_CP_VTAG "c_plane_vlan_tag" #define KEY_UP_VTAG "u_plane_vlan_tag" #define KEY_DEBUG_STOP "debugStop" +#define KEY_DEBUG_STOP_CNT "debugStopCount" +#define KEY_BBDEV_MODE "bbdevMode" +#define KEY_DYNA_SEC_ENA "DynamicSectionEna" +#define KEY_ALPHA "Gps_Alpha" +#define KEY_BETA "Gps_Beta" + +#define KEY_NPRBELEM_DL "nPrbElemDl" +#define KEY_PRBELEM_DL "PrbElemDl" + +#define KEY_NPRBELEM_UL "nPrbElemUl" +#define KEY_PRBELEM_UL "PrbElemUl" /** @@ -114,112 +163,248 @@ static void trim(char* input) static int fillConfigStruct(RuntimeConfig *config, const char *key, const char *value) { int32_t parse_res = 0; + static unsigned int section_idx_dl = 0, section_idx_ul; if (strcmp(key, KEY_APP_MODE) == 0){ config->appMode = atoi(value); + } else if (strcmp(key, KEY_XRAN_TECH) == 0) { + config->xranTech = atoi(value); } else if (strcmp(key, KEY_XRAN_MODE) == 0) { - config->xranMode = atoi(value); + config->xranCat = atoi(value); } else if (strcmp(key, KEY_CC_PER_PORT_NUM) == 0) { config->numCC= atoi(value); } else if (strcmp(key, KEY_MU_NUMBER) == 0) { config->mu_number= atoi(value); + printf("mu_number: %d\n",config->mu_number); + } else if (strcmp(key, KEY_NDLABSFREPOINTA) == 0) { + config->nDLAbsFrePointA = atoi(value); + printf("nDLAbsFrePointA: %d\n",config->nDLAbsFrePointA); + } else if (strcmp(key, KEY_NULABSFREPOINTA) == 0) { + config->nULAbsFrePointA = atoi(value); + printf("nULAbsFrePointA: %d\n",config->nULAbsFrePointA); + } else if (strcmp(key, KEY_NDLBANDWIDTH) == 0) { + config->nDLBandwidth = atoi(value); + printf("nDLBandwidth: %d\n",config->nDLBandwidth); + } else if (strcmp(key, KEY_NULBANDWIDTH) == 0) { + config->nULBandwidth = atoi(value); + printf("nULBandwidth: %d\n",config->nULBandwidth); + } else if (strcmp(key, KEY_NDLFFTSIZE) == 0) { + config->nDLFftSize = atoi(value); + printf("nDLFftSize: %d\n",config->nDLFftSize); + } else if (strcmp(key, KEY_NULFFTSIZE) == 0) { + config->nULFftSize = atoi(value); + printf("nULFftSize: %d\n",config->nULFftSize); + } else if (strcmp(key, KEY_NFRAMEDUPLEXTYPE) == 0) { + config->nFrameDuplexType = atoi(value); + printf("nFrameDuplexType: %d\n",config->nFrameDuplexType); + } else if (strcmp(key, KEY_DU_PORT_ID_BITWIDTH) == 0) { + config->DU_Port_ID_bitwidth = atoi(value); + printf("DU_Port_ID_bitwidth: %d\n",config->DU_Port_ID_bitwidth); + } else if (strcmp(key, KEY_BANDSECTOR_ID_BITWIDTH) == 0) { + config->BandSector_ID_bitwidth = atoi(value); + printf("BandSector_ID_bitwidth: %d\n",config->BandSector_ID_bitwidth); + } else if (strcmp(key, KEY_CC_ID_BITWIDTH) == 0) { + config->CC_ID_bitwidth = atoi(value); + printf("CC_ID_bitwidth: %d\n",config->CC_ID_bitwidth); + } else if (strcmp(key, KEY_RU_PORT_ID_BITWIDTH) == 0) { + config->RU_Port_ID_bitwidth = atoi(value); + printf("RU_Port_ID_bitwidth: %d\n",config->RU_Port_ID_bitwidth); + } else if (strcmp(key, KEY_NTDDPERIOD) == 0) { + config->nTddPeriod = atoi(value); + printf("nTddPeriod: %d\n",config->nTddPeriod); + if (config->nTddPeriod > XRAN_MAX_TDD_PERIODICITY) + { + printf("nTddPeriod is larger than max allowed, invalid!\n"); + config->nTddPeriod = XRAN_MAX_TDD_PERIODICITY; + } + } else if (strncmp(key, KEY_SSLOTCONFIG, strlen(KEY_SSLOTCONFIG)) == 0) { + unsigned int slot_num = 0; + int i = 0; + sscanf(key,"sSlotConfig%u",&slot_num); + if (slot_num >= config->nTddPeriod){ + printf("slot_num %d exceeds TddPeriod\n",slot_num); + } + else{ + sscanf(value, "%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx,%02hhx", + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[0], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[1], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[2], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[3], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[4], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[5], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[6], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[7], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[8], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[9], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[10], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[11], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[12], + (uint8_t *)&config->sSlotConfig[slot_num].nSymbolType[13]); + printf("sSlotConfig%d: ",slot_num); + for (i = 0; i< 14; i++){ + printf("%d ",config->sSlotConfig[slot_num].nSymbolType[i]); + } + printf("\n"); + } } else if (strcmp(key, KEY_ANT_NUM) == 0) { config->numAxc = atoi(value); + } else if (strcmp(key, KEY_UL_ANT_NUM) == 0) { + config->numUlAxc = atoi(value); + }else if (strcmp(key, KEY_ANT_ELM_TRX_NUM) == 0) { + config->antElmTRx = atoi(value); + printf("antElmTRx %d\n", config->antElmTRx); + } else if (strcmp(key, KEY_MU_MIMO_UES_NUM) == 0) { + config->muMimoUEs = atoi(value); + } else if (strcmp(key, KEY_DLLAYERS_PER_UE) == 0) { + config->DlLayersPerUe = atoi(value); + } else if (strcmp(key, KEY_ULLAYERS_PER_UE) == 0) { + config->UlLayersPerUe = atoi(value); } else if (strcmp(key, KEY_TTI_PERIOD) == 0) { config->ttiPeriod = atoi(value); } else if (strcmp(key, KEY_IQ_SWAP) == 0) { config->iqswap = atoi(value); } else if (strcmp(key, KEY_HTONS_SWAP) == 0) { config->nebyteorderswap = atoi(value); - } else if (strcmp(key, KEY_LLS_CU_MAC) == 0) { - sscanf(value, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t*)&config->lls_cu_addr.addr_bytes[0], - (uint32_t*)&config->lls_cu_addr.addr_bytes[1], - (uint32_t*)&config->lls_cu_addr.addr_bytes[2], - (uint32_t*)&config->lls_cu_addr.addr_bytes[3], - (uint32_t*)&config->lls_cu_addr.addr_bytes[4], - (uint32_t*)&config->lls_cu_addr.addr_bytes[5]); - - printf("lls-CU MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n", - config->lls_cu_addr.addr_bytes[0], - config->lls_cu_addr.addr_bytes[1], - config->lls_cu_addr.addr_bytes[2], - config->lls_cu_addr.addr_bytes[3], - config->lls_cu_addr.addr_bytes[4], - config->lls_cu_addr.addr_bytes[5]); - - } else if (strcmp(key, KEY_RU_MAC) == 0) { - sscanf(value, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t*)&config->ru_addr.addr_bytes[0], - (uint32_t*)&config->ru_addr.addr_bytes[1], - (uint32_t*)&config->ru_addr.addr_bytes[2], - (uint32_t*)&config->ru_addr.addr_bytes[3], - (uint32_t*)&config->ru_addr.addr_bytes[4], - (uint32_t*)&config->ru_addr.addr_bytes[5]); - - printf("RU MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n", - config->ru_addr.addr_bytes[0], - config->ru_addr.addr_bytes[1], - config->ru_addr.addr_bytes[2], - config->ru_addr.addr_bytes[3], - config->ru_addr.addr_bytes[4], - config->ru_addr.addr_bytes[5]); - } else if (strcmp(key, KEY_FILE_AxC0) == 0) { - strncpy(&config->ant_file[0][0], value, strlen(value)); - printf("ant0: %s\n",config->ant_file[0]); - } else if (strcmp(key, KEY_FILE_AxC1) == 0) { - strncpy(&config->ant_file[1][0], value, strlen(value)); - printf("ant1: %s\n",config->ant_file[1]); - } else if (strcmp(key, KEY_FILE_AxC2) == 0) { - strncpy(&config->ant_file[2][0], value, strlen(value)); - printf("ant2: %s\n",config->ant_file[2]); - } else if (strcmp(key, KEY_FILE_AxC3) == 0) { - strncpy(&config->ant_file[3][0], value, strlen(value)); - printf("ant3: %s\n",config->ant_file[3]); - } else if (strcmp(key, KEY_FILE_AxC4) == 0) { - strncpy(&config->ant_file[4][0], value, strlen(value)); - printf("ant4: %s\n",config->ant_file[4]); - } else if (strcmp(key, KEY_FILE_AxC5) == 0) { - strncpy(&config->ant_file[5][0], value, strlen(value)); - printf("ant5: %s\n",config->ant_file[5]); - } else if (strcmp(key, KEY_FILE_AxC6) == 0) { - strncpy(&config->ant_file[6][0], value, strlen(value)); - printf("ant6: %s\n",config->ant_file[6]); - } else if (strcmp(key, KEY_FILE_AxC7) == 0) { - strncpy(&config->ant_file[7][0], value, strlen(value)); - printf("ant7: %s\n",config->ant_file[7]); - } else if (strcmp(key, KEY_FILE_AxC8) == 0) { - strncpy(&config->ant_file[8][0], value, strlen(value)); - printf("ant8: %s\n",config->ant_file[8]); - } else if (strcmp(key, KEY_FILE_AxC9) == 0) { - strncpy(&config->ant_file[9][0], value, strlen(value)); - printf("ant9: %s\n",config->ant_file[9]); - } else if (strcmp(key, KEY_FILE_AxC10) == 0) { - strncpy(&config->ant_file[10][0], value, strlen(value)); - printf("ant10: %s\n",config->ant_file[10]); - } else if (strcmp(key, KEY_FILE_AxC11) == 0) { - strncpy(&config->ant_file[11][0], value, strlen(value)); - printf("ant11: %s\n",config->ant_file[11]); - } else if (strcmp(key, KEY_FILE_AxC12) == 0) { - strncpy(&config->ant_file[12][0], value, strlen(value)); - printf("ant12: %s\n",config->ant_file[12]); - } else if (strcmp(key, KEY_FILE_AxC13) == 0) { - strncpy(&config->ant_file[13][0], value, strlen(value)); - printf("ant13: %s\n",config->ant_file[13]); - } else if (strcmp(key, KEY_FILE_AxC14) == 0) { - strncpy(&config->ant_file[14][0], value, strlen(value)); - printf("ant14: %s\n",config->ant_file[14]); - } else if (strcmp(key, KEY_FILE_AxC15) == 0) { - strncpy(&config->ant_file[15][0], value, strlen(value)); - printf("ant15: %s\n",config->ant_file[15]); + } else if (strcmp(key, KEY_COMPRESSION) == 0) { + config->compression = atoi(value); + } else if (strcmp(key, KEY_COMP_TYPE) == 0) { + config->CompHdrType = atoi(value); + } else if (strcmp(key, KEY_MTU_SIZE) == 0) { + config->mtu = atoi(value); + printf("mtu %d\n", config->mtu); + } else if (strcmp(key, KEY_IO_SLEEP) == 0) { + config->io_sleep = atoi(value); + printf("io_sleep %d \n", config->io_sleep); + } else if (strcmp(key, KEY_IO_CORE) == 0) { + config->io_core = atoi(value); + printf("io_core %d [core id]\n", config->io_core); + } else if (strcmp(key, KEY_IO_WORKER) == 0) { + config->io_worker = strtoll(value, NULL, 0); + printf("io_worker 0x%lx [mask]\n", config->io_worker); + } else if (strcmp(key, KEY_SYSTEM_CORE) == 0) { + config->system_core = atoi(value); + printf("system core %d [core id]\n", config->system_core); + } else if (strcmp(key, KEY_IOVA_MODE) == 0) { + config->iova_mode = atoi(value); + printf("iova_mode %d\n", config->iova_mode); + } else if (strcmp(key, KEY_INSTANCE_ID) == 0) { + config->instance_id = atoi(value); + printf("instance_id %d\n", config->instance_id); + } else if (strncmp(key, KEY_DU_MAC, strlen(KEY_DU_MAC)) == 0) { + unsigned int vf_num = 0; + sscanf(key,"duMac%02u",&vf_num); + if (vf_num >= XRAN_VF_MAX) { + printf("duMac%d exceeds max antenna supported\n",vf_num); + } else { + printf("duMac%d: %s\n",vf_num, value); + sscanf(value, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[0], + (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[1], + (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[2], + (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[3], + (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[4], + (uint8_t*)&config->o_du_addr[vf_num].addr_bytes[5]); + + printf("[vf %d]O-DU MAC address: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", + vf_num, + config->o_du_addr[vf_num].addr_bytes[0], + config->o_du_addr[vf_num].addr_bytes[1], + config->o_du_addr[vf_num].addr_bytes[2], + config->o_du_addr[vf_num].addr_bytes[3], + config->o_du_addr[vf_num].addr_bytes[4], + config->o_du_addr[vf_num].addr_bytes[5]); + } + } else if (strncmp(key, KEY_RU_MAC, strlen(KEY_RU_MAC)) == 0) { + unsigned int vf_num = 0; + sscanf(key,"ruMac%02u",&vf_num); + if (vf_num >= XRAN_VF_MAX) { + printf("ruMac%d exceeds max antenna supported\n",vf_num); + } else { + printf("ruMac%d: %s\n",vf_num, value); + + sscanf(value, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[0], + (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[1], + (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[2], + (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[3], + (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[4], + (uint8_t*)&config->o_ru_addr[vf_num].addr_bytes[5]); + + printf("[vf %d]RU MAC address: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", + vf_num, + config->o_ru_addr[vf_num].addr_bytes[0], + config->o_ru_addr[vf_num].addr_bytes[1], + config->o_ru_addr[vf_num].addr_bytes[2], + config->o_ru_addr[vf_num].addr_bytes[3], + config->o_ru_addr[vf_num].addr_bytes[4], + config->o_ru_addr[vf_num].addr_bytes[5]); + } + } else if (strcmp(key, KEY_FILE_NUMSLOTS) == 0) { + config->numSlots = atoi(value); + printf("numSlots: %d\n",config->numSlots); + }else if (strncmp(key, KEY_FILE_AxC, strlen(KEY_FILE_AxC)) == 0) { + unsigned int ant_num = 0; + sscanf(key,"antC%02u",&ant_num); + if (ant_num >= MAX_ANT_CARRIER_SUPPORTED) { + printf("antC%d exceeds max antenna supported\n",ant_num); + } else { + strncpy(&config->ant_file[ant_num][0], value, strlen(value)); + printf("antC%d: %s\n",ant_num, config->ant_file[ant_num]); + } + } else if (strncmp(key, KEY_FILE_DLBFWUE, strlen(KEY_FILE_DLBFWUE)) == 0) { + unsigned int ue_num = 0; + sscanf(key,"DlBfwUe%02u",&ue_num); + if (ue_num >= MAX_ANT_CARRIER_SUPPORTED) { + printf("DlBfwUe%d exceeds max streams supported\n",ue_num); + } else { + strncpy(&config->dl_bfw_file[ue_num][0], value, strlen(value)); + printf("DlBfwUe%d: %s\n",ue_num, config->dl_bfw_file[ue_num]); + } + }else if (strncmp(key, KEY_FILE_ULBFWUE, strlen(KEY_FILE_ULBFWUE)) == 0) { + unsigned int ue_num = 0; + sscanf(key,"UlBfwUe%02u",&ue_num); + if (ue_num >= MAX_ANT_CARRIER_SUPPORTED) { + printf("UlBfwUe%d exceeds max streams supported\n",ue_num); + } else { + strncpy(&config->ul_bfw_file[ue_num][0], value, strlen(value)); + printf("UlBfwUe%d: %s\n",ue_num, config->ul_bfw_file[ue_num]); + } + }else if (strncmp(key, KEY_FILE_ULSRS, strlen(KEY_FILE_ULSRS)) == 0) { + unsigned int srs_ant = 0; + sscanf(key,"antSrsC%02u",&srs_ant); + if (srs_ant >= MAX_ANT_CARRIER_SUPPORTED_CAT_B) { + printf("antSrsC%d exceeds max ant elemnets supported [%d]\n", srs_ant, MAX_ANT_CARRIER_SUPPORTED_CAT_B); + } else { + strncpy(&config->ul_srs_file[srs_ant][0], value, strlen(value)); + printf("antSrsC%d: %s\n",srs_ant, config->ul_srs_file[srs_ant]); + } } else if (strcmp(key, KEY_PRACH_ENABLE) == 0) { config->enablePrach = atoi(value); printf("Prach enable: %d\n",config->enablePrach); - } else if (strcmp(key, KEY_PRACH_OFFSET ) == 0) { - config->prachOffset = atoi(value); - printf("Prach Offset: %d\n",config->prachOffset); - } else if (strcmp(key, KEY_PRACH_CFG_IDX ) == 0) { + }else if (strcmp(key, KEY_MAX_FRAME_ID) == 0) { + config->maxFrameId = atoi(value); + printf("maxFrameId: %d\n",config->maxFrameId); + } else if (strcmp(key, KEY_SRS_ENABLE) == 0) { + config->enableSrs = atoi(value); + printf("Srs enable: %d\n",config->enablePrach); + } else if (strcmp(key, KEY_PRACH_CFGIDX) == 0) { config->prachConfigIndex = atoi(value); - printf("Prach Conf Index: %d\n",config->prachConfigIndex); - + printf("Prach config index: %d\n",config->prachConfigIndex); + } else if (strcmp(key, KEY_SRS_SYM_IDX) == 0) { + config->srsSymMask = atoi(value); + printf("Srs symbol [0-13]: %d\n",config->srsSymMask); + } else if (strncmp(key, KEY_FILE_PRACH_AxC, strlen(KEY_FILE_PRACH_AxC)) == 0) { + unsigned int ant_num = 0; + sscanf(key,"antPrachC%02u",&ant_num); + if (ant_num >= MAX_ANT_CARRIER_SUPPORTED) + { + printf("antC%d exceeds max antenna supported\n",ant_num); + } + else{ + strncpy(&config->prach_file[ant_num][0], value, strlen(value)); + printf("antPrachC%d: %s\n",ant_num, config->prach_file[ant_num]); + } + } else if (strcmp(key, KEY_BFW_NUM) == 0) { + config->totalBfWeights = atoi(value); + printf("%s : %d\n",KEY_BFW_NUM, config->totalBfWeights); /* timing */ } else if (strcmp(key, KEY_TADV_CP_DL ) == 0) { config->Tadv_cp_dl = atoi(value); @@ -279,12 +464,85 @@ static int fillConfigStruct(RuntimeConfig *config, const char *key, const char * } else if (strcmp(key, KEY_DEBUG_STOP ) == 0) { config->debugStop = atoi(value); printf("debugStop: %d\n",config->debugStop); + } else if (strcmp(key, KEY_DEBUG_STOP_CNT) == 0) { + config->debugStopCount = atoi(value); + printf("debugStopCount: %d\n",config->debugStopCount); + } else if (strcmp(key, KEY_BBDEV_MODE) == 0) { + config->bbdevMode = atoi(value); + printf("bbdevMode: %d\n",config->debugStopCount); + } else if (strcmp(key, KEY_DYNA_SEC_ENA) == 0) { + config->DynamicSectionEna = atoi(value); + printf("DynamicSectionEna: %d\n",config->DynamicSectionEna); + } else if (strcmp(key, KEY_ALPHA) == 0) { + config->GPS_Alpha = atoi(value); + printf("GPS_Alpha: %d\n",config->GPS_Alpha); + } else if (strcmp(key, KEY_BETA) == 0) { + config->GPS_Beta = atoi(value); + printf("GPS_Beta: %d\n",config->GPS_Beta); } else if (strcmp(key, KEY_CP_VTAG ) == 0) { config->cp_vlan_tag = atoi(value); printf("cp_vlan_tag: %d\n",config->cp_vlan_tag); } else if (strcmp(key, KEY_UP_VTAG ) == 0) { config->up_vlan_tag = atoi(value); printf("up_vlan_tag: %d\n",config->up_vlan_tag); + } else if (strcmp(key, KEY_NPRBELEM_UL ) == 0) { + config->PrbMapUl.nPrbElm = atoi(value); + if (config->PrbMapUl.nPrbElm > XRAN_MAX_PRBS) + { + printf("nTddPeriod is larger than max allowed, invalid!\n"); + config->PrbMapUl.nPrbElm = XRAN_MAX_PRBS; + } + printf("nPrbElemUl: %d\n",config->PrbMapUl.nPrbElm); + } else if (strncmp(key, KEY_PRBELEM_UL, strlen(KEY_PRBELEM_UL)) == 0) { + sscanf(key,"PrbElemUl%u",§ion_idx_ul); + if (section_idx_ul >= config->PrbMapUl.nPrbElm){ + printf("section_idx %d exceeds nPrbElemUl\n",section_idx_ul); + } + else{ + struct xran_prb_elm *pPrbElem = &config->PrbMapUl.prbMap[section_idx_ul]; + sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd", + (int16_t*)&pPrbElem->nRBStart, + (int16_t*)&pPrbElem->nRBSize, + (int16_t*)&pPrbElem->nStartSymb, + (int16_t*)&pPrbElem->numSymb, + (int16_t*)&pPrbElem->nBeamIndex, + (int16_t*)&pPrbElem->bf_weight_update, + (int16_t*)&pPrbElem->compMethod, + (int16_t*)&pPrbElem->iqWidth, + (int16_t*)&pPrbElem->BeamFormingType); + printf("nPrbElemUl%d: ",section_idx_ul); + printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n", + pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType); + } + }else if (strcmp(key, KEY_NPRBELEM_DL ) == 0) { + config->PrbMapDl.nPrbElm = atoi(value); + if (config->PrbMapDl.nPrbElm > XRAN_MAX_PRBS) + { + printf("nTddPeriod is larger than max allowed, invalid!\n"); + config->PrbMapDl.nPrbElm = XRAN_MAX_PRBS; + } + printf("nPrbElemDl: %d\n",config->PrbMapDl.nPrbElm); + } else if (strncmp(key, KEY_PRBELEM_DL, strlen(KEY_PRBELEM_DL)) == 0) { + sscanf(key,"PrbElemDl%u",§ion_idx_dl); + if (section_idx_dl >= config->PrbMapDl.nPrbElm){ + printf("section_idx %d exceeds nPrbElemDl\n",section_idx_dl); + } + else{ + struct xran_prb_elm *pPrbElem = &config->PrbMapDl.prbMap[section_idx_dl]; + sscanf(value, "%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd", + (int16_t*)&pPrbElem->nRBStart, + (int16_t*)&pPrbElem->nRBSize, + (int16_t*)&pPrbElem->nStartSymb, + (int16_t*)&pPrbElem->numSymb, + (int16_t*)&pPrbElem->nBeamIndex, + (int16_t*)&pPrbElem->bf_weight_update, + (int16_t*)&pPrbElem->compMethod, + (int16_t*)&pPrbElem->iqWidth, + (int16_t*)&pPrbElem->BeamFormingType); + printf("nPrbElemDl%d: ",section_idx_dl); + printf("nRBStart %d,nRBSize %d,nStartSymb %d,numSymb %d,nBeamIndex %d, bf_weight_update %d compMethod %d, iqWidth %d BeamFormingType %d\n", + pPrbElem->nRBStart,pPrbElem->nRBSize,pPrbElem->nStartSymb,pPrbElem->numSymb,pPrbElem->nBeamIndex, pPrbElem->bf_weight_update, pPrbElem->compMethod, pPrbElem->iqWidth, pPrbElem->BeamFormingType); + } } else { printf("Unsupported configuration key [%s]\n", key); return -1; @@ -304,11 +562,11 @@ int parseConfigFile(char *filename, RuntimeConfig *config) FILE *file = fopen(filename, "r"); if (NULL == file) { - //log_err("Error while opening config file from: %s", filename); + log_err("Error while opening config file from: %s", filename); return -1; } - init_config(config); +// init_config(config); for (;;) { if (fgets(inputLine, MAX_LINE_SIZE, file) == NULL) { @@ -341,7 +599,7 @@ int parseConfigFile(char *filename, RuntimeConfig *config) key[i] = '\0'; trim(key); if ((i + 1 > inputLen - 1) || (i - 2 > inputLen)) { - //log_err("Parsing config file error at line %d", lineNum); + log_err("Parsing config file error at line %d", lineNum); fclose(file); return -1; }