Commit f1384977 authored by Titouan Soulard's avatar Titouan Soulard

trx-bridge: implement parameters for start function

parent 65b11aac
......@@ -16,11 +16,109 @@ int bridge_trx_output_get_param_double(void *app_opaque, double *pval, const cha
return potoml_toml_get_double((struct PotomlTomlSubset *) app_opaque, prop_name);
}
TRXDriverParams2 *fill_trx_driver_params(struct PotomlTomlSubset *config) {
TRXDriverParams2 *trx_driver_params = malloc(sizeof(TRXDriverParams2));
int rxi, txi, pi, ci;
char param_name[256];
trx_driver_params->rx_channel_count = potoml_toml_get_long(config, "rx_channel_count");
trx_driver_params->tx_channel_count = potoml_toml_get_long(config, "tx_channel_count");
trx_driver_params->rf_port_count = potoml_toml_get_long(config, "rf_port_count");
trx_driver_params->cell_count = potoml_toml_get_long(config, "cell_count");
trx_driver_params->s72_enable = potoml_toml_get_long(config, "s72_enable");
trx_driver_params->rx_freq = malloc(trx_driver_params->rx_channel_count * sizeof(int64_t));
trx_driver_params->rx_gain = malloc(trx_driver_params->rx_channel_count * sizeof(double));
trx_driver_params->rx_bandwidth = malloc(trx_driver_params->rx_channel_count * sizeof(int));
trx_driver_params->rx_port_channel_count = malloc(trx_driver_params->rx_channel_count * sizeof(int));
for(rxi = 0; rxi < trx_driver_params->rx_channel_count; rxi++) {
sprintf(param_name, "rx%d.freq", rxi);
trx_driver_params->rx_freq[rxi] = potoml_toml_get_long(config, param_name);
sprintf(param_name, "rx%d.gain", rxi);
trx_driver_params->rx_gain[rxi] = potoml_toml_get_double(config, param_name);
sprintf(param_name, "rx%d.bandwidth", rxi);
trx_driver_params->rx_bandwidth[rxi] = potoml_toml_get_long(config, param_name);
sprintf(param_name, "rx%d.port_channel_count", rxi);
trx_driver_params->rx_port_channel_count[rxi] = potoml_toml_get_long(config, param_name);
}
trx_driver_params->tx_freq = malloc(trx_driver_params->tx_channel_count * sizeof(int64_t));
trx_driver_params->tx_gain = malloc(trx_driver_params->tx_channel_count * sizeof(double));
trx_driver_params->tx_bandwidth = malloc(trx_driver_params->tx_channel_count * sizeof(int));
trx_driver_params->tx_port_channel_count = malloc(trx_driver_params->tx_channel_count * sizeof(int));
for(txi = 0; txi < trx_driver_params->tx_channel_count; txi++) {
sprintf(param_name, "tx%d.freq", txi);
trx_driver_params->tx_freq[txi] = potoml_toml_get_long(config, param_name);
sprintf(param_name, "tx%d.gain", txi);
trx_driver_params->tx_gain[txi] = potoml_toml_get_double(config, param_name);
sprintf(param_name, "tx%d.bandwidth", txi);
trx_driver_params->tx_bandwidth[txi] = potoml_toml_get_long(config, param_name);
sprintf(param_name, "tx%d.port_channel_count", txi);
trx_driver_params->tx_port_channel_count[txi] = potoml_toml_get_long(config, param_name);
}
trx_driver_params->sample_rate = malloc(trx_driver_params->rf_port_count * sizeof(TRXFraction));
for(pi = 0; pi < trx_driver_params->rf_port_count; pi++) {
sprintf(param_name, "port%d.sample_rate_num", pi);
trx_driver_params->sample_rate[pi].num = potoml_toml_get_long(config, param_name);
sprintf(param_name, "port%d.sample_rate_den", pi);
trx_driver_params->sample_rate[pi].den = potoml_toml_get_long(config, param_name);
}
trx_driver_params->cell_info = malloc(trx_driver_params->cell_count * sizeof(TRXCellInfo));
for(ci = 0; ci < trx_driver_params->cell_count; ci++) {
sprintf(param_name, "cell%d.rf_port_index", ci);
trx_driver_params->cell_info[ci].rf_port_index = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.dl_earfcn", ci);
trx_driver_params->cell_info[ci].dl_earfcn = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.ul_earfcn", ci);
trx_driver_params->cell_info[ci].ul_earfcn = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.n_rb_dl", ci);
trx_driver_params->cell_info[ci].n_rb_dl = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.n_rb_ul", ci);
trx_driver_params->cell_info[ci].n_rb_ul = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.dl_cyclic_prefix", ci);
trx_driver_params->cell_info[ci].dl_cyclic_prefix = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.ul_cyclic_prefix", ci);
trx_driver_params->cell_info[ci].ul_cyclic_prefix = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.type", ci);
trx_driver_params->cell_info[ci].type = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.tdd.uldl_config", ci);
trx_driver_params->cell_info[ci].u.tdd.uldl_config = potoml_toml_get_long(config, param_name);
sprintf(param_name, "cell%d.tdd.special_subframe_config", ci);
trx_driver_params->cell_info[ci].u.tdd.special_subframe_config = potoml_toml_get_long(config, param_name);
}
return trx_driver_params;
}
int main(int argc, char *argv[]) {
struct CommonHashtableTable config;
struct PotomlTomlSubset *bridge_config;
struct PotomlTomlSubset *input_driver_config;
struct PotomlTomlSubset *output_driver_config;
struct PotomlTomlSubset *output_driver_start_config;
int opt;
int result;
......@@ -42,6 +140,7 @@ int main(int argc, char *argv[]) {
TRXState input_trx_state;
TRXState output_trx_state;
TRXDriverParams2 *output_trx_start_params;
// This is used for debugging purposes, and was improvised by nonprofessionals.
// Do not attempt to reproduce it.
......@@ -79,6 +178,7 @@ int main(int argc, char *argv[]) {
bridge_config = potoml_toml_create_subset(&config, "bridge");
input_driver_config = potoml_toml_create_subset(&config, "input-driver");
output_driver_config = potoml_toml_create_subset(&config, "output-driver");
output_driver_start_config = potoml_toml_create_subset(&config, "output-driver-extra");
input_lib_name = potoml_toml_get_string(bridge_config, "input_driver_path");
output_lib_name = potoml_toml_get_string(bridge_config, "output_driver_path");
......@@ -145,6 +245,9 @@ int main(int argc, char *argv[]) {
return -1;
}
// XXX: genericity should also fill this struct for input
output_trx_start_params = fill_trx_driver_params(output_driver_start_config);
dlclose(input_lib_handle);
dlclose(output_lib_handle);
......
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