| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Update CMD_NAME from its migratory home in CMD_ARGV[-1] to cmd->name.
Allows CMD_ARGV++ idiom to be used safely in command handlers.
|
|
|
|
|
|
|
|
|
|
| |
Adds the command_invocation structure to encapsulate parameters for
all COMMAND_HANDLER routines. Rather than passing several arguments
to each successive subroutine, a single pointer may be passed around.
Changes the CMD_* macros to reference the new fields.
Updates run_command to create an instance and pass it to the handler.
|
|
|
|
| |
Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
|
|
|
|
|
| |
This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.
|
|
|
|
|
| |
This patch converts all instances of 'argc' in COMMAND_HANDLER routines
to use CMD_ARGC.
|
|
|
|
|
|
|
|
|
| |
Add additional macros to allow command handling to be migrated easily:
CMD_CTX, CMD_ARGC, and CMD_ARGV. Updates CMD_NAME to use CMD_ARGV.
In addition to making the remaining patches of this series cleaner,
this introduces easily sed-able symbols that could allow us to retire
these once the command handler infrastructure matures (i.e. pre-1.0).
|
|
|
|
|
|
|
|
|
|
| |
Rename the "armv4_5" command prefix to straight "arm" so it makes
more sense for newer cores. Add a simple compatibility script.
Make sure all the commands give the same "not an ARM" diagnostic
message (and fail properly) when called against non-ARM targets.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Add const keyword to file url and cast to free().
Make size an ssize_t and chase all format strings that use it.
|
|
|
|
|
|
|
| |
Uses unsigned type to pass line numbers.
Use uint64_t to pass sleep routines their milliseconds. Updates sleep
routines to use this type and improve whitespace.
|
|
|
|
| |
The jim_register command just needed to use the type defined by jim.h.
|
| |
|
|
|
|
|
| |
The getopt_long call allows a const struct option, so mark ours
const too.
|
|
|
|
|
|
|
| |
The "improve inline binarybuffer helpers" mis-handled bytes
with the high bit set; treat them as unsigned, not signed.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
|
|
|
|
| |
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
|
|
|
|
|
|
|
|
| |
The ARRAY_SIZE macro was defined in several target files, so move it
to types.h.
This patch also removes two other identical macros: DIM (from jtag.h)
and asizeof (from arm11.h).
|
|
|
|
|
| |
Improves the name of this macro, moves it to types.h, and adds a block
of Doxygen comments to describe what it does.
|
|
|
|
|
|
| |
The container_of macro is useful as a general solution. It belongs
in types.h, rather than target.h where it was introduced. Requires
the offsetof macro, which comes from <stddef.h> (moved as well).
|
|
|
|
|
|
|
| |
In some cases, the FILEIO_NONE access mode may be useful as a parameter
to indicate that file access should be disabled. High-level routines can
use it to skip file access calls, as 'fileio_open' will fail presently
if called to open a file using this mode.
|
|
|
|
|
| |
Adds Doxygen documentation for a number of the binarybuffer APIs,
including "unexpected" behavior exposed during review on the list.
|
|
|
|
| |
Use void*, unsigned, and bool types with inline helpers.
|
|
|
|
|
| |
Use void * and unsigned types for buffer and their sizes.
Allows it to be used with more than uint8_t * without casts.
|
|
|
|
| |
Use memset instead of loop. Improve types, using void * and unsigned.
|
|
|
|
|
| |
Use memcpy for bulk of copy, improve final byte handling.
Improve types by using void * for buffers and unsigned for size.
|
|
|
|
|
|
|
|
| |
Rewrite buf_cmp to use memcpy for bulk of comparison. Add static
helper to perform comparison of trailing byte, which uses another
static helper to perform a maksed comparison. The masked comparison
helper is used by the buf_cmp_mask to simplify its loop.
Improve types to use void *, unsigned, and return bool.
|
|
|
|
|
| |
Improve types: use void * and unsigned. Move all variables to point of
first use. Move radix guessing logic to new str_radix_guess helper.
|
|
|
|
| |
Reduce some noise from subsequent patches.
|
|
|
|
| |
Add inter-operator whitespace. Improve existing documentation.
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Remove obsolete suffix from struct scan_field. Somehow, these
definitions did not get updated but did not cause any errors.
|
|
|
|
| |
Remove misleading typedef and redundant suffix from struct command.
|
|
|
|
| |
Remove misleading typedef and redundant suffix from struct command_context.
|
|
|
|
|
| |
Search and destroy the jtag_tap_t typedef. This also cleans up a
layering violation, removing the declaration from types.h.
|
|
|
|
| |
Remove useless structure typedef.
|
|
|
|
|
| |
Removes useless and confusing typedef for log callback structure.
Types with _t should be suitable for passing by-value as arguments.
|
|
|
|
|
| |
This patch removes 'cmd' from the list of direct parameters, moving
that pointer to args[-1] (by way of the new CMD_NAME macro).
|
|
|
|
|
| |
This patch prevents command handlers from modifying the strings passed
in the 'args' array.
|
|
|
|
|
| |
Prevents the command name from being modified in command handlers.
Again, this has cascading effects, but the patches are fairly minimal.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
By introducing the CMD_NAME macro, this parameter may be integrated
as args[-1] in command.[ch], without touching any other call sites.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 a typedef for command output handler function type, simplifying
the appearance of functions that use it and eliminating duplicate code.
|
|
|
|
|
|
|
| |
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 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.
|
|
|
|
|
| |
Add helpers to manage adding entries to the helptext list.
Adds support for arbitrarily nested commands.
|
|
|
|
|
|
|
| |
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.
|