/*
- * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ * (C) Copyright 2014,2018 Leo C. <erbl259-lmu@yahoo.de>
*
* (C) Copyright 2000
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
/*--------------------------------------------------------------------------*/
-int z180_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
+static ERRNUM z180_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
{
if (!(z80_bus_cmd(Request) & ZST_ACQUIRED))
- return -1;
+ return EBUSTO;
z80_read_block (buf, addr, count);
z80_bus_cmd(Release);
- return 0;
+ return ESUCCESS;
}
/*--------------------------------------------------------------------------*/
}
/* Print the lines. */
- 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;
- }
+ ERRNUM ret = dump_mem(addr, addr, length, z180_read_buf, NULL);
+ if (ret == EBUSTO)
+ cmd_error(CMD_RET_FAILURE, ret, NULL);
- if (ret >= 0) {
+ if (ret == ESUCCESS) {
dp_last_addr = addr + length;
dp_last_length = length;
}
* the next value. A non-converted value exits.
*/
do {
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
data = z80_read(addr);
z80_bus_cmd(Release);
printf_P(PSTR("%05lx: %02x"), addr, data);
data = eval_arg(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
z80_write(addr, data);
z80_bus_cmd(Release);
if (incrflag)
if (argc == 3)
count = eval_arg(argv[optind], NULL);
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
-
+ z80_bus_request_or_exit();
if (width == 1)
z80_memset(addr, writeval, count);
else {
while (count-- > 0) {
uint8_t data;
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
data = z80_read(src);
z80_write(dest, data);
z80_bus_cmd(Release);
* If we have only one object, just run infinite loops.
*/
if (length == 1) {
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
cli();
for (;;)
z80_read(addr);
}
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
cli();
for (;;) {
uint32_t i = length;
* If we have only one object, just run infinite loops.
*/
if (length == 1) {
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
cli();
for (;;)
z80_write(addr, data);
}
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
cli();
for (;;) {
uint32_t i = length;
printf_P(PSTR("Iteration: %6d\r"), iteration + 1);
// debug("\n");
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
- }
+ z80_bus_request_or_exit();
errs += mem_test_alt(start, end);
z80_bus_cmd(Release);