still trying to get control OUT data working

This commit is contained in:
Michael Ossmann
2013-02-22 19:12:51 -07:00
parent 3351a390ba
commit 6fb0aa2877

View File

@ -370,12 +370,11 @@ usb_request_status_t usb_vendor_request_read_rffc5071(
usb_request_status_t usb_vendor_request_write_spiflash( usb_request_status_t usb_vendor_request_write_spiflash(
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
{ {
uint32_t addr; static uint32_t addr;
uint16_t len; static uint16_t len;
uint8_t spiflash_buffer[0xffff]; static uint8_t spiflash_buffer[0xffff];
if (stage == USB_TRANSFER_STAGE_DATA) { if (stage == USB_TRANSFER_STAGE_SETUP) {
//FIXME this never seems to get called with USB_TRANSFER_STAGE_DATA
addr = (endpoint->setup.value << 16) | endpoint->setup.index; addr = (endpoint->setup.value << 16) | endpoint->setup.index;
len = endpoint->setup.length; len = endpoint->setup.length;
if ((len > W25Q80BV_NUM_BYTES) || (addr > W25Q80BV_NUM_BYTES) if ((len > W25Q80BV_NUM_BYTES) || (addr > W25Q80BV_NUM_BYTES)
@ -383,10 +382,13 @@ usb_request_status_t usb_vendor_request_write_spiflash(
return USB_REQUEST_STATUS_STALL; return USB_REQUEST_STATUS_STALL;
} else { } else {
usb_endpoint_schedule(endpoint->out, &spiflash_buffer[0], len); usb_endpoint_schedule(endpoint->out, &spiflash_buffer[0], len);
return USB_REQUEST_STATUS_OK;
}
} else if (stage == USB_TRANSFER_STAGE_DATA) {
//FIXME still trying to make this work
w25q80bv_program(addr, len, &spiflash_buffer[0]); w25q80bv_program(addr, len, &spiflash_buffer[0]);
usb_endpoint_schedule_ack(endpoint->in); usb_endpoint_schedule_ack(endpoint->in);
return USB_REQUEST_STATUS_OK; return USB_REQUEST_STATUS_OK;
}
} else { } else {
return USB_REQUEST_STATUS_OK; return USB_REQUEST_STATUS_OK;
} }