Commit Graph

666 Commits

Author SHA1 Message Date
Zachary T Welch
04ee41de52 move more nor flash implementation details
Splits the exec mode commands out of flash.c into the flash/nor/ files.
The routines used by these high-level commands are moved into nor/core.c,
with their internal declarations placed in nor/imp.h.

Fixes distribution of <flash/nor/core.h> header.
2009-12-04 16:56:23 -08:00
Zachary T Welch
c65d94f7d0 add flash/nor/core.[ch]
The newly moved flash TCL routines access the internals of the module
too much.  Fix the layering issues by adding new core NOR flash APIs:

<flash/nor/core.h>:
  - flash_driver_find_by_name() - self-descriptive

<flash/nor/imp.h>:
  - flash_bank_add()            - encapsulates adding banks to bank list
  - flash_bank_list()           - encapsulates retreiving bank list

This allows the externs in flash/nor/imp.h to be removed, and
these mechanisms may now be re-used by other flash module code.
2009-12-04 03:34:33 -08:00
Zachary T Welch
3cb0b56005 add flash/nor/{tcl.c,imp.h} from flash/flash.c
Moves the top-level 'flash' command handlers into flash/nor/tcl.c,
with flash/nor/imp.h providing an internal implementation header
to share non-public API components.
2009-12-04 03:34:33 -08:00
Dean Glazeski
cf2cb0fc84 Make ARM NAND I/O operations aware of last op
Updates the ARM NAND I/O code to look at and update the op
field of arm_nand_data to reflect the last operation performed.
It uses this field to copy the correct code to the target in the
case where the struct is used for reads and writes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-03 17:29:42 -08:00
Dean Glazeski
66985bb306 ARM NAND I/O interface update
Modify the arm_nand_data struct to better support both read and
write operations while using the same struct.  An additional
field was added, and initialized, to record the last operation
so that the correct code can be loaded to the working area.

[dbrownell@users.sourceforge.net: merge init patch, tweak GPL note]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-03 17:29:41 -08:00
Dean Glazeski
9a51b8b0e3 NAND page command refactoring.
Created a new function that handles sending a command and the address
information for pages to a NAND device.

[dbrownell@users.sourceforge.net: tweaked line lengths, name 'oob_only']

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-03 16:44:27 -08:00
Zachary T Welch
822c06d9e3 remove tertiary include paths
With all #include directives converted, we only need to have the
top-level src/ directory in the search path.
2009-12-03 04:24:50 -08:00
Zachary T Welch
f7bd1e8f3a change #include "../hello.h" to "hello.h"
Before we can -I the top-level src/ directory alone, references to
"hello.h" must be updated.  This is an internal header, so it does
not need angle brackets.
2009-12-03 04:24:50 -08:00
Zachary T Welch
2a402ae2c7 change #include "s3c24xx_regs.h" to <flash/nand/s3c24xx_regs.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "s3c24xx_regs.h"

the following form should be used.

	#include <flash/nand/s3c24xx_regs.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:49 -08:00
Zachary T Welch
afb6d38bd5 change #include "ocl.h" to <flash/nor/ocl.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "ocl.h"

the following form should be used.

	#include <flash/nor/ocl.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:49 -08:00
Zachary T Welch
450ceda9ae change #include "nand.h" to <flash/nand.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "nand.h"

the following form should be used.

	#include <flash/nand.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
2b2d5ec1e3 change #include "flash.h" to <flash/flash.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "flash.h"

the following form should be used.

	#include <flash/flash.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
eac262e5d2 change #include "arm_nandio.h" to <flash/arm_nandio.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm_nandio.h"

the following form should be used.

	#include <flash/arm_nandio.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
c6dd6a576d change #include "target.h" to <target/target.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "target.h"

the following form should be used.

	#include <target/target.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
a8880f0b5a change #include "mips32.h" to <target/mips32.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "mips32.h"

the following form should be used.

	#include <target/mips32.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
7da02a8330 change #include "image.h" to <target/image.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "image.h"

the following form should be used.

	#include <target/image.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
1650ab3a22 change #include "embeddedice.h" to <target/embeddedice.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "embeddedice.h"

the following form should be used.

	#include <target/embeddedice.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
54063d7294 change #include "avrt.h" to <target/avrt.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "avrt.h"

the following form should be used.

	#include <target/avrt.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
f52a596860 change #include "armv7m.h" to <target/armv7m.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv7m.h"

the following form should be used.

	#include <target/armv7m.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
ddea033043 change #include "armv4_5.h" to <target/armv4_5.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv4_5.h"

the following form should be used.

	#include <target/armv4_5.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
41e92d8a7a change #include "arm966e.h" to <target/arm966e.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm966e.h"

the following form should be used.

	#include <target/arm966e.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
9e3136a5f8 change #include "arm7_9_common.h" to <target/arm7_9_common.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm7_9_common.h"

the following form should be used.

	#include <target/arm7_9_common.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
2958665f6b change #include "algorithm.h" to <target/algorithm.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "algorithm.h"

the following form should be used.

	#include <target/algorithm.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
cb4a475f6c change #include "jtag.h" to <jtag/jtag.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "jtag.h"

