cmd_mem.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * (C) Copyright 2000
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * Memory Functions
  25. */
  26. #ifndef _CMD_MEM_H
  27. #define _CMD_MEM_H
  28. #if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
  29. #define CMD_TBL_MD MK_CMD_TBL_ENTRY( \
  30. "md", 2, 3, 1, do_mem_md, \
  31. "md - memory display\n", \
  32. "[.b, .w, .l] address [# of objects]\n - memory display\n" \
  33. ),
  34. #define CMD_TBL_MM MK_CMD_TBL_ENTRY( \
  35. "mm", 2, 2, 1, do_mem_mm, \
  36. "mm - memory modify (auto-incrementing)\n", \
  37. "[.b, .w, .l] address\n" \
  38. " - memory modify, auto increment address\n" \
  39. ),
  40. #define CMD_TBL_NM MK_CMD_TBL_ENTRY( \
  41. "nm", 2, 2, 1, do_mem_nm, \
  42. "nm - memory modify (constant address)\n", \
  43. "[.b, .w, .l] address\n - memory modify, read and keep address\n" \
  44. ),
  45. #define CMD_TBL_MW MK_CMD_TBL_ENTRY( \
  46. "mw", 2, 4, 1, do_mem_mw, \
  47. "mw - memory write (fill)\n", \
  48. "[.b, .w, .l] address value [count]\n - write memory\n" \
  49. ),
  50. #define CMD_TBL_CP MK_CMD_TBL_ENTRY( \
  51. "cp", 2, 4, 1, do_mem_cp, \
  52. "cp - memory copy\n", \
  53. "[.b, .w, .l] source target count\n - copy memory\n" \
  54. ),
  55. #define CMD_TBL_CMP MK_CMD_TBL_ENTRY( \
  56. "cmp", 3, 4, 1, do_mem_cmp, \
  57. "cmp - memory compare\n", \
  58. "[.b, .w, .l] addr1 addr2 count\n - compare memory\n" \
  59. ),
  60. #define CMD_TBL_CRC MK_CMD_TBL_ENTRY( \
  61. "crc32", 3, 4, 1, do_mem_crc, \
  62. "crc32 - checksum calculation\n", \
  63. "address count [addr]\n - compute CRC32 checksum [save at addr]\n" \
  64. ),
  65. #define CMD_TBL_BASE MK_CMD_TBL_ENTRY( \
  66. "base", 2, 2, 1, do_mem_base, \
  67. "base - print or set address offset\n", \
  68. "\n - print address offset for memory commands\n" \
  69. "base off\n - set address offset for memory commands to 'off'\n" \
  70. ),
  71. /*
  72. * Require full name for "loop" and "mtest" because these are infinite loops!
  73. */
  74. #define CMD_TBL_LOOP MK_CMD_TBL_ENTRY( \
  75. "loop", 4, 3, 1, do_mem_loop, \
  76. "loop - infinite loop on address range\n", \
  77. "[.b, .w, .l] address number_of_objects\n" \
  78. " - loop on a set of addresses\n" \
  79. ),
  80. #define CMD_TBL_MTEST MK_CMD_TBL_ENTRY( \
  81. "mtest", 5, 4, 1, do_mem_mtest, \
  82. "mtest - simple RAM test\n", \
  83. "[start [end [pattern]]]\n" \
  84. " - simple RAM read/write test\n" \
  85. ),
  86. int do_mem_md (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  87. int do_mem_mm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  88. int do_mem_nm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  89. int do_mem_mw (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  90. int do_mem_cp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  91. int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  92. int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  93. int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  94. int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  95. int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  96. #else
  97. #define CMD_TBL_MD
  98. #define CMD_TBL_MM
  99. #define CMD_TBL_NM
  100. #define CMD_TBL_MW
  101. #define CMD_TBL_CP
  102. #define CMD_TBL_CMP
  103. #define CMD_TBL_CRC
  104. #define CMD_TBL_BASE
  105. #define CMD_TBL_LOOP
  106. #define CMD_TBL_MTEST
  107. #endif /* CFG_CMD_MEMORY */
  108. #endif /* _CMD_MEM_H */