diff --git a/avr/usbload/commandline/snesuploader b/avr/usbload/commandline/snesuploader index d43d4cf..6df3529 100755 Binary files a/avr/usbload/commandline/snesuploader and b/avr/usbload/commandline/snesuploader differ diff --git a/avr/usbload/commandline/snesuploader.c b/avr/usbload/commandline/snesuploader.c index c31ba8c..e968d4b 100644 --- a/avr/usbload/commandline/snesuploader.c +++ b/avr/usbload/commandline/snesuploader.c @@ -16,9 +16,10 @@ #define READ_BUFFER_SIZE 1024 -#define SEND_BUFFER_SIZE 128 +#define SEND_BUFFER_SIZE 0x200 #define BUFFER_CRC (1024 * 32) #define BANK_SIZE (1<<15) +#define BANK_SIZE_SHIFT 15 #include #include @@ -31,6 +32,7 @@ #include "../usbconfig.h" /* device's VID/PID and names */ + void dump_packet(uint32_t addr, uint32_t len, uint8_t * packet) { uint16_t i, @@ -171,19 +173,23 @@ int main(int argc, char **argv) usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, - USB_UPLOAD_INIT, 0, 0, NULL, 0, 5000); + USB_UPLOAD_INIT, BANK_SIZE_SHIFT , 0, NULL, 0, 5000); while ((cnt = fread(read_buffer, READ_BUFFER_SIZE, 1, fp)) > 0) { - for (step = 0; step < READ_BUFFER_SIZE; step += SEND_BUFFER_SIZE) { + for (step = 0; step <= READ_BUFFER_SIZE; step += SEND_BUFFER_SIZE) { addr_lo = addr & 0xffff; addr_hi = (addr >> 16) & 0xff; + //memset(read_buffer, 0xff, READ_BUFFER_SIZE); cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, USB_UPLOAD_ADDR, addr_hi, addr_lo, (char *) read_buffer + step, SEND_BUFFER_SIZE, 5000); - + if (addr%0x1000==0){ + printf ("bank=0x%02x addr=0x%08x\n", bank, addr); + } + if (cnt < 0) { fprintf(stderr, "USB error: %s\n", usb_strerror()); exit(-1); @@ -193,24 +199,29 @@ int main(int argc, char **argv) #endif addr += SEND_BUFFER_SIZE; } - memcpy(crc_buffer + cnt_crc, read_buffer, READ_BUFFER_SIZE); cnt_crc += READ_BUFFER_SIZE; if (cnt_crc >= BANK_SIZE) { crc = do_crc(crc_buffer, BANK_SIZE); - printf - ("Addr: 0x%06x Bank: 0x%02x HiAddr: 0x%02x LoAddr: 0x%04x Crc: 0x%04x\n", - addr, bank, addr_hi, addr_lo, crc); + printf ("bank=0x%02x crc=0x%04x\n", bank, crc); memset(crc_buffer, 0, BUFFER_CRC); bank++; cnt_crc = 0; } } + + /* + cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, USB_CRC, addr_hi, addr_lo, NULL, 0, 5000); - + */ + cnt = usb_control_msg(handle, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | + USB_ENDPOINT_OUT, USB_SNES_BOOT, 0, 0, NULL, + 0, 5000); + if (cnt < 1) { if (cnt < 0) { diff --git a/avr/usbload/config.h b/avr/usbload/config.h index ee530ed..0d9e277 100644 --- a/avr/usbload/config.h +++ b/avr/usbload/config.h @@ -3,10 +3,10 @@ #define __config_h__ #define DEBUG_USB 1 -#undef DEBUG_USB_RAW 1 -#undef DEBUG_SRAM 1 -#undef DEBUG_SRAM_RAW -#undef DEBUG_SREG +#define DEBUG_USB_RAW 1 +#define DEBUG_SRAM 0 +#define DEBUG_SRAM_RAW 0 +#define DEBUG_SREG 0 #define DEBUG 1 @@ -15,11 +15,12 @@ #define REQ_STATUS_BULK_UPLOAD 0x03 #define REQ_STATUS_BULK_NEXT 0x04 #define REQ_STATUS_CRC 0x05 +#define REQ_STATUS_BOOT 0x06 #define USB_MAX_TRANS 0xff #define USB_CRC_CHECK 0x01 -#define TRANSFER_BUFFER_SIZE 0xff +#define TRANSFER_BUFFER_SIZE 0x200 #endif diff --git a/avr/usbload/crc.c b/avr/usbload/crc.c index 1e5e968..1fae813 100644 --- a/avr/usbload/crc.c +++ b/avr/usbload/crc.c @@ -41,23 +41,50 @@ uint16_t do_crc_update(uint16_t crc, uint8_t * data, uint16_t size) } -void crc_check_memory(uint32_t top_addr,uint8_t *buffer) +void crc_check_bulk_memory(uint32_t bottom_addr,uint32_t top_addr) +{ + uint16_t crc = 0; + uint32_t addr = 0; + uint8_t req_bank = 0; + sram_bulk_read_start(bottom_addr); + for (addr = bottom_addr; addr < top_addr; addr++) { + if (addr && addr % 0x8000 == 0) { + printf("crc_check_bulk: bank=0x%02x addr=0x%08lx crc=0x%04x\n", + req_bank,addr,crc); + req_bank++; + crc = 0; + } + crc = crc_xmodem_update(crc, sram_bulk_read()); + sram_bulk_read_next(); + } + sram_bulk_read_end(); + if (addr % 0x8000 == 0) + printf("crc_check_bulk: bank=0x%02x addr=0x%08lx crc=0x%04x\n", + req_bank,addr,crc); + +} + + + +void crc_check_memory(uint32_t bottom_addr,uint32_t top_addr,uint8_t *buffer) { uint16_t crc = 0; uint32_t addr; uint8_t req_bank = 0; - for (addr = 0x000000; addr < top_addr; addr += TRANSFER_BUFFER_SIZE) { - sram_read_buffer(addr, buffer, TRANSFER_BUFFER_SIZE); - crc = do_crc_update(crc, buffer, TRANSFER_BUFFER_SIZE); - if (addr && addr % 32768 == 0) { - printf("crc_check_memory: req_bank: 0x%02x Addr: 0x%08lx CRC: 0x%04x\n", - req_bank, addr, crc); + for (addr = bottom_addr; addr < top_addr; addr += TRANSFER_BUFFER_SIZE) { + if (addr && addr % 0x8000 == 0) { + printf("crc_check_memory: bank=0x%02x addr=0x%08lx crc=0x%04x\n", + req_bank,addr,crc); req_bank++; crc = 0; } + sram_read_buffer(addr, buffer, TRANSFER_BUFFER_SIZE); + crc = do_crc_update(crc, buffer, TRANSFER_BUFFER_SIZE); } } + + uint16_t crc_check_memory_range(uint32_t start_addr, uint32_t size,uint8_t *buffer) { uint16_t crc = 0; @@ -66,8 +93,5 @@ uint16_t crc_check_memory_range(uint32_t start_addr, uint32_t size,uint8_t *buff sram_read_buffer(addr, buffer, TRANSFER_BUFFER_SIZE); crc = do_crc_update(crc, buffer, TRANSFER_BUFFER_SIZE); } -#if DEBUG_USB - printf("crc_check_memory_range: Addr: 0x%08lx CRC: 0x%04x\n", addr, crc); -#endif - return crc; + return crc; } diff --git a/avr/usbload/crc.h b/avr/usbload/crc.h index a09b75d..a563156 100644 --- a/avr/usbload/crc.h +++ b/avr/usbload/crc.h @@ -2,8 +2,9 @@ #include -uint16_t crc_xmodem_update (uint16_t crc, uint8_t data); +uint16_t crc_xmodem_update(uint16_t crc, uint8_t data); uint16_t do_crc(uint8_t * data,uint16_t size); uint16_t do_crc_update(uint16_t crc,uint8_t * data,uint16_t size); -void crc_check_memory(uint32_t top_addr,uint8_t *buffer); +void crc_check_memory(uint32_t bottom_addr,uint32_t top_addr,uint8_t *buffer); uint16_t crc_check_memory_range(uint32_t start_addr, uint32_t size,uint8_t *buffer); +void crc_check_bulk_memory(uint32_t bottom_addr,uint32_t top_addr); diff --git a/avr/usbload/main.c b/avr/usbload/main.c index e9be090..46e50f1 100644 --- a/avr/usbload/main.c +++ b/avr/usbload/main.c @@ -21,7 +21,7 @@ uint8_t read_buffer[TRANSFER_BUFFER_SIZE]; uint32_t req_addr = 0; uint32_t req_size; uint8_t req_bank; -uint32_t req_bank_size; +uint16_t req_bank_size; uint8_t req_state = REQ_STATUS_IDLE; uint8_t rx_remaining = 0; uint8_t tx_remaining = 0; @@ -52,8 +52,9 @@ usbMsgLen_t usbFunctionSetup(uchar data[8]) rx_remaining = 0; req_bank_size = 1 << rq->wValue.word; sync_errors = 0; + crc = 0; #if DEBUG_USB - printf("USB_UPLOAD_INIT: bank_size=%li\n", req_bank_size); + printf("USB_UPLOAD_INIT: bank_size=0x%x\n", req_bank_size); #endif /* * ------------------------------------------------------------------------- @@ -75,11 +76,20 @@ usbMsgLen_t usbFunctionSetup(uchar data[8]) } rx_remaining = rq->wLength.word; ret_len = USB_MAX_TRANS; +#if DEBUG_USB + if (req_addr && (req_addr % 0x1000) == 0) { + + printf("USB_UPLOAD_ADDR: bank=0x%02x addr=0x%08lx\n", + req_bank, req_addr); + crc_check_bulk_memory(req_addr - 0x1000,req_addr); + + } +#endif if (req_addr && req_addr % req_bank_size == 0) { #if DEBUG_USB - printf("USB_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx \n", -#endif + printf("USB_UPLOAD_ADDR: req_bank=0x%02x addr=0x%08lx\n", req_bank, req_addr); +#endif req_bank++; } ret_len = USB_MAX_TRANS; @@ -108,10 +118,10 @@ usbMsgLen_t usbFunctionSetup(uchar data[8]) req_bank = 0; rx_remaining = 0; - req_bank_size = 1 << rq->wValue.word; + req_bank_size = (1 << rq->wValue.word) & 0xffff; sync_errors = 0; #if DEBUG_USB - printf("USB_BULK_UPLOAD_INIT: bank_size=%li\n", req_bank_size); + printf("USB_BULK_UPLOAD_INIT: bank_size=0x%x\n", req_bank_size); #endif /* * ------------------------------------------------------------------------- @@ -189,15 +199,20 @@ usbMsgLen_t usbFunctionSetup(uchar data[8]) req_addr = req_addr << 16; req_addr = req_addr | rq->wIndex.word; #if DEBUG_USB - printf("USB_CRC: addr=0x%lx \n", req_addr); + printf("USB_CRC: addr=0x%08lx \n", req_addr); #endif -#if USB_CRC_CHECK - cli(); - crc_check_memory(req_addr,read_buffer); - sei(); + crc_check_bulk_memory(0x000000,req_addr); + ret_len = 0; +/* + * ------------------------------------------------------------------------- + */ + } else if (rq->bRequest == USB_SNES_BOOT) { + req_state = REQ_STATUS_BOOT; +#if DEBUG_USB + printf("USB_SNES_BOOT: "); + ret_len = 0; #endif - /* * ------------------------------------------------------------------------- */ @@ -247,7 +262,6 @@ void test_read_write(){ while (addr++ <= 0x0000ff){ sram_write(addr,i++); } - addr = 0x000000; while (addr++ <= 0x0000ff){ printf("read addr=0x%08lx %x\n",addr,sram_read(addr)); @@ -279,19 +293,43 @@ void test_bulk_read_write(){ sram_bulk_read_end(); } + +void test_non_zero_memory(uint32_t bottom_addr,uint32_t top_addr) +{ + uint32_t addr = 0; + uint8_t c; + sram_bulk_read_start(bottom_addr); + for (addr = bottom_addr; addr < top_addr; addr++) { + c = sram_bulk_read(); + if (c!=0xff) + printf("addr=0x%08lx c=0x%x\n",addr,c); + sram_bulk_read_next(); + } + sram_bulk_read_end(); +} + + + +void test_crc(){ + printf("test_crc: clear\n"); + avr_bus_active(); + sram_bulk_set(0x000000,0x10000,0xff); + printf("test_crc: crc\n"); + crc_check_bulk_memory(0x000000,0x10000); + printf("test_crc: check\n"); + test_non_zero_memory(0x000000,0x10000); +} + int main(void) { uint8_t i; - uint32_t addr; uart_init(); stdout = &uart_stdout; system_init(); printf("Sytem Init\n"); - - //while(1); - + avr_bus_active(); usbInit(); printf("USB Init\n"); @@ -312,9 +350,23 @@ int main(void) printf("USB connect\n"); sei(); printf("USB poll\n"); - for (;;) { /* main event loop */ + while (req_state != REQ_STATUS_BOOT){ usbPoll(); } + printf("USB poll done\n"); + usbDeviceDisconnect(); + printf("USB disconnect\n"); + crc_check_bulk_memory(0x000000,0x80000); + + printf("Disable snes WR\n"); + snes_wr_disable(); + printf("Use Snes lowrom\n"); + snes_lorom(); + printf("Activate Snes bus\n"); + snes_bus_active(); + + + while(1); return 0; } diff --git a/avr/usbload/requests.h b/avr/usbload/requests.h index 9de0e80..892144a 100644 --- a/avr/usbload/requests.h +++ b/avr/usbload/requests.h @@ -29,5 +29,6 @@ #define USB_BULK_UPLOAD_ADDR 7 #define USB_BULK_UPLOAD_NEXT 8 #define USB_BULK_UPLOAD_END 9 +#define USB_SNES_BOOT 10 #endif /* __REQUESTS_H_INCLUDED__ */ diff --git a/avr/usbload/sram.c b/avr/usbload/sram.c index 706a7a8..65f4a7e 100644 --- a/avr/usbload/sram.c +++ b/avr/usbload/sram.c @@ -66,18 +66,18 @@ void system_init(void) void sreg_set(uint32_t addr) { uint8_t i = 24; -#ifdef DEBUG_SREG +#if DEBUG_SREG printf("sreg_set: addr=0x%08lx",addr); #endif while(i--) { if ((addr & ( 1L << i))){ -#ifdef DEBUG_SREG +#if DEBUG_SREG printf("1"); #endif AVR_ADDR_SER_PORT |= ( 1 << AVR_ADDR_SER_PIN); } else { AVR_ADDR_SER_PORT &= ~( 1 << AVR_ADDR_SER_PIN); -#ifdef DEBUG_SREG +#if DEBUG_SREG printf("0"); #endif @@ -85,7 +85,7 @@ void sreg_set(uint32_t addr) AVR_ADDR_SCK_PORT |= (1 << AVR_ADDR_SCK_PIN); AVR_ADDR_SCK_PORT &= ~(1 << AVR_ADDR_SCK_PIN); } -#ifdef DEBUG_SREG +#if DEBUG_SREG printf("\n"); #endif AVR_ADDR_LATCH_PORT |= (1 << AVR_ADDR_LATCH_PIN); @@ -99,7 +99,7 @@ void sreg_set(uint32_t addr) void sram_bulk_read_start(uint32_t addr) { -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_bulk_read_start: addr=0x%08lx\n\r", addr); #endif avr_data_in(); @@ -112,6 +112,11 @@ void sram_bulk_read_start(uint32_t addr) AVR_RD_PORT &= ~(1 << AVR_RD_PIN); asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); } inline void sram_bulk_read_next(void) @@ -121,6 +126,11 @@ inline void sram_bulk_read_next(void) AVR_RD_PORT &= ~(1 << AVR_RD_PIN); asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); } @@ -131,7 +141,7 @@ inline uint8_t sram_bulk_read(void) void sram_bulk_read_end(void) { -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_bulk_read_end:"); #endif AVR_RD_PORT |= (1 << AVR_RD_PIN); @@ -142,7 +152,7 @@ void sram_bulk_read_end(void) uint8_t sram_read(uint32_t addr) { uint8_t byte; -#ifdef DEBUG_SRAM_RAW +#if DEBUG_SRAM_RAW printf("sram_read: addr=0x%08lx\n\r", addr); #endif @@ -157,6 +167,11 @@ uint8_t sram_read(uint32_t addr) AVR_RD_PORT &= ~(1 << AVR_RD_PIN); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); + asm volatile ("nop"); asm volatile ("nop"); byte = AVR_DATA_PIN; @@ -171,7 +186,7 @@ uint8_t sram_read(uint32_t addr) void sram_bulk_write_start(uint32_t addr) { -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_bulk_write_start: addr=0x%08lx\n\r", addr); #endif @@ -200,7 +215,7 @@ inline void sram_bulk_write( uint8_t data) void sram_bulk_write_end(void) { -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_bulk_write_end:"); #endif AVR_WR_PORT |= (1 << AVR_WR_PIN); @@ -212,7 +227,7 @@ void sram_bulk_write_end(void) void sram_write(uint32_t addr, uint8_t data) { -#ifdef DEBUG_SRAM_RAW +#if DEBUG_SRAM_RAW printf("sram_write: addr=0x%08lx data=%x\n\r", addr, data); #endif @@ -239,7 +254,7 @@ void sram_bulk_copy(uint32_t addr, uint8_t * src, uint32_t len) uint32_t i; uint8_t *ptr = src; -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_copy: addr=0x%08lx src=0x%p len=%li\n\r", addr,src,len); #endif sram_bulk_write_start(addr); @@ -255,7 +270,7 @@ void sram_bulk_read_buffer(uint32_t addr, uint8_t * dst, uint32_t len) uint32_t i; uint8_t *ptr = dst; -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_bulk_read_buffer: addr=0x%08lx dst=0x%p len=%li\n\r", addr,dst,len); #endif sram_bulk_read_start(addr); @@ -267,18 +282,18 @@ void sram_bulk_read_buffer(uint32_t addr, uint8_t * dst, uint32_t len) sram_bulk_read_end(); } -void sram_bulk_clear(uint32_t addr, uint32_t len){ +void sram_bulk_set(uint32_t addr, uint32_t len,uint8_t value){ uint32_t i; -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_bulk_clear: addr=0x%08lx len=%li\n\r", addr,len); #endif sram_bulk_write_start(addr); for (i = addr; i < (addr + len); i++) { if (0 == i % 0xfff) -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_bulk_clear: addr=0x%08lx\n\r", i); #endif - sram_bulk_write(0xff); + sram_bulk_write(value); sram_bulk_write_next(); } sram_bulk_write_end(); @@ -287,12 +302,12 @@ void sram_bulk_clear(uint32_t addr, uint32_t len){ void sram_clear(uint32_t addr, uint32_t len) { uint32_t i; -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_clear: addr=0x%08lx len=%li\n\r", addr,len); #endif for (i = addr; i < (addr + len); i++) { if (0 == i % 0xfff) -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_clear: addr=0x%08lx\n\r", i); #endif sram_write(i, 0x00); @@ -304,7 +319,7 @@ void sram_copy(uint32_t addr, uint8_t * src, uint32_t len) uint32_t i; uint8_t *ptr = src; -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_copy: addr=0x%08lx src=0x%p len=%li\n\r", addr,src,len); #endif for (i = addr; i < (addr + len); i++) @@ -316,7 +331,7 @@ void sram_read_buffer(uint32_t addr, uint8_t * dst, uint32_t len) uint32_t i; uint8_t *ptr = dst; -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_read_buffer: addr=0x%08lx dst=0x%p len=%li\n\r", addr,dst,len); #endif for (i = addr; i < (addr + len); i++) { @@ -325,10 +340,11 @@ void sram_read_buffer(uint32_t addr, uint8_t * dst, uint32_t len) } } + uint8_t sram_check(uint8_t * buffer, uint32_t len) { uint16_t cnt; -#ifdef DEBUG_SRAM +#if DEBUG_SRAM printf("sram_check: len=%li\n\r",len); #endif for (cnt = 0; cnt < len; cnt++) @@ -336,3 +352,5 @@ uint8_t sram_check(uint8_t * buffer, uint32_t len) return 1; return 0; } + + diff --git a/avr/usbload/sram.h b/avr/usbload/sram.h index 861e5e6..599ec4d 100644 --- a/avr/usbload/sram.h +++ b/avr/usbload/sram.h @@ -161,4 +161,4 @@ void sram_bulk_write(uint8_t data); void sram_bulk_copy(uint32_t addr, uint8_t * src, uint32_t len); void sram_bulk_read_buffer(uint32_t addr, uint8_t * dst, uint32_t len); -void sram_bulk_clear(uint32_t addr, uint32_t len); +void sram_bulk_set(uint32_t addr, uint32_t len,uint8_t value); diff --git a/avr/usbload/uart.h b/avr/usbload/uart.h index 7af251f..7f559ec 100644 --- a/avr/usbload/uart.h +++ b/avr/usbload/uart.h @@ -16,3 +16,4 @@ static int uart_stream(char c, FILE *stream); #endif /* _UART_H_ */ + diff --git a/avr/usbload/usb_bulk.c b/avr/usbload/usb_bulk.c index ff140c4..8af1354 100644 --- a/avr/usbload/usb_bulk.c +++ b/avr/usbload/usb_bulk.c @@ -26,6 +26,7 @@ extern uint8_t req_state; extern uint8_t rx_remaining; extern uint8_t tx_remaining; extern uint8_t tx_buffer[32]; +extern uint16_t crc; uint8_t usbFunctionWrite(uint8_t * data, uint8_t len) { @@ -43,9 +44,7 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len) printf("usbFunctionWrite REQ_STATUS_UPLOAD addr: 0x%08lx len: %i rx_remaining=%i\n", req_addr, len, rx_remaining); #endif - //cli(); sram_copy(req_addr, data, len); - //sei(); req_addr += len; } else if (req_state == REQ_STATUS_BULK_UPLOAD) { @@ -56,12 +55,10 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len) #endif ptr = data; i = len; - cli(); while(i--){ sram_bulk_write(*ptr++); counter_up(); } - sei(); } return len; } diff --git a/avr/usbload/usb_bulk.h b/avr/usbload/usb_bulk.h index 4f93a1f..92c1093 100644 --- a/avr/usbload/usb_bulk.h +++ b/avr/usbload/usb_bulk.h @@ -1,3 +1,4 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len); -uint8_t usbFunctionRead(uint8_t * data, uint8_t len); \ No newline at end of file +uint8_t usbFunctionRead(uint8_t * data, uint8_t len); + diff --git a/avr/usbload/usbconfig.h b/avr/usbload/usbconfig.h index 0284c4a..589a846 100644 --- a/avr/usbload/usbconfig.h +++ b/avr/usbload/usbconfig.h @@ -114,7 +114,7 @@ section at the end of this file). /* Define this to 1 if the device has its own power supply. Set it to 0 if the * device is powered from the USB bus. */ -#define USB_CFG_MAX_BUS_POWER 40 +#define USB_CFG_MAX_BUS_POWER 300 /* Set this variable to the maximum USB bus power consumption of your device. * The value is in milliamperes. [It will be divided by two since USB * communicates power requirements in units of 2 mA.] @@ -141,7 +141,7 @@ section at the end of this file). * of the macros usbDisableAllRequests() and usbEnableAllRequests() in * usbdrv.h. */ -#define USB_CFG_LONG_TRANSFERS 0 +#define USB_CFG_LONG_TRANSFERS 1 /* Define this to 1 if you want to send/receive blocks of more than 254 bytes * in a single control-in or control-out transfer. Note that the capability * for long transfers increases the driver size. diff --git a/snesram.tmproj b/snesram.tmproj index 10fc8f5..e24e15a 100644 --- a/snesram.tmproj +++ b/snesram.tmproj @@ -3,7 +3,7 @@ currentDocument - avr/usbload/commandline/snesuploader.c + avr/usbload/main.c documents @@ -68,14 +68,14 @@ caret column - 0 + 23 line - 0 + 206 firstVisibleColumn 0 firstVisibleLine - 198 + 206 avr/usbload/crc.c @@ -84,7 +84,37 @@ column 0 line + 44 + + columnSelection + + firstVisibleColumn + 0 + firstVisibleLine + 21 + selectFrom + + column 0 + line + 43 + + selectTo + + column + 0 + line + 44 + + + avr/usbload/crc.h + + caret + + column + 14 + line + 9 firstVisibleColumn 0 @@ -152,14 +182,14 @@ caret column - 17 + 23 line - 59 + 195 firstVisibleColumn 0 firstVisibleLine - 161 + 176 avr/usbload/sram.c @@ -217,6 +247,20 @@ firstVisibleLine 0 + avr/usbload/usb_bulk.c + + caret + + column + 0 + line + 47 + + firstVisibleColumn + 0 + firstVisibleLine + 21 + avr/usbload/usbconfig.h caret @@ -578,6 +622,7 @@ scripts/b.py scripts/rom.py avr/usbload/crc.c + avr/usbload/crc.h avr/usbload/sram.c avr/usbload/sram.h avr/usbload/fifo.h @@ -587,6 +632,7 @@ avr/usbload/debug.c avr/usbload/uart.c avr/usbload/main.c + avr/usbload/usb_bulk.c avr/usbload/usbconfig.h avr/usbload/commandline/opendevice.c avr/usbload/commandline/opendevice.h