the following form should be used.

	#include <jtag/jtag.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:33 -08:00
Zachary T Welch
df0e90ec8c change #include "types.h" to <helper/types.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "types.h"

the following form should be used.

	#include <helper/types.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
6512e5e36b change #include "time_support.h" to <helper/time_support.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "time_support.h"

the following form should be used.

	#include <helper/time_support.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
6c3a28ca26 change #include "membuf.h" to <helper/membuf.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "membuf.h"

the following form should be used.

	#include <helper/membuf.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
c79cca04be change #include "log.h" to <helper/log.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "log.h"

the following form should be used.

	#include <helper/log.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
14ed20967f change #include "fileio.h" to <helper/fileio.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "fileio.h"

the following form should be used.

	#include <helper/fileio.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:51 -08:00
Zachary T Welch
d1bc4375e9 change #include "binarybuffer.h" to <helper/binarybuffer.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "binarybuffer.h"

the following form should be used.

	#include <helper/binarybuffer.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:17 -08:00
Zachary T Welch
5d57cad001 normalize headers to make changing easier
These headers need minor tweaks to paves the way for wholesale
scripted coversion of the header files.
2009-12-03 04:20:31 -08:00
Zachary T Welch
896ac8d4ef allow #include directives to use module name
Includes the src directory in the search path, so header files may be
migrated from:

  #include "foo.h"

to
  #include <module/foo.h>

which is more conducive for installation.
2009-12-03 01:54:15 -08:00
Zachary T Welch
fe9228a32d move nor drivers to src/flash/nor
Moves NOR flash drivers to 'src/flash/nor/'.
Adds 'src/flash/nor/Makefile.am'.
Builds 'libocdflashnor.la'.
2009-12-02 23:27:09 -08:00
Zachary T Welch
e1ec02bb05 move nand drivers to src/flash/nand/
Moves NAND drivers to src/flash/nand/.
Adds src/flash/nand/Makefile.am.
Builds libocdflashnand.la.
2009-12-02 23:27:09 -08:00
Zachary T Welch
37201c019f flash: factor init to 'flash init'
Split flash initialiation into 'flash init', called from 'init'.
2009-12-02 13:26:22 -08:00
Zachary T Welch
1de0b9d351 mflash: factor init to 'mflash init'
Splits mflash initialiation to 'mflash init', called from 'init'.
2009-12-02 13:26:22 -08:00
Zachary T Welch
747f8af672 nand: factor init to 'nand init'
Split NAND initialization into 'nand init', which gets called from
the main 'init' command.
2009-12-02 13:26:22 -08:00
lementec fabien
b0858e89c7 fix s3c24xx device command helper
Returns the common structure for the s3c24xx device, which was
somehow nuked during past cleaning efforts.
2009-11-28 15:52:03 -08:00
Zachary T Welch
01f93137c4 add 'nonce' nand driver
The nonce NAND driver provides a no-op implementation useful for
testing the system independently of any driver side-effects.
2009-11-28 13:00:39 -08:00
Zachary T Welch
f31dfffdef fix 'nand info' command
Move device argument parsing after check for number of arguments;
otherwise, calling this command without any arguments would access
argv[0] before checking whether it even existed.
2009-11-27 11:11:26 -08:00
Dean Glazeski
2221a03744 ARM NAND I/O header documentation update.
Fixed the header file to properly specify the doxygen documentation for the
items defined in it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:57:56 -08:00
Dean Glazeski
8f3c728273 ARM NAND I/O documentation update.
This updates the functions in the file to all have doxygen comments
describing what they do.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:56:58 -08:00
Dean Glazeski
05a5f682c6 ARM NAND I/O refactor code copying.
Created a function for copying code to the working area on
a target.  The NAND write and read functions are updated to
include use of this function.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:55:40 -08:00
Dean Glazeski
ffc704fdeb ARM NAND I/O read function.
Implementation of the NAND read function for ARM NAND I/O that
includes running a local algorithm on a device to increase the
performance of block reads.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:52:52 -08:00
Dean Glazeski
7c9cd47893 NAND Flash documentation update.
Updated doxygen comments for different interface structures for
the NAND interface.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:45:41 -08:00
Eric Wetzel
3f8aa3cb03 fix 'flash protect' and 'flash erase_sector'
Command upgrading introduced two off-by-one bugs in the flash commands.
This patch fixes the 'flash {protect,erase_sector}' commands to check
that they have been passed the correct number of arguments.

Ammended during commit to fix help text for 'erase_address' too.
2009-11-26 07:57:51 -08:00
Zachary T Welch
4946925bea use ARRAY_SIZE macro
Search and destroy lingering cases where the ARRAY_SIZE macro should
be used to convey more intrinsic meaning in the OpenOCD code.
2009-11-25 10:32:00 -08:00
Zachary T Welch
a93b404161 improve command handling examples
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.
2009-11-25 10:29:05 -08:00
Zachary T Welch
17a9dea53a add jim_handler to command_registration
Adding jim_handler field to command_registration allows removing the
register_jim helper.  All command registrations now go through the
register_command{,s}() functions.
2009-11-24 21:37:37 -08:00
Zachary T Welch
90d09e35e4 remove nand_controller->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
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