1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-04 23:59:23 +02:00

libatrf: cw test mode can now be resumed, with lower overhead (231 only)

- lib/cwtest.c (enter_test_mode_231, prepare_test_mode_231,
  start_test_mode_231, cw_test_begin): broke enter_test_mode_231 into
  a slow setup component and a fast start/resume component
- include/cwtest.h (cw_test_resume), lib/cwtest.c (cw_test_resume):
  resume transmission in a previously set up test mode
This commit is contained in:
Werner Almesberger 2011-04-13 12:17:02 -03:00
parent 5f153ca4b8
commit 16a48d6931
2 changed files with 27 additions and 2 deletions

View File

@ -20,6 +20,7 @@
void cw_test_begin(struct atrf_dsc *dsc, uint8_t cont_tx);
void cw_test_resume(struct atrf_dsc *dsc);
void cw_test_end(struct atrf_dsc *dsc);
#endif /* !CW_TEST_H */

View File

@ -23,6 +23,9 @@
#include "cwtest.h"
static int last_cont_tx; /* @@@ hack for resuming on the 230 */
static void enter_test_mode_230(struct atrf_dsc *dsc, uint8_t cont_tx)
{
atrf_buf_write(dsc, "", 1);
@ -42,7 +45,7 @@ static void enter_test_mode_230(struct atrf_dsc *dsc, uint8_t cont_tx)
}
static void enter_test_mode_231(struct atrf_dsc *dsc, uint8_t cont_tx)
static void prepare_test_mode_231(struct atrf_dsc *dsc, uint8_t cont_tx)
{
uint8_t buf[127];
uint8_t status;
@ -80,7 +83,11 @@ static void enter_test_mode_231(struct atrf_dsc *dsc, uint8_t cont_tx)
atrf_reg_write(dsc, REG_RX_CTRL, 0xa7); /*11 */
atrf_buf_write(dsc, buf, sizeof(buf)); /*12 */
}
static void start_test_mode_231(struct atrf_dsc *dsc)
{
atrf_reg_write(dsc, REG_PART_NUM, 0x54); /*13 */
atrf_reg_write(dsc, REG_PART_NUM, 0x46); /*14 */
@ -96,9 +103,26 @@ void cw_test_begin(struct atrf_dsc *dsc, uint8_t cont_tx)
switch (atrf_identify(dsc)) {
case artf_at86rf230:
enter_test_mode_230(dsc, cont_tx);
last_cont_tx = cont_tx;
break;
case artf_at86rf231:
enter_test_mode_231(dsc, cont_tx);
prepare_test_mode_231(dsc, cont_tx);
start_test_mode_231(dsc);
break;
default:
abort();
}
}
void cw_test_resume(struct atrf_dsc *dsc)
{
switch (atrf_identify(dsc)) {
case artf_at86rf230:
enter_test_mode_230(dsc, last_cont_tx);
break;
case artf_at86rf231:
start_test_mode_231(dsc);
break;
default:
abort();