From 71d98050f38840f61d37ddb5f7e4efd5d5f0bab4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 26 Mar 2014 17:49:06 +0100 Subject: sysmobts: Honor power reduction on older sysmoBTSv2 hardware Older hardware didn't have the external attentuator that was used to control the wanted output power. So starting from the git commit 3c8ff3c70bc52d0a1d75a1e6b87b0069d92f10f9 older hardware was always transmitting with 23 dBm regardless of the power reduction. Remember the hardware revision returned by the SystemInformation primitive, postpone the call to l1if_activate_rf until we know the board revision. Manually verified on BTS #1 and #57. On BTS#1 the external attenuator has not been configured and on BTS#57 it was. --- src/osmo-bts-sysmo/l1_if.c | 30 +++++++++++++++++++++++------- src/osmo-bts-sysmo/l1_if.h | 2 ++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 67801935..e9f33b65 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -1094,6 +1094,16 @@ static int get_clk_cal(struct femtol1_hdl *hdl) #endif } +/* + * RevC was the last HW revision without an external + * attenuator. Check for that. + */ +static int has_external_atten(struct femtol1_hdl *hdl) +{ + /* older version doesn't have an attenuator */ + return hdl->hw_info.ver_major > 2; +} + /* activate or de-activate the entire RF-Frontend */ int l1if_activate_rf(struct femtol1_hdl *hdl, int on) { @@ -1127,9 +1137,12 @@ int l1if_activate_rf(struct femtol1_hdl *hdl, int on) sysp->u.activateRfReq.rfRx.iClkCor = get_clk_cal(hdl); #endif /* API 2.4.0 */ #if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(2,2,0) - sysp->u.activateRfReq.rfTrx.u8UseExtAtten = 1; - sysp->u.activateRfReq.rfTrx.fMaxTxPower = - sysmobts_get_nominal_power(trx); + if (has_external_atten(hdl)) { + LOGP(DL1C, LOGL_INFO, "Using external attenuator.\n"); + sysp->u.activateRfReq.rfTrx.u8UseExtAtten = 1; + sysp->u.activateRfReq.rfTrx.fMaxTxPower = + sysmobts_get_nominal_power(trx); + } #endif /* 2.2.0 */ #endif /* !HW_SYSMOBTS_V1 */ } else { @@ -1241,7 +1254,10 @@ static int info_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp) fl1h->hw_info.fpga_version[1] = sic->fpgaVersion.minor; fl1h->hw_info.fpga_version[2] = sic->fpgaVersion.build; - LOGP(DL1C, LOGL_INFO, "DSP v%u.%u.%u, FPGA v%u.%u.%u\n", + fl1h->hw_info.ver_major = sic->boardVersion.rev; + fl1h->hw_info.ver_minor = sic->boardVersion.option; + + LOGP(DL1C, LOGL_INFO, "DSP v%u.%u.%u, FPGA v%u.%u.%u\nn", sic->dspVersion.major, sic->dspVersion.minor, sic->dspVersion.build, sic->fpgaVersion.major, sic->fpgaVersion.minor, sic->fpgaVersion.build); @@ -1261,6 +1277,9 @@ static int info_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp) LOGP(DL1C, LOGL_FATAL, "BTS band %s not supported by hw\n", gsm_band_name(trx->bts->band)); + /* Request the activation */ + l1if_activate_rf(fl1h, 1); + #if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(2,4,0) /* load calibration tables (if we know their path) */ rc = calib_load(fl1h); @@ -1314,9 +1333,6 @@ static int reset_compl_cb(struct gsm_bts_trx *trx, struct msgb *resp) /* obtain version information on DSP/FPGA and band capabilities */ l1if_get_info(fl1h); - /* otherwise, request activation of RF board */ - l1if_activate_rf(fl1h, 1); - return 0; } diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h index aa893df6..dd65de9a 100644 --- a/src/osmo-bts-sysmo/l1_if.h +++ b/src/osmo-bts-sysmo/l1_if.h @@ -67,6 +67,8 @@ struct femtol1_hdl { uint8_t dsp_version[3]; uint8_t fpga_version[3]; uint32_t band_support; /* bitmask of GSM_BAND_* */ + uint8_t ver_major; + uint8_t ver_minor; /* from EEPROM */ uint16_t model_nr; uint16_t model_flags; -- cgit v1.2.3