]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/print-utils.c
mcd_mem.c: use cmd_error(), z80_bus_request_or_exit()
[z180-stamp.git] / avr / print-utils.c
index b8100a0411b870bb2d2280acc479f25d60012dc9..69f45536924241e82717e25c2f95df079e351725 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ * (C) Copyright 2014,2018 Leo C. <erbl259-lmu@yahoo.de>
  *
- * SPDX-License-Identifier:    GPL-2.0+
+ * SPDX-License-Identifier:    GPL-2.0
  */
 
 #include "common.h"
@@ -18,28 +18,28 @@ void print_blanks(uint_fast8_t count)
 }
 
 
-int eeprom_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
+ERRNUM eeprom_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
 {
        eeprom_read_block((void *) buf, (const void *) (size_t) addr, count);
-       return 0;
+       return ESUCCESS;
 }
 
-int ram_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
+ERRNUM ram_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
 {
        while (count--)
                *buf++ = *(uint8_t *) (size_t) addr++;
-       return 0;
+       return ESUCCESS;
 }
 
-int flash_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
+ERRNUM flash_read_buf(uint8_t *buf, uint32_t addr, uint8_t count)
 {
        while (count--)
                *buf++ = *(const __memx uint8_t *) (__uint24) addr++;
-       return 0;
+       return ESUCCESS;
 }
 
-int dump_mem(uint32_t address, uint32_t offset, uint32_t len,
-               int (*readfkt)(uint8_t *, uint32_t, uint8_t), char *title)
+ERRNUM dump_mem(uint32_t address, uint32_t offset, uint32_t len,
+               ERRNUM (*readfkt)(uint8_t *, uint32_t, uint8_t), char *title)
 {
        uint8_t buf[16];
        uint8_t llen = 16;
@@ -56,7 +56,7 @@ int dump_mem(uint32_t address, uint32_t offset, uint32_t len,
                if (len < 16)
                        llen = len;
                if (readfkt(buf, address, llen - pre) != 0)
-                       return -2; /* TODO: Error codes */
+                       return -EBUSTO;
 
                if (title)
                        print_blanks(4);
@@ -82,9 +82,9 @@ int dump_mem(uint32_t address, uint32_t offset, uint32_t len,
                len -= llen;
 
                if (ctrlc())
-                       return -1;
+                       return EINTR;
        }
-       return 0;
+       return ESUCCESS;
 }
 
 void dump_eep(uint32_t addr, unsigned int len, char *title)