1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

tools/: rearranged cwtest/atrf-path to be more clear about reset and do re-init

- include/cwtest.h (cw_test_needs_reset), lib/cwtest.c
  (cw_test_needs_reset): new function to indicate all cases where the
  transceiver needs to be reset (instead of using SLP_TR)
- lib/cwtest.c (cw_test_end): use cw_test_needs_reset instead of
  open-coding the decision
- lib/cwtest.c (enter_test_mode_230, start_test_mode_231): always wait
  for the PLL to lock. Contrary to the assumption in the previous
  commit, we should always see this interrupt.
- atrf-path/atrf-path.c (sample): initialize the transceiver if we had
  to reset it
- atrf-path/atrf-path.c (sample), atrf-path/atrf-path.c (do_half_sweep):
  moved the tTR19 delay to "sweep", so that all branches share it and it
  is taken only once
This commit is contained in:
Werner Almesberger
2011-06-13 14:24:59 -03:00
parent 8c00833542
commit 9ef447865b
3 changed files with 19 additions and 12 deletions

View File

@@ -74,14 +74,11 @@ static void sample(const struct sweep *sweep, int cont_tx,
int sum = 0, min = -1, max = -1;
double offset = tx_power_step2dBm(sweep->tx, sweep->power);
/*
* For the 230, we don't have reset-less exit from test mode (yet ?) and
* need to set up things from scratch:
*
* init_tx(sweep->tx, sweep->trim_tx, sweep->power);
* set_channel(sweep->tx, chan);
* usleep(155); / * table 7-2, tTR19 * /
*/
if (cw_test_needs_reset(sweep->tx)) {
init_tx(sweep->tx, sweep->trim_tx, sweep->power);
need_init = 1;
}
usleep(155); /* table 7-2, tTR19 */
if (first || need_init) {
cw_test_begin(sweep->tx, cont_tx);
need_init = 0;
@@ -123,7 +120,6 @@ static int do_half_sweep(const struct sweep *sweep, int cont_tx,
for (i = 0; i != N_CHAN; i++) {
set_channel(sweep->rx, chan);
set_channel(sweep->tx, chan);
usleep(155); /* table 7-2, tTR19 */
sample(sweep, cont_tx, res, chan == 11 && !sweep->cont_tx);
if (res->avg > sweep->max[i])