Commit Graph

666 Commits

Author SHA1 Message Date
Zachary T Welch
ad090413a8 remove flash_driver->register_callbacks
Replace flash_driver callback with pointer to command_registration.
Eliminates all related routines and allows drivers to omit commands.
2009-11-24 21:37:35 -08:00
Zachary T Welch
6b9bb584a5 tms470: use register_commands() 2009-11-24 21:37:35 -08:00
Zachary T Welch
b4e95c3720 str9xpec: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
5e977b46c3 str9x: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
dfa856ca18 str7x: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
f9606a6cb7 stm32x: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
737f8f2735 stellaris: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
0ff0dbba49 pic32mx: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
ccae9ae020 nand: use register_commands()
Eliminates 'nand_cmd' global variable.
2009-11-24 21:37:34 -08:00
Zachary T Welch
1bf7462edb mflash: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
7609e1091a lpc3180_nand_controller: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
1cbe3ec6f1 lpc2900: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
a12a29c28a lpc2000: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
b90bf52be3 flash: use register_commands()
Eliminates 'flash_cmd' global variable.
2009-11-24 21:37:34 -08:00
Zachary T Welch
1765b10304 ecos: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
b595ab8b97 cfi: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
c4aa2fd6e7 avrf: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
bdae918dcd at91sam7: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
2a4a94b7ac at91sam3: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch
833e7f5248 use COMMAND_REGISTER macro
Replaces direct calls to register_command() with a macro, to allow
its parameters to be changed and callers updated in phases.
2009-11-24 21:37:29 -08:00
Øyvind Harboe
5416c525d4 flash: dynamically allocate working storage
Allocate working memory rather than using stack.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-22 19:14:06 +01:00
Zachary T Welch
153848e6cc fix flash/nand name parsing
Start driver.num check from end, and make sure the numeric part is
actually a number.  Fix problems trying to parse bank names.
2009-11-20 07:10:55 -08:00
Dean Glazeski
31fb7788a6 NAND verify doesn't advance.
Fix to move the device address up as the contents are verified.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-19 15:25:18 -08:00
Zachary T Welch
664ba309d5 add support for naming NAND banks
Requires users to name their nand banks, allowing them to be used
instead of bank numbers in script commands.
2009-11-19 13:39:41 -08:00
Zachary T Welch
59d4466b55 refactor handle_nand_device_command
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.
2009-11-19 13:39:41 -08:00
Zachary T Welch
fd654c8a3e add support for naming flash banks
Requires users to name their flash banks, allowing them to be used
instead of bank numbers in script commands.
2009-11-19 13:39:41 -08:00
Zachary T Welch
dd44ae18b4 refactor handle_flash_bank_command
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.
2009-11-19 13:39:41 -08:00
Zachary T Welch
ff25e76bad rename flash and nand command helpers
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
2009-11-19 13:39:41 -08:00
Zachary T Welch
870b8c0455 allow flash/nand banks commands to accept names
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.
2009-11-19 13:39:41 -08:00
Dean Glazeski
c049033fde nand_fileio_parse_args parses wrong param for size
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>
2009-11-19 07:00:30 -08:00
Zachary T Welch
410fab9ea8 use COMMAND_PARSE_ENABLE macro where appropriate
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.
2009-11-18 15:51:07 -08:00
Zachary T Welch
75a37eb5b3 use COMMAND_PARSE_ON_OFF where appropriate
Updates all command parsing of "on" and "off" arguments.
2009-11-18 15:51:07 -08:00
Zachary T Welch
cb7dbc1af4 split startup.tcl file across modules
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.
2009-11-18 07:21:42 -08:00
David Brownell
d6c8945662 ARM: only use one set of dummy FPA registers
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>
2009-11-17 23:50:17 -08:00
Zachary T Welch
2861877b32 command_handler: change 'cmd_ctx' to CMD_CTX
Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
2009-11-17 11:40:06 -08:00
Zachary T Welch
23402315ce command_handler: change 'args' to CMD_ARGV
This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.
2009-11-17 11:38:07 -08:00
Zachary T Welch
7bf1a86e47 command_handler: change to 'argc' to CMD_ARGC
This patch converts all instances of 'argc' in COMMAND_HANDLER routines
to use CMD_ARGC.
2009-11-17 11:38:06 -08:00
Zachary T Welch
51862bb98c fileio: improve API types
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.
2009-11-16 15:47:09 -08:00
Zachary T Welch
69df712d1d struct fileio: improve member types
Add const keyword to file url and cast to free().

