+static int
+fillSlotStructAsCb(void* cbParam, const char *key, const char *value)
+{
+ struct slot_cfg_to_pars *p_slot_cfg = (struct slot_cfg_to_pars*) cbParam;
+ RuntimeConfig *config = p_slot_cfg->config;
+ int32_t direction = p_slot_cfg->direction;
+ int32_t slot_idx = p_slot_cfg->slot_idx;
+ uint32_t section_idx = 0;
+
+ //printf("Dir %d slot %d\n", direction, slot_idx);
+
+ if (strcmp(key, KEY_NPRBELEM_UL ) == 0) {
+ config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = atoi(value);
+ if (config->p_SlotPrbMap[direction][slot_idx]->nPrbElm > XRAN_MAX_SECTIONS_PER_SLOT)
+ {
+ printf("nTddPeriod is larger than max allowed, invalid!\n");
+ config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = XRAN_MAX_SECTIONS_PER_SLOT;
+ }
+ printf("nPrbElemUl: %d\n",config->p_SlotPrbMap[direction][slot_idx]->nPrbElm );
+ } else if (strncmp(key, KEY_PRBELEM_UL_ANT_M, strlen(KEY_PRBELEM_UL_ANT_M)) == 0) {
+ sscanf(key,"PrbElemUlAntCMask%u",§ion_idx);
+ if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
+ printf("section_idx %d exceeds nPrbElemul\n",section_idx);
+ }
+ else{
+ sscanf(value, "%lx",(uint64_t*)&config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
+ printf("%s%u 0x%lx\n",KEY_PRBELEM_UL_ANT_M, section_idx, config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
+ }
+ } else if (strncmp(key, KEY_PRBELEM_UL_CC_M, strlen(KEY_PRBELEM_UL_CC_M)) == 0) {
+ sscanf(key,"PrbElemUlCCMask%u",§ion_idx);
+ if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
+ printf("section_idx %d exceeds nPrbElemUL\n",section_idx);
+ }
+ else{
+ sscanf(value, "%02hx",(uint16_t*)&config->SlotPrbCCmask[direction][slot_idx][section_idx]);
+ printf("%s%u 0x%02x\n",KEY_PRBELEM_UL_CC_M, section_idx, config->SlotPrbCCmask[direction][slot_idx][section_idx]);
+ }
+ } else if (strncmp(key, KEY_PRBELEM_UL, strlen(KEY_PRBELEM_UL)) == 0) {
+ sscanf(key,"PrbElemUl%u",§ion_idx);
+ if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm) {
+ printf("section_idx %d exceeds nPrbElemUl\n",section_idx);
+ }
+ else {
+ struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
+ 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);
+ 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(strncmp(key, KEY_EXTBFW_UL, strlen(KEY_EXTBFW_UL)) == 0) {
+ sscanf(key, "ExtBfwUl%u", §ion_idx);
+ if(section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm) {
+ printf("section_idx %d of bfw exceeds nPrbElemUl\n",section_idx);
+ }else{
+ struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
+ sscanf(value, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",
+ (uint8_t*)&pPrbElem->bf_weight.numBundPrb,
+ (uint8_t*)&pPrbElem->bf_weight.numSetBFWs,
+ (uint8_t*)&pPrbElem->bf_weight.RAD,
+ (uint8_t*)&pPrbElem->bf_weight.disableBFWs,
+ (uint8_t*)&pPrbElem->bf_weight.bfwIqWidth,
+ (uint8_t*)&pPrbElem->bf_weight.bfwCompMeth);
+ printf(KEY_EXTBFW_UL"%d: ", section_idx);
+ printf("numBundPrb %d, numSetBFW %d, RAD %d, disableBFW %d, bfwIqWidth %d, bfwCompMeth %d\n",
+ pPrbElem->bf_weight.numBundPrb, pPrbElem->bf_weight.numSetBFWs, pPrbElem->bf_weight.RAD, pPrbElem->bf_weight.disableBFWs, pPrbElem->bf_weight.bfwIqWidth, pPrbElem->bf_weight.bfwCompMeth);
+ }
+ }else if (strcmp(key, KEY_NPRBELEM_DL ) == 0) {
+ config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = atoi(value);
+ if (config->p_SlotPrbMap[direction][slot_idx]->nPrbElm > XRAN_MAX_SECTIONS_PER_SLOT)
+ {
+ printf("nTddPeriod is larger than max allowed, invalid!\n");
+ config->p_SlotPrbMap[direction][slot_idx]->nPrbElm = XRAN_MAX_SECTIONS_PER_SLOT;
+ }
+ printf("nPrbElemDl: %d\n",config->p_SlotPrbMap[direction][slot_idx]->nPrbElm);
+ } else if (strncmp(key, KEY_PRBELEM_DL_ANT_M, strlen(KEY_PRBELEM_DL_ANT_M)) == 0) {
+ sscanf(key,"PrbElemDlAntCMask%u",§ion_idx);
+ if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
+ printf("section_idx %d exceeds nPrbElemDl\n",section_idx);
+ }
+ else{
+ sscanf(value, "%lx",(uint64_t*)&config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
+ printf("%s%u 0x%lx\n",KEY_PRBELEM_DL_ANT_M, section_idx, config->SlotPrbAntCMask[direction][slot_idx][section_idx]);
+ }
+ } else if (strncmp(key, KEY_PRBELEM_DL_CC_M, strlen(KEY_PRBELEM_DL_CC_M)) == 0) {
+ sscanf(key,"PrbElemDlCCMask%u",§ion_idx);
+ if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
+ printf("section_idx %d exceeds nPrbElemDl\n",section_idx);
+ }
+ else{
+ sscanf(value, "%02hx",(uint16_t*)&config->SlotPrbCCmask[direction][slot_idx][section_idx]);
+ printf("%s%u 0x%02x\n",KEY_PRBELEM_DL_CC_M, section_idx, config->SlotPrbCCmask[direction][slot_idx][section_idx]);
+ }
+ } else if (strncmp(key, KEY_PRBELEM_DL, strlen(KEY_PRBELEM_DL)) == 0) {
+ sscanf(key,"PrbElemDl%u",§ion_idx);
+ if (section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm){
+ printf("section_idx %d exceeds nPrbElemDl\n",section_idx);
+ }
+ else{
+ struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
+ 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);
+ 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(strncmp(key, KEY_EXTBFW_DL, strlen(KEY_EXTBFW_DL)) == 0) {
+ sscanf(key, "ExtBfwDl%u", §ion_idx);
+ if(section_idx >= config->p_SlotPrbMap[direction][slot_idx]->nPrbElm) {
+ printf("section_idx %d of bfw exceeds nPrbElemUl\n",section_idx);
+ }
+ else{
+ struct xran_prb_elm *pPrbElem = &config->p_SlotPrbMap[direction][slot_idx]->prbMap[section_idx];
+ sscanf(value, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu",
+ (uint8_t*)&pPrbElem->bf_weight.numBundPrb,
+ (uint8_t*)&pPrbElem->bf_weight.numSetBFWs,
+ (uint8_t*)&pPrbElem->bf_weight.RAD,
+ (uint8_t*)&pPrbElem->bf_weight.disableBFWs,
+ (uint8_t*)&pPrbElem->bf_weight.bfwIqWidth,
+ (uint8_t*)&pPrbElem->bf_weight.bfwCompMeth);
+ printf(KEY_EXTBFW_DL"%d: ",section_idx);
+ printf("numBundPrb %d, numSetBFW %d, RAD %d, disableBFW %d, bfwIqWidth %d, bfwCompMeth %d\n",
+ pPrbElem->bf_weight.numBundPrb, pPrbElem->bf_weight.numSetBFWs, pPrbElem->bf_weight.RAD, pPrbElem->bf_weight.disableBFWs, pPrbElem->bf_weight.bfwIqWidth, pPrbElem->bf_weight.bfwCompMeth);
+ }
+ } else {
+ printf("Unsupported configuration key [%s]\n", key);
+ return -1;
+ }
+
+ return 0;
+}
+
+struct xran_prb_map*
+config_malloc_prb_map(void)
+{
+ uint32_t size = sizeof(struct xran_prb_map) + (XRAN_MAX_SECTIONS_PER_SLOT -1) * sizeof(struct xran_prb_elm);
+ void *ret = NULL;
+
+ ret = malloc(size);
+
+ if(ret) {
+ memset(ret, 0, size);
+ return (struct xran_prb_map*)ret;
+ } else {
+ rte_panic("xran_prb_map alloc failed");
+ }
+}
+
+int32_t
+config_init(RuntimeConfig *p_o_xu_cfg)
+{
+ int32_t i, j, k, z;
+ memset(p_o_xu_cfg, 0, sizeof(RuntimeConfig));
+
+ p_o_xu_cfg->p_PrbMapDl = config_malloc_prb_map();
+ p_o_xu_cfg->p_PrbMapUl = config_malloc_prb_map();
+ p_o_xu_cfg->p_PrbMapSrs = config_malloc_prb_map();
+
+ for (i= 0; i < XRAN_DIR_MAX; i++){
+ for (j= 0; j < XRAN_N_FE_BUF_LEN; j++){
+ p_o_xu_cfg->p_SlotPrbMap[i][j] = config_malloc_prb_map();
+ }
+ }
+
+ for (i = 0; i < XRAN_DIR_MAX; i++) {
+ for (j = 0; j < XRAN_N_FE_BUF_LEN; j++) {
+ for (k = 0; k < XRAN_MAX_SECTOR_NR; k++) {
+ for (z = 0; z < XRAN_MAX_ANTENNA_NR; z++) {
+ p_o_xu_cfg->p_RunSlotPrbMap[i][j][k][z] = config_malloc_prb_map();
+ p_o_xu_cfg->p_RunSrsSlotPrbMap[i][j][k][z] = config_malloc_prb_map();
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+int
+parseConfigFile(char *filename, RuntimeConfig *config)