summaryrefslogtreecommitdiff
path: root/src/helper
Commit message (Collapse)AuthorAgeFilesLines
...
* fileio: improve API typesZachary T Welch2009-11-162-37/+36
| | | | | | | | | | | | | 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.
* struct fileio: improve member typesZachary T Welch2009-11-162-3/+3
| | | | | | Add const keyword to file url and cast to free(). Make size an ssize_t and chase all format strings that use it.
* helper/log: improve API parameter typesZachary T Welch2009-11-162-19/+16
| | | | | | | 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.
* use Jim_CmdProc in jim_registerZachary T Welch2009-11-162-2/+4
| | | | The jim_register command just needed to use the type defined by jim.h.
* improve constness of open_file_from_pathZachary T Welch2009-11-162-2/+2
|
* make command line options constZachary T Welch2009-11-161-1/+1
| | | | | The getopt_long call allows a const struct option, so mark ours const too.
* binarybuffer: regression fixDavid Brownell2009-11-161-2/+4
| | | | | | | 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>
* "types.h" doxygen fixDavid Brownell2009-11-161-2/+2
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* move ARRAY_SIZE macro to types.hZachary T Welch2009-11-161-0/+10
| | | | | | | | 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).
* rename CEIL as DIV_ROUND_UPZachary T Welch2009-11-163-6/+13
| | | | | Improves the name of this macro, moves it to types.h, and adds a block of Doxygen comments to describe what it does.
* move container_of to types.hZachary T Welch2009-11-161-0/+15
| | | | | | 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).
* Add FILEIO_NONE access mode.Zachary T Welch2009-11-161-0/+1
| | | | | | | 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.
* binarybuffer: add API documentationZachary T Welch2009-11-161-3/+41
| | | | | Adds Doxygen documentation for a number of the binarybuffer APIs, including "unexpected" behavior exposed during review on the list.
* improve inline binarybuffer helpersZachary T Welch2009-11-161-7/+8
| | | | Use void*, unsigned, and bool types with inline helpers.
* improve buf_set_buf helperZachary T Welch2009-11-162-5/+8
| | | | | Use void * and unsigned types for buffer and their sizes. Allows it to be used with more than uint8_t * without casts.
* improve buf_set_onesZachary T Welch2009-11-162-10/+11
| | | | Use memset instead of loop. Improve types, using void * and unsigned.
* improve buf_cpy helperZachary T Welch2009-11-162-9/+11
| | | | | Use memcpy for bulk of copy, improve final byte handling. Improve types by using void * for buffers and unsigned for size.
* improve buf_cmp and buf_cmp_mask helpersZachary T Welch2009-11-162-39/+40
| | | | | | | | 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 str_to_buf and buf_to_str helpersZachary T Welch2009-11-162-65/+67
| | | | | Improve types: use void * and unsigned. Move all variables to point of first use. Move radix guessing logic to new str_radix_guess helper.
* 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.