* (C) Copyright 2000
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
- * SPDX-License-Identifier: GPL-2.0+
+ * SPDX-License-Identifier: GPL-2.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;
}
/*--------------------------------------------------------------------------*/
}
/* 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;
}
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] == '-')) {
/* <CR> pressed as only input, don't modify current
* location and move to next. "-" pressed will go back.
if (incrflag)
addr += nbytes ? -1 : 1;
nbytes = 1;
- }
- else {
+
+ } else {
char *endp;
data = strtoul(console_buffer, &endp, 16);
nbytes = endp - console_buffer;