From e9a17292e8545d5f651e9614c43bc1626e10ac5f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Jan 2016 22:50:06 +0100 Subject: [PATCH] LC15/sysmobts: Don't try to refer to fl1h from PHY config At the time the phy link / phy instance level VTY configuration commands are parsed, we did not yet call l1if_open() and thus pinst->u.{lc15,sysmobts}.hdl == NULL. PHY or PHY instance specific configuration must thus be stored inside the phy_link or phy_instance itself, and not inside the (not yet existing) handle. We solve this by moving around some parameters: * clk_use_eeprom/clk_cal/clk_src/calib_path get replicated in phy_instance * min_qual_{rach,norm} are moved into the generic part (which means that osmo-bts-octphy and osmo-bts-trx should also implement them) --- include/osmo-bts/gsm_data.h | 3 + include/osmo-bts/phy_link.h | 9 +++ src/common/bts.c | 5 ++ src/common/vty.c | 33 ++++++++++ src/osmo-bts-litecell15/calib_file.c | 6 +- src/osmo-bts-litecell15/l1_if.c | 11 +--- src/osmo-bts-litecell15/l1_if.h | 3 - src/osmo-bts-litecell15/lc15bts_vty.c | 44 ++----------- src/osmo-bts-sysmo/calib_file.c | 8 ++- src/osmo-bts-sysmo/l1_if.c | 39 +++++++---- src/osmo-bts-sysmo/l1_if.h | 4 -- src/osmo-bts-sysmo/main.c | 28 -------- src/osmo-bts-sysmo/sysmobts_vty.c | 94 ++++++++------------------- 13 files changed, 121 insertions(+), 166 deletions(-) diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index f9e6ed13f..c4953cbbb 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -104,6 +104,9 @@ struct gsm_bts_role_bts { struct llist_head queue; /* list of struct smscb_msg */ struct smscb_msg *cur_msg; /* current SMS-CB */ } smscb_state; + + float min_qual_rach; /* minimum quality for RACH bursts */ + float min_qual_norm; /* minimum quality for normal daata */ }; enum lchan_ciph_state { diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h index 73d57749c..e31971e69 100644 --- a/include/osmo-bts/phy_link.h +++ b/include/osmo-bts/phy_link.h @@ -82,7 +82,13 @@ struct phy_instance { union { struct { + /* configuration */ + uint8_t clk_use_eeprom; uint32_t dsp_trace_f; + int clk_cal; + uint8_t clk_src; + char *calib_path; + struct femtol1_hdl *hdl; } sysmobts; struct { @@ -93,7 +99,10 @@ struct phy_instance { uint32_t trx_id; } octphy; struct { + /* configuration */ uint32_t dsp_trace_f; + char *calib_path; + struct lc15l1_hdl *hdl; } lc15; } u; diff --git a/src/common/bts.c b/src/common/bts.c index 222a82ce3..20d551dce 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -44,6 +44,9 @@ #include #include +#define MIN_QUAL_RACH 5.0f /* at least 5 dB C/I */ +#define MIN_QUAL_NORM -0.5f /* at least -1 dB C/I */ + static void bts_update_agch_max_queue_length(struct gsm_bts *bts); struct gsm_network bts_gsmnet = { @@ -112,6 +115,8 @@ int bts_init(struct gsm_bts *bts) btsb->max_ta = 63; btsb->ny1 = 4; btsb->t3105_ms = 300; + btsb->min_qual_rach = MIN_QUAL_RACH; + btsb->min_qual_norm = MIN_QUAL_NORM; for (i = 0; i < ARRAY_SIZE(btsb->t200_ms); i++) btsb->t200_ms[i] = oml_default_t200_ms[i]; diff --git a/src/common/vty.c b/src/common/vty.c index 7488fbbaa..627517720 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -270,6 +270,10 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) const char *name = get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH); vty_out(vty, " gsmtap-sapi %s%s", osmo_str_tolower(name), VTY_NEWLINE); } + vty_out(vty, " min-qual-rach %.0f%s", btsb->min_qual_rach * 10.0f, + VTY_NEWLINE); + vty_out(vty, " min-qual-norm %.0f%s", btsb->min_qual_norm * 10.0f, + VTY_NEWLINE); bts_model_config_write_bts(vty, bts); @@ -532,6 +536,33 @@ DEFUN(cfg_bts_ul_power_target, cfg_bts_ul_power_target_cmd, return CMD_SUCCESS; } +DEFUN(cfg_bts_min_qual_rach, cfg_bts_min_qual_rach_cmd, + "min-qual-rach <-100-100>", + "Set the minimum quality level of RACH burst to be accpeted\n" + "C/I level in tenth of dB\n") +{ + struct gsm_bts *bts = vty->index; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + + btsb->min_qual_rach = strtof(argv[0], NULL) / 10.0f; + + return CMD_SUCCESS; +} + +DEFUN(cfg_bts_min_qual_norm, cfg_bts_min_qual_norm_cmd, + "min-qual-norm <-100-100>", + "Set the minimum quality level of normal burst to be accpeted\n" + "C/I level in tenth of dB\n") +{ + struct gsm_bts *bts = vty->index; + struct gsm_bts_role_bts *btsb = bts_role_bts(bts); + + btsb->min_qual_norm = strtof(argv[0], NULL) / 10.0f; + + return CMD_SUCCESS; +} + + #define DB_DBM_STR \ "Unit is dB (decibels)\n" \ "Unit is mdB (milli-decibels, or rather 1/10000 bel)\n" @@ -1001,6 +1032,8 @@ int bts_vty_init(struct gsm_bts *bts, const struct log_info *cat) install_element(BTS_NODE, &cfg_bts_agch_queue_mgmt_default_cmd); install_element(BTS_NODE, &cfg_bts_agch_queue_mgmt_params_cmd); install_element(BTS_NODE, &cfg_bts_ul_power_target_cmd); + install_element(BTS_NODE, &cfg_bts_min_qual_rach_cmd); + install_element(BTS_NODE, &cfg_bts_min_qual_norm_cmd); install_element(BTS_NODE, &cfg_trx_gsmtap_sapi_cmd); install_element(BTS_NODE, &cfg_trx_no_gsmtap_sapi_cmd); diff --git a/src/osmo-bts-litecell15/calib_file.c b/src/osmo-bts-litecell15/calib_file.c index 2a35a05cc..da79df6fc 100644 --- a/src/osmo-bts-litecell15/calib_file.c +++ b/src/osmo-bts-litecell15/calib_file.c @@ -104,6 +104,7 @@ static int calib_file_open(struct lc15l1_hdl *fl1h, const struct calib_file_desc *desc) { struct calib_send_state *st = &fl1h->st; + char *calib_path = fl1h->phy_inst->u.lc15.calib_path; char fname[PATH_MAX]; if (st->fp) { @@ -113,7 +114,7 @@ static int calib_file_open(struct lc15l1_hdl *fl1h, } fname[0] = '\0'; - snprintf(fname, sizeof(fname)-1, "%s/%s", fl1h->calib_path, desc->fname); + snprintf(fname, sizeof(fname)-1, "%s/%s", calib_path, desc->fname); fname[sizeof(fname)-1] = '\0'; st->fp = fopen(fname, "rb"); @@ -241,8 +242,9 @@ int calib_load(struct lc15l1_hdl *fl1h) { int rc; struct calib_send_state *st = &fl1h->st; + char *calib_path = fl1h->phy_inst->u.lc15.calib_path; - if (!fl1h->calib_path) { + if (!calib_path) { LOGP(DL1C, LOGL_ERROR, "Calibration file path not specified\n"); return -1; } diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c index e65f97d42..1e81b74c6 100644 --- a/src/osmo-bts-litecell15/l1_if.c +++ b/src/osmo-bts-litecell15/l1_if.c @@ -69,10 +69,6 @@ extern int pcu_direct; -#define MIN_QUAL_RACH 5.0f /* at least 5 dB C/I */ -#define MIN_QUAL_NORM -0.5f /* at least -1 dB C/I */ - - struct wait_l1_conf { struct llist_head list; /* internal linked list */ struct osmo_timer_list timer; /* timer for L1 timeout */ @@ -833,6 +829,7 @@ static int handle_ph_data_ind(struct lc15l1_hdl *fl1, GsmL1_PhDataInd_t *data_in struct msgb *l1p_msg) { struct gsm_bts_trx *trx = lc15l1_hdl_trx(fl1); + struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts); uint8_t chan_nr, link_id; struct osmo_phsap_prim *l1sap; uint32_t fn; @@ -853,7 +850,7 @@ static int handle_ph_data_ind(struct lc15l1_hdl *fl1, GsmL1_PhDataInd_t *data_in process_meas_res(trx, chan_nr, &data_ind->measParam); - if (data_ind->measParam.fLinkQuality < fl1->min_qual_norm + if (data_ind->measParam.fLinkQuality < btsb->min_qual_norm && data_ind->msgUnitParam.u8Size != 0) { msgb_free(l1p_msg); return 0; @@ -918,7 +915,7 @@ static int handle_ph_ra_ind(struct lc15l1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind, ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh) btsb->load.rach.busy++; - if (ra_ind->measParam.fLinkQuality < fl1->min_qual_rach) { + if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) { msgb_free(l1p_msg); return 0; } @@ -1400,8 +1397,6 @@ struct lc15l1_hdl *l1if_open(struct phy_instance *pinst) fl1h->phy_inst = pinst; fl1h->clk_cal = 0; - fl1h->min_qual_rach = MIN_QUAL_RACH; - fl1h->min_qual_norm = MIN_QUAL_NORM; fl1h->dsp_trace_f = pinst->u.lc15.dsp_trace_f; get_hwinfo(fl1h); diff --git a/src/osmo-bts-litecell15/l1_if.h b/src/osmo-bts-litecell15/l1_if.h index bb56c2b9a..78421a0b2 100644 --- a/src/osmo-bts-litecell15/l1_if.h +++ b/src/osmo-bts-litecell15/l1_if.h @@ -38,9 +38,6 @@ struct lc15l1_hdl { uint32_t hLayer1; /* handle to the L1 instance in the DSP */ uint32_t dsp_trace_f; /* currently operational DSP trace flags */ int clk_cal; - float min_qual_rach; - float min_qual_norm; - char *calib_path; struct llist_head wlc_list; struct phy_instance *phy_inst; diff --git a/src/osmo-bts-litecell15/lc15bts_vty.c b/src/osmo-bts-litecell15/lc15bts_vty.c index 558e7e1c5..2f624c8d3 100644 --- a/src/osmo-bts-litecell15/lc15bts_vty.c +++ b/src/osmo-bts-litecell15/lc15bts_vty.c @@ -94,38 +94,11 @@ DEFUN(cfg_phy_cal_path, cfg_phy_cal_path_cmd, "Set the path name to TRX calibration data\n" "Path name\n") { struct phy_instance *pinst = vty->index; - struct lc15l1_hdl *fl1h = pinst->u.lc15.hdl; - if (fl1h->calib_path) - talloc_free(fl1h->calib_path); + if (pinst->u.lc15.calib_path) + talloc_free(pinst->u.lc15.calib_path); - fl1h->calib_path = talloc_strdup(fl1h, argv[0]); - - return CMD_SUCCESS; -} - -DEFUN(cfg_phy_min_qual_rach, cfg_phy_min_qual_rach_cmd, - "min-qual-rach <-100-100>", - "Set the minimum quality level of RACH burst to be accpeted\n" - "C/I level in tenth of dB\n") -{ - struct phy_instance *pinst = vty->index; - struct lc15l1_hdl *fl1h = pinst->u.lc15.hdl; - - fl1h->min_qual_rach = strtof(argv[0], NULL) / 10.0f; - - return CMD_SUCCESS; -} - -DEFUN(cfg_phy_min_qual_norm, cfg_phy_min_qual_norm_cmd, - "min-qual-norm <-100-100>", - "Set the minimum quality level of normal burst to be accpeted\n" - "C/I level in tenth of dB\n") -{ - struct phy_instance *pinst = vty->index; - struct lc15l1_hdl *fl1h = pinst->u.lc15.hdl; - - fl1h->min_qual_norm = strtof(argv[0], NULL) / 10.0f; + pinst->u.lc15.calib_path = talloc_strdup(pinst, argv[0]); return CMD_SUCCESS; } @@ -362,7 +335,6 @@ void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx) static void write_phy_inst(struct vty *vty, struct phy_instance *pinst) { - struct lc15l1_hdl *fl1h = pinst->u.lc15.hdl; int i; for (i = 0; i < 32; i++) { @@ -373,13 +345,9 @@ static void write_phy_inst(struct vty *vty, struct phy_instance *pinst) VTY_NEWLINE); } } - if (fl1h->calib_path) + if (pinst->u.lc15.calib_path) vty_out(vty, " trx-calibration-path %s%s", - fl1h->calib_path, VTY_NEWLINE); - vty_out(vty, " min-qual-rach %.0f%s", fl1h->min_qual_rach * 10.0f, - VTY_NEWLINE); - vty_out(vty, " min-qual-norm %.0f%s", fl1h->min_qual_norm * 10.0f, - VTY_NEWLINE); + pinst->u.lc15.calib_path, VTY_NEWLINE); } void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink) @@ -444,8 +412,6 @@ int bts_model_vty_init(struct gsm_bts *bts) install_element(PHY_INST_NODE, &cfg_phy_dsp_trace_f_cmd); install_element(PHY_INST_NODE, &cfg_phy_no_dsp_trace_f_cmd); install_element(PHY_INST_NODE, &cfg_phy_cal_path_cmd); - install_element(PHY_INST_NODE, &cfg_phy_min_qual_rach_cmd); - install_element(PHY_INST_NODE, &cfg_phy_min_qual_norm_cmd); return 0; } diff --git a/src/osmo-bts-sysmo/calib_file.c b/src/osmo-bts-sysmo/calib_file.c index 884643f7e..8cb09d93f 100644 --- a/src/osmo-bts-sysmo/calib_file.c +++ b/src/osmo-bts-sysmo/calib_file.c @@ -390,12 +390,13 @@ static int calib_file_send(struct femtol1_hdl *fl1h, { struct calib_send_state *st = &fl1h->st; struct msgb *msg; + char *calib_path = fl1h->phy_inst->u.sysmobts.calib_path; int rc; msg = sysp_msgb_alloc(); - if (fl1h->calib_path) - rc = calib_file_read(fl1h->calib_path, desc, msgb_sysprim(msg)); + if (calib_path) + rc = calib_file_read(calib_path, desc, msgb_sysprim(msg)); else rc = calib_eeprom_read(desc, msgb_sysprim(msg)); if (rc < 0) { @@ -422,10 +423,11 @@ static int calib_send_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg, { struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx); struct calib_send_state *st = &fl1h->st; + char *calib_path = fl1h->phy_inst->u.sysmobts.calib_path; LOGP(DL1C, LOGL_NOTICE, "L1 calibration table %s loaded (src: %s)\n", calib_files[st->last_file_idx].fname, - fl1h->calib_path ? "file" : "eeprom"); + calib_path ? "file" : "eeprom"); msgb_free(l1_msg); diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 55453ef6c..aa34ea1f0 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -65,10 +65,6 @@ extern int pcu_direct; -#define MIN_QUAL_RACH 5.0f /* at least 5 dB C/I */ -#define MIN_QUAL_NORM -0.5f /* at least -1 dB C/I */ - - struct wait_l1_conf { struct llist_head list; /* internal linked list */ struct osmo_timer_list timer; /* timer for L1 timeout */ @@ -791,6 +787,7 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i struct msgb *l1p_msg) { struct gsm_bts_trx *trx = femtol1_hdl_trx(fl1); + struct gsm_bts_role_bts *btsb = bts_role_bts(trx->bts); uint8_t chan_nr, link_id; struct msgb *sap_msg; struct osmo_phsap_prim *l1sap; @@ -810,7 +807,7 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i process_meas_res(trx, chan_nr, &data_ind->measParam); - if (data_ind->measParam.fLinkQuality < fl1->min_qual_norm + if (data_ind->measParam.fLinkQuality < btsb->min_qual_norm && data_ind->msgUnitParam.u8Size != 0) { msgb_free(l1p_msg); return 0; @@ -870,7 +867,7 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind, ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh) btsb->load.rach.busy++; - if (ra_ind->measParam.fLinkQuality < fl1->min_qual_rach) { + if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) { msgb_free(l1p_msg); return 0; } @@ -1436,6 +1433,27 @@ static int get_hwinfo_eeprom(struct femtol1_hdl *fl1h) return 0; } +/* Set the clock calibration to the value read from the eeprom. */ +static void clk_cal_use_eeprom(struct femtol1_hdl *hdl) +{ + struct phy_instance *pinst = hdl->phy_inst; + eeprom_RfClockCal_t rf_clk; + int rc; + + if (!pinst->u.sysmobts.clk_use_eeprom) + return; + + rc = eeprom_ReadRfClockCal(&rf_clk); + if (rc != EEPROM_SUCCESS) { + LOGP(DL1C, LOGL_ERROR, "Failed to read from EEPROM.\n"); + return; + } + + hdl->clk_cal = rf_clk.iClkCor; + LOGP(DL1C, LOGL_NOTICE, + "Read clock calibration(%d) from EEPROM.\n", hdl->clk_cal); +} + struct femtol1_hdl *l1if_open(struct phy_instance *pinst) { struct femtol1_hdl *fl1h; @@ -1459,11 +1477,10 @@ struct femtol1_hdl *l1if_open(struct phy_instance *pinst) INIT_LLIST_HEAD(&fl1h->wlc_list); fl1h->phy_inst = pinst; - fl1h->clk_cal = 0; - fl1h->clk_use_eeprom = 1; - fl1h->min_qual_rach = MIN_QUAL_RACH; - fl1h->min_qual_norm = MIN_QUAL_NORM; fl1h->dsp_trace_f = pinst->u.sysmobts.dsp_trace_f; + fl1h->clk_src = pinst->u.sysmobts.clk_src; + fl1h->clk_cal = pinst->u.sysmobts.clk_cal; + clk_cal_use_eeprom(fl1h); get_hwinfo_eeprom(fl1h); #if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(2,1,0) if (fl1h->hw_info.model_nr == 2050) { @@ -1577,7 +1594,7 @@ static int clock_correct_info_cb(struct gsm_bts_trx *trx, struct msgb *resp, } fl1h->clk_cal = sysp->u.rfClockInfoCnf.rfTrxClkCal.iClkErr; - fl1h->clk_use_eeprom = 0; + fl1h->phy_inst->u.sysmobts.clk_use_eeprom = 0; msgb_free(resp); /* diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h index f69ee9cc0..bb1d5a520 100644 --- a/src/osmo-bts-sysmo/l1_if.h +++ b/src/osmo-bts-sysmo/l1_if.h @@ -46,12 +46,8 @@ struct femtol1_hdl { struct gsm_time gsm_time; uint32_t hLayer1; /* handle to the L1 instance in the DSP */ uint32_t dsp_trace_f; /* currently operational DSP trace flags */ - uint8_t clk_use_eeprom; int clk_cal; uint8_t clk_src; - float min_qual_rach; - float min_qual_norm; - char *calib_path; struct llist_head wlc_list; struct phy_instance *phy_inst; /* Reference to PHY instance */ diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c index 68143bb46..e54ba468e 100644 --- a/src/osmo-bts-sysmo/main.c +++ b/src/osmo-bts-sysmo/main.c @@ -56,32 +56,6 @@ extern int pcu_direct; -/* Set the clock calibration to the value - * read from the eeprom. - */ -void clk_cal_use_eeprom(struct gsm_bts *bts) -{ - int rc; - struct femtol1_hdl *hdl; - eeprom_RfClockCal_t rf_clk; - - hdl = bts->c0->role_bts.l1h; - - if (!hdl || !hdl->clk_use_eeprom) - return; - - rc = eeprom_ReadRfClockCal(&rf_clk); - if (rc != EEPROM_SUCCESS) { - LOGP(DL1C, LOGL_ERROR, "Failed to read from EEPROM.\n"); - return; - } - - hdl->clk_cal = rf_clk.iClkCor; - LOGP(DL1C, LOGL_NOTICE, - "Read clock calibration(%d) from EEPROM.\n", hdl->clk_cal); -} - - int bts_model_init(struct gsm_bts *bts) { struct gsm_bts_role_bts *btsb; @@ -99,8 +73,6 @@ int bts_model_init(struct gsm_bts *bts) exit(1); } - clk_cal_use_eeprom(bts); - if (stat(SYSMOBTS_RF_LOCK_PATH, &st) == 0) { LOGP(DL1C, LOGL_NOTICE, "Not starting BTS due to RF_LOCK file present\n"); exit(23); diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c index d620b4a1c..11e3e8faf 100644 --- a/src/osmo-bts-sysmo/sysmobts_vty.c +++ b/src/osmo-bts-sysmo/sysmobts_vty.c @@ -90,9 +90,8 @@ DEFUN(cfg_phy_clkcal_eeprom, cfg_phy_clkcal_eeprom_cmd, "Use the eeprom clock calibration value\n") { struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; - fl1h->clk_use_eeprom = 1; + pinst->u.sysmobts.clk_use_eeprom = 1; return CMD_SUCCESS; } @@ -102,10 +101,9 @@ DEFUN(cfg_phy_clkcal_def, cfg_phy_clkcal_def_cmd, "Set the clock calibration value\n" "Default Clock DAC value\n") { struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; - fl1h->clk_use_eeprom = 0; - fl1h->clk_cal = 0xffff; + pinst->u.sysmobts.clk_use_eeprom = 0; + pinst->u.sysmobts.clk_cal = 0xffff; return CMD_SUCCESS; } @@ -117,10 +115,9 @@ DEFUN(cfg_phy_clkcal, cfg_phy_clkcal_cmd, { unsigned int clkcal = atoi(argv[0]); struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; - fl1h->clk_use_eeprom = 0; - fl1h->clk_cal = clkcal & 0xfff; + pinst->u.sysmobts.clk_use_eeprom = 0; + pinst->u.sysmobts.clk_cal = clkcal & 0xfff; return CMD_SUCCESS; } @@ -131,10 +128,9 @@ DEFUN(cfg_phy_clkcal, cfg_phy_clkcal_cmd, { int clkcal = atoi(argv[0]); struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; - fl1h->clk_use_eeprom = 0; - fl1h->clk_cal = clkcal; + pinst->u.sysmobts.clk_use_eeprom = 0; + pinst->u.sysmobts.clk_cal = clkcal; return CMD_SUCCESS; } @@ -149,14 +145,13 @@ DEFUN(cfg_phy_clksrc, cfg_phy_clksrc_cmd, "Use the GPS pps\n") { struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; int rc; rc = get_string_value(femtobts_clksrc_names, argv[0]); if (rc < 0) return CMD_WARNING; - fl1h->clk_src = rc; + pinst->u.sysmobts.clk_src = rc; return CMD_SUCCESS; } @@ -166,12 +161,11 @@ DEFUN(cfg_phy_cal_path, cfg_phy_cal_path_cmd, "Set the path name to TRX calibration data\n" "Path name\n") { struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; - if (fl1h->calib_path) - talloc_free(fl1h->calib_path); + if (pinst->u.sysmobts.calib_path) + talloc_free(pinst->u.sysmobts.calib_path); - fl1h->calib_path = talloc_strdup(fl1h, argv[0]); + pinst->u.sysmobts.calib_path = talloc_strdup(pinst, argv[0]); return CMD_SUCCESS; } @@ -189,32 +183,6 @@ DEFUN_DEPRECATED(cfg_trx_ul_power_target, cfg_trx_ul_power_target_cmd, return CMD_SUCCESS; } -DEFUN(cfg_phy_min_qual_rach, cfg_phy_min_qual_rach_cmd, - "min-qual-rach <-100-100>", - "Set the minimum quality level of RACH burst to be accpeted\n" - "C/I level in tenth of dB\n") -{ - struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; - - fl1h->min_qual_rach = strtof(argv[0], NULL) / 10.0f; - - return CMD_SUCCESS; -} - -DEFUN(cfg_phy_min_qual_norm, cfg_phy_min_qual_norm_cmd, - "min-qual-norm <-100-100>", - "Set the minimum quality level of normal burst to be accpeted\n" - "C/I level in tenth of dB\n") -{ - struct phy_instance *pinst = vty->index; - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; - - fl1h->min_qual_norm = strtof(argv[0], NULL) / 10.0f; - - return CMD_SUCCESS; -} - DEFUN(cfg_trx_nominal_power, cfg_trx_nominal_power_cmd, "nominal-tx-power <0-100>", "Set the nominal transmit output power in dBm\n" @@ -253,22 +221,19 @@ DEFUN(cfg_phy_no_dsp_trace_f, cfg_phy_no_dsp_trace_f_cmd, /* runtime */ -DEFUN(show_trx_clksrc, show_trx_clksrc_cmd, - "show trx <0-0> clock-source", +DEFUN(show_phy_clksrc, show_trx_clksrc_cmd, + "show phy <0-255> clock-source", SHOW_TRX_STR "Display the clock source for this TRX") { - int trx_nr = atoi(argv[0]); - struct gsm_bts_trx *trx = gsm_bts_trx_num(vty_bts, trx_nr); - struct femtol1_hdl *fl1h; + int phy_nr = atoi(argv[0]); + struct phy_instance *pinst = vty_get_phy_instance(vty, phy_nr, 0); - if (!trx) + if (!pinst) return CMD_WARNING; - fl1h = trx_femtol1_hdl(trx); - - vty_out(vty, "TRX Clock Source: %s%s", - get_value_string(femtobts_clksrc_names, fl1h->clk_src), - VTY_NEWLINE); + vty_out(vty, "PHY Clock Source: %s%s", + get_value_string(femtobts_clksrc_names, + pinst->u.sysmobts.clk_src), VTY_NEWLINE); return CMD_SUCCESS; } @@ -507,7 +472,6 @@ void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx) static void write_phy_inst(struct vty *vty, struct phy_instance *pinst) { - struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; int i; for (i = 0; i < 32; i++) { @@ -519,21 +483,17 @@ static void write_phy_inst(struct vty *vty, struct phy_instance *pinst) } } - if (fl1h->clk_use_eeprom) + if (pinst->u.sysmobts.clk_use_eeprom) vty_out(vty, " clock-calibration eeprom%s", VTY_NEWLINE); else - vty_out(vty, " clock-calibration %d%s", fl1h->clk_cal, - VTY_NEWLINE); - if (fl1h->calib_path) + vty_out(vty, " clock-calibration %d%s", + pinst->u.sysmobts.clk_cal, VTY_NEWLINE); + if (pinst->u.sysmobts.calib_path) vty_out(vty, " trx-calibration-path %s%s", - fl1h->calib_path, VTY_NEWLINE); + pinst->u.sysmobts.calib_path, VTY_NEWLINE); vty_out(vty, " clock-source %s%s", - get_value_string(femtobts_clksrc_names, fl1h->clk_src), - VTY_NEWLINE); - vty_out(vty, " min-qual-rach %.0f%s", fl1h->min_qual_rach * 10.0f, - VTY_NEWLINE); - vty_out(vty, " min-qual-norm %.0f%s", fl1h->min_qual_norm * 10.0f, - VTY_NEWLINE); + get_value_string(femtobts_clksrc_names, + pinst->u.sysmobts.clk_src), VTY_NEWLINE); } void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink) @@ -590,8 +550,6 @@ int bts_model_vty_init(struct gsm_bts *bts) install_element(PHY_INST_NODE, &cfg_phy_clkcal_def_cmd); install_element(PHY_INST_NODE, &cfg_phy_clksrc_cmd); install_element(PHY_INST_NODE, &cfg_phy_cal_path_cmd); - install_element(PHY_INST_NODE, &cfg_phy_min_qual_rach_cmd); - install_element(PHY_INST_NODE, &cfg_phy_min_qual_norm_cmd); return 0; }