diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-06-20 17:26:27 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-06-20 17:28:21 +0200 |
commit | 86074fce2e86975dff079a9c1f0c1536f0134582 (patch) | |
tree | 6b8e2b72df6afae95de071f3df03310e93291d7a /src/target/firmware/layer1/prim_fbsb.c | |
parent | c1168aaec27542c609bd79749006235340c67bc3 (diff) |
[layer1] FBSB: abort FB0 acquisition after 30 failing attempts
This should remove the 'endless FB0 loop' when the DSP detects a FB
where there really is none, and we drive the AFC DAC to its maximum
without ever getting the frequency offset below our threshold.
Diffstat (limited to 'src/target/firmware/layer1/prim_fbsb.c')
-rw-r--r-- | src/target/firmware/layer1/prim_fbsb.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/target/firmware/layer1/prim_fbsb.c b/src/target/firmware/layer1/prim_fbsb.c index e0236fd8..ff9ab697 100644 --- a/src/target/firmware/layer1/prim_fbsb.c +++ b/src/target/firmware/layer1/prim_fbsb.c @@ -50,6 +50,7 @@ #include <l1a_l23_interface.h> #define FB0_RETRY_COUNT 3 +#define AFC_RETRY_COUNT 30 extern uint16_t rf_arfcn; // TODO @@ -75,6 +76,7 @@ struct l1a_fb_state { struct l1ctl_fbsb_req req; int16_t initial_freq_err; uint8_t fb_retries; + uint8_t afc_retries; }; static struct l1a_fb_state fbs; @@ -442,11 +444,18 @@ static int l1s_fbdet_resp(__unused uint8_t p1, uint8_t attempt, tdma_sched_reset(); /* FIXME: don't only use the last but an average */ if (abs(last_fb->freq_diff) < fbs.req.freq_err_thresh1 && - last_fb->snr > FB0_SNR_THRESH) + last_fb->snr > FB0_SNR_THRESH) { + /* continue with FB1 task in DSP */ tdma_schedule_set(1, fb_sched_set, 1); - else { - /* FIXME: check timeout */ - tdma_schedule_set(1, fb_sched_set, 0); + } else { + if (fbs.afc_retries < AFC_RETRY_COUNT) { + tdma_schedule_set(1, fb_sched_set, 0); + fbs.afc_retries++; + } else { + /* Abort */ + last_fb->attempt = 13; + l1s_compl_sched(L1_COMPL_FB); + } } } else l1s_compl_sched(L1_COMPL_FB); |