fix new debug routing and start debugging sram bulk

This commit is contained in:
David Voswinkel 2009-06-29 08:53:59 +02:00
parent f9724a3209
commit 2ebd2b75aa
9 changed files with 36 additions and 19 deletions

Binary file not shown.

View File

@ -15,8 +15,8 @@
*/
#define READ_BUFFER_SIZE 1024
#define SEND_BUFFER_SIZE 0x200
#define READ_BUFFER_SIZE (1024 * 32)
#define SEND_BUFFER_SIZE 128
#define BUFFER_CRC (1024 * 32)
#define BANK_SIZE (1<<15)
#define BANK_SIZE_SHIFT 15
@ -170,7 +170,6 @@ int main(int argc, char **argv)
crc_buffer = (unsigned char *) malloc(BUFFER_CRC);
memset(crc_buffer, 0, BUFFER_CRC);
addr = 0x000000;
usb_control_msg(handle,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT,
USB_UPLOAD_INIT, BANK_SIZE_SHIFT , 0, NULL, 0, 5000);
@ -192,11 +191,13 @@ int main(int argc, char **argv)
if (cnt < 0) {
fprintf(stderr, "USB error: %s\n", usb_strerror());
usb_close(handle);
exit(-1);
}
addr += SEND_BUFFER_SIZE;
break;
}
dump_packet(0x00000,READ_BUFFER_SIZE, read_buffer);
dump_packet(0x00000,SEND_BUFFER_SIZE, read_buffer);
memcpy(crc_buffer + cnt_crc, read_buffer, READ_BUFFER_SIZE);
cnt_crc += READ_BUFFER_SIZE;
if (cnt_crc >= READ_BUFFER_SIZE) {
@ -206,6 +207,7 @@ int main(int argc, char **argv)
bank++;
cnt_crc = 0;
}
break;
}

View File

@ -5,6 +5,7 @@
#include "uart.h"
extern FILE uart_stdout;
extern int debug_level; /* the higher, the more messages... */
@ -21,9 +22,10 @@ void debug(int level, char* format, ...) {
if (!(debug_level & level))
return;
va_start(args, format);
printf(format, args);
vprintf(format, args);
va_end(args);
#endif /* NDEBUG */
#endif /* NDEBUG && __GNUC__ */
}

View File

@ -47,14 +47,19 @@ void dump_memory(uint32_t bottom_addr, uint32_t top_addr)
{
uint32_t addr;
uint8_t byte;
sram_bulk_read_start(bottom_addr);
//sram_bulk_read_start(bottom_addr);
bottom_addr = 0x00;
top_addr = 0x80;
printf("%08lx - %08lx\n",bottom_addr, top_addr);
printf("%08lx:", bottom_addr);
for ( addr = bottom_addr; addr < top_addr; addr++) {
if (addr%0x16 == 0)
printf("\n%08lx:", bottom_addr);
byte = sram_bulk_read();
sram_bulk_read_next();
if (addr%0x10 == 0)
printf("\n%08lx:", addr);
byte = sram_read(addr);
//sram_bulk_read_next();
printf(" %02x", byte);
}
sram_bulk_read_end();
//sram_bulk_read_end();
}

View File

@ -5,8 +5,9 @@
#include <stdint.h>
#include <stdarg.h>
void dump_packet(uint32_t addr,uint32_t len,uint8_t *packet);
void dump_memory(uint32_t bottom_addr, uint32_t top_addr);
void dump_packet(uint32_t addr,uint32_t len,uint8_t *packet);
#endif

View File

@ -17,7 +17,7 @@
extern FILE uart_stdout;
uint8_t debug_level = ( DEBUG | DEBUG_USB );
uint8_t debug_level = ( DEBUG | DEBUG_USB | DEBUG_USB_TRANS | DEBUG_SRAM);
uint8_t read_buffer[TRANSFER_BUFFER_SIZE];
uint32_t req_addr = 0;
@ -231,6 +231,7 @@ void test_read_write(){
}
void test_bulk_read_write(){
uint8_t i;
@ -318,17 +319,21 @@ int main(void)
printf("USB poll done\n");
usbDeviceDisconnect();
printf("USB disconnect\n");
crc_check_bulk_memory(0x000000,0x1000);
crc_check_bulk_memory(0x000000,0x8000);
dump_memory(0x00,0x80);
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;
}

View File

@ -42,6 +42,8 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len)
rx_remaining -= len;
debug(DEBUG_USB_TRANS,"usbFunctionWrite REQ_STATUS_UPLOAD addr: 0x%08lx len: %i rx_remaining=%i\n",
req_addr, len, rx_remaining);
debug(DEBUG_USB_TRANS,"usbFunctionWrite %02x %02x %02x %02x %02x %02x %02x %x\n",
data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
sram_copy(req_addr, data, len);
req_addr += len;
} else if (req_state == REQ_STATUS_BULK_UPLOAD) {

View File

@ -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 300
#define USB_CFG_MAX_BUS_POWER 200
/* 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.]