X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/e39cd2a2822a410ba06d61657a467c8307daa35d..a8eb521f94848a627a3fe470e34f62b13c157d34:/avr/debug.c diff --git a/avr/debug.c b/avr/debug.c index 1940eb0..d4ae1f4 100644 --- a/avr/debug.c +++ b/avr/debug.c @@ -1,3 +1,9 @@ +/* + * (C) Copyright 2014 Leo C. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + #include "common.h" #include #include @@ -7,6 +13,7 @@ #include "command.h" #include "print-utils.h" #include "debug.h" + /* * Debugging */ @@ -14,29 +21,6 @@ #ifdef DEBUG -void eeprom_read_buf(uint8_t *buf, uint32_t addr, uint8_t count) -{ - eeprom_read_block((void *) buf, (const void *) (size_t) addr, count); -} - -void ram_read_buf(uint8_t *buf, uint32_t addr, uint8_t count) -{ - while (count--) - *buf++ = *(uint8_t *) (size_t) addr++; -} - - -void dump_eep(uint32_t addr, unsigned int len, char *title) -{ - dump_mem(addr, len, eeprom_read_buf, title); -} - -void dump_ram(uint32_t addr, unsigned int len, char *title) -{ - dump_mem(addr, len, ram_read_buf, title); -} - - #if 0 void dump_heap(void) { @@ -65,12 +49,19 @@ command_ret_t do_dump_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg uint32_t addr; uint32_t length = 128; - if (strchr(argv[0],'r') != NULL) + switch (argv[0][3]) { + case 'r': readhow = ram_read_buf; - else if (strchr(argv[0],'e') != NULL) + break; + case 'e': readhow = eeprom_read_buf; - else + break; + case 'f': + readhow = flash_read_buf; + break; + default: return CMD_RET_USAGE; + } /* Address is specified since argc > 1 */ addr = strtoul(argv[1], NULL, 16); @@ -80,7 +71,7 @@ command_ret_t do_dump_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg length = (uint16_t) strtoul(argv[2], NULL, 16); /* Print the lines. */ - dump_mem(addr, length, readhow, NULL); + dump_mem(addr, addr, length, readhow, NULL); return CMD_RET_SUCCESS; } @@ -135,8 +126,8 @@ command_ret_t do_eep_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[ return CMD_RET_SUCCESS; } -/*------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------*/ #if 1