diff options
Diffstat (limited to 'src/common/tx_power.c')
-rw-r--r-- | src/common/tx_power.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/common/tx_power.c b/src/common/tx_power.c index 348aba5c..83cdb629 100644 --- a/src/common/tx_power.c +++ b/src/common/tx_power.c @@ -12,7 +12,7 @@ * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. @@ -239,8 +239,7 @@ static void power_ramp_do_step(struct gsm_bts_trx *trx, int first) osmo_timer_schedule(&tpp->ramp.step_timer, tpp->ramp.step_interval_sec, 0); } - -int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, ramp_compl_cb_t ramp_compl_cb) +int _power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, ramp_compl_cb_t ramp_compl_cb, bool skip_ramping) { struct trx_power_params *tpp = &trx->power_params; @@ -259,13 +258,18 @@ int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, } /* Cancel any pending request */ - osmo_timer_del(&tpp->ramp.step_timer); + power_ramp_abort(trx); /* set the new target */ tpp->p_total_tgt_mdBm = p_total_tgt_mdBm; tpp->ramp.compl_cb = ramp_compl_cb; - if (we_are_ramping_up(trx)) { + if (skip_ramping) { + /* Jump straight to the target power */ + tpp->p_total_cur_mdBm = p_total_tgt_mdBm; + tpp->ramp.attenuation_mdB = 0; + power_ramp_timer_cb(trx); + } else if (we_are_ramping_up(trx)) { if (tpp->p_total_tgt_mdBm <= tpp->ramp.max_initial_pout_mdBm) { LOGPTRX(trx, DL1C, LOGL_INFO, "target_power (%d mdBm) is below or equal to 'power ramp max-initial' power (%d mdBm)\n", @@ -297,6 +301,12 @@ int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass, return 0; } +/* Cancel any pending request */ +void power_ramp_abort(struct gsm_bts_trx *trx) +{ + osmo_timer_del(&trx->power_params.ramp.step_timer); +} + /* determine the initial transceiver output power at start-up time */ int power_ramp_initial_power_mdBm(const struct gsm_bts_trx *trx) { |