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

tools/: the great removal of atrf_interrupt

- atrf-proxy/PROTOCOL, atrf-proxy/atrf-proxy.c (cmd_zero): removed the
  POLL command
- lib/atben.c (atben_driver): don't export atben_interrupt anymore (we
  still use it internally)
- lib/atnet.c (atnet_interrupt, atnet_driver): removed atnet_interrupt
- lib/atusb-common.h (atusb_interrupt), lib/atusb-common.h
  (atusb_interrupt), lib/atusb-spi.c (atusb_spi_driver),
  lib/atusb.c (atusb_driver): removed atusb_interrupt
- lib/driver.h (struct atrf_driver): removed "interrupt"
- include/atrf.h (atrf_interrupt), lib/atrf.c (atrf_interrupt): removed
This commit is contained in:
Werner Almesberger 2011-06-20 21:03:52 -03:00
parent 12fef1b196
commit d0fb1a8992
11 changed files with 0 additions and 71 deletions

View File

@ -56,10 +56,6 @@ GETRAM addr
+value
-message
POLL
+0|1
-message
WAIT timeout_ms
+value
-message

View File

@ -196,8 +196,6 @@ static int cmd_more(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
static int cmd_zero(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
{
int res;
if (!strcasecmp(cmd, "spec")) {
const char *spec = atrf_driver_spec(dsc, 1);
@ -231,14 +229,6 @@ static int cmd_zero(struct atrf_dsc *dsc, struct netio *netio, const char *cmd)
buf[got] = '\n';
return netio_write(netio, buf, got+1);
}
if (!strcasecmp(cmd, "poll")) {
res = atrf_interrupt(dsc);
if (res < 0)
return netio_printf(netio, "-I/O error\n");
if (!res)
usleep(2*1000);
return netio_printf(netio, "+%d\n", res);
}
return netio_printf(netio, "-unrecognized command\n");
}

View File

@ -55,7 +55,6 @@ int atrf_buf_read(struct atrf_dsc *dsc, void *buf, int size);
void atrf_sram_write(struct atrf_dsc *dsc, uint8_t addr, uint8_t value);
uint8_t atrf_sram_read(struct atrf_dsc *dsc, uint8_t addr);
int atrf_interrupt(struct atrf_dsc *dsc);
int atrf_interrupt_wait(struct atrf_dsc *dsc, int timeout_ms);
#endif /* !ATRF_H */

View File

@ -436,6 +436,5 @@ struct atrf_driver atben_driver = {
.buf_read = atben_buf_read,
.sram_write = atben_sram_write,
.sram_read = atben_sram_read,
.interrupt = atben_interrupt,
.interrupt_wait = atben_interrupt_wait,
};

View File

@ -441,28 +441,6 @@ static uint8_t atnet_sram_read(void *handle, uint8_t addr)
/* ----- RF interrupt ------------------------------------------------------ */
static int atnet_interrupt(void *handle)
{
struct atnet_dsc *dsc = handle;
unsigned long value;
char *end;
if (dsc->error)
return -1;
if (dialog(dsc, "POLL") < 0) {
dsc->error = 1;
return -1;
}
value = strtoul(dsc->reply+1, &end, 0);
if (*end || value > 1) {
fprintf(stderr, "invalid response \"%s\"\n", dsc->reply+1);
dsc->error = 1;
return -1;
}
return value;
}
int atnet_interrupt_wait(void *handle, int timeout_ms)
{
struct atnet_dsc *dsc = handle;
@ -515,6 +493,5 @@ struct atrf_driver atnet_driver = {
.buf_read = atnet_buf_read,
.sram_write = atnet_sram_write,
.sram_read = atnet_sram_read,
.interrupt = atnet_interrupt,
.interrupt_wait = atnet_interrupt_wait,
};

View File

@ -318,13 +318,6 @@ uint8_t atrf_sram_read(struct atrf_dsc *dsc, uint8_t addr)
}
int atrf_interrupt(struct atrf_dsc *dsc)
{
return
dsc->driver->interrupt ? dsc->driver->interrupt(dsc->handle) : 1;
}
int atrf_interrupt_wait(struct atrf_dsc *dsc, int timeout_ms)
{
return dsc->driver->interrupt_wait ?

View File

@ -174,27 +174,6 @@ void atusb_slp_tr(void *handle, int on, int pulse)
/* ----- RF interrupt ------------------------------------------------------ */
int atusb_interrupt(void *handle)
{
struct atusb_dsc *dsc = handle;
uint8_t buf;
int res;
if (dsc->error)
return -1;
res = usb_control_msg(dsc->dev, FROM_DEV, ATUSB_POLL_INT, 0, 0,
(void *) &buf, 1, 1000);
if (res < 0) {
fprintf(stderr, "ATUSB_POLL_INT: %d\n", res);
dsc->error = 1;
return -1;
}
return buf;
}
/*
* The logic here is a bit tricky. Assuming that we can get a lot of
* interrupts, system state can change as follows:

View File

@ -33,7 +33,6 @@ void atusb_reset(void *handle);
void atusb_reset_rf(void *handle);
void atusb_test_mode(void *handle);
void atusb_slp_tr(void *handle, int on, int pulse);
int atusb_interrupt(void *handle);
int atusb_interrupt_wait(void *handle, int timeout_ms);
int atusb_set_clkm(void *handle, int mhz);

View File

@ -167,6 +167,5 @@ struct atrf_driver atusb_spi_driver = {
.buf_read = atusb_spi_buf_read,
.sram_write = atusb_spi_sram_write,
.sram_read = atusb_spi_sram_read,
.interrupt = atusb_interrupt,
.interrupt_wait = atusb_interrupt_wait,
};

View File

@ -161,6 +161,5 @@ struct atrf_driver atusb_driver = {
.buf_read = atusb_buf_read,
.sram_write = atusb_sram_write,
.sram_read = atusb_sram_read,
.interrupt = atusb_interrupt,
.interrupt_wait = atusb_interrupt_wait,
};

View File

@ -35,7 +35,6 @@ struct atrf_driver {
int (*buf_read)(void *dsc, void *buf, int size);
void (*sram_write)(void *dsc, uint8_t addr, uint8_t value);
uint8_t (*sram_read)(void *dsc, uint8_t addr);
int (*interrupt)(void *dsc);
int (*interrupt_wait)(void *dsc, int timeout_ms);
};