mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-26 11:06:16 +02:00
libatrf: add option to send a pulse with atrf_slp_tr
- include/atrf.h (atrf_slp_tr), lib/atrf.c (atrf_slp_tr): added pulse argument - atrf-proxy/PROTOCOL, atrf-proxy/atrf-proxy.c (cmd_two, cmd_more): added second argument to SLP_TR command - atrf-xtal/atben.c (atben_sample), lib/cwtest.c (cw_test_end): updated for API change - lib/driver.h (struct atrf_driver): added "pulse" argument to slp_tr - lib/atben.c (atben_slp_tr), lib/atnet.c (atnet_slp_tr): added support for pulse mode
This commit is contained in:
parent
87e06b4e4e
commit
1a3f169e89
@ -24,7 +24,7 @@ TEST
|
|||||||
+[comment]
|
+[comment]
|
||||||
-message
|
-message
|
||||||
|
|
||||||
SLP_TR 0|1
|
SLP_TR 0|1 0|1
|
||||||
+[comment]
|
+[comment]
|
||||||
-message
|
-message
|
||||||
|
|
||||||
|
@ -116,6 +116,20 @@ static int cmd_two(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
|
|||||||
return netio_printf(netio, "-I/O error\n");
|
return netio_printf(netio, "-I/O error\n");
|
||||||
return netio_printf(netio, "+\n");
|
return netio_printf(netio, "+\n");
|
||||||
}
|
}
|
||||||
|
if (!strcasecmp(cmd, "slp_tr")) {
|
||||||
|
int val;
|
||||||
|
|
||||||
|
if (n > 1)
|
||||||
|
return netio_printf(netio, "-bad argument\n");
|
||||||
|
val = get_num(netio, 1, &ret);
|
||||||
|
if (val < 0)
|
||||||
|
return ret;
|
||||||
|
if (val > 1)
|
||||||
|
return netio_printf(netio, "-bad argument\n");
|
||||||
|
if (atrf_slp_tr(dsc, n, val) < 0)
|
||||||
|
return netio_printf(netio, "-I/O error\n");
|
||||||
|
return netio_printf(netio, "+\n");
|
||||||
|
}
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,18 +144,13 @@ static int cmd_more(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
|
|||||||
return cmd_two(dsc, netio, cmd);
|
return cmd_two(dsc, netio, cmd);
|
||||||
if (!strcasecmp(cmd, "write"))
|
if (!strcasecmp(cmd, "write"))
|
||||||
return cmd_two(dsc, netio, cmd);
|
return cmd_two(dsc, netio, cmd);
|
||||||
|
if (!strcasecmp(cmd, "slp_tr"))
|
||||||
|
return cmd_two(dsc, netio, cmd);
|
||||||
|
|
||||||
n = get_num(netio, 1, &ret);
|
n = get_num(netio, 1, &ret);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (!strcasecmp(cmd, "slp_tr")) {
|
|
||||||
if (n > 1)
|
|
||||||
return netio_printf(netio, "-bad argument\n");
|
|
||||||
if (atrf_slp_tr(dsc, n) < 0)
|
|
||||||
return netio_printf(netio, "-I/O error\n");
|
|
||||||
return netio_printf(netio, "+\n");
|
|
||||||
}
|
|
||||||
if (!strcasecmp(cmd, "clkm")) {
|
if (!strcasecmp(cmd, "clkm")) {
|
||||||
if (n > 16)
|
if (n > 16)
|
||||||
return netio_printf(netio, "-bad argument\n");
|
return netio_printf(netio, "-bad argument\n");
|
||||||
|
@ -178,8 +178,7 @@ unsigned atben_sample(struct atrf_dsc *dsc)
|
|||||||
* high overhead, though, so we optimize it below.
|
* high overhead, though, so we optimize it below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
atrf_slp_tr(dsc, 1);
|
atrf_slp_tr(dsc, 1, 1);
|
||||||
atrf_slp_tr(dsc, 0);
|
|
||||||
while (i) {
|
while (i) {
|
||||||
if (atrf_interrupt(dsc))
|
if (atrf_interrupt(dsc))
|
||||||
break;
|
break;
|
||||||
|
@ -43,7 +43,7 @@ void atrf_reset_rf(struct atrf_dsc *dsc);
|
|||||||
enum atrf_chip_id atrf_identify(struct atrf_dsc *dsc);
|
enum atrf_chip_id atrf_identify(struct atrf_dsc *dsc);
|
||||||
|
|
||||||
int atrf_test_mode(struct atrf_dsc *dsc);
|
int atrf_test_mode(struct atrf_dsc *dsc);
|
||||||
int atrf_slp_tr(struct atrf_dsc *dsc, int on);
|
int atrf_slp_tr(struct atrf_dsc *dsc, int on, int pulse);
|
||||||
int atrf_set_clkm(struct atrf_dsc *dsc, int mhz);
|
int atrf_set_clkm(struct atrf_dsc *dsc, int mhz);
|
||||||
|
|
||||||
void atrf_reg_write(struct atrf_dsc *dsc, uint8_t reg, uint8_t value);
|
void atrf_reg_write(struct atrf_dsc *dsc, uint8_t reg, uint8_t value);
|
||||||
|
@ -355,7 +355,7 @@ static uint8_t atben_sram_read(void *handle, uint8_t addr)
|
|||||||
/* ----- SLP_TR ------------------------------------------------------------ */
|
/* ----- SLP_TR ------------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
static void atben_slp_tr(void *handle, int on)
|
static void atben_slp_tr(void *handle, int on, int pulse)
|
||||||
{
|
{
|
||||||
struct atben_dsc *dsc = handle;
|
struct atben_dsc *dsc = handle;
|
||||||
|
|
||||||
@ -363,6 +363,12 @@ static void atben_slp_tr(void *handle, int on)
|
|||||||
PDDATS = SLP_TR;
|
PDDATS = SLP_TR;
|
||||||
else
|
else
|
||||||
PDDATC = SLP_TR;
|
PDDATC = SLP_TR;
|
||||||
|
if (!pulse)
|
||||||
|
return;
|
||||||
|
if (on)
|
||||||
|
PDDATC = SLP_TR;
|
||||||
|
else
|
||||||
|
PDDATS = SLP_TR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -266,13 +266,13 @@ static void atnet_test_mode(void *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void atnet_slp_tr(void *handle, int on)
|
static void atnet_slp_tr(void *handle, int on, int pulse)
|
||||||
{
|
{
|
||||||
struct atnet_dsc *dsc = handle;
|
struct atnet_dsc *dsc = handle;
|
||||||
|
|
||||||
if (dsc->error)
|
if (dsc->error)
|
||||||
return;
|
return;
|
||||||
if (dialog(dsc, "SLP_TR %d", on) < 0)
|
if (dialog(dsc, "SLP_TR %d %d", on, pulse) < 0)
|
||||||
dsc->error = 1;
|
dsc->error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,11 +226,11 @@ int atrf_test_mode(struct atrf_dsc *dsc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int atrf_slp_tr(struct atrf_dsc *dsc, int on)
|
int atrf_slp_tr(struct atrf_dsc *dsc, int on, int pulse)
|
||||||
{
|
{
|
||||||
if (!dsc->driver->slp_tr)
|
if (!dsc->driver->slp_tr)
|
||||||
return 0;
|
return 0;
|
||||||
dsc->driver->slp_tr(dsc->handle, on);
|
dsc->driver->slp_tr(dsc->handle, on, pulse);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ void cw_test_end(struct atrf_dsc *dsc)
|
|||||||
break;
|
break;
|
||||||
case artf_at86rf231:
|
case artf_at86rf231:
|
||||||
usleep(2); /* table 7-1: tTR12(typ) = 1 us */
|
usleep(2); /* table 7-1: tTR12(typ) = 1 us */
|
||||||
atrf_slp_tr(dsc, 1);
|
atrf_slp_tr(dsc, 1, 0);
|
||||||
usleep(10); /* table 7-1: tTR3(typ) doesn't really apply */
|
usleep(10); /* table 7-1: tTR3(typ) doesn't really apply */
|
||||||
atrf_slp_tr(dsc, 0);
|
atrf_slp_tr(dsc, 0, 0);
|
||||||
usleep(500); /* table 7-1: tTR2(typ) = 380 */
|
usleep(500); /* table 7-1: tTR2(typ) = 380 */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -27,7 +27,7 @@ struct atrf_driver {
|
|||||||
void (*reset)(void *dsc);
|
void (*reset)(void *dsc);
|
||||||
void (*reset_rf)(void *dsc);
|
void (*reset_rf)(void *dsc);
|
||||||
void (*test_mode)(void *dsc);
|
void (*test_mode)(void *dsc);
|
||||||
void (*slp_tr)(void *dsc, int on);
|
void (*slp_tr)(void *dsc, int on, int pulse);
|
||||||
int (*set_clkm)(void *dsc, int mhz);
|
int (*set_clkm)(void *dsc, int mhz);
|
||||||
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value);
|
void (*reg_write)(void *dsc, uint8_t reg, uint8_t value);
|
||||||
uint8_t (*reg_read)(void *dsc, uint8_t reg);
|
uint8_t (*reg_read)(void *dsc, uint8_t reg);
|
||||||
|
Loading…
Reference in New Issue
Block a user