summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-02-26 18:47:22 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2013-02-26 18:47:22 +0100
commitb85feece835e3d090cd4fd7c387fbdb6890c6e76 (patch)
tree569944e4009046898931780c92e6e34b5a03b26a
parentfdf73eb40f7ee6aaf0f50b3f60c6f054d63a49bf (diff)
Add gain control to calypso BTS code
The gain of RX does not follow the sync-cell anymore. It still uses the appropiate gain for sync-cell, but for RX of BTS bursts it uses a gain that is suitable for a receive level of -47 dBm (by default). This is a gain level of 0. The low gain of 0 is the best start value, if phones are close to the BTS, but also for low RX levels below -100 dBm, as several tests showed.
-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);
}