From e2f3d846d95aeca3d2b42d138d65984355437f31 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Fri, 2 Sep 2011 23:09:20 +0200 Subject: target/rf: Make the trf6151_set_arfcn use ARFCN_UPLINK flag to select UL/DL This way we can independentely control what frequency we want and wheter we want to TX or RX. This allow TX on DL band and RX on UL band. This also means all call to tx_window setup now need to properly set the ARFCN_UPLINK flag ! Signed-off-by: Sylvain Munaut --- src/target/firmware/include/rf/trf6151.h | 4 +++- src/target/firmware/layer1/prim_rach.c | 2 +- src/target/firmware/layer1/prim_tch.c | 4 ++-- src/target/firmware/layer1/prim_tx_nb.c | 2 +- src/target/firmware/rf/trf6151.c | 12 ++++++++---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/target/firmware/include/rf/trf6151.h b/src/target/firmware/include/rf/trf6151.h index f0891b6b..c1eaf3b2 100644 --- a/src/target/firmware/include/rf/trf6151.h +++ b/src/target/firmware/include/rf/trf6151.h @@ -22,7 +22,9 @@ int trf6151_set_gain(uint8_t dbm); uint8_t trf6151_get_gain(void); /* Request the PLL to be tuned to the given frequency */ -void trf6151_set_arfcn(uint16_t arfcn, int uplink); +/* arfcn must have ARFCN_UPLINK flag set if you want uplink ! */ +/* tx selects the TX path only and doesn't set UL band ! */ +void trf6151_set_arfcn(uint16_t arfcn, int tx); enum trf6151_mode { TRF6151_IDLE, diff --git a/src/target/firmware/layer1/prim_rach.c b/src/target/firmware/layer1/prim_rach.c index 47f74241..9370589d 100644 --- a/src/target/firmware/layer1/prim_rach.c +++ b/src/target/firmware/layer1/prim_rach.c @@ -73,7 +73,7 @@ static int l1s_tx_rach_cmd(__unused uint8_t p1, __unused uint8_t p2, __unused ui dsp_api.db_w->d_task_ra = RACH_DSP_TASK; - l1s_tx_win_ctrl(l1s.serving_cell.arfcn, L1_TXWIN_AB, 0, 3); + l1s_tx_win_ctrl(l1s.serving_cell.arfcn | ARFCN_UPLINK, L1_TXWIN_AB, 0, 3); return 0; } diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c index 96858fb6..292ca103 100644 --- a/src/target/firmware/layer1/prim_tch.c +++ b/src/target/firmware/layer1/prim_tch.c @@ -479,7 +479,7 @@ skip_tx_traffic: l1s_rx_win_ctrl(arfcn, L1_RXWIN_NB, 0); dsp_load_tx_task(TCHT_DSP_TASK, 0, tsc); /* burst_id unused for TCH */ - l1s_tx_win_ctrl(arfcn, L1_TXWIN_NB, 0, 3); + l1s_tx_win_ctrl(arfcn | ARFCN_UPLINK, L1_TXWIN_NB, 0, 3); return 0; } @@ -738,7 +738,7 @@ static int l1s_tch_a_cmd(__unused uint8_t p1, __unused uint8_t p2, uint16_t p3) l1s_rx_win_ctrl(arfcn, L1_RXWIN_NB, 0); dsp_load_tx_task(TCHA_DSP_TASK, 0, tsc); /* burst_id unused for TCHA */ - l1s_tx_win_ctrl(arfcn, L1_TXWIN_NB, 0, 3); + l1s_tx_win_ctrl(arfcn, L1_TXWIN_NB | ARFCN_UPLINK, 0, 3); return 0; } diff --git a/src/target/firmware/layer1/prim_tx_nb.c b/src/target/firmware/layer1/prim_tx_nb.c index 3038178b..df13c757 100644 --- a/src/target/firmware/layer1/prim_tx_nb.c +++ b/src/target/firmware/layer1/prim_tx_nb.c @@ -123,7 +123,7 @@ static int l1s_tx_cmd(uint8_t p1, uint8_t burst_id, uint16_t p3) dsp_load_tx_task(DUL_DSP_TASK, burst_id, tsc); - l1s_tx_win_ctrl(arfcn, L1_TXWIN_NB, 0, 3); + l1s_tx_win_ctrl(arfcn | ARFCN_UPLINK, L1_TXWIN_NB, 0, 3); return 0; } diff --git a/src/target/firmware/rf/trf6151.c b/src/target/firmware/rf/trf6151.c index 53604024..96210fc6 100644 --- a/src/target/firmware/rf/trf6151.c +++ b/src/target/firmware/rf/trf6151.c @@ -428,12 +428,16 @@ static void trf6151_band_select(enum trf6151_gsm_band band) } /* Set ARFCN. Takes 2 reg_write, i.e. 8 TPU instructions */ -void trf6151_set_arfcn(uint16_t arfcn, int uplink) +void trf6151_set_arfcn(uint16_t arfcn, int tx) { uint32_t freq_khz; uint16_t pll_config; + int uplink; enum trf6151_gsm_band pll_band; + uplink = !!(arfcn & ARFCN_UPLINK); + arfcn != ~ARFCN_UPLINK; + switch (gsm_arfcn2band(arfcn)) { case GSM_BAND_850: case GSM_BAND_900: @@ -452,7 +456,7 @@ void trf6151_set_arfcn(uint16_t arfcn, int uplink) freq_khz = gsm_arfcn2freq10(arfcn, uplink) * 100; printd("ARFCN %u -> %u kHz\n", arfcn, freq_khz); - if (uplink == 0) + if (!tx) trf6151_pll_rx(freq_khz, &pll_config, &pll_band); else trf6151_pll_tx(freq_khz, &pll_config, &pll_band); @@ -512,7 +516,7 @@ uint8_t trf6151_get_gain(void) void trf6151_test(uint16_t arfcn) { - /* Select ARFCN 871 downlink */ + /* Select ARFCN downlink */ trf6151_set_arfcn(arfcn, 0); trf6151_set_mode(TRF6151_RX); @@ -532,7 +536,7 @@ void trf6151_test(uint16_t arfcn) void trf6151_tx_test(uint16_t arfcn) { /* Select ARFCN uplink */ - trf6151_set_arfcn(arfcn, 1); + trf6151_set_arfcn(arfcn | ARFCN_UPLINK, 1); trf6151_set_mode(TRF6151_TX); tpu_enq_wait(TRF6151_RX_PLL_DELAY); -- cgit v1.2.3