summaryrefslogtreecommitdiff
path: root/avr/debug.c
diff options
context:
space:
mode:
authorLeo C2016-06-21 15:10:40 +0200
committerLeo C2016-06-21 17:14:07 +0200
commit2d914b45c43c9a4c986e88428d1e28c0710ae298 (patch)
treed6d479030247a0699fdf9f41aae547b56068ca14 /avr/debug.c
parentfcd2239eb2849432269ba4456718b657fdff3972 (diff)
downloadz180-stamp-2d914b45c43c9a4c986e88428d1e28c0710ae298.zip
aval_arg() for all commands
Diffstat (limited to 'avr/debug.c')
-rw-r--r--avr/debug.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/avr/debug.c b/avr/debug.c
index e38ccb2..1b4ecc2 100644
--- a/avr/debug.c
+++ b/avr/debug.c
@@ -1,18 +1,19 @@
/*
- * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ * (C) Copyright 2014,2016 Leo C. <erbl259-lmu@yahoo.de>
*
* SPDX-License-Identifier: GPL-2.0
*/
#include "debug.h"
#include "common.h"
-#include <stdlib.h>
+#include <stdlib.h> /* __malloc_margin */
#include <string.h>
#include <ctype.h>
#include <avr/eeprom.h>
#include "command.h"
#include "cli_readline.h"
+#include "eval_arg.h"
#include "print-utils.h"
/*
@@ -65,11 +66,11 @@ command_ret_t do_dump_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg
}
/* Address is specified since argc > 1 */
- addr = strtoul(argv[1], NULL, 16);
+ addr = eval_arg(argv[1], NULL);
/* If another parameter, it is the length to display. */
if (argc > 2)
- length = (uint16_t) strtoul(argv[2], NULL, 16);
+ length = (uint16_t) eval_arg(argv[2], NULL);
/* Print the lines. */
dump_mem(addr, addr, length, readwhat, NULL);
@@ -88,9 +89,9 @@ command_ret_t do_eep_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
if (argc != 4)
return CMD_RET_USAGE;
- src = (size_t) strtoul(argv[1], NULL, 16);
- dest = (size_t) strtoul(argv[2], NULL, 16);
- count = (size_t) strtoul(argv[3], NULL, 16);
+ src = (size_t) eval_arg(argv[1], NULL);
+ dest = (size_t) eval_arg(argv[2], NULL);
+ count = (size_t) eval_arg(argv[3], NULL);
if (src > E2END) {
debug("src > EEPROM size: 0x%04x\n", src);
@@ -160,7 +161,7 @@ mod_mem_avr(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
/* Address is specified since argc > 1
*/
- addr = (uint8_t *) (size_t) strtoul(argv[1], NULL, 16);
+ addr = (uint8_t *) (size_t) eval_arg(argv[1], NULL);
}
/* Print the address, followed by value. Then accept input for
@@ -181,7 +182,7 @@ mod_mem_avr(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
} else {
char *endp;
- data = strtoul(console_buffer, &endp, 16);
+ data = eval_arg(console_buffer, &endp);
nbytes = endp - console_buffer;
if (nbytes) {
*addr = data;