still trying to get control OUT data working
This commit is contained in:
@ -370,12 +370,11 @@ usb_request_status_t usb_vendor_request_read_rffc5071(
|
||||
usb_request_status_t usb_vendor_request_write_spiflash(
|
||||
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
||||
{
|
||||
uint32_t addr;
|
||||
uint16_t len;
|
||||
uint8_t spiflash_buffer[0xffff];
|
||||
static uint32_t addr;
|
||||
static uint16_t len;
|
||||
static uint8_t spiflash_buffer[0xffff];
|
||||
|
||||
if (stage == USB_TRANSFER_STAGE_DATA) {
|
||||
//FIXME this never seems to get called with USB_TRANSFER_STAGE_DATA
|
||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||
addr = (endpoint->setup.value << 16) | endpoint->setup.index;
|
||||
len = endpoint->setup.length;
|
||||
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;
|
||||
} else {
|
||||
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]);
|
||||
usb_endpoint_schedule_ack(endpoint->in);
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
} else {
|
||||
return USB_REQUEST_STATUS_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user