1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-26 08:04:14 +02:00

Added interrupt polling support for atusb.

- atrf/fw/include/atspi/ep0.h enum atspi_requests), atrf/fw/atspi/ep0.c
  (my_setup): new command ATSPI_POLL_INT to poll IRQ_RF
- atrf/fw/atspi/ep0.c (my_setup): ATSPI_BUILD sent one byte too many
- tools/lib/atusb.c (atusd_interrupt, atusb_driver): implemented interrupt
  polling
- tools/lib/atusd.c: added section title for the RF interrupt function
This commit is contained in:
Werner Almesberger 2010-09-09 20:22:45 -03:00
parent 4df6d2c2f9
commit b6a80ba3dd
4 changed files with 39 additions and 2 deletions

View File

@ -126,7 +126,7 @@ static __bit my_setup(struct setup_request *setup) __reentrant
buf[BUILD_OFFSET-1] = ' ';
for (size = 0; build_date[size]; size++)
buf[BUILD_OFFSET+size] = build_date[size];
size += BUILD_OFFSET-i+1;
size += BUILD_OFFSET-i;
SDCC_FORCE_EVAL(uint8_t, setup->bRequest);
if (size > setup->wLength)
return 0;
@ -143,6 +143,14 @@ static __bit my_setup(struct setup_request *setup) __reentrant
reset_rf();
return 1;
case ATSPI_FROM_DEV(ATSPI_POLL_INT):
debug("ATSPI_POLL_INT\n");
if (setup->wLength < 1)
return 0;
*buf = IRQ_RF;
usb_send(&ep0, buf, 1, NULL, NULL);
return 1;
case ATSPI_TO_DEV(ATSPI_REG_WRITE):
debug("ATSPI_REG_WRITE\n");
nSS = 0;

View File

@ -21,7 +21,8 @@
* ->host ATSPI_BUILD - - #bytes
* host-> ATSPI_RESET - - 0
*
* host-> ATSPI_RF_RESET - -
* host-> ATSPI_RF_RESET - - 0
* ->host ATSPI_POLL_INT - - 1
*
* host-> ATSPI_REG_WRITE value addr 0
* ->host ATSPI_REG_READ - addr 1
@ -63,6 +64,7 @@ enum atspi_requests {
ATSPI_BUILD,
ATSPI_RESET,
ATSPI_RF_RESET = 0x10,
ATSPI_POLL_INT,
ATSPI_REG_WRITE = 0x20,
ATSPI_REG_READ,
ATSPI_BUF_WRITE,

View File

@ -187,6 +187,29 @@ static int atusb_buf_read(void *dsc, void *buf, int size)
}
/* ----- RF interrupt ------------------------------------------------------ */
static int atusd_interrupt(void *dsc)
{
usb_dev_handle *dev = dsc;
uint8_t buf;
int res;
if (error)
return -1;
res = usb_control_msg(dev, FROM_DEV, ATSPI_POLL_INT, 0, 0,
(void *) &buf, 1, 1000);
if (res < 0) {
fprintf(stderr, "ATSPI_POLL_INT: %d\n", res);
error = 1;
}
return buf;
}
/* ----- driver interface -------------------------------------------------- */
@ -202,4 +225,5 @@ struct atspi_driver atusb_driver = {
.reg_read = atusb_reg_read,
.buf_write = atusb_buf_write,
.buf_read = atusb_buf_read,
.interrupt = atusd_interrupt,
};

View File

@ -300,6 +300,9 @@ static int atusd_buf_read(void *handle, void *buf, int size)
}
/* ----- RF interrupt ------------------------------------------------------ */
static int atusd_interrupt(void *handle)
{
struct atusd_dsc *dsc = handle;