summaryrefslogtreecommitdiff
path: root/src/flash
Commit message (Collapse)AuthorAgeFilesLines
* use ARRAY_SIZE macroZachary T Welch2009-11-252-8/+8
| | | | | Search and destroy lingering cases where the ARRAY_SIZE macro should be used to convey more intrinsic meaning in the OpenOCD code.
* improve command handling examplesZachary T Welch2009-11-251-0/+12
| | | | | | Removes hello and foo commands from top-level registration. Instead, the dummy interface driver and faux flash driver have been augmented to register these commands as sub-commands.
* add jim_handler to command_registrationZachary T Welch2009-11-241-3/+6
| | | | | | Adding jim_handler field to command_registration allows removing the register_jim helper. All command registrations now go through the register_command{,s}() functions.
* remove nand_controller->register_callbacksZachary T Welch2009-11-2412-41/+8
| | | | | Replace flash_driver callback with pointer to command_registration. Eliminates all related routines and allows drivers to omit commands.
* remove flash_driver->register_callbacksZachary T Welch2009-11-2417-105/+25
| | | | | Replace flash_driver callback with pointer to command_registration. Eliminates all related routines and allows drivers to omit commands.
* tms470: use register_commands()Zachary T Welch2009-11-241-7/+32
|
* str9xpec: use register_commands()Zachary T Welch2009-11-241-38/+81
|
* str9x: use register_commands()Zachary T Welch2009-11-241-8/+21
|
* str7x: use register_commands()Zachary T Welch2009-11-241-8/+20
|
* stm32x: use register_commands()Zachary T Welch2009-11-241-21/+44
|
* stellaris: use register_commands()Zachary T Welch2009-11-241-7/+20
|
* pic32mx: use register_commands()Zachary T Welch2009-11-241-17/+25
|
* nand: use register_commands()Zachary T Welch2009-11-241-47/+98
| | | | Eliminates 'nand_cmd' global variable.
* mflash: use register_commands()Zachary T Welch2009-11-241-17/+54
|
* lpc3180_nand_controller: use register_commands()Zachary T Welch2009-11-241-5/+21
|
* lpc2900: use register_commands()Zachary T Welch2009-11-241-34/+55
|
* lpc2000: use register_commands()Zachary T Welch2009-11-241-8/+20
|
* flash: use register_commands()Zachary T Welch2009-11-241-50/+117
| | | | Eliminates 'flash_cmd' global variable.
* ecos: use register_commands()Zachary T Welch2009-11-241-2/+0
|
* cfi: use register_commands()Zachary T Welch2009-11-241-6/+0
|
* avrf: use register_commands()Zachary T Welch2009-11-241-8/+20
|
* at91sam7: use register_commands()Zachary T Welch2009-11-241-9/+21
|
* at91sam3: use register_commands()Zachary T Welch2009-11-241-27/+35
|
* use COMMAND_REGISTER macroZachary T Welch2009-11-2418-119/+95
| | | | | Replaces direct calls to register_command() with a macro, to allow its parameters to be changed and callers updated in phases.
* flash: dynamically allocate working storageØyvind Harboe2009-11-221-16/+52
| | | | | | Allocate working memory rather than using stack. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* fix flash/nand name parsingZachary T Welch2009-11-201-1/+3
| | | | | Start driver.num check from end, and make sure the numeric part is actually a number. Fix problems trying to parse bank names.
* NAND verify doesn't advance.Dean Glazeski2009-11-191-1/+1
| | | | | | Fix to move the device address up as the contents are verified. Signed-off-by: Zachary T Welch <zw@superlucidity.net>
* add support for naming NAND banksZachary T Welch2009-11-192-3/+11
| | | | | Requires users to name their nand banks, allowing them to be used instead of bank numbers in script commands.
* refactor handle_nand_device_commandZachary T Welch2009-11-191-62/+62
| | | | | | | | | Move bulk of for-loop to a new static command helper function. Adds handle_nand_list_drivers command handler, registered as 'nand drivers'. Improves command help text and error reporting.
* add support for naming flash banksZachary T Welch2009-11-192-2/+10
| | | | | Requires users to name their flash banks, allowing them to be used instead of bank numbers in script commands.
* refactor handle_flash_bank_commandZachary T Welch2009-11-191-17/+13
| | | | | | | | Move variables to point of first use, reducing their scope. Add driver_name temporary to help arguments be changed later. Eliminates the useless 'found' variable, changing the code to terminate the loop immediate and return its success.
* rename flash and nand command helpersZachary T Welch2009-11-1913-44/+44
| | | | | | | After adding support for referencing banks by name, renames the COMMAND_HELPERs appropriately: flash_command_get_bank_by_num -> flash_command_get_bank nand_command_get_device_by_num -> flash_command_get_device
* allow flash/nand banks commands to accept namesZachary T Welch2009-11-197-4/+154
| | | | | | | | | | | | | | | | Add get_flash_bank_by_name (and get_nand_device_by_name) helpers to retrieves struct flash_bank * (struct nand_device *) given a driver name and an (optional) driver-specific bank index. These are used to extend flash_command_get_bank_by_num (and nand_command_get_device_by_num) to allow all flash (nand) commands to reference defined banks by name, not just by number. To avoid some code duplication, add the flash/common.[ch] files to hold functionality common to both types driver. The first two methods are helpers for the above routines to find a bank specified by a "name" or "name.index" string. get_flash_name_index() finds the '.index' portion, while flash_driver_name_matches() performs the string portion matching.
* nand_fileio_parse_args parses wrong param for sizeDean Glazeski2009-11-191-1/+1
| | | | | | | This changes the size parameter from argv[2] to argv[3], which is what it's supposed to be. Signed-off-by: Zachary T Welch <zw@superlucidity.net>
* use COMMAND_PARSE_ENABLE macro where appropriateZachary T Welch2009-11-181-8/+1
| | | | | | | | Updates all command parsing of simple "enable" and "disable" arguments. A few case in the tree use a tri-state or extended arguments, which cannot use this simple macro. Simlifies the xscale icache/dcache command handler logic.
* use COMMAND_PARSE_ON_OFF where appropriateZachary T Welch2009-11-181-7/+2
| | | | Updates all command parsing of "on" and "off" arguments.
* split startup.tcl file across modulesZachary T Welch2009-11-182-0/+18
| | | | | | | Moves definitions for each layer into their own file, eliminating layering violations in the built-in TCL code. Updates src/Makefile.am rules to include all files in the final startup.tcl input file, and others Makefile.am rules to distribute the new files in our packages.
* ARM: only use one set of dummy FPA registersDavid Brownell2009-11-171-1/+0
| | | | | | | | | | | | | | | | All ARM cores need to provide obsolete FPA registers in their GDB register dumps. (Even though cores with floating point support now generally use some version of VFP...) Clean up that support a bit by sharing the same dummy registers, and removing the duplicate copies. Eventually we shouldn't need to export those dummies. (This makes the ARMv7-M support include the armv4_5 header, and cleans up related #includes, but doesn't yet use anything from there except those dummies.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* command_handler: change 'cmd_ctx' to CMD_CTXZachary T Welch2009-11-1715-177/+177
| | | | Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
* command_handler: change 'args' to CMD_ARGVZachary T Welch2009-11-1723-198/+198
| | | | | This patch converts all instances of 'args' in COMMAND_HANDLER routines to use CMD_ARGV macro.
* command_handler: change to 'argc' to CMD_ARGCZachary T Welch2009-11-1725-99/+99
| | | | | This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
* fileio: improve API typesZachary T Welch2009-11-165-12/+15
| | | | | | | | | | | | | Use size_t instead of uint32_t when specifying file sizes. Update all consumers up through the layers to use size_t when required. These changes should be safe, but the higher-levels will need to be updated further to receive the intended benefits (i.e. large file support). Add error checking for fileio_read and file_write. Previously, all errors were being silently ignored, so this change might cause some problems for some people in some cases. However, it gives us the chance to handle any errors that do occur at higher-levels, rather than burying our heads in the sand.
* struct fileio: improve member typesZachary T Welch2009-11-163-3/+3
| | | | | | Add const keyword to file url and cast to free(). Make size an ssize_t and chase all format strings that use it.
* rename CEIL as DIV_ROUND_UPZachary T Welch2009-11-163-8/+8
| | | | | Improves the name of this macro, moves it to types.h, and adds a block of Doxygen comments to describe what it does.
* nand_command_get_device_by_num: make COMMAND_HELPERZachary T Welch2009-11-162-10/+11
| | | | | Use COMMAND_HELPER macro to define nand_command_get_device_by_num. Use CALL_COMMAND_HANDLER to invoke it.
* flash_command_get_bank_by_num: make COMMAND_HELPERZachary T Welch2009-11-1611-41/+41
| | | | | Use COMMAND_HELPER macro to declare flash_command_get_bank_by_num. This is required for COMMAND_PARSE_NUMBER macro.
* Add 'nand verify' commandZachary T Welch2009-11-161-0/+65
| | | | | | | | | | | Add the 'nand verify' command to perform a dump and fake-write simultaneously, checking the read bits against those generated by the write process. Appropriate user documentation for this command has been added to the user guide as well. The algorithm presently makes a relatively naive comparison. Some chips that use ECC may not verify correctly using this implementation, but the new documentation provides details about this limitation.
* Use nand_fileio_* in write/dump commands.Zachary T Welch2009-11-161-248/+46
| | | | | | | | | | | This patch eliminates duplicated code in the the NAND 'dump' and 'write' by using the new static helper functions. These changes also fix a possible memory leak in nand dump command, in the case that the dump file failed to open. Overall, the changes should be functionally equivalent, but the resulting code will be easier to improve and extend further.
* Add nand_fileio_* helper APIs.Zachary T Welch2009-11-161-0/+216
| | | | | | | | | | | | | | | This patch provides helpers APIs that will eliminate duplicated code in the the NAND 'dump' and 'write' commands by factoring their common code into static helper functions. These helpers may be useful for creating new commands, as shown in the final patch to 'verify' flash from a file. Several previously unreported error conditions now generate messages and propogate the return codes, such as when the file fails to open and bad arguments are given. These changes will fix a possible memory leak in nand dump command, in the case that the dump file failed to open. Overall, the changes should be functionally equivalent, but the resulting code will be easier to improve and extend consistently.
* #include "target.h" less wildlyDavid Brownell2009-11-164-4/+2
| | | | | | | | | Don't include "target.h" from more headers than necessary. This avoids needless interdependencies and duplicated include paths. Don't needlessly include it in source files, either. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>