mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/periph_flashpage: use od_hex_dump for memdump
Replaces the custom `memdump` implementation with `od_hex_dump`, which provides a more common and especially more compact print format.
This commit is contained in:
parent
32168da8d6
commit
c21eb6b8a8
@ -7,6 +7,7 @@ FEATURES_OPTIONAL += periph_flashpage_pagewise
|
||||
FEATURES_OPTIONAL += periph_flashpage_rwee
|
||||
|
||||
USEMODULE += od
|
||||
USEMODULE += od_string
|
||||
USEMODULE += shell
|
||||
|
||||
# avoid running Kconfig by default
|
||||
|
@ -1,5 +1,6 @@
|
||||
# this file enables modules defined in Kconfig. Do not use this file for
|
||||
# application configuration. This is only needed during migration.
|
||||
CONFIG_MODULE_OD=y
|
||||
CONFIG_MODULE_OD_STRING=y
|
||||
CONFIG_MODULE_PERIPH_FLASHPAGE=y
|
||||
CONFIG_MODULE_SHELL=y
|
||||
|
@ -81,31 +81,9 @@ static int getpage(const char *str)
|
||||
}
|
||||
|
||||
#ifdef MODULE_PERIPH_FLASHPAGE_PAGEWISE
|
||||
static void dumpchar(uint8_t mem)
|
||||
{
|
||||
if (mem >= ' ' && mem <= '~') {
|
||||
printf(" %c ", mem);
|
||||
}
|
||||
else {
|
||||
printf(" ?? ");
|
||||
}
|
||||
}
|
||||
|
||||
static void memdump(void *addr, size_t len)
|
||||
{
|
||||
unsigned pos = 0;
|
||||
uint8_t *mem = (uint8_t *)addr;
|
||||
|
||||
while (pos < (unsigned)len) {
|
||||
for (unsigned i = 0; i < LINE_LEN; i++) {
|
||||
printf("0x%02x ", mem[pos + i]);
|
||||
}
|
||||
puts("");
|
||||
for (unsigned i = 0; i < LINE_LEN; i++) {
|
||||
dumpchar(mem[pos++]);
|
||||
}
|
||||
puts("");
|
||||
}
|
||||
od_hex_dump (addr, len, LINE_LEN);
|
||||
}
|
||||
|
||||
static void dump_local(void)
|
||||
|
Loading…
Reference in New Issue
Block a user