Make size an ssize_t and chase all format strings that use it.
2009-11-16 15:47:09 -08:00
Zachary T Welch
a94748ec6d rename CEIL as DIV_ROUND_UP
Improves the name of this macro, moves it to types.h, and adds a block
of Doxygen comments to describe what it does.
2009-11-16 09:58:11 -08:00
Zachary T Welch
cbc0578372 nand_command_get_device_by_num: make COMMAND_HELPER
Use COMMAND_HELPER macro to define nand_command_get_device_by_num.
Use CALL_COMMAND_HANDLER to invoke it.
2009-11-16 08:44:38 -08:00
Zachary T Welch
e84849f5ed flash_command_get_bank_by_num: make COMMAND_HELPER
Use COMMAND_HELPER macro to declare flash_command_get_bank_by_num.
This is required for COMMAND_PARSE_NUMBER macro.
2009-11-16 08:44:38 -08:00
Zachary T Welch
555757175e Add 'nand verify' command
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.
2009-11-16 01:38:19 -08:00
Zachary T Welch
51cd370b39 Use nand_fileio_* in write/dump commands.
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.
2009-11-16 01:38:19 -08:00
Zachary T Welch
23cc85b307 Add nand_fileio_* helper APIs.
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.
2009-11-16 01:38:19 -08:00
David Brownell
b695cb7522 #include "target.h" less wildly
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>
2009-11-16 00:35:24 -08:00
David Brownell
1186f7efa7 target: less implicit inclusion of "command.h"
Lots of files still include it, often through needless
duplicate inclusion of "log.h"; sigh.

This cleans up the inclusion graph a bunch, so there are
fewer inclusion paths, but it doesn't change much otherwise.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-16 00:35:11 -08:00
David Brownell
db094c2e60 target: don't implicitly include "algorithm.h"
Most files in the tree seem to have ended up including this,
and *quite* needlessly ... only code implementing or using
downloadable algorithms actually needs these declarations.

So take it out of the header files which included it, and put
it in files which use it ... reduce needless interdependencies.

Also: "algorithm.h" doesn't need to include "types.h" again;
it already comes from a different header.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-16 00:35:05 -08:00
David Brownell
ecc659d44d lpc2900.h -- remove from Makefile.am too
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-14 14:58:14 -08:00
David Brownell
dd47bba6f8 flash: remove needless lpc2900.h header
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-14 14:53:19 -08:00
David Brownell
afe0298399 ARM7/9: rm arm7_9_get_arch_pointers()
Remove the last external user of arm7_9_get_arch_pointers(), and
that annoying downcast utility.  Add an is_arm7_9() predicate.

Stop returning specious success codes on various failure paths
in the ARM7/ARM9 commands which used that downcast utility.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-13 13:44:50 -08:00
Zachary T Welch
ef746e27c5 command_t -> struct command
Remove misleading typedef and redundant suffix from struct command.
2009-11-13 13:30:50 -08:00
Zachary T Welch
98723c4ecd command_context_t -> struct command_context
Remove misleading typedef and redundant suffix from struct command_context.
2009-11-13 13:25:47 -08:00
Zachary T Welch
96b62996d2 flash_bank_t -> struct flash_bank
Remove misleading typedef and redundant suffix from struct flash_bank.
2009-11-13 11:58:14 -08:00
Zachary T Welch
2f6e56e383 nand_device_t -> struct nand_device
Remove misleading typedef and redundant suffix from struct nand_device.
2009-11-13 11:58:14 -08:00
Zachary T Welch
0f1163e823 target_t -> struct target
Remove misleading typedef and redundant suffix from struct target.
2009-11-13 11:58:14 -08:00
Zachary T Welch
dfecfd5fd4 image_t -> struct image
Remove misleading typedef and redundant suffix from struct image.

Also removes the typedef from enum image_type, as it is used in
image.h only.
2009-11-13 11:58:13 -08:00
Zachary T Welch
af949b2531 armv4_5_common_t -> struct arm
Remove misleading typedef and just use struct arm.
2009-11-13 11:58:13 -08:00
Zachary T Welch
46fc1d57ac working_area_t -> struct working_area
Remove misleading typedef and redundant suffix from struct working_area.
2009-11-13 11:58:12 -08:00
Zachary T Welch
a8141cafde mips_ejtag_t -> struct mips_ejtag
Remove misleading typedef and redundant suffix from struct mips_ejtag.
2009-11-13 11:58:11 -08:00
Zachary T Welch
3b7aee21b5 mips32_common_t -> struct mips32_common
Remove misleading typedef and redundant suffix from struct mips32_common.
2009-11-13 11:58:11 -08:00
Zachary T Welch
e7f65c5a11 avr_common_t -> struct avr_common
Remove misleading typedef and redundant suffix from struct avr_common.
2009-11-13 11:58:10 -08:00
Zachary T Welch
5e43565ab5 armv7m_algorithm_t -> struct armv7m_algorithm
Remove misleading typedef and redundant suffix from struct armv7m_algorithm.
2009-11-13 11:58:10 -08:00
Zachary T Welch
15e8e45308 armv4_5_algorithm_t -> struct armv4_5_algorithm
Remove misleading typedef and redundant suffix from struct armv4_5_algorithm.
2009-11-13 11:58:10 -08:00
Zachary T Welch
056fcdb540 arm_jtag_t -> struct arm_jtag
Remove misleading typedef and redundant suffix from struct arm_jtag.
2009-11-13 11:58:10 -08:00
Zachary T Welch
8012b3963f arm7_9_common_t -> struct arm7_9_common
Remove misleading typedef and redundant suffix from struct arm7_9_common.
2009-11-13 11:58:09 -08:00
Zachary T Welch
b1de5eb9a0 reg_param_t -> struct reg_param
Remove misleading typedef and redundant suffix from struct reg_param.
2009-11-13 11:58:09 -08:00
Zachary T Welch
6c965a3da9 mem_param_t -> struct mem_param
Remove misleading typedef and redundant suffix from struct mem_param.
2009-11-13 11:58:09 -08:00
Zachary T Welch
43483e5054 remove unused aduc702x structure.
The ADUC702x_FLASH_MMIO structure was completely used, so it must die.
2009-11-13 11:58:08 -08:00
Zachary T Welch
a03c9a8dce aduc702x_flash_bank_t -> struct aduc702x_flash_bank
Remove misleading typedef and redundant suffix from struct
aduc702x_flash_bank.
2009-11-13 11:58:08 -08:00
Zachary T Welch
6a374afe71 tms470_flash_bank_t -> struct tms470_flash_bank
Remove misleading typedef and redundant suffix from struct tms470_flash_bank.
2009-11-13 11:58:08 -08:00
Zachary T Welch
3c9afaa645 pic32mx_mem_layout_t -> struct pic32mx_mem_layout
Remove misleading typedef and redundant suffix from struct pic32mx_mem_layout.
2009-11-13 11:58:08 -08:00
Zachary T Welch
54be77bc79 non_cfi_t -> struct non_cfi
Remove misleading typedef and redundant suffix from struct non_cfi.
2009-11-13 11:58:08 -08:00
Zachary T Welch
d0dfec33b6 nand_block_t -> struct nand_block
Remove misleading typedef and redundant suffix from struct nand_block.
2009-11-13 11:58:07 -08:00
Zachary T Welch
92fc7a6fde str9xpec_flash_controller_t -> struct str9xpec_flash_controller
Remove misleading typedef and redundant suffix from struct str9xpec_flash_controller.
2009-11-13 11:58:07 -08:00
Zachary T Welch
6aa82891b6 str9x_flash_bank_t -> struct str9x_flash_bank
Remove misleading typedef and redundant suffix from struct str9x_flash_bank.
2009-11-13 11:58:07 -08:00
Zachary T Welch
774d71f2cf str7x_mem_layout_t -> struct str7x_mem_layout
Remove misleading typedef and redundant suffix from struct str7x_mem_layout.
2009-11-13 11:58:07 -08:00
Zachary T Welch
3b09560ae8 str7x_flash_bank_t -> struct str7x_flash_bank
Remove misleading typedef and redundant suffix from struct str7x_flash_bank.
2009-11-13 11:58:07 -08:00
Zachary T Welch
01b10d65bf stm32x_mem_layout_t -> struct stm32x_mem_layout
Remove misleading typedef and redundant suffix from struct stm32x_mem_layout.
2009-11-13 11:58:07 -08:00
Zachary T Welch
c7b2cad52d stm32x_flash_bank_t -> struct stm32x_flash_bank
Remove misleading typedef and redundant suffix from struct stm32x_flash_bank.
2009-11-13 11:58:07 -08:00
Zachary T Welch
40273967bf stm32x_options_t -> struct stm32x_options
Remove misleading typedef and redundant suffix from struct stm32x_options.
2009-11-13 11:58:07 -08:00
Zachary T Welch
9059f9f28e stellaris_flash_bank_t -> struct stellaris_flash_bank
Remove misleading typedef and redundant suffix from struct stellaris_flash_bank.
2009-11-13 11:58:07 -08:00
Zachary T Welch
ed9c4ef3c4 s3c24xx_nand_controller_t -> struct s3c24xx_nand_controller
Remove misleading typedef and redundant suffix from struct s3c24xx_nand_controller.
2009-11-13 11:58:07 -08:00
Zachary T Welch
eba5608b52 pic32mx_flash_bank_t -> struct pic32mx_flash_bank
Remove misleading typedef and redundant suffix from struct pic32mx_flash_bank.
2009-11-13 11:58:07 -08:00
Zachary T Welch
5948e66ee8 orion_nand_controller_t -> struct orion_nand_controller
Remove misleading typedef and redundant suffix from struct orion_nand_controller.
2009-11-13 11:58:07 -08:00
Zachary T Welch
c7b96a4dc1 ocl_priv_t -> struct ocl_priv
Remove misleading typedef and redundant suffix from struct ocl_priv.
2009-11-13 11:58:07 -08:00
Zachary T Welch
958ff04b08 nand_info_t -> struct nand_info
Remove misleading typedef and redundant suffix from struct nand_info.
2009-11-13 11:58:07 -08:00
Zachary T Welch
f7ca047213 nand_manufacturer_t -> struct nand_manufacturer
Remove misleading typedef and redundant suffix from struct nand_manufacturer.
2009-11-13 11:58:07 -08:00
Zachary T Welch
8f4860d13f nand_ecclayout_t -> struct nand_ecclayout
Remove misleading typedef and redundant suffix from struct nand_ecclayout.
2009-11-13 11:58:07 -08:00
Zachary T Welch
8605352387 nand_flash_controller_t -> struct nand_flash_controller
Remove misleading typedef and redundant suffix from struct nand_flash_controller.
2009-11-13 11:58:07 -08:00
Zachary T Welch
4bc46d61ca mx3_nf_controller_t -> struct mx3_nf_controller
Remove misleading typedef and redundant suffix from struct mx3_nf_controller.
2009-11-13 11:58:07 -08:00
Zachary T Welch
79338ec6c2 mflash_bank_t -> struct mflash_bank
Remove misleading typedef and redundant suffix from struct mflash_bank.
2009-11-13 11:58:07 -08:00
Zachary T Welch
bb6b9988cb mg_drv_info_t -> struct mg_drv_info
Remove misleading typedef and redundant suffix from struct mg_drv_info.
2009-11-13 11:58:07 -08:00
Zachary T Welch
fc01dd6a13 mflash_gpio_drv_t -> struct mflash_gpio_drv
Remove misleading typedef and redundant suffix from struct mflash_gpio_drv.
2009-11-13 11:58:06 -08:00
Zachary T Welch
a043632a52 mflash_gpio_num_t -> struct mflash_gpio_num
Remove misleading typedef and redundant suffix from struct mflash_gpio_num.
2009-11-13 11:58:06 -08:00
Zachary T Welch
ed1aed8dd9 lpc3180_nand_controller_t -> struct lpc3180_nand_controller
Remove misleading typedef and redundant suffix from struct lpc3180_nand_controller.
2009-11-13 11:58:06 -08:00
Zachary T Welch
b712a4e8b8 lpc2900_flash_bank_t -> struct lpc2900_flash_bank
Remove misleading typedef and redundant suffix from struct lpc2900_flash_bank.
2009-11-13 11:58:06 -08:00
Zachary T Welch
12f83f0429 lpc288x_flash_bank_t -> struct lpc288x_flash_bank
Remove misleading typedef and redundant suffix from struct lpc288x_flash_bank.
2009-11-13 11:58:06 -08:00
Zachary T Welch
a15d4cc75e lpc2000_flash_bank_t -> struct lpc2000_flash_bank
Remove misleading typedef and redundant suffix from struct lpc2000_flash_bank.
2009-11-13 11:58:06 -08:00
Zachary T Welch
632fd663a8 flash_driver_t -> struct flash_driver
Remove misleading typedef and redundant suffix from struct flash_driver.
2009-11-13 11:58:06 -08:00
Zachary T Welch
fb59ec739a flash_sector_t -> struct flash_sector
Remove misleading typedef and redundant suffix from struct flash_sector.
2009-11-13 11:58:06 -08:00
Zachary T Welch
98d7ed8523 faux_flash_bank_t -> struct faux_flash_bank
Remove misleading typedef and redundant suffix from struct faux_flash_bank.
2009-11-13 11:58:06 -08:00
Zachary T Welch
de1781b7fa ecosflash_flash_bank_t -> struct ecosflash_flash_bank
Remove misleading typedef and redundant suffix from struct ecosflash_flash_bank.
2009-11-13 11:58:06 -08:00
Zachary T Welch
453a103f48 cfi_fixup_t -> struct cfi_fixup
Remove misleading typedef and redundant suffix from struct cfi_fixup.
2009-11-13 11:58:06 -08:00
Zachary T Welch
4c28cc68ed cfi_unlock_addresses_t -> struct cfi_unlock_addresses
Remove misleading typedef and redundant suffix from struct cfi_unlock_addresses.
2009-11-13 11:58:06 -08:00
Zachary T Welch
0139e7d51a cfi_spansion_pri_ext_t -> struct cfi_spansion_pri_ext
Remove misleading typedef and redundant suffix from struct cfi_spansion_pri_ext.
2009-11-13 11:58:06 -08:00
Zachary T Welch
2ded74115d cfi_atmel_pri_ext_t -> struct cfi_atmel_pri_ext
Remove misleading typedef and redundant suffix from struct cfi_atmel_pri_ext.
2009-11-13 11:58:06 -08:00
Zachary T Welch
1f328f2885 cfi_intel_pri_ext_t -> struct cfi_intel_pri_ext
Remove misleading typedef and redundant suffix from struct cfi_intel_pri_ext.
2009-11-13 11:58:06 -08:00
Zachary T Welch
3be0edbc5e cfi_flash_bank_t -> struct cfi_flash_bank
Remove misleading typedef and redundant suffix from struct cfi_flash_bank.
2009-11-13 11:58:06 -08:00
Zachary T Welch
a7a8a1c9e2 avrf_flash_bank_t -> struct avrf_flash_bank
Remove misleading typedef and redundant suffix from struct avrf_flash_bank.
2009-11-13 11:58:06 -08:00
Zachary T Welch
6ca63ee756 avrf_type_t -> struct avrf_type
Remove misleading typedef and redundant suffix from struct avrf_type.
2009-11-13 11:58:06 -08:00
Zachary T Welch
3877201581 at91sam7_flash_bank_t -> struct at91sam7_flash_bank
Remove misleading typedef and redundant suffix from struct at91sam7_flash_bank.
2009-11-13 11:58:05 -08:00
Zachary T Welch
d0809ac060 scan_field_t -> struct scan_field
Remove useless structure typedef.
2009-11-13 11:58:04 -08:00
Zachary T Welch
42ef503d37 jtag_tap_t -> struct jtag_tap
Search and destroy the jtag_tap_t typedef.  This also cleans up a
layering violation, removing the declaration from types.h.
2009-11-13 11:58:04 -08:00
Zachary T Welch
9f212b01be fileio_t -> struct fileio
Remove useless structure typedef.
2009-11-13 11:58:04 -08:00
Zachary T Welch
d22270e0ed command_handler_t: make argc unsigned
The number of command arguments will always be 0 or more, so use
the right type in handlers.  This has a cascading effect up through
the layers, but the new COMMAND_HANDLER macros prevented total chaos.
2009-11-13 10:55:27 -08:00
Zachary T Welch
a585bdf726 add CMD_NAME macro for command handlers
By introducing the CMD_NAME macro, this parameter may be integrated
as args[-1] in command.[ch], without touching any other call sites.
2009-11-13 10:55:00 -08:00
Zachary T Welch
5b6df55a1e use CALL_COMMAND_HANDLER instead of direct calls
By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or
even removed in inherited signatures, without requiring revisiting
all of the various call sites.
2009-11-13 10:51:46 -08:00
Zachary T Welch
670f999e7a nand: add NAND_DEVICE_COMMAND_HANDLER macro
Abstracts the extended NAND command handling to allow the function
signature to be controlled by __COMMAND_HANDLER.
2009-11-13 10:51:46 -08:00
Zachary T Welch
0796dfff89 use FLASH_BANK_COMMAND_HANDLER macro
Defines all flash_bank_command handlers using the new macro.
2009-11-13 10:51:46 -08:00
Zachary T Welch
57c5c5f463 add FLASH_BANK_COMMAND_HANDLER macro
The FLASH_BANK_COMMAND_HANDLER provides an extended command handler
using the __COMMAND_HANDLER macro, whereby changing that macro is
sufficient to update flash handlers with the new signature.  It also
enforces uniform style and scope when implementing this handler.
2009-11-13 10:51:46 -08:00
Zachary T Welch
76868e0713 s3c24xx: use COMMAND_HANDLER with command helper
Add S3C24XX_DEVICE_COMMAND macros to abstract common command handler
conventions.
2009-11-13 10:51:46 -08:00
Zachary T Welch
cfc4d5c6b7 use COMMAND_HANDLER macro to define all commands 2009-11-13 10:51:45 -08:00
Zachary T Welch
e8e94ab245 nand: rename device to nand
To be more informative (and consistent with flash and pld trees), change
'device' parameter name to 'nand' in NAND source files.  This change
eliminates confusing 'device->device->' instance from the code, and
it simplifies the forthcoming command handler patches.
2009-11-12 22:25:55 -08:00
Zachary T Welch
2821115ab8 remove obsolete doxygen comments
Documenting command handler parameters is redundant and pointless.
2009-11-11 11:53:22 -08:00
Zachary T Welch
39ab1c1a41 remove more useless declarations
Removes forward declarations by moving command registration after
defintion of the command handlers.
2009-11-11 11:53:22 -08:00
Zachary T Welch
ca594adb5a add const keyword to some APIs
Add 'const' keyword to 'char *' parameters to allow command handlers to
pass constant string arguments.  These changes allow the 'args' command
handler to be changed to 'const' in a subsequent patch.
2009-11-11 11:53:22 -08:00
Zachary T Welch
9741e126fd change argv to args in command handlers
Subsequent patches expect all command handlers to use a uniform
parameter naming scheme.  In the entire tree, these two files used
standard 'argv' instead of our non-standard 'args'.  This patch opts
to reduces the noise required to unify the command handlers, using
dominant 'args' form.

A future patch may be used to convert us back to the standard argv, but
that requires coordination with all developers to minimize disruptions.
2009-11-11 11:50:36 -08:00
Zachary T Welch
b7b4efcdf1 makefiles: improve build order
Separates various groups of files to be built in logical succession.
In each layer, the core module (target.c, nand.c, etc.) is built _after_
their helper modules (e.g. image.c, nand_ecc.c) but _before_ any of
their drivers (e.g. arm966e.c, mx3_nand.c).

This allows problems introduced at the bottom of the stack to result
in build failures as soon as possible, as the helpers and core should
wrap portions of them.
2009-11-11 05:40:48 -08:00
Zachary T Welch
2351641b8f {pic32m,stm32}x.c: remove useless declarations
Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:48 -08:00
Zachary T Welch
6cd97f48d0 str{7,9}x*.c: remove useless forward declarations
Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:47 -08:00
Zachary T Welch
041c319d9d flash/<various>.c: remove useless declarations
Remove useless forward declarations.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:47 -08:00
Zachary T Welch
712d3fc0fb flash/<assorted>.c: remove useless declarations
Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:47 -08:00
Zachary T Welch
4cd02c63e9 flash/at91sam[37].c: remove useless declarations
Remove useless forward declarations.
Moves command registration to end of file.
Moves flash structure definitions to end of files.

