Commit 2623e3f2 authored by Robert Schmidt's avatar Robert Schmidt

Improve interface of FlexRAN RAN API: Return protobuf types

The functions of the RAN API should not return the types of OAI, but protobuf
types. Previously, they would return OAI types and the calling code "marshals"
this into Protobuf type. This commit changes the following functions and
modifies the calling code to directly store the protobuf type:
* flexran_get_hopping_mode()
* flexran_get_phich_resource()
* flexran_get_phich_duration()
* flexran_get_ul_cyclic_prefix_length()
* flexran_get_dl_cyclic_prefix_length()
* flexran_get_duplex_mode() usage
* flexran_get_enable64QAM()
parent 9a2aab34
......@@ -840,33 +840,18 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(mod_id,i);
cell_conf[i]->has_pusch_hopping_offset = 1;
if (flexran_get_hopping_mode(mod_id,i) == 0) {
cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER;
} else if(flexran_get_hopping_mode(mod_id,i) == 1) {
cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA;
}
cell_conf[i]->hopping_mode = flexran_get_hopping_mode(mod_id,i);
cell_conf[i]->has_hopping_mode = 1;
cell_conf[i]->n_sb = flexran_get_n_SB(mod_id,i);
cell_conf[i]->has_n_sb = 1;
if (flexran_get_phich_resource(mod_id,i) == 0) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0
} else if (flexran_get_phich_resource(mod_id,i) == 1) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1
} else if (flexran_get_phich_resource(mod_id,i) == 2) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2
} else if (flexran_get_phich_resource(mod_id,i) == 3) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3
}
cell_conf[i]->phich_resource = flexran_get_phich_resource(mod_id,i);
cell_conf[i]->has_phich_resource = 1;
if (flexran_get_phich_duration(mod_id,i) == 0) {
cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL;
} else if(flexran_get_phich_duration(mod_id,i) == 1) {
cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED;
}
cell_conf[i]->phich_duration = flexran_get_phich_duration(mod_id,i);
cell_conf[i]->has_phich_duration = 1;
cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(mod_id,i);
cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1;
Protocol__FlexSiConfig *si_config;
......@@ -914,29 +899,18 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(mod_id,i);
cell_conf[i]->has_ul_bandwidth = 1;
if (flexran_get_ul_cyclic_prefix_length(mod_id, i) == 0) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL;
} else if(flexran_get_ul_cyclic_prefix_length(mod_id, i) == 1) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED;
}
cell_conf[i]->ul_cyclic_prefix_length = flexran_get_ul_cyclic_prefix_length(mod_id, i);
cell_conf[i]->has_ul_cyclic_prefix_length = 1;
if (flexran_get_ul_cyclic_prefix_length(mod_id,i) == 0) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL;
} else if (flexran_get_ul_cyclic_prefix_length(mod_id,i) == 1) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED;
}
cell_conf[i]->dl_cyclic_prefix_length = flexran_get_dl_cyclic_prefix_length(mod_id,i);
cell_conf[i]->has_dl_cyclic_prefix_length = 1;
cell_conf[i]->antenna_ports_count = flexran_get_antenna_ports(mod_id, i);
cell_conf[i]->has_antenna_ports_count = 1;
if (flexran_get_duplex_mode(mod_id,i) == 1) {
cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD;
} else if(flexran_get_duplex_mode(mod_id,i) == 0) {
cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD;
}
cell_conf[i]->duplex_mode = flexran_get_duplex_mode(mod_id,i);
cell_conf[i]->has_duplex_mode = 1;
cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(mod_id, i);
cell_conf[i]->has_subframe_assignment = 1;
cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(mod_id,i);
......@@ -1022,11 +996,7 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
cell_conf[i]->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (mod_id,i);
cell_conf[i]->has_ul_pusch_power = 1;
if (flexran_get_enable64QAM(mod_id,i) == 0) {
cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM;
} else if(flexran_get_enable64QAM(mod_id,i) == 1) {
cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM;
}
cell_conf[i]->enable_64qam = flexran_get_enable64QAM(mod_id,i);
cell_conf[i]->has_enable_64qam = 1;
cell_conf[i]->carrier_index = i;
......
......@@ -508,10 +508,16 @@ uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id)
return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.pusch_HoppingOffset;
}
PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id)
{
if (!phy_is_present(mod_id, cc_id)) return 0;
return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.hoppingMode;
Protocol__FlexHoppingMode flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id)
{
if (!phy_is_present(mod_id, cc_id)) return -1;
switch (RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.hoppingMode) {
case interSubFrame:
return PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER;
case intraAndInterSubFrame:
return PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA;
}
return -1;
}
uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id)
......@@ -520,33 +526,41 @@ uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id)
return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.n_SB;
}
uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id)
Protocol__FlexQam flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id)
{
if (!phy_is_present(mod_id, cc_id)) return 0;
return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.enable64QAM;
if (RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.enable64QAM == TRUE)
return PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM;
else
return PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM;
}
PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id)
Protocol__FlexPhichDuration flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id)
{
if (!phy_is_present(mod_id, cc_id)) return 0;
return RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_duration;
if (!phy_is_present(mod_id, cc_id)) return -1;
switch (RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_duration) {
case normal:
return PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL;
case extended:
return PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED;
}
return -1;
}
int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id)
Protocol__FlexPhichResource flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id)
{
if (!phy_is_present(mod_id, cc_id)) return 0;
if (!phy_is_present(mod_id, cc_id)) return -1;
switch (RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_resource) {
case oneSixth:
return 0;
return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH;
case half:
return 1;
return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF;
case one:
return 2;
return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE;
case two:
return 3;
default:
return -1;
return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;
}
return -1;
}
uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id)
......@@ -585,16 +599,28 @@ uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id)
return RC.eNB[mod_id][cc_id]->frame_parms.maxHARQ_Msg3Tx;
}
lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id)
Protocol__FlexUlCyclicPrefixLength flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id)
{
if (!phy_is_present(mod_id, cc_id)) return 0;
return RC.eNB[mod_id][cc_id]->frame_parms.Ncp_UL;
if (!phy_is_present(mod_id, cc_id)) return -1;
switch (RC.eNB[mod_id][cc_id]->frame_parms.Ncp_UL) {
case EXTENDED:
return PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED;
case NORMAL:
return PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL;
}
return -1;
}
lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id)
Protocol__FlexDlCyclicPrefixLength flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id)
{
if (!phy_is_present(mod_id, cc_id)) return 0;
return RC.eNB[mod_id][cc_id]->frame_parms.Ncp;
if (!phy_is_present(mod_id, cc_id)) return -1;
switch (RC.eNB[mod_id][cc_id]->frame_parms.Ncp) {
case EXTENDED:
return PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED;
case NORMAL:
return PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL;
}
return -1;
}
uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id)
......
......@@ -206,10 +206,10 @@ uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id);
/* Get the length of the UL cyclic prefix */
lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
Protocol__FlexUlCyclicPrefixLength flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
/* Get the length of the DL cyclic prefix */
lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
Protocol__FlexDlCyclicPrefixLength flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
/* Get the physical cell id of a cell */
uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id);
......@@ -283,17 +283,17 @@ int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id);
PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id);
Protocol__FlexHoppingMode flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id);
int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id);
Protocol__FlexPhichResource flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id);
Protocol__FlexQam flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id);
PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id);
Protocol__FlexPhichDuration flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id);
/*
* ************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment