enable bulk sram transfers

This commit is contained in:
David Voswinkel 2009-06-30 23:40:18 +02:00
parent 656192fc14
commit 7ef03b498f
4 changed files with 18 additions and 16 deletions

Binary file not shown.

View File

@ -170,7 +170,7 @@ int main(int argc, char **argv)
addr = 0x000000;
cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT,
USB_UPLOAD_INIT, BANK_SIZE_SHIFT , 0, NULL, 0, 5000);
USB_BULK_UPLOAD_INIT, BANK_SIZE_SHIFT , 0, NULL, 0, 5000);
if (cnt < 0) {
fprintf(stderr, "USB error: %s\n", usb_strerror());
@ -188,7 +188,7 @@ int main(int argc, char **argv)
cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE |
USB_ENDPOINT_OUT, USB_UPLOAD_ADDR, addr_hi,
USB_ENDPOINT_OUT, USB_BULK_UPLOAD_ADDR, addr_hi,
addr_lo, (char *) read_buffer + step,
SEND_BUFFER_SIZE, 5000);
@ -211,8 +211,6 @@ int main(int argc, char **argv)
}
}
}
if (bank == 1)
break;
}
bank = 0;

View File

@ -103,10 +103,6 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
* -------------------------------------------------------------------------
*/
} else if (rq->bRequest == USB_BULK_UPLOAD_INIT) {
if (req_state != REQ_STATUS_IDLE){
debug(DEBUG_USB,"USB_BULK_UPLOAD_INIT: ERROR state is not REQ_STATUS_IDLE\n");
return 0;
}
req_bank = 0;
rx_remaining = 0;
@ -118,16 +114,19 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
*/
} else if (rq->bRequest == USB_BULK_UPLOAD_ADDR) {
if (req_state != REQ_STATUS_IDLE){
debug(DEBUG_USB,"USB_BULK_UPLOAD_ADDR: ERROR state is not REQ_STATUS_IDLE\n");
return 0;
}
req_state = REQ_STATUS_BULK_UPLOAD;
req_addr = rq->wValue.word;
req_addr = req_addr << 16;
req_addr = req_addr | rq->wIndex.word;
debug(DEBUG_USB,"USB_BULK_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx \n",req_bank,req_addr);
ret_len = 0;
sram_bulk_write_start(req_addr);
//debug(DEBUG_USB,"USB_BULK_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx \n",req_bank,req_addr);
rx_remaining = rq->wLength.word;
if (req_addr && req_addr % req_bank_size == 0) {
debug(DEBUG_USB,"USB_BULK_UPLOAD_ADDR: req_bank=0x%02x addr= 0x%08lx \n",
req_bank, req_addr);
req_bank++;
}
ret_len = USB_MAX_TRANS;
/*
* -------------------------------------------------------------------------
@ -336,10 +335,14 @@ int main(void)
printf("Use Snes lowrom\n");
snes_lorom();
printf("IRQ off\n");
snes_irq_off();
printf("Activate Snes bus\n");
snes_bus_active();
while(1);
while(1);
return 0;
}

View File

@ -32,6 +32,7 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len)
{
uint8_t *ptr;
uint8_t i;
if (len > rx_remaining) {
printf("ERROR:usbFunctionWrite more data than expected remain: %i len: %i\n",
rx_remaining, len);
@ -55,7 +56,7 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len)
i = len;
while(i--){
sram_bulk_write(*ptr++);
counter_up();
sram_bulk_write_next();
}
}
return len;