summaryrefslogtreecommitdiff
path: root/avr/cmd_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/cmd_mem.c')
-rw-r--r--avr/cmd_mem.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/avr/cmd_mem.c b/avr/cmd_mem.c
index 101b912..effa416 100644
--- a/avr/cmd_mem.c
+++ b/avr/cmd_mem.c
@@ -42,13 +42,14 @@ static uint32_t base_address = 0;
/*--------------------------------------------------------------------------*/
-
-void z180_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
+int z180_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
{
- if (z80_bus_cmd(Request) & ZST_ACQUIRED) {
- z80_read_block (buf, addr, count);
- z80_bus_cmd(Release);
- }
+ if (!(z80_bus_cmd(Request) & ZST_ACQUIRED))
+ return -1;
+
+ z80_read_block (buf, addr, count);
+ z80_bus_cmd(Release);
+ return 0;
}
/*--------------------------------------------------------------------------*/
@@ -92,10 +93,16 @@ command_ret_t do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
}
/* Print the lines. */
- dump_mem(addr, addr, length, z180_read_buf, NULL);
+ int ret = dump_mem(addr, addr, length, z180_read_buf, NULL);
+ if (ret == -2) { /* TODO: Error codes */
+ my_puts_P(PSTR("Bus timeout\n"));
+ return CMD_RET_FAILURE;
+ }
- dp_last_addr = addr + length;
- dp_last_length = length;
+ if (ret >= 0) {
+ dp_last_addr = addr + length;
+ dp_last_length = length;
+ }
return CMD_RET_SUCCESS;
}