summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/l1ctl_proto.h1
-rw-r--r--src/target/firmware/include/layer1/sync.h1
-rw-r--r--src/target/firmware/layer1/l23_api.c1
-rw-r--r--src/target/firmware/layer1/prim_bts.c8
4 files changed, 11 insertions, 0 deletions
diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h
index fa8814be..86aaa5f4 100644
--- a/include/l1ctl_proto.h
+++ b/include/l1ctl_proto.h
@@ -312,6 +312,7 @@ struct l1ctl_bts_mode {
uint8_t enabled;
uint8_t bsic;
uint16_t band_arfcn;
+ uint8_t gain;
} __attribute__((packed));
/* BTS mode: Burst Request */
diff --git a/src/target/firmware/include/layer1/sync.h b/src/target/firmware/include/layer1/sync.h
index 2cb5152c..cfa7ae4d 100644
--- a/src/target/firmware/include/layer1/sync.h
+++ b/src/target/firmware/include/layer1/sync.h
@@ -159,6 +159,7 @@ struct l1s_state {
struct {
uint16_t arfcn;
uint8_t bsic;
+ uint8_t gain;
} bts;
};
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index 342196f8..40bbdbae 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -607,6 +607,7 @@ static int l1ctl_bts_mode(struct msgb *msg)
if (bm->enabled) {
mframe_enable(MF_TASK_BTS);
+ l1s.bts.gain = bm->gain;
} else {
mframe_disable(MF_TASK_BTS);
}
diff --git a/src/target/firmware/layer1/prim_bts.c b/src/target/firmware/layer1/prim_bts.c
index 627cf36b..ca64118e 100644
--- a/src/target/firmware/layer1/prim_bts.c
+++ b/src/target/firmware/layer1/prim_bts.c
@@ -264,8 +264,16 @@ l1s_bts_cmd(uint8_t p1, uint8_t p2, uint16_t p3)
/* Enable task */
dsp_api.db_w->d_task_d = 23;
+ /* store current gain */
+ uint8_t last_gain = rffe_get_gain();
+
+ rffe_compute_gain(-47 - l1s.bts.gain, CAL_DSP_TGT_BB_LVL);
+
/* Open RX window */
l1s_rx_win_ctrl(l1s.bts.arfcn | ARFCN_UPLINK, L1_RXWIN_NB, 0);
+
+ /* restore last gain */
+ rffe_set_gain(last_gain);
}