#define BAUD_RATE 375000
#define MAX_DATA_SIZE 191
+#define PROGRESS_STEP (4 * 1024)
static int setup(int fd)
{
return 0;
}
+static void print_progress(int done, int total)
+{
+ int i, step;
+
+ printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); /* 20 */
+ printf("\b\b\b\b\b\b");
+ printf("%06x/%06x |", done, total);
+
+ step = total / 20;
+ for (i = step; i <= total; i += step)
+ printf("%c", done >= i ? '=' : '-');
+ printf("| %3d%%", done * 100 / total);
+ fflush(stdout);
+
+ if (done == total)
+ printf("\n");
+}
+
static void dump_pkt(const uint8_t *buf, size_t size, const char *msg)
{
size_t i;
static int do_rx(int fd, uint32_t addr, void *buf, size_t size)
{
+ size_t size_total = size;
+ int progress_bytes = 0;
char *cbuf = buf;
int ret;
int len;
addr += len;
cbuf += len;
size -= len;
+
+ progress_bytes -= len;
+ if (progress_bytes <= 0 || size == 0) {
+ print_progress(size_total - size, size_total);
+ progress_bytes = PROGRESS_STEP;
+ }
}
return 0;
static int do_tx(int fd, uint32_t addr, void *buf, size_t size, int exe)
{
+ int progress_bytes = 0;
+ size_t size_total = size;
size_t size_last = size;
uint32_t addr_last = addr;
char *cbuf = buf;
addr += len;
cbuf += len;
size -= len;
+
+ progress_bytes -= len;
+ if (progress_bytes <= 0) {
+ print_progress(size_total - size - size_last,
+ size_total);
+ progress_bytes = PROGRESS_STEP;
+ }
}
}
if (ret != 0)
return ret;
+ print_progress(size_total, size_total);
+
return 0;
}
" tx <addr> <size> <infile> [x]\n"
" <outfile> can be \"/hd/\" for a hexdump\n"
" x instructs to execute uploaded data\n"
- " for tx, size 0 asks to use filesize\n", argv0);
+ " for tx, size 0 asks to use filesize\n\n"
+ "useful regions (addr size):\n"
+ " 0x00000000 0x080000 - BIOS\n"
+ " 0x00180000 0x010000 - Backup-RAM\n"
+ " 0x00200000 0x100000 - Work-RAM-L\n"
+ " 0x05a00000 0x080000 - 68000-RAM\n"
+ " 0x05c00000 0x080000 - VDP1-VRAM\n"
+ " 0x05c80000 0x040000 - VDP1-FB\n"
+ " 0x05e00000 0x080000 - VDP2-VRAM\n"
+ " 0x05f00000 0x001000 - VDP2-CRAM\n"
+ " 0x06000000 0x100000 - Work-RAM-H\n"
+ , argv0);
exit(1);
}