summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/board
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-06-25 13:38:22 +0200
committerHarald Welte <laforge@gnumonks.org>2010-06-25 13:39:58 +0200
commit028dcd9e2543c4f91667c393813de24ae4e90cb8 (patch)
tree367dbd8b198aa8bccc05cc458c6e62f271f4ebba /src/target/firmware/board
parent52ef5a78eea9e54eb572ac5e1713a304a90e1f9a (diff)
[layer1] An actual AGC implementation
We introduce trf6151_compute_gain() to compute the gain setting that leads to the ideal analog baseband power input level. This function is called from rffe_set_gain() for both the compal and the gta0x rf frontend, as there are no other amplifiers inside those phone designs. The new AGC function is not used yet from the regular layer1 code.
Diffstat (limited to 'src/target/firmware/board')
-rw-r--r--src/target/firmware/board/common/rffe_compal_dualband.c9
-rw-r--r--src/target/firmware/board/common/rffe_gta0x_triband.c10
2 files changed, 17 insertions, 2 deletions
diff --git a/src/target/firmware/board/common/rffe_compal_dualband.c b/src/target/firmware/board/common/rffe_compal_dualband.c
index 6aa9381f..bfd3d98e 100644
--- a/src/target/firmware/board/common/rffe_compal_dualband.c
+++ b/src/target/firmware/board/common/rffe_compal_dualband.c
@@ -7,6 +7,11 @@
#include <calypso/tsp.h>
#include <rf/trf6151.h>
+/* This is a value that has been measured on the C123 by Harald: 71dBm,
+ it is the difference between the input level at the antenna and what
+ the DSP reports, subtracted by the total gain of the TRF6151 */
+#define SYSTEM_INHERENT_GAIN 71
+
/* describe how the RF frontend is wired on the Motorola E88 board (C117/C118/C121/C123) */
#define RITA_RESET TSPACT(0) /* Reset of the Rita TRF6151 */
@@ -60,11 +65,13 @@ uint8_t rffe_get_gain(void)
return trf6151_get_gain();
}
+const uint8_t system_inherent_gain = SYSTEM_INHERENT_GAIN;
+
/* Given the expected input level of exp_inp dBm/8 and the target of target_bb
* dBm8, configure the RF Frontend with the respective gain */
void rffe_set_gain(int16_t exp_inp, int16_t target_bb)
{
- /* FIXME */
+ trf6151_compute_gain(exp_inp, target_bb);
}
void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb)
diff --git a/src/target/firmware/board/common/rffe_gta0x_triband.c b/src/target/firmware/board/common/rffe_gta0x_triband.c
index 6406f04e..a21cc612 100644
--- a/src/target/firmware/board/common/rffe_gta0x_triband.c
+++ b/src/target/firmware/board/common/rffe_gta0x_triband.c
@@ -7,6 +7,11 @@
#include <calypso/tsp.h>
#include <rf/trf6151.h>
+/* This is a value that has been measured on the C123 by Harald: 71dBm,
+ it is the difference between the input level at the antenna and what
+ the DSP reports, subtracted by the total gain of the TRF6151 */
+#define SYSTEM_INHERENT_GAIN 71
+
/* describe how the RF frontend is wired on the Openmoko GTA0x boards */
#define RITA_RESET TSPACT(0) /* Reset of the Rita TRF6151 */
@@ -75,11 +80,14 @@ uint8_t rffe_get_gain(void)
return trf6151_get_gain();
}
+const uint8_t system_inherent_gain = SYSTEM_INHERENT_GAIN;
+
+#define to_dbm8(x) ((x)*8)
/* Given the expected input level of exp_inp dBm/8 and the target of target_bb
* dBm8, configure the RF Frontend with the respective gain */
void rffe_set_gain(int16_t exp_inp, int16_t target_bb)
{
- /* FIXME */
+ trf6151_compute_gain(exp_inp, target_bb);
}
void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb)