summaryrefslogtreecommitdiff
path: root/src/helper
Commit message (Collapse)AuthorAgeFilesLines
...
* binarybuffer: move variables to point of first useZachary T Welch2009-11-162-28/+9
| | | | Reduce some noise from subsequent patches.
* binarybuffer: fix whitespace related issuesZachary T Welch2009-11-162-23/+18
| | | | Add inter-operator whitespace. Improve existing documentation.
* target: less implicit inclusion of "command.h"David Brownell2009-11-162-2/+0
| | | | | | | | | | 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>
* remove unused buf_to_u32_handlerZachary T Welch2009-11-142-12/+0
| | | | | | Purge an unused routine from the tree and remove a layering violation. If this code is needed, it should reappear somwhere in src/jtag/, where struct scan_field gets defined.
* struct scan_field_s -> struct scan_fieldZachary T Welch2009-11-142-3/+3
| | | | | Remove obsolete suffix from struct scan_field. Somehow, these definitions did not get updated but did not cause any errors.
* command_t -> struct commandZachary T Welch2009-11-132-26/+26
| | | | Remove misleading typedef and redundant suffix from struct command.
* command_context_t -> struct command_contextZachary T Welch2009-11-138-52/+52
| | | | Remove misleading typedef and redundant suffix from struct command_context.
* jtag_tap_t -> struct jtag_tapZachary T Welch2009-11-131-2/+0
| | | | | Search and destroy the jtag_tap_t typedef. This also cleans up a layering violation, removing the declaration from types.h.
* fileio_t -> struct fileioZachary T Welch2009-11-132-24/+23
| | | | Remove useless structure typedef.
* log_callback_t -> struct log_callbackZachary T Welch2009-11-132-9/+8
| | | | | Removes useless and confusing typedef for log callback structure. Types with _t should be suitable for passing by-value as arguments.
* command_handler_t: make cmd an indirect parameterZachary T Welch2009-11-132-10/+12
| | | | | This patch removes 'cmd' from the list of direct parameters, moving that pointer to args[-1] (by way of the new CMD_NAME macro).
* command_handler_t: make args parameter constZachary T Welch2009-11-132-5/+7
| | | | | This patch prevents command handlers from modifying the strings passed in the 'args' array.
* command_handler_t: make cmd parameter constZachary T Welch2009-11-131-1/+1
| | | | | Prevents the command name from being modified in command handlers. Again, this has cascading effects, but the patches are fairly minimal.
* command_handler_t: make argc unsignedZachary T Welch2009-11-132-2/+2
| | | | | | 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.
* add CMD_NAME macro for command handlersZachary T Welch2009-11-131-0/+6
| | | | | By introducing the CMD_NAME macro, this parameter may be integrated as args[-1] in command.[ch], without touching any other call sites.
* use COMMAND_HANDLER macro to define all commandsZachary T Welch2009-11-133-18/+11
|
* add command_handler_t typeZachary T Welch2009-11-132-7/+6
| | | | | | This patch adds new typedefs for command handler callback functions. Users of this type signature were updated to use these new types. It uses the new __COMMAND_HANDLER macro to prevent duplication.
* add COMMAND_HANDLER and COMMAND_HELPER macrosZachary T Welch2009-11-131-0/+42
| | | | | | | | | | | | | | | | | The COMMAND_HANDLER and COMMAND_HELPER macros allow commands to be defined in a manner that decouples them from the exact order and type of their parameters. Once converted, incremental changes to the command handler type can be addressed in incremental patches that do not need to touch the entire tree. These macros' implementation, __COMMAND_HANDLER, is used to define the new command_handler_t type, and additional patches will use it to derive new macros to define extended command types (e.g. flash, nand, pld). The CALL_COMMAND_HANDLER provides a means of calling helpers or nested handlers from withing a command handler. This patch uses C99 varadic macro expansion. Please report compilers that cannot handle this code.
* add command_output_handler_tZachary T Welch2009-11-132-4/+10
| | | | | Add a typedef for command output handler function type, simplifying the appearance of functions that use it and eliminating duplicate code.
* improve command registrationZachary T Welch2009-11-111-31/+43
| | | | | | | Eliminate duplicate code for linking commands into a list. Adds a check to ensure the command does not already exist; if it does, return that one instead of creating a duplicate.
* add help regardless of callbackZachary T Welch2009-11-111-2/+2
| | | | | | | | | Add help for commands regardless of whether a handler is involved. With this, all sorts of new commands can be found in 'help' text. Hopefully, all of them have been documented.... Sadly, the lsort function appears to handle nested lists poorly, such that sub-commands do not group with their parents.
* eliminate duplicate helptext managementZachary T Welch2009-11-111-31/+30
| | | | | Add helpers to manage adding entries to the helptext list. Adds support for arbitrarily nested commands.
* add command_name helperZachary T Welch2009-11-112-32/+49
| | | | | | | The command_name function returns a malloced string for a given command and its parents. This can be used to display a message to the user, but it is used internally to handle registration and syntax errors. This helps permit arbitrary command nesting.
* wrap help commandZachary T Welch2009-11-111-9/+17
| | | | Use continuation characters to wrap the help command into 80 columns.
* script_debug(): improve typesZachary T Welch2009-11-112-5/+6
| | | | Use unsigned type for number of arguments.
* command.c: make private routines staticZachary T Welch2009-11-111-2/+4
| | | | This patch also improves the signature of run_command function.
* log: improve log_callback_fn signatureZachary T Welch2009-11-112-3/+3
| | | | Use unsigned type for line number in log_callback_fn signature.
* time_support: improve use of typesZachary T Welch2009-11-112-26/+15
| | | | | Update timeval_add_time to use long int; implement timeval_add with it. Update timeval_ms to check gettimeofday return value, return int64_t.
* tcl: HostOs now picks up eCos as well during compile timeØyvind Harboe2009-11-101-0/+2
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* command.c: make commands staticZachary T Welch2009-11-091-50/+48
| | | | | Removes useless declarations, moving the handler functions to appear before their use in the (much bigger) command registriation function.
* src/helper: wrap and clean headers.Zachary T Welch2009-11-096-63/+95
| | | | | Remove all useless 'extern' keywords from function prototypes. Wraps long lines for readability.
* User's Guide: bugfix global state infoDavid Brownell2009-11-091-8/+13
| | | | | | | | | The "$ocd_HOSTOS" variable was wrongly documented. Fix its documentation, and its value on Linux. Shrink a few of the too-long lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Overhaul time support APIZachary T Welch2009-11-092-27/+35
| | | | | | | | | | | | | | | | | | | 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.
* Improve debug_level command argument parsing.Zachary T Welch2009-11-051-3/+1
|
* Add macro for parsing numeric command arguments.Zachary T Welch2009-11-051-0/+21
| | | | | | | | This helper eliminates significant amount of redundant code in command handler functions throughout the system. It wraps the lower-level parse_* macros to implement a policy for reporting parse errors to the active command context (cmd_ctx). If errors do occur, this macro causes the calling function to abort with the proper return code.
* Add stringify macros in src/helper/types.h.Zachary T Welch2009-11-051-0/+4
|
* bin2char: for win32 set stdin/stdout to binary modeSpencer Oliver2009-10-301-0/+10
| | | | Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* eCos synthetic target updates.Øyvind Harboe2009-10-211-2/+11
|
* corrective fix for MinGW GNU C99 printf complianceRedirect 'Slash' NIL2009-10-192-6/+8
| | | | | | | | | | | | | | Compilation on cygwin, using gcc v3 with option -mno-cygwin, currently produces a large number of the following warnings: warning: `gnu_printf' is an unrecognized format function type These have been introduced with the recent MinGW GNU C99 printf compliance patch, as gnu_printf was only introduced with gcc v4.4 and is not recognized with earlier versions. The attached fix adds gcc version detection to the previous patch to avoid the problem.
* Sync with official Jim Tcl repository.oyvind2009-10-193-4/+6
|
* safer conversion to HANDLER on MinGW-W64Redirect 'Slash' NIL2009-10-171-2/+2
| | | | | Assign to "intptr_t", which on some versions of MS-Windows will widen the variable; then cast to HANDLE.
* More MinGW C99 printf complianceRedirect 'Slash' NIL2009-10-172-5/+21
| | | | | | | | Passing "--std=gun99" is unfortunately not sufficient to make current MinGW compilers conform with respect to checking printf format strings. (The C runtime seems not to have problems.) Fix by using a "gnu_printf" format specifier not "printf".
* jim-eventloop for MinGW-w64Redirect \"Slash\" NIL2009-10-172-2/+2
| | | | | | | | Use JIM_WIDE_MODIFIER for the sscanf format, and apply it for MINGW32 as well as other Windows environments. (Microsoft doesn't conform to the C99 standard, and uses "%I64d" not "%lld" for "long long".) NB: __MINGW32__ should work on both w32 and w64,.
* xscale: better fix for debug_handler.binDavid Brownell2009-10-161-3/+7
| | | | | | | | | | | | | Generate a C struct with the data, and use that, instead of an assembly language file. The assembly language causes issues on Darwin and MS-Windows, which don't necessarily use GNU AS; or if they do, don't necessarily use its ELF syntax. It's also better in two other ways: fewer global symbols; and the init-time size check gets optimized away at compile time. (Unless it fails, in which case bigger chunks of the file vanish.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* portability updatesDavid Brownell2009-10-141-3/+3
| | | | | | | | | Based on some patches from <redirect.slash.nil@gmail.com> for preliminary Win64 compilation. More such updates are needed, but they need work. Compile tested on 64 and 32 bit Linuxes, and Cygwin. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* doc updates to match "help" betterDavid Brownell2009-10-141-52/+5
| | | | | | | | | | | | | | | | | | | This makes the documentation a closer match to "help" output: - "pathmove" somehow was not documented in the User's Guide - "jtag_nsrst_assert_width" and "jtag_ntrst_assert_width" are new; both needed descriptions. - Removed two undocumented and fairly useless script mechanisms: * production/production_info/production_test ... using it, requires replacing everything; so having it adds no value. * cpu ... way out of date; hopeless to keep that current Note that anyone using that "production" stuff already defines their own procedures, and can keep using them with no change. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Missing type for eCos.Øyvind Harboe2009-10-131-0/+1
|
* add overridable Tcl "init_reset"David Brownell2009-10-081-8/+22
| | | | | | | | | | | This abstracts the "jtag arp_init-reset" call into a method called from OpenOCD startup and reset processing. Platforms which have different requirements for how such hard resets must be performed can now override "init_reset" instead of needing to rebuild custom hacked versions of the server. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Update copyright statements. Make it easier to sync with Jim TclØyvind Harboe2009-10-081-1/+4
|
* Introduced jtag_init and "jtag arp_init" to allow target scripts more ↵oharboe2009-10-061-0/+10
| | | | | | control over how OpenOCD starts up and initializes the target. git-svn-id: svn://svn.berlios.de/openocd/trunk@2805 b42882b7-edfa-0310-969c-e2dbd0fdcd60