mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-12-23 16:25:30 +02:00
atusb/fw/ep0.c: fixed ATUSB_SRAM_READ
- ep0.c (my_setup): ATUSB_SRAM_READ is FROM_DEV, not TO_DEV - ep0.c (my_setup): in ATUSB_SRAM_READ, write setup->wLength bytes, not "size" (which is uninitialized)
This commit is contained in:
parent
6b447f805c
commit
b733431847
@ -169,7 +169,7 @@ static int my_setup(const struct setup_request *setup)
|
|||||||
size = setup->wLength+2;
|
size = setup->wLength+2;
|
||||||
usb_recv(&eps[0], buf+2, setup->wLength, do_buf_write, NULL);
|
usb_recv(&eps[0], buf+2, setup->wLength, do_buf_write, NULL);
|
||||||
return 1;
|
return 1;
|
||||||
case ATUSB_TO_DEV(ATUSB_SRAM_READ):
|
case ATUSB_FROM_DEV(ATUSB_SRAM_READ):
|
||||||
debug("ATUSB_SRAM_READ\n");
|
debug("ATUSB_SRAM_READ\n");
|
||||||
if (setup->wIndex > SRAM_SIZE)
|
if (setup->wIndex > SRAM_SIZE)
|
||||||
return 0;
|
return 0;
|
||||||
@ -178,10 +178,10 @@ static int my_setup(const struct setup_request *setup)
|
|||||||
spi_begin();
|
spi_begin();
|
||||||
spi_send(AT86RF230_SRAM_READ);
|
spi_send(AT86RF230_SRAM_READ);
|
||||||
spi_send(setup->wIndex);
|
spi_send(setup->wIndex);
|
||||||
for (i = 0; i != size; i++)
|
for (i = 0; i != setup->wLength; i++)
|
||||||
buf[i] = spi_recv();
|
buf[i] = spi_recv();
|
||||||
spi_end();
|
spi_end();
|
||||||
usb_send(&eps[0], buf, size, NULL, NULL);
|
usb_send(&eps[0], buf, setup->wLength, NULL, NULL);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user