Changes a few references to global flash structure to local refs.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:47 -08:00
Zachary T Welch
770716e9e0 flash/lpc2???.c: remove useless declarations
Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:47 -08:00
Zachary T Welch
8b5c5c054d flash/*nand*.c: remove useless declarations
Remove useless forward declarations.
Moves command registration to end of files.
Moves flash structure definition to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:47 -08:00
Zachary T Welch
5c95741df7 flash/flash.c: remove forward declarations
Remove useless forward declarations.
Moves command registration to end of file.
Moves flash structure definition to end of file.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-09 18:42:47 -08:00
Zachary T Welch
81fbc63718 src/flash: remove 'extern' and wrap headers
Removes 'extern' keywords from function prototypes in the flash headers.
Wraps long lines to fit into 80 columns.

Adds multiple inclusion protection for s3c2xx_nand.h.
2009-11-09 09:44:33 -08:00
Zachary T Welch
2689f58f2a Overhaul time support API
This patch changes the duration_* API in several ways.  First, it
updates the API to use better names.  Second, string formatting has
been removed from the API (with its associated malloc).  Finally, a
new function added to convert the time into seconds, which can be
used (or formatted) by the caller.  This eliminates hidden calls to
malloc that require associated calls to free().

This patch also removes the useless extern keyword from prototypes,
and it eliminates the duration_t typedef (use 'struct duration').
These API also allows proper error checking, as it is possible for
gettimeofday to fail in certain circumstances.

The consumers have all been chased to use this new API as well, as
there were relatively few cases doing this type of measurement.
In most cases, the code performs additional checks for errors, but
the calling code looks much cleaner in every case.
2009-11-09 01:21:50 -08:00
Zachary T Welch
ca00483a95 Simplify nand indentation.
Removes check covered by new nand_command_get_device_by_num helper.
Reverses logic of probe check to further reduce indentation.
2009-11-06 02:52:56 -08:00
Zachary T Welch
ff61e6a37c Improve flash indentation.
Removes redundant tests and reverses backwards logic to reduce the
indentation level in flash.c.
2009-11-06 02:52:51 -08:00
Zachary T Welch
36b4ac90e4 Improve str9xpec command argument parsing. 2009-11-05 18:19:19 -08:00
Zachary T Welch
fa9e5d1027 Improve str9x config command argument parsing. 2009-11-05 18:19:19 -08:00
Zachary T Welch
111b7a6a9d Improve str7x config command argument parsing. 2009-11-05 18:19:19 -08:00
Zachary T Welch
aa9351ba46 Improve stm32x.c command argument parsing. 2009-11-05 18:19:19 -08:00
Zachary T Welch
786106d725 Improve stellaris.c erase argument parsing. 2009-11-05 18:19:19 -08:00
Zachary T Welch
fc116380bf Improve pic32mx.c command argument parsing. 2009-11-05 18:19:18 -08:00
Zachary T Welch
ee4723c494 Improve mflash.c command argument parsing. 2009-11-05 18:19:18 -08:00
Zachary T Welch
c63671e4f7 Improve lpc3180_nand_controller.c parsing.
This fixes a memory leak in lpc3180_nand_device_command by
reordering the malloc to occur after all parsing has completed.
2009-11-05 18:19:18 -08:00
Zachary T Welch
7b2d8d93e6 Improve lpc2900.c command argument parsing. 2009-11-05 18:19:18 -08:00