aboutsummaryrefslogtreecommitdiff
path: root/src/flash/flash.c
AgeCommit message (Collapse)AuthorFilesLines
2009-12-04eliminate src/flash/flash.cZachary T Welch1-216/+0
Move remaining NOR flash implemenation into flash/nor/core.c Removes flash.c from the build, leaving only its header to split.
2009-12-04add flash/nor/drivers.cZachary T Welch1-43/+0
Encapsulates access to the flash_drivers array, providing a base of operations for future dynamic driver module loading features.
2009-12-04move more nor flash implementation detailsZachary T Welch1-999/+0
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-04add flash/nor/{tcl.c,imp.h} from flash/flash.cZachary T Welch1-175/+0
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-03change #include "image.h" to <target/image.h>Zachary T Welch1-1/+1
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-03change #include "time_support.h" to <helper/time_support.h>Zachary T Welch1-1/+1
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-02flash: factor init to 'flash init'Zachary T Welch1-0/+23
Split flash initialiation into 'flash init', called from 'init'.
2009-11-26fix 'flash protect' and 'flash erase_sector'Eric Wetzel1-3/+3
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-24add jim_handler to command_registrationZachary T Welch1-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.
2009-11-24remove flash_driver->register_callbacksZachary T Welch1-5/+10
Replace flash_driver callback with pointer to command_registration. Eliminates all related routines and allows drivers to omit commands.
2009-11-24flash: use register_commands()Zachary T Welch1-50/+117
Eliminates 'flash_cmd' global variable.
2009-11-24use COMMAND_REGISTER macroZachary T Welch1-14/+14
Replaces direct calls to register_command() with a macro, to allow its parameters to be changed and callers updated in phases.
2009-11-22flash: dynamically allocate working storageØyvind Harboe1-16/+52
Allocate working memory rather than using stack. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-19add support for naming flash banksZachary T Welch1-2/+8
Requires users to name their flash banks, allowing them to be used instead of bank numbers in script commands.
2009-11-19refactor handle_flash_bank_commandZachary T Welch1-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.
2009-11-19rename flash and nand command helpersZachary T Welch1-4/+4
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-19allow flash/nand banks commands to accept namesZachary T Welch1-2/+24
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-18use COMMAND_PARSE_ON_OFF where appropriateZachary T Welch1-7/+2
Updates all command parsing of "on" and "off" arguments.
2009-11-17command_handler: change 'cmd_ctx' to CMD_CTXZachary T Welch1-29/+29
Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
2009-11-17command_handler: change 'args' to CMD_ARGVZachary T Welch1-46/+46
This patch converts all instances of 'args' in COMMAND_HANDLER routines to use CMD_ARGV macro.
2009-11-17command_handler: change to 'argc' to CMD_ARGCZachary T Welch1-16/+16
This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
2009-11-16fileio: improve API typesZachary T Welch1-2/+2
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-16struct fileio: improve member typesZachary T Welch1-1/+1
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-16flash_command_get_bank_by_num: make COMMAND_HELPERZachary T Welch1-6/+6
Use COMMAND_HELPER macro to declare flash_command_get_bank_by_num. This is required for COMMAND_PARSE_NUMBER macro.
2009-11-13command_t -> struct commandZachary T Welch1-1/+1
Remove misleading typedef and redundant suffix from struct command.
2009-11-13command_context_t -> struct command_contextZachary T Welch1-4/+4
Remove misleading typedef and redundant suffix from struct command_context.
2009-11-13flash_bank_t -> struct flash_bankZachary T Welch1-31/+31
Remove misleading typedef and redundant suffix from struct flash_bank.
2009-11-13target_t -> struct targetZachary T Welch1-13/+13
Remove misleading typedef and redundant suffix from struct target.
2009-11-13image_t -> struct imageZachary T Welch1-4/+4
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-13flash_driver_t -> struct flash_driverZachary T Welch1-20/+20
Remove misleading typedef and redundant suffix from struct flash_driver.
2009-11-13fileio_t -> struct fileioZachary T Welch1-1/+1
Remove useless structure typedef.
2009-11-13add CMD_NAME macro for command handlersZachary T Welch1-1/+1
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-13use CALL_COMMAND_HANDLER instead of direct callsZachary T Welch1-1/+2
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-13use COMMAND_HANDLER macro to define all commandsZachary T Welch1-13/+11
2009-11-11add const keyword to some APIsZachary T Welch1-1/+1
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-09flash/flash.c: remove forward declarationsZachary T Welch1-57/+62
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-09Overhaul time support APIZachary T Welch1-80/+37
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-06Improve flash indentation.Zachary T Welch1-221/+210
Removes redundant tests and reverses backwards logic to reduce the indentation level in flash.c.
2009-11-05Improve flash.c command argument parsing.Zachary T Welch1-68/+51
2009-11-05Add Flash/NAND bank command argument helpers.Zachary T Welch1-0/+17
This eliminates redundant code for parsing and retreiving the bank specified from a script command argument. This patch was written to replace existing functionality; however, the parsing logic can be updated later to allow flash commands to accept bank names as well as their numbers.
2009-10-20Added the faux flash driver and target. Used for testing.Øyvind Harboe1-0/+2
2009-10-20Added 'unlock' option to flash write_imageØyvind Harboe1-14/+59
2009-10-10printf format warning fixesDavid Brownell1-5/+6
Observed on a Cygwin build. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-09-22- fix build issue under win32 (cygwin/msys) from svn r2746ntfreak1-1/+1
git-svn-id: svn://svn.berlios.de/openocd/trunk@2748 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-22Make it easier to erase or protect through to the enddbrownell1-36/+75
of a (NOR) flash chip: allow passing "last" as an alias for the number of the last sector. Improve several aspects of error checking while we're at it. From: Johnny Halfmoon <jhalfmoon@milksnot.com> git-svn-id: svn://svn.berlios.de/openocd/trunk@2746 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-16Rolf Meeser <rolfm_9dq@yahoo.de> adds flash support for NXP's LPC2900 family ↵oharboe1-2/+4
(ARM968E). git-svn-id: svn://svn.berlios.de/openocd/trunk@2715 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30David Brownell <david-b@pacbell.net> Remove duplicate check for flash write ↵oharboe1-21/+19
status. Via code review by Steve Grubb <sgrubb@redhat.com>  Also minor fixes for the message from "fill": the byte count is unsigned, not signed; and more importantly, print the real number of bytes written git-svn-id: svn://svn.berlios.de/openocd/trunk@2652 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-17Andreas Fritiofson <andreas.fritiofson@gmail.com> UTF8 fixesoharboe1-1/+1
git-svn-id: svn://svn.berlios.de/openocd/trunk@2549 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30Remove at91sam3.h from flash.c; use extern like other drivers.zwelch1-1/+1
git-svn-id: svn://svn.berlios.de/openocd/trunk@2438 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24Add support for ATMEL AT91SAM3U - CortexM3 Familyduane1-0/+2
git-svn-id: svn://svn.berlios.de/openocd/trunk@2383 b42882b7-edfa-0310-969c-e2dbd0fdcd60