aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/osmo-bts/Makefile.am2
-rw-r--r--include/osmo-bts/bts_model.h2
-rw-r--r--include/osmo-bts/gsm_data.h1
-rw-r--r--include/osmo-bts/tx_power.h74
4 files changed, 78 insertions, 1 deletions
diff --git a/include/osmo-bts/Makefile.am b/include/osmo-bts/Makefile.am
index 68d63e09..b2941444 100644
--- a/include/osmo-bts/Makefile.am
+++ b/include/osmo-bts/Makefile.am
@@ -1,3 +1,3 @@
noinst_HEADERS = abis.h bts.h bts_model.h gsm_data.h logging.h measurement.h \
oml.h paging.h rsl.h signal.h vty.h amr.h pcu_if.h pcuif_proto.h \
- handover.h msg_utils.h
+ handover.h msg_utils.h tx_power.h
diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h
index 2641db72..200d02d2 100644
--- a/include/osmo-bts/bts_model.h
+++ b/include/osmo-bts/bts_model.h
@@ -46,4 +46,6 @@ void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx);
int bts_model_oml_estab(struct gsm_bts *bts);
+int bts_model_change_power(struct gsm_bts_trx *trx, int p_trxout_mdBm);
+
#endif
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index c7a0fc61..5e0af775 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -6,6 +6,7 @@
#include <osmocom/gsm/lapdm.h>
#include <osmo-bts/paging.h>
+#include <osmo-bts/tx_power.h>
#define GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DEFAULT 41
#define GSM_BTS_AGCH_QUEUE_THRESH_LEVEL_DISABLE 999999
diff --git a/include/osmo-bts/tx_power.h b/include/osmo-bts/tx_power.h
new file mode 100644
index 00000000..c5d6f2ba
--- /dev/null
+++ b/include/osmo-bts/tx_power.h
@@ -0,0 +1,74 @@
+#pragma once
+
+#include <stdint.h>
+#include <osmocom/core/timer.h>
+
+/* our unit is 'milli dB" or "milli dBm", i.e. 1/1000 of a dB(m) */
+#define to_mdB(x) (x * 1000)
+
+/* PA calibration table */
+struct pa_calibration {
+ int gain_mdB[1024]; /* gain provided at given ARFCN */
+ /* FIXME: thermal calibration */
+};
+
+/* representation of a RF power amplifier */
+struct power_amp {
+ /* nominal gain of the PA */
+ int nominal_gain_mdB;
+ /* table with calibrated actual gain for each ARFCN */
+ struct pa_calibration calib;
+};
+
+/* Transmit power related parameters of a transceiver */
+struct trx_power_params {
+ /* specified maximum output of TRX at full power, has to be
+ * initialized by BTS model at startup*/
+ int trx_p_max_out_mdBm;
+
+ /* intended current total system output power */
+ int p_total_tgt_mdBm;
+
+ /* actual current total system output power, filled in by tx_power code */
+ int p_total_cur_mdBm;
+
+ /* current temporary attenuation due to thermal management,
+ * set by thermal management code via control interface */
+ int thermal_attenuation_mdB;
+
+ /* external gain (+) or attenuation (-) added by the user, configured
+ * by the user via VTY */
+ int user_gain_mdB;
+
+ /* calibration table of internal PA */
+ struct power_amp pa;
+
+ /* calibration table of user PA */
+ struct power_amp user_pa;
+
+ /* power ramping related data */
+ struct {
+ /* maximum initial Pout including all PAs */
+ int max_initial_pout_mdBm;
+ /* temporary attenuation due to power ramping */
+ int attenuation_mdB;
+ unsigned int step_size_mdB;
+ unsigned int step_interval_sec;
+ struct osmo_timer_list step_timer;
+ } ramp;
+};
+
+int get_p_max_out_mdBm(struct gsm_bts_trx *trx);
+
+int get_p_nominal_mdBm(struct gsm_bts_trx *trx);
+
+int get_p_target_mdBm(struct gsm_bts_trx *trx, uint8_t bs_power_ie);
+int get_p_target_mdBm_lchan(struct gsm_lchan *lchan);
+
+int get_p_trxout_target_mdBm(struct gsm_bts_trx *trx, uint8_t bs_power_ie);
+int get_p_trxout_target_mdBm_lchan(struct gsm_lchan *lchan);
+
+int get_p_trxout_actual_mdBm(struct gsm_bts_trx *trx, uint8_t bs_power_ie);
+int get_p_trxout_actual_mdBm_lchan(struct gsm_lchan *lchan);
+
+int power_ramp_start(struct gsm_bts_trx *trx, int p_total_tgt_mdBm, int bypass);