X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/ad9bc17c8ecab1f0bbd26f2270d4d396f4bc5e52..79082813de096a57d76fa5b7757183b8a23a95b2:/avr/cmd_mem.c diff --git a/avr/cmd_mem.c b/avr/cmd_mem.c index 101b912..a725c61 100644 --- a/avr/cmd_mem.c +++ b/avr/cmd_mem.c @@ -4,7 +4,7 @@ * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * - * SPDX-License-Identifier: GPL-2.0+ + * SPDX-License-Identifier: GPL-2.0 */ /* @@ -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; } @@ -144,7 +151,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) z80_bus_cmd(Release); printf_P(PSTR("%05lx: %02x"), addr, data); - nbytes = cli_readline(PSTR(" ? ")); + nbytes = cli_readline(PSTR(" ? "), 0); if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) { /* pressed as only input, don't modify current * location and move to next. "-" pressed will go back.