mirror of
https://xff.cz/git/u-boot/
synced 2025-09-29 22:41:17 +02:00
cmd: mem: Use a macro to avoid #ifdef in help
It is a bit painful to have #ifdefs in the middle of the help for each command. Add a macro to avoid this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
68
cmd/mem.c
68
cmd/mem.c
@@ -33,6 +33,13 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||||||
#define CONFIG_SYS_MEMTEST_SCRATCH 0
|
#define CONFIG_SYS_MEMTEST_SCRATCH 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Create a compile-time value */
|
||||||
|
#if MEM_SUPPORT_64BIT_DATA
|
||||||
|
#define HELP_Q ", .q"
|
||||||
|
#else
|
||||||
|
#define HELP_Q ""
|
||||||
|
#endif
|
||||||
|
|
||||||
static int mod_mem(struct cmd_tbl *, int, int, int, char * const []);
|
static int mod_mem(struct cmd_tbl *, int, int, int, char * const []);
|
||||||
|
|
||||||
/* Display values from last command.
|
/* Display values from last command.
|
||||||
@@ -1016,7 +1023,6 @@ static int do_mem_mtest(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
*
|
*
|
||||||
* Syntax:
|
* Syntax:
|
||||||
* mm{.b, .w, .l, .q} {addr}
|
* mm{.b, .w, .l, .q} {addr}
|
||||||
* nm{.b, .w, .l, .q} {addr}
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
|
mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
|
||||||
@@ -1196,63 +1202,39 @@ static int do_random(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
md, 3, 1, do_mem_md,
|
md, 3, 1, do_mem_md,
|
||||||
"memory display",
|
"memory display",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address [# of objects]"
|
||||||
"[.b, .w, .l, .q] address [# of objects]"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address [# of objects]"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
mm, 2, 1, do_mem_mm,
|
mm, 2, 1, do_mem_mm,
|
||||||
"memory modify (auto-incrementing address)",
|
"memory modify (auto-incrementing address)",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address"
|
||||||
"[.b, .w, .l, .q] address"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
nm, 2, 1, do_mem_nm,
|
nm, 2, 1, do_mem_nm,
|
||||||
"memory modify (constant address)",
|
"memory modify (constant address)",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address"
|
||||||
"[.b, .w, .l, .q] address"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
mw, 4, 1, do_mem_mw,
|
mw, 4, 1, do_mem_mw,
|
||||||
"memory write (fill)",
|
"memory write (fill)",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address value [count]"
|
||||||
"[.b, .w, .l, .q] address value [count]"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address value [count]"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
cp, 4, 1, do_mem_cp,
|
cp, 4, 1, do_mem_cp,
|
||||||
"memory copy",
|
"memory copy",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] source target count"
|
||||||
"[.b, .w, .l, .q] source target count"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] source target count"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
cmp, 4, 1, do_mem_cmp,
|
cmp, 4, 1, do_mem_cmp,
|
||||||
"memory compare",
|
"memory compare",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] addr1 addr2 count"
|
||||||
"[.b, .w, .l, .q] addr1 addr2 count"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] addr1 addr2 count"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_CRC32
|
#ifdef CONFIG_CMD_CRC32
|
||||||
@@ -1299,22 +1281,14 @@ U_BOOT_CMD(
|
|||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
loop, 3, 1, do_mem_loop,
|
loop, 3, 1, do_mem_loop,
|
||||||
"infinite loop on address range",
|
"infinite loop on address range",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address number_of_objects"
|
||||||
"[.b, .w, .l, .q] address number_of_objects"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address number_of_objects"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef CONFIG_LOOPW
|
#ifdef CONFIG_LOOPW
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
loopw, 4, 1, do_mem_loopw,
|
loopw, 4, 1, do_mem_loopw,
|
||||||
"infinite write loop on address range",
|
"infinite write loop on address range",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address number_of_objects data_to_write"
|
||||||
"[.b, .w, .l, .q] address number_of_objects data_to_write"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address number_of_objects data_to_write"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
#endif /* CONFIG_LOOPW */
|
#endif /* CONFIG_LOOPW */
|
||||||
|
|
||||||
@@ -1330,21 +1304,13 @@ U_BOOT_CMD(
|
|||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
mdc, 4, 1, do_mem_mdc,
|
mdc, 4, 1, do_mem_mdc,
|
||||||
"memory display cyclic",
|
"memory display cyclic",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address count delay(ms)"
|
||||||
"[.b, .w, .l, .q] address count delay(ms)"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address count delay(ms)"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
mwc, 4, 1, do_mem_mwc,
|
mwc, 4, 1, do_mem_mwc,
|
||||||
"memory write cyclic",
|
"memory write cyclic",
|
||||||
#if MEM_SUPPORT_64BIT_DATA
|
"[.b, .w, .l" HELP_Q "] address value delay(ms)"
|
||||||
"[.b, .w, .l, .q] address value delay(ms)"
|
|
||||||
#else
|
|
||||||
"[.b, .w, .l] address value delay(ms)"
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
#endif /* CONFIG_CMD_MX_CYCLIC */
|
#endif /* CONFIG_CMD_MX_CYCLIC */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user