From 32da71ef5ccb01d1a6f91657661637ba2a451196 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 21 Feb 2010 09:38:44 +0100 Subject: TWL3025: Add uplink enable/disable function --- src/target/firmware/abb/twl3025.c | 26 ++++++++++++++++++++++++++ src/target/firmware/include/abb/twl3025.h | 3 +++ 2 files changed, 29 insertions(+) (limited to 'src/target/firmware') diff --git a/src/target/firmware/abb/twl3025.c b/src/target/firmware/abb/twl3025.c index 2e88a3fd..b9c55696 100644 --- a/src/target/firmware/abb/twl3025.c +++ b/src/target/firmware/abb/twl3025.c @@ -188,6 +188,8 @@ void twl3025_clk13m(int enable) #define BDLCAL_DURATION 66 #define BDLON_TO_BDLENA 7 #define BULON_TO_BULENA 16 +#define BULON_TO_BULCAL 17 +#define BULCAL_DURATION 143 /* really that long? */ /* bdl_ena - TSP_DELAY - BDLCAL_DURATION - TSP_DELAY - BDLON_TO_BDLCAL - TSP_DELAY */ #define DOWNLINK_DELAY (3 * TSP_DELAY + BDLCAL_DURATION + BDLON_TO_BDLCAL) @@ -223,6 +225,30 @@ void twl3025_downlink(int on, int16_t at) } } +void twl3025_uplink(int on, int16_t at) +{ + int16_t bul_ena = at - TSP_DELAY - 6; + + if (bul_ena < 0) + printf("BULENA time negative (%d)\n", bul_ena); + if (on) { + /* FIXME: calibration should be done just before BULENA */ + twl3025_tsp_write(BULON); + tpu_enq_wait(BULON_TO_BULCAL - TSP_DELAY); + twl3025_tsp_write(BULON | BULCAL); + tpu_enq_wait(BULCAL_DURATION - TSP_DELAY); + twl3025_tsp_write(BULON); + tpu_enq_wait(35); /* minimum time required to bring the ramp up (really needed?) */ + tpu_enq_at(bul_ena); + twl3025_tsp_write(BULON | BULENA); + } else { + tpu_enq_at(bul_ena); + twl3025_tsp_write(BULON); + tpu_enq_wait(35); /* minimum time required to bring the ramp down (needed!) */ + twp3025_tsp_write(0); + } +} + void twl3025_afc_set(int16_t val) { printf("twl3025_afc_set(%d)\n", val); diff --git a/src/target/firmware/include/abb/twl3025.h b/src/target/firmware/include/abb/twl3025.h index c6c30aac..d171db8e 100644 --- a/src/target/firmware/include/abb/twl3025.h +++ b/src/target/firmware/include/abb/twl3025.h @@ -113,6 +113,9 @@ void twl3025_tsp_write(uint8_t data); /* Enqueue a series of TSP commands in the TPU to (de)activate the downlink path */ void twl3025_downlink(int on, int16_t at); +/* Enqueue a series of TSP commands in the TPU to (de)activate the uplink path */ +void twl3025_uplink(int on, int16_t at); + /* Update the AFC DAC value */ void twl3025_afc_set(int16_t val); -- cgit v1.2.3