1. 16 Nov, 2009 26 commits
    • Zachary T Welch's avatar
      move ARRAY_SIZE macro to types.h · dc1685ca
      Zachary T Welch authored
      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).
      dc1685ca
    • Zachary T Welch's avatar
      armv7m: make core reg read/write use unsigned · 10cce4a5
      Zachary T Welch authored
      Eliminate redundant check that gets covered by using unsigned type.
      Created to eliminate noise from subsequent patches, but this kind of
      conversion will be beneficial in similar ways throughout the tree.
      10cce4a5
    • Zachary T Welch's avatar
      remove TAP_SCAN_BYTES macro · 0535a924
      Zachary T Welch authored
      Use DIV_ROUND_UP(n, 8) instead of TAP_SCAN_BYTES macro.
      0535a924
    • Zachary T Welch's avatar
      rename CEIL as DIV_ROUND_UP · a94748ec
      Zachary T Welch authored
      Improves the name of this macro, moves it to types.h, and adds a block
      of Doxygen comments to describe what it does.
      a94748ec
    • Zachary T Welch's avatar
      move container_of to types.h · f0ce88b3
      Zachary T Welch authored
      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).
      f0ce88b3
    • Zachary T Welch's avatar
      nand_command_get_device_by_num: make COMMAND_HELPER · cbc05783
      Zachary T Welch authored
      Use COMMAND_HELPER macro to define nand_command_get_device_by_num.
      Use CALL_COMMAND_HANDLER to invoke it.
      cbc05783
    • Zachary T Welch's avatar
      flash_command_get_bank_by_num: make COMMAND_HELPER · e84849f5
      Zachary T Welch authored
      Use COMMAND_HELPER macro to declare flash_command_get_bank_by_num.
      This is required for COMMAND_PARSE_NUMBER macro.
      e84849f5
    • Zachary T Welch's avatar
      cleanup jtag minidrivers · d7a0dfa4
      Zachary T Welch authored
      Remove two vestigial externs from our JTAG minidriver source files.
      Also, removes many extra blank lines from the minidummy driver.
      d7a0dfa4
    • Zachary T Welch's avatar
      Add 'nand verify' command · 55575717
      Zachary T Welch authored
      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.
      55575717
    • Zachary T Welch's avatar
      Add FILEIO_NONE access mode. · da4cb3c0
      Zachary T Welch authored
      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.
      da4cb3c0
    • Zachary T Welch's avatar
      Use nand_fileio_* in write/dump commands. · 51cd370b
      Zachary T Welch authored
      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.
      51cd370b
    • Zachary T Welch's avatar
      Add nand_fileio_* helper APIs. · 23cc85b3
      Zachary T Welch authored
      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.
      23cc85b3
    • Zachary T Welch's avatar
      binarybuffer: add API documentation · 45527ee8
      Zachary T Welch authored
      Adds Doxygen documentation for a number of the binarybuffer APIs,
      including "unexpected" behavior exposed during review on the list.
      45527ee8
    • Zachary T Welch's avatar
      improve inline binarybuffer helpers · d6348d43
      Zachary T Welch authored
      Use void*, unsigned, and bool types with inline helpers.
      d6348d43
    • Zachary T Welch's avatar
      improve buf_set_buf helper · 21b452cf
      Zachary T Welch authored
      Use void * and unsigned types for buffer and their sizes.
      Allows it to be used with more than uint8_t * without casts.
      21b452cf
    • Zachary T Welch's avatar
      improve buf_set_ones · d8d8c5d8
      Zachary T Welch authored
      Use memset instead of loop. Improve types, using void * and unsigned.
      d8d8c5d8
    • Zachary T Welch's avatar
      improve buf_cpy helper · d09e3081
      Zachary T Welch authored
      Use memcpy for bulk of copy, improve final byte handling.
      Improve types by using void * for buffers and unsigned for size.
      d09e3081
    • Zachary T Welch's avatar
      improve buf_cmp and buf_cmp_mask helpers · e4ee8917
      Zachary T Welch authored
      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.
      e4ee8917
    • Zachary T Welch's avatar
      improve str_to_buf and buf_to_str helpers · d50caa97
      Zachary T Welch authored
      Improve types: use void * and unsigned.  Move all variables to point of
      first use.  Move radix guessing logic to new str_radix_guess helper.
      d50caa97
    • Zachary T Welch's avatar
      binarybuffer: move variables to point of first use · 5a43bd2e
      Zachary T Welch authored
      Reduce some noise from subsequent patches.
      5a43bd2e
    • Zachary T Welch's avatar
      binarybuffer: fix whitespace related issues · 82fc2f96
      Zachary T Welch authored
      Add inter-operator whitespace.  Improve existing documentation.
      82fc2f96
    • David Brownell's avatar
      #include "target.h" less wildly · b695cb75
      David Brownell authored
      
      
      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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      b695cb75
    • David Brownell's avatar
      target: no implicit #includes of "register.h" · 8193f17c
      David Brownell authored
      
      
      Same deal:  "register.h" got needlessly included all over the
      place because of being in a few widely included headers.
      
      So take it out of the header files which included it, and put
      it in files which use it ... reduce needless interdependencies.
      
      Also, don't need that extra "types.h" inclusion.
      
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      8193f17c
    • David Brownell's avatar
      target: less implicit inclusion of "command.h" · 1186f7ef
      David Brownell authored
      
      
      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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      1186f7ef
    • David Brownell's avatar
      target: don't implicitly include "algorithm.h" · db094c2e
      David Brownell authored
      
      
      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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      db094c2e
    • David Brownell's avatar
      target: don't implicitly include "breakpoint.h" · aa7c4496
      David Brownell authored
      
      
      Most files in the tree seem to have ended up including this,
      and *quite* needlessly ... only code implementing or using
      breakpoints 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.
      
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      aa7c4496
  2. 15 Nov, 2009 10 commits
    • David Brownell's avatar
      ARM11: use now-generic memory utils · 5d1a9033
      David Brownell authored
      
      
      Now the ARM11 cores can use the renamed arm_checksum_memory()
      and arm_blank_check_memory() routines ... do so.
      
      Sanity checked with "flash erase_check" of both NOR banks on an
      OMAP2420 ... the algorithm code dumped four lines of of "poll"
      status after each of almost 520 blocks (yes, *very* annoying) but
      gave plausible results after producing that spam.
      
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      5d1a9033
    • David Brownell's avatar
      ARM11: fixup method table · 2280ddee
      David Brownell authored
      
      
      Three changes:  remove ARM11_HANDLER() in favor of normal structure
      initialization syntax; fix goofy indentation in that structure; and
      don't needlessly export arm11_register_commands(), it's only called
      through that method table.
      
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      2280ddee
    • David Brownell's avatar
      ARM: memory utils aren't ARM7/ARM9 dependent · 269040bb
      David Brownell authored
      
      
      The arm7_9_checksum_memory() and arm7_9_blank_check_memory()
      routines are not actually specific to the ARM7 and ARM9 core
      generations ... they can work for any core which can run
      algorithms using basic ARM (not Thumb) instructions.
      
      Rename them; move the declarations to a more generic site;
      likewise move the code (and tidy it a bit in the process).
      
      NOTE:  the blank_check() method falsely returned a success
      status (0) on one error path, when the algorithm failed.
      Fixed this bug.
      
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      269040bb
    • David Brownell's avatar
      target: make "examined" flag be per-target · 9ac7cdec
      David Brownell authored
      
      
      Previously this flag was stored in "target_type", so that for example
      if there were two ARM7TDMI targets in a scan chain, both would claim
      to have been examined although only the first one actually had its
      examine() method called.
      
      Move this state to where it should have been in the first place, and
      hide a method that didn't need exposure ... the flag is write-once.
      
      Provide some doxygen.  The examine() method is confusing, since it
      isn't separating one-time setup from the after-each-reset stuff.  And
      the ARM7/ARM9 version is, somewhat undesirably, not leaving the debug
      state alone after reset ... probably more of an issue for trace setup
      than for watchpoints and breakpoints.
      
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      9ac7cdec
    • Zachary T Welch's avatar
      arm-jtag-ew,jlink: switch to COMMAND_HANDLER · f3013660
      Zachary T Welch authored
      These drivers were overlooked during the recent upgrade.  Convert them,
      moving their registration routines to eliminate their declarations.
      f3013660
    • Zachary T Welch's avatar
      rlink: fix overzealous sed · 67319688
      Zachary T Welch authored
      Fix an instance where my cleanup when awry.
      67319688
    • Zachary T Welch's avatar
      remove unused arm_jtag_buf_to_* helpers · a502676d
      Zachary T Welch authored
      Removes unused arm_jtag_buf_* helpers from arm_jtag.[ch].  These could
      reappear if patches are provided to conver the tree to use them, but
      this code should not be in the master tree until that series is ready.
      a502676d
    • Zachary T Welch's avatar
      remove unused buf_to_u32_handler · bc07ee82
      Zachary T Welch authored
      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.
      bc07ee82
    • Zachary T Welch's avatar
      struct scan_field_s -> struct scan_field · 4d4b2958
      Zachary T Welch authored
      Remove obsolete suffix from struct scan_field.  Somehow, these
      definitions did not get updated but did not cause any errors.
      4d4b2958
    • Krzysztof Dziuba's avatar
      Fix for md* commands, similar to mw*. · c2edc790
      Krzysztof Dziuba authored
      c2edc790
  3. 14 Nov, 2009 4 commits