diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-10-29 23:54:17 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-10-30 14:04:08 -0400 |
commit | 473828ca6aef18c574b8665ae484513e5592af03 (patch) | |
tree | 74d6b8f205ce92282475ad0f6575ea0c5af01fc2 /src/debugcmds.c | |
parent | aaf3dc6ac3e3a38b0dd3508d72594214ede27c5c (diff) | |
download | kutter-473828ca6aef18c574b8665ae484513e5592af03.tar.gz kutter-473828ca6aef18c574b8665ae484513e5592af03.tar.xz kutter-473828ca6aef18c574b8665ae484513e5592af03.zip |
command: Add command_decode_ptr() helper
Add a helper function to convert from a string buffer passed in the
args[] parameter to an actual pointer. This avoids all the callers
needing to perfrom pointer manipulation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/debugcmds.c')
-rw-r--r-- | src/debugcmds.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/debugcmds.c b/src/debugcmds.c index bdbd0d48..22350c18 100644 --- a/src/debugcmds.c +++ b/src/debugcmds.c @@ -48,7 +48,7 @@ void command_debug_read(uint32_t *args) { uint8_t order = args[0]; - void *ptr = (void*)(size_t)args[1]; + void *ptr = command_decode_ptr(args[1]); uint32_t v; irqstatus_t flag = irq_save(); switch (order) { @@ -66,7 +66,7 @@ void command_debug_write(uint32_t *args) { uint8_t order = args[0]; - void *ptr = (void*)(size_t)args[1]; + void *ptr = command_decode_ptr(args[1]); uint32_t v = args[2]; irqstatus_t flag = irq_save(); switch (order) { @@ -83,7 +83,7 @@ void command_debug_ping(uint32_t *args) { uint8_t len = args[0]; - char *data = (void*)(size_t)args[1]; + char *data = command_decode_ptr(args[1]); sendf("pong data=%*s", len, data); } DECL_COMMAND_FLAGS(command_debug_ping, HF_IN_SHUTDOWN, "debug_ping data=%*s"); |