- qdips: patch chunk upload working but fw transfer bug remains

usb bulk transfers copy the last byte of the chunk to SRAM twice.
This commit is contained in:
Tobias Pflug 2009-10-25 01:34:03 +02:00
parent 297b10ccf7
commit b927fbf93b
3 changed files with 17 additions and 23 deletions

View File

@ -50,7 +50,7 @@
#define DO_CRC_CHECK_LOADER 0 #define DO_CRC_CHECK_LOADER 0
#define DO_CRC_CHECK 0 #define DO_CRC_CHECK 0
#define DO_SHM_SCRATCHPAD 1 #define DO_SHM_SCRATCHPAD 0
#define DO_SHM 0 #define DO_SHM 0
#define DO_TIMER 0 #define DO_TIMER 0
#define DO_SHELL 1 #define DO_SHELL 1

View File

@ -305,7 +305,7 @@ int main(void)
system_set_bus_avr(); system_set_bus_avr();
system_send_snes_reset(); system_send_snes_reset();
} }
globals_init(); /*globals_init();*/
} }
return 0; return 0;
} }

View File

@ -44,9 +44,9 @@
typedef struct _ips_tag { typedef struct _ips_tag {
uint32_t ofs; /* offset in file to patch */ uint32_t ofs; /* offset in file to patch */
uint16_t len; /* number of bytes in this chunk */ uint16_t len; /* number of bytes in this chunk */
uint8_t* data; /* chunk data */ uint8_t* data; /* chunk data */
} ips_tag_t; } ips_tag_t;
int qd16_apply_ips_chunk(ips_tag_t* ips_tag); int qd16_apply_ips_chunk(ips_tag_t* ips_tag);
@ -120,8 +120,6 @@ int main(int argc, char * argv[])
fprintf(stderr,"Error during init. Exiting!\n"); fprintf(stderr,"Error during init. Exiting!\n");
exit(1); exit(1);
} }
qd16_finish();
exit(0);
fname = argv[optind]; fname = argv[optind];
patch_file = fopen(fname,"rb"); patch_file = fopen(fname,"rb");
@ -177,20 +175,11 @@ int main(int argc, char * argv[])
int qd16_apply_ips_chunk(ips_tag_t* ips_tag) int qd16_apply_ips_chunk(ips_tag_t* ips_tag)
{ {
return 0;
int addr_hi = (ips_tag->ofs)>>16; int addr_hi = (ips_tag->ofs)>>16;
int addr_lo = (ips_tag->ofs)&0xffff; int addr_lo = (ips_tag->ofs)&0xffff;
printf("hi:%x lo:%x\n",addr_hi,addr_lo); printf("hi:%x lo:%x len:%d\n",addr_hi,addr_lo,ips_tag->len);
int ret = QD16_SEND_ADDR(addr_hi,addr_lo,ips_tag->data,ips_tag->len); int ret = QD16_SEND_ADDR(addr_hi,addr_lo,ips_tag->data,ips_tag->len);
/*int ret = QD16_SEND_ADDR(addr_hi,addr_lo,dummy,128);*/
if (ret<0){
printf("error executing command!:%s\n",usb_strerror());
}
ret = QD16_SEND_DATA(addr_hi,addr_lo,ips_tag->data,ips_tag->len);
/*int ret = QD16_SEND_ADDR(addr_hi,addr_lo,dummy,128);*/
if (ret<0){ if (ret<0){
printf("error executing command!:%s\n",usb_strerror()); printf("error executing command!:%s\n",usb_strerror());
} }
@ -200,7 +189,6 @@ int qd16_apply_ips_chunk(ips_tag_t* ips_tag)
void qd16_finish(void) void qd16_finish(void)
{ {
#if 0
cnt = usb_control_msg(handle, cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_RECIP_DEVICE |
USB_ENDPOINT_OUT, USB_BULK_UPLOAD_END, 0, 0, NULL, USB_ENDPOINT_OUT, USB_BULK_UPLOAD_END, 0, 0, NULL,
@ -209,12 +197,12 @@ void qd16_finish(void)
if (cnt<0) { if (cnt<0) {
printf("USB_BULK_UPLOAD_END failed: %s\n",usb_strerror()); printf("USB_BULK_UPLOAD_END failed: %s\n",usb_strerror());
} }
#endif
cnt = usb_control_msg(handle, cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_RECIP_DEVICE |
USB_ENDPOINT_OUT, USB_SET_LOADER, 0, 0, NULL, USB_ENDPOINT_OUT, USB_SET_LOADER, 1, 1, NULL,
0, 5000); 0, 5000);
cnt = usb_control_msg(handle, cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_RECIP_DEVICE |
USB_ENDPOINT_OUT, USB_MODE_SNES, 0, 0, NULL, USB_ENDPOINT_OUT, USB_MODE_SNES, 0, 0, NULL,
@ -237,6 +225,14 @@ int qd16_init(void)
return 1; return 1;
} }
cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE |
USB_ENDPOINT_OUT, USB_SET_LOADER, 0, 0, NULL,
0, 5000);
if (cnt<0) {
printf("USB_SET_LOADER failed: %s\n",usb_strerror());
}
cnt = usb_control_msg(handle, cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_RECIP_DEVICE |
@ -249,7 +245,6 @@ int qd16_init(void)
usleep(500000); usleep(500000);
#if 0
cnt = usb_control_msg(handle, cnt = usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT,
USB_BULK_UPLOAD_INIT, USB_BULK_UPLOAD_INIT,
@ -260,7 +255,6 @@ int qd16_init(void)
if (cnt<0) { if (cnt<0) {
printf("USB_BULK_UPLOAD_INIT failed: %s\n",usb_strerror()); printf("USB_BULK_UPLOAD_INIT failed: %s\n",usb_strerror());
} }
#endif
return 0; return 0;
} }