From d0fb1a8992d1cf83c558c87ae4dedfae063ddc8f Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 20 Jun 2011 21:03:52 -0300 Subject: [PATCH] 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 --- tools/atrf-proxy/PROTOCOL | 4 ---- tools/atrf-proxy/atrf-proxy.c | 10 ---------- tools/include/atrf.h | 1 - tools/lib/atben.c | 1 - tools/lib/atnet.c | 23 ----------------------- tools/lib/atrf.c | 7 ------- tools/lib/atusb-common.c | 21 --------------------- tools/lib/atusb-common.h | 1 - tools/lib/atusb-spi.c | 1 - tools/lib/atusb.c | 1 - tools/lib/driver.h | 1 - 11 files changed, 71 deletions(-) diff --git a/tools/atrf-proxy/PROTOCOL b/tools/atrf-proxy/PROTOCOL index 2a0cbd6..f1a8866 100644 --- a/tools/atrf-proxy/PROTOCOL +++ b/tools/atrf-proxy/PROTOCOL @@ -56,10 +56,6 @@ GETRAM addr +value -message -POLL -+0|1 --message - WAIT timeout_ms +value -message diff --git a/tools/atrf-proxy/atrf-proxy.c b/tools/atrf-proxy/atrf-proxy.c index d815df6..fbdf344 100644 --- a/tools/atrf-proxy/atrf-proxy.c +++ b/tools/atrf-proxy/atrf-proxy.c @@ -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"); } diff --git a/tools/include/atrf.h b/tools/include/atrf.h index c83ee50..70d0320 100644 --- a/tools/include/atrf.h +++ b/tools/include/atrf.h @@ -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 */ diff --git a/tools/lib/atben.c b/tools/lib/atben.c index 5a0cc11..33e4bca 100644 --- a/tools/lib/atben.c +++ b/tools/lib/atben.c @@ -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, }; diff --git a/tools/lib/atnet.c b/tools/lib/atnet.c index 1270c72..1ab03b3 100644 --- a/tools/lib/atnet.c +++ b/tools/lib/atnet.c @@ -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, }; diff --git a/tools/lib/atrf.c b/tools/lib/atrf.c index aaf1c15..15f1b07 100644 --- a/tools/lib/atrf.c +++ b/tools/lib/atrf.c @@ -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 ? diff --git a/tools/lib/atusb-common.c b/tools/lib/atusb-common.c index f5d720f..bcb588e 100644 --- a/tools/lib/atusb-common.c +++ b/tools/lib/atusb-common.c @@ -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: diff --git a/tools/lib/atusb-common.h b/tools/lib/atusb-common.h index 8439cc2..6569665 100644 --- a/tools/lib/atusb-common.h +++ b/tools/lib/atusb-common.h @@ -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); diff --git a/tools/lib/atusb-spi.c b/tools/lib/atusb-spi.c index f28998f..e913957 100644 --- a/tools/lib/atusb-spi.c +++ b/tools/lib/atusb-spi.c @@ -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, }; diff --git a/tools/lib/atusb.c b/tools/lib/atusb.c index 5961d96..e035718 100644 --- a/tools/lib/atusb.c +++ b/tools/lib/atusb.c @@ -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, }; diff --git a/tools/lib/driver.h b/tools/lib/driver.h index 727f138..c82c46b 100644 --- a/tools/lib/driver.h +++ b/tools/lib/driver.h @@ -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); };