summaryrefslogtreecommitdiff
path: root/common/cmd_mem.c
Commit message (Collapse)AuthorAgeLines
* cmd_mem: cmp: convert while() to for() loopMike Frysinger2012-06-19-5/+2
| | | | | | | | Simplify the code slightly by using a for() loop since this is basically what we're already doing -- incrementing "ngood" to the value in "count". Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* cmd_mem: cmp: unify size code pathsMike Frysinger2012-06-19-33/+19
| | | | | | | | | | | | | | | | Not only does the source code get simpler, but it also shrinks the compiled object code too. While we're here, tweak the summary message to avoid the plural issue. It isn't that big of a deal, and it's currently wrong anyways in the single (1 byte) case: Total of 1 byte were the same Grammar wise, that should be "was" rather than "were". The new output people should be able to easily figure out: Total of 1 byte(s) were the same Total of 10 byte(s) were the same Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* cmd_mem: replace custom PRINTF() with debug()Mike Frysinger2012-06-19-9/+3
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Convert cmd_usage() calls in common to use a return valueSimon Glass2012-03-06-11/+11
| | | | | | | | | Change all files in common/ to use CMD_RET_USAGE instead of calling cmd_usage() directly. I'm not completely sure about this patch since the code since impact is small (100 byte or so on ARM) and it might need splitting into smaller patches. But for now here it is. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: move extern char console_buffer[] to common.hIgor Grinberg2011-11-22-1/+0
| | | | | | | | | Extract all extern declarations for console_buffer[] out of c files into the common.h header. Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Cc: Frank Gottschling <fgottschling@eltec.de> Cc: Murray Jensen <Murray.Jensen@csiro.au>
* Revert "sandbox: Change md command to use map_physmem"Kumar Gala2011-11-16-7/+2
| | | | | | | | | | This reverts commit 355a835747c6f7c5071ead295a7dfc489c73cb03. The original commit broke long standing assumption that md commands work on effective addresses. This normally isn't an issue for most systems that map 1:1, however on systems with a 36-bit address map it breaks. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* sandbox: Change md command to use map_physmemSimon Glass2011-11-03-2/+7
| | | | | | | | | | Sandbox wants to support commands which use memory. The map_physmen() call provides this feature, so should be used more consistently in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org> Tested-by: Matthias Weisser <weisserm@arcor.de>
* sandbox: Use uintptr_t for 32/64-bit compatibilitySimon Glass2011-10-17-1/+1
| | | | | | This fixes a problems when building on some 64-bit machines. Signed-off-by: Simon Glass <sjg@chromium.org>
* GCC4.6: Squash warning in cmd_mem.cMarek Vasut2011-10-01-4/+4
| | | | | | | | | | | cmd_mem.c: In function ‘do_mem_loop’: cmd_mem.c:474:25: warning: variable ‘junk’ set but not used [-Wunused-but-set-variable] The assigned variable can be removed because the pointers are volatile so accesses to their addresses are always generated. Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
* Fix: if using crc32 command watchdog timed outJens Scharsig2011-07-26-2/+2
| | | | | | | | * Fix: if using crc32 command watchdog timed out * change function call crc32(..) to the watchdog-safe variant crc_32_wd(..) to support watchdog reset Signed-off-by: Jens Scharsig <esw@bus-elektronik.de>
* md5sum/sha1sum/unzip: split out of mondo mem fileMike Frysinger2011-04-13-104/+0
| | | | | | | | There's no real need to keep these functions in the cmd_mem file since they do not use any of the common global mem variables. So split them out into their own dedicated cmd files. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* crc32: make command optionalMike Frysinger2011-04-13-0/+8
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* unzip: return uncompressed size in `filesize', and print it.Wolfgang Denk2011-02-15-1/+9
| | | | | | | | | | | The unzip command did not provide a way for the caller to get any information about the uncompressed size. To make it better usable in scripts, we now store the uncompressed size in the `filesize' variable, like we do when for example loading a file over the network or when reading it from a file system. Following that analogy, it is only consequent to also print the size. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Fix defines needed to enable command sha1sumAlexander Holler2011-01-19-2/+2
| | | | | | | | | | | Documented is CONFIG_CMD_SHA1, through confusion in the source CONFIG_CMD_SHA1 and CONFIG_CMD_SHA1SUM has to be used to enable sha1sum. Fix both, the documentation and the source, so that only CONFIG_CMD_SHA1SUM is needed to enable the command sha1sum. Signed-off-by: Alexander Holler <holler@ahsoftware.de>
* cmd_mem: localize state variablesMike Frysinger2011-01-09-3/+3
| | | | | | These "last" variables aren't used outside of this file, so add static. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* cp/cmp: Add WATCHDOG_RESET in copy and compare loopStefan Roese2010-10-12-0/+8
| | | | | | | | | | | On some boards with a very short watchdog timeout, the "cp" and "cmp" commands may reset the board. This patch adds some watchdog resets inside the loops. Otherwise for example the lwmon5 board will reset while doing something like this: => cp.b fc000000 1000000 100000 Signed-off-by: Stefan Roese <sr@denx.de>
* cmd_usage(): simplify return code handlingWolfgang Denk2010-07-24-53/+27
| | | | | | | | | | | | | | | | Lots of code use this construct: cmd_usage(cmdtp); return 1; Change cmd_usage() let it return 1 - then we can replace all these ocurrances by return cmd_usage(cmdtp); This fixes a few places with incorrect return code handling, too. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Make sure that argv[] argument pointers are not modified.Wolfgang Denk2010-07-04-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hush shell dynamically allocates (and re-allocates) memory for the argument strings in the "char *argv[]" argument vector passed to commands. Any code that modifies these pointers will cause serious corruption of the malloc data structures and crash U-Boot, so make sure the compiler can check that no such modifications are being done by changing the code into "char * const argv[]". This modification is the result of debugging a strange crash caused after adding a new command, which used the following argument processing code which has been working perfectly fine in all Unix systems since version 6 - but not so in U-Boot: int main (int argc, char **argv) { while (--argc > 0 && **++argv == '-') { /* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ... } The line marked "====>" will corrupt the malloc data structures and usually cause U-Boot to crash when the next command gets executed by the shell. With the modification, the compiler will prevent this with an error: increment of read-only location '*argv' N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ... Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* move prototypes for gunzip() and zunzip() to common.hWolfgang Wegner2009-12-21-2/+0
| | | | | | | | Prototype for gunzip/zunzip was only in lib_generic/gunzip.c and thus repeated in every file using it. This patch moves the prototypes to common.h and removes all prototypes distributed anywhere else. Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
* mem_mtest: fix error reporting, allow escape with ^CPaul Gortmaker2009-10-18-14/+44
| | | | | | | | | | | | | | | | | | | | | | | | The basic memtest function tries to watch for ^C after each pattern pass as an escape mechanism, but if things are horribly wrong, we'll be stuck in an inner loop flooding the console with error messages and never check for ^C. To make matters worse, if the user waits for all the error messages to complete, we then incorrectly report the test passed without errors. Adding a check for ^C after any error is printed will give the end user an escape mechanism from a console flood without slowing down the overall test speed on a slow processor. Also, the more extensive memtest quit after just a single error, which is inconsistent with the normal memtest, and not useful if if you are doing dynamic environmental impact testing, such as heating/cooling etc. Both tests now track the error count and report it properly at test completion. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Add md5sum and sha1 commands...Robin Getz2009-08-25-0/+68
| | | | | | | Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files. Signed-off-by: Robin Getz <rgetz@analog.com>
* General help message cleanupWolfgang Denk2009-06-12-20/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many of the help messages were not really helpful; for example, many commands that take no arguments would not print a correct synopsis line, but "No additional help available." which is not exactly wrong, but not helpful either. Commit ``Make "usage" messages more helpful.'' changed this partially. But it also became clear that lots of "Usage" and "Help" messages (fields "usage" and "help" in struct cmd_tbl_s respective) were actually redundant. This patch cleans this up - for example: Before: => help dtt dtt - Digital Thermometer and Thermostat Usage: dtt - Read temperature from digital thermometer and thermostat. After: => help dtt dtt - Read temperature from Digital Thermometer and Thermostat Usage: dtt Signed-off-by: Wolfgang Denk <wd@denx.de>
* Eliminate support for using MMC as memoryAndy Fleming2009-02-16-43/+0
| | | | | | MMC cards are not memory, so we stop treating them that way. Signed-off-by: Andy Fleming <afleming@freescale.com>
* Command usage cleanupPeter Tyser2009-01-28-15/+15
| | | | | | | | Remove command name from all command "usage" fields and update common/command.c to display "name - usage" instead of just "usage". Also remove newlines from command usage fields. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* Standardize command usage messages with cmd_usage()Peter Tyser2009-01-28-12/+12
| | | | Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* common: Iteration limit for memory test.Dirk Eibach2009-01-24-14/+31
| | | | | | | | | The iteration limit is passed to mtest as a fourth parameter: [start [end [pattern [iterations]]]] If no fourth parameter is supplied, there is no iteration limit and the test will loop forever. Signed-off-by: Dirk Eibach <eibach@gdsys.de>
* cmd_mem: Remove unused variablePeter Tyser2008-12-14-1/+0
| | | | Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD2008-10-18-9/+9
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cmd_mem: Move conditional compilation to MakefileJean-Christophe PLAGNIOL-VILLARD2008-09-10-4/+0
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* move cmd_get_data_size to command.cJean-Christophe PLAGNIOL-VILLARD2008-09-10-29/+0
| | | | | | add CMD_DATA_SIZE macro to enable it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* common/cmd_mem.c: remove nested #if defined(CONFIG_CMD_MEMORY)Markus Heidelberg2008-09-09-2/+0
| | | | Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
* cmd_mem.c: Fix help message alignmentWolfgang Denk2008-08-26-15/+15
| | | | | | Bug was introced by "Big white-space cleanup" (53677ef1) Signed-off-by: Wolfgang Denk <wd@denx.de>
* add 'unzip' command to u-boot commandlineHarald Welte2008-08-18-0/+36
| | | | | | | | | | [PATCH] add new 'unzip' command to u-boot commandline common/cmd_mem.c: new command "unzip srcaddr dstaddr [dstsize]" to unzip from memory to memory, and option CONFIG_CMD_UNZIP to enable it Signed-off-by: Werner Almesberger <werner@openmoko.org> Signed-off-by: Harald Welte <laforge@openmoko.org>
* Big white-space cleanup.Wolfgang Denk2008-05-21-30/+30
| | | | | | | | | | | This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Merge branch 'master' of /home/wd/git/u-boot/lwmon5Wolfgang Denk2008-04-25-0/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: common/cmd_bootm.c common/cmd_log.c include/common.h post/board/lwmon5/Makefile post/board/lwmon5/dsp.c post/board/lwmon5/dspic.c post/board/lwmon5/fpga.c post/board/lwmon5/gdc.c post/board/lwmon5/sysmon.c post/board/lwmon5/watchdog.c Signed-off-by: Wolfgang Denk <wd@denx.de>
| * Added watchdog triggering calls in the "mtest" test function.Sergei Poselenov2008-04-22-0/+7
| | | | | | | | Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
* | Fix CFG_NO_FLASH compilation.Stelian Pop2008-03-30-1/+5
|/ | | | | | | | | Many Atmel boards have no "real" (NOR) flash on board, and rely only on DataFlash and NAND memories. This patch enables CFG_NO_FLASH to be present in a board configuration file, while still enabling flash commands like 'flinfo', 'protect', etc. Signed-off-by: Stelian Pop <stelian@popies.net>
* fix copy from ram to dataflashKim B. Heino2008-03-03-1/+1
| | | | | | | | If I try to "cp.b <ram> <dataflash>", u-boot selects normal flash routines instead of dataflash. This is because it checks "if source address is not dataflash" instead of target address. Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
* Fix wrong memory limit calculation in memory-testGuennadi Liakhovetski2008-02-15-15/+8
| | | | | | | | | | If the length of the memory address range passed to the "mtest" command is not of the form 2^x - 1, not all address lines are tested. This bug is inherited from the original software at http://www.netrino.com/Embedded-Systems/How-To/Memory-Test-Suite-C. Fix this. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
* Merge branch 'master' of git://www.denx.de/git/u-boot-blackfinWolfgang Denk2008-02-15-3/+48
|\ | | | | | | | | | | | | | | | | Conflicts: Makefile doc/README.standalone Signed-off-by: Wolfgang Denk <wd@denx.de>
| * add support for memory commands with Blackfin L1 instruction memoryMike Frysinger2008-02-04-3/+48
| | | | | | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | Fix return value of mtest when CFG_ALT_MEMTEST setGuennadi Liakhovetski2008-02-14-2/+2
|/ | | | | | Fix a missing return statement from a non-void function. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
* common/: Remove lingering references to CFG_CMD_* symbols.Jon Loeliger2007-07-10-1/+1
| | | | | | | | Fixed some broken instances of "#ifdef CMD_CFG_IDE" too. Those always evaluated TRUE, and thus were always compiled even when IDE really wasn't defined/wanted. Signed-off-by: Jon Loeliger <jdl@freescale.com>
* common/cmd_[i-n]*: Remove obsolete references to CONFIG_COMMANDS.Jon Loeliger2007-07-08-10/+5
| | | | Signed-off-by: Jon Loeliger <jdl@freescale.com>
* common/cmd_[i-z]* : Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).Jon Loeliger2007-07-04-5/+11
| | | | | | | | | | | | | | This is a compatibility step that allows both the older form and the new form to co-exist for a while until the older can be removed entirely. All transformations are of the form: Before: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) After: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT) Signed-off-by: Jon Loeliger <jdl@freescale.com>
* [PATCH 3_9] Move buffer print code from md command to common functionGrant Likely2007-02-20-51/+14
| | | | | | | Printing a buffer is a darn useful thing. Move the buffer print code into print_buffer() in lib_generic/ Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* Make code better readable.Wolfgang Denk2006-07-21-1/+1
| | | | Patch by Ladislav Michl, 14 Sep 2005
* Cleanup for GCC-4.xWolfgang Denk2005-10-13-2/+2
|
* memory commands "mdc" and "mwc" added for cyclic read/writestroese2004-12-16-0/+74
|
* * Patch by Gridish Shlomi, 30 Aug 2004:wdenk2004-10-10-1/+1
| | | | | | | | | | | | | | | | | - Add support to revA version of PQ27 and PQ27E. - Reverted MPC8260ADS baudrate back to original 115200 * Patch by Hojin, 17 Sep 2004: Fix typo in cfi_flash.c * Patch by Mark Jonas, 09 September 2004: mtest's data line test (with CFG_ALT_MEMTEST set) returned a wrong error message * Patch by Mark Jonas, 31 August 2004: Added option CFG_XLB_PIPELINING to enable XLB pipelining. This improves FTP performance for MPC5200 systems. Enabled for IceCube by default.