summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-10-22 07:03:20 -0700
committerZachary T Welch <zw@superlucidity.net>2009-11-05 18:03:19 -0800
commit11a0afc932853fc9cb8d33a5fdce954195f406e2 (patch)
tree54377e2c3663306e534ed3af3faf715b19cbf19b
parent3541ed3aa3beb93c80bb2a01be429dacdec33919 (diff)
downloadopenocd_libswd-11a0afc932853fc9cb8d33a5fdce954195f406e2.tar.gz
openocd_libswd-11a0afc932853fc9cb8d33a5fdce954195f406e2.tar.bz2
openocd_libswd-11a0afc932853fc9cb8d33a5fdce954195f406e2.tar.xz
openocd_libswd-11a0afc932853fc9cb8d33a5fdce954195f406e2.zip
Improve arm7_9_common command argument parsing.
-rw-r--r--src/target/arm7_9_common.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c
index 45394b7e..21c5c7a2 100644
--- a/src/target/arm7_9_common.c
+++ b/src/target/arm7_9_common.c
@@ -2959,8 +2959,8 @@ int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cm
return ERROR_OK;
}
- value = strtoul(args[0], NULL, 0);
- spsr = strtol(args[1], NULL, 0);
+ COMMAND_PARSE_NUMBER(u32, args[0], value);
+ COMMAND_PARSE_NUMBER(int, args[1], spsr);
/* if we're writing the CPSR, mask the T bit */
if (!spsr)
@@ -3004,9 +3004,9 @@ int handle_arm7_9_write_xpsr_im8_command(struct command_context_s *cmd_ctx, char
return ERROR_OK;
}
- value = strtoul(args[0], NULL, 0);
- rotate = strtol(args[1], NULL, 0);
- spsr = strtol(args[2], NULL, 0);
+ COMMAND_PARSE_NUMBER(u32, args[0], value);
+ COMMAND_PARSE_NUMBER(int, args[1], rotate);
+ COMMAND_PARSE_NUMBER(int, args[2], spsr);
arm7_9->write_xpsr_im8(target, value, rotate, spsr);
if ((retval = jtag_execute_queue()) != ERROR_OK)
@@ -3045,9 +3045,9 @@ int handle_arm7_9_write_core_reg_command(struct command_context_s *cmd_ctx, char
return ERROR_OK;
}
- num = strtol(args[0], NULL, 0);
- mode = strtoul(args[1], NULL, 0);
- value = strtoul(args[2], NULL, 0);
+ COMMAND_PARSE_NUMBER(int, args[0], num);
+ COMMAND_PARSE_NUMBER(u32, args[1], mode);
+ COMMAND_PARSE_NUMBER(u32, args[2], value);
return arm7_9_write_core_reg(target, num, mode, value);
}