}
/* Print the lines. */
- dump_mem(addr, length, z180_read_buf, NULL);
+ dump_mem(addr, addr, length, z180_read_buf, NULL);
dp_last_addr = addr + length;
dp_last_length = length;
#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)
{
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;
}
}
-int dump_mem(uint32_t startaddr, uint32_t len,
+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++;
+}
+
+int dump_mem(uint32_t address, uint32_t offset, uint32_t len,
void (*readfkt)(uint8_t *, uint32_t, uint8_t), char *title)
{
uint8_t buf[16];
char *indent = NULL;
uint8_t llen = 16;
- uint8_t pre = startaddr % 16;
- uint32_t addr = startaddr & ~0x0f;
+ uint8_t pre = offset % 16;
+ offset = offset & ~0x0f;
len += pre;
uint8_t i;
while (len) {
if (len < 16)
llen = len;
- readfkt(buf, addr + pre, llen - pre);
+ readfkt(buf, address, llen - pre);
- printf_P(PSTR("%s%.5lx:"),indent, addr);
+ printf_P(PSTR("%s%.5lx:"),indent, offset);
for (i = 0; i < llen; i++) {
if ((i % 8) == 0)
putchar(' ');
printf_P(PSTR("%c"), isprint(buf[i-pre]) ? buf[i-pre] : '.');
putchar('\n');
+ address += llen - pre;
+ offset += 16;
pre = 0;
- addr += 16;
len -= llen;
if (ctrlc())
}
return 0;
}
+
+void dump_eep(uint32_t addr, unsigned int len, char *title)
+{
+ dump_mem(addr, addr, len, eeprom_read_buf, title);
+}
+
+void dump_ram(uint32_t addr, uint32_t offset, unsigned int len, char *title)
+{
+ dump_mem(addr, offset, len, ram_read_buf, title);
+}
#endif /* 0 */
-void dump_eep(uint32_t addr, unsigned int len, char *title);
-void dump_ram(uint32_t addr, unsigned int len, char *title);
void printfreelist(const char * title);
+#ifndef PRINT_UTILS_H
+#define PRINT_UTILS_H
+
+#include "common.h"
+#include <avr/eeprom.h>
+
void print_blanks(uint_fast8_t count);
-int dump_mem(uint32_t startaddr, uint32_t len,
+int dump_mem(uint32_t address, uint32_t offset, uint32_t len,
void (*readfkt)(uint8_t *, uint32_t, uint8_t), char *title);
+
+void dump_eep(uint32_t addr, unsigned int len, char *title);
+void dump_ram(uint32_t addr, uint32_t offset, unsigned int len, char *title);
+
+void eeprom_read_buf(uint8_t *buf, uint32_t addr, uint8_t count);
+void ram_read_buf(uint8_t *buf, uint32_t addr, uint8_t count);
+
+#endif /* PRINT_UTILS_H */