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:
@@ -26,6 +26,16 @@
|
||||
static int last_cont_tx; /* @@@ hack for resuming on the 230 */
|
||||
|
||||
|
||||
int cw_test_needs_reset(struct atrf_dsc *dsc)
|
||||
{
|
||||
if (atrf_usb_handle(dsc))
|
||||
return 1;
|
||||
if (atrf_identify(dsc) == artf_at86rf230)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void enter_test_mode_230(struct atrf_dsc *dsc, uint8_t cont_tx)
|
||||
{
|
||||
atrf_buf_write(dsc, "", 1);
|
||||
@@ -39,7 +49,7 @@ static void enter_test_mode_230(struct atrf_dsc *dsc, uint8_t cont_tx)
|
||||
}
|
||||
|
||||
atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_PLL_ON);
|
||||
wait_for_interrupt(dsc, IRQ_PLL_LOCK, IRQ_PLL_LOCK, 10, 20);
|
||||
wait_for_interrupt(dsc, IRQ_PLL_LOCK, IRQ_PLL_LOCK, 10, 0);
|
||||
|
||||
atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_TX_START);
|
||||
}
|
||||
@@ -92,7 +102,7 @@ static void start_test_mode_231(struct atrf_dsc *dsc)
|
||||
atrf_reg_write(dsc, REG_PART_NUM, 0x46); /*14 */
|
||||
|
||||
atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_PLL_ON); /*15 */
|
||||
wait_for_interrupt(dsc, IRQ_PLL_LOCK, IRQ_PLL_LOCK, 10, 20); /*16 */
|
||||
wait_for_interrupt(dsc, IRQ_PLL_LOCK, IRQ_PLL_LOCK, 10, 0); /*16 */
|
||||
|
||||
atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_TX_START); /*17 */
|
||||
}
|
||||
@@ -142,7 +152,7 @@ void cw_test_end(struct atrf_dsc *dsc)
|
||||
* AT86RF231 also exits test mode if we send it to sleep for a
|
||||
* moment.
|
||||
*/
|
||||
if (atrf_identify(dsc) == artf_at86rf230 || atrf_usb_handle(dsc))
|
||||
if (cw_test_needs_reset(dsc))
|
||||
atrf_reset_rf(dsc);
|
||||
else {
|
||||
usleep(2); /* table 7-1: tTR12(typ) = 1 us */
|
||||
|
||||
Reference in New Issue
Block a user