aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÁlvaro Neira Ayuso <anayuso@sysmocom.de>2014-04-28 13:40:24 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-04-29 12:08:28 +0200
commit9ed6b95c9096a0e4e12673feb322cb0355d3dafe (patch)
tree64953c9f205b4457859558866ca16ad65818990a
parent3e5b6db2d26f279f9238089f8c79de1d71a997aa (diff)
osmo-bts-sysmo/utils.c: Added a function for calculate the power transmitter
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
-rw-r--r--src/osmo-bts-sysmo/oml.c4
-rw-r--r--src/osmo-bts-sysmo/utils.c11
-rw-r--r--src/osmo-bts-sysmo/utils.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 1543f85..4ebf664 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -323,7 +323,7 @@ static int trx_init(struct gsm_bts_trx *trx)
dev_par->u16BcchArfcn = trx->bts->c0->arfcn;
dev_par->u8NbTsc = trx->bts->bsic & 7;
dev_par->fRxPowerLevel = fl1h->ul_power_target;
- dev_par->fTxPowerLevel = trx->nominal_power - trx->max_power_red;
+ dev_par->fTxPowerLevel = sysmobts_get_power_trx(trx);
LOGP(DL1C, LOGL_NOTICE, "Init TRX (ARFCN %u, TSC %u, RxPower % 2f dBm, "
"TxPower % 2.2f dBm\n", dev_par->u16Arfcn, dev_par->u8NbTsc,
dev_par->fRxPowerLevel, dev_par->fTxPowerLevel);
@@ -1544,7 +1544,7 @@ int bts_model_apply_oml(struct gsm_bts *bts, struct msgb *msg,
/* Did we go through MphInit yet? If yes fire and forget */
if (fl1h->hLayer1)
- l1if_set_txpower(fl1h, trx->nominal_power - trx->max_power_red);
+ l1if_set_txpower(fl1h, sysmobts_get_power_trx(trx));
}
/* FIXME: we actaully need to send a ACK or NACK for the OML message */
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index f576eef..af1e5d2 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -136,3 +136,14 @@ int sysmobts_get_nominal_power(struct gsm_bts_trx *trx)
}
return -1;
}
+
+int sysmobts_get_power_trx(struct gsm_bts_trx *trx)
+{
+ int power_transmitter = trx->nominal_power - trx->max_power_red;
+ power_transmitter -= trx->power_reduce;
+
+ if (power_transmitter < 0)
+ power_transmitter = 0;
+
+ return power_transmitter;
+}
diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h
index ff41437..aef774c 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -12,4 +12,5 @@ int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn);
int sysmobts_get_nominal_power(struct gsm_bts_trx *trx);
+int sysmobts_get_power_trx(struct gsm_bts_trx *trx);
#endif