You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(16) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <zw...@ma...> - 2009-06-09 02:58:30
|
Author: zwelch Date: 2009-06-09 02:58:23 +0200 (Tue, 09 Jun 2009) New Revision: 2134 Added: trunk/tcl/board/csb337.cfg Modified: trunk/tcl/target/str912.cfg Log: David Brownell <da...@pa...>: Add configuration for an old AT91rm9200 board, the Cogent CSB 337. Worth noting from the OpenOCD perspective: - It got a real hardware trace port connector; wired up here as much as we can, lacking inexpensive trace-aware dongles. - This is the first in-tree use of the "arm920t cp15" command. It adjusts the CPU clocking and enables i-cache, which gives more than 4x speedup after booting Linux; it's visible even just running U-Boot. Added: trunk/tcl/board/csb337.cfg =================================================================== --- trunk/tcl/board/csb337.cfg 2009-06-08 22:18:16 UTC (rev 2133) +++ trunk/tcl/board/csb337.cfg 2009-06-09 00:58:23 UTC (rev 2134) @@ -0,0 +1,118 @@ +# Cogent CSB337 +# http://cogcomp.com/csb_csb337.htm + +source [find target/at91rm9200.cfg] + +# boots from NOR on CS0: 8 MBytes CFI flash, 16-bit bus +flash bank cfi 0x10000000 0x00800000 2 2 $_TARGETNAME + +# ETM9 trace port connector present on this board, 16 data pins. +if { [info exists ETM_DRIVER] } { + etm config $_TARGETNAME 16 normal half $ETM_DRIVER + # OpenOCD may someday support a real trace port driver... + # system config file would need to configure it. +} else { + etm config $_TARGETNAME 16 normal half dummy + etm_dummy config $_TARGETNAME +} + +proc csb337_clk_init { } { + # CPU is in Slow Clock Mode (32KiHz) ... needs slow JTAG clock + jtag_khz 8 + + # CKGR_MOR: start main oscillator (3.6864 MHz) + mww 0xfffffc20 0xff01 + sleep 10 + + # CKGR_PLLAR: start PLL A for CPU and peripherals (184.32 MHz) + mww 0xfffffc28 0x20313e01 + # CKGR_PLLBR: start PLL B for USB timing (96 MHz, with div2) + mww 0xfffffc2c 0x12703e18 + # let PLLs lock + sleep 10 + + # PMC_MCKR: switch to CPU clock = PLLA, master clock = CPU/4 + mww 0xfffffc30 0x0302 + sleep 20 + + # CPU is in Normal Mode ... allows faster JTAG clock speed + jtag_khz 40000 +} + +proc csb337_nor_init { } { + # SMC_CSR0: adjust timings (10 wait states) + mww 0xffffff70 0x1100318a + + flash probe 0 +} + +proc csb337_sdram_init { } { + # enable PIOC clock + mww 0xfffffc10 0x0010 + # PC31..PC16 are D31..D16, with internal pullups like D15..D0 + mww 0xfffff870 0xffff0000 + mww 0xfffff874 0x0 + mww 0xfffff804 0xffff0000 + + # SDRC_CR: set timings + mww 0xffffff98 0x2188b0d5 + + # SDRC_MR: issue all banks precharge to SDRAM + mww 0xffffff90 2 + mww 0x20000000 0 + + # SDRC_MR: 8 autorefresh cycles + mww 0xffffff90 4 + mww 0x20000000 0 + mww 0x20000000 0 + mww 0x20000000 0 + mww 0x20000000 0 + mww 0x20000000 0 + mww 0x20000000 0 + mww 0x20000000 0 + mww 0x20000000 0 + + # SDRC_MR: set SDRAM mode registers (CAS, burst len, etc) + mww 0xffffff90 3 + mww 0x20000080 0 + + # SDRC_TR: set refresh rate + mww 0xffffff94 0x200 + mww 0x20000000 0 + + # SDRC_MR: normal mode, 32 bit bus + mww 0xffffff90 0 + mww 0x20000000 0 +} + +# The rm9200 chip has just been reset. Bring it up far enough +# that we can write flash or run code from SDRAM. +proc csb337_reset_init { } { + csb337_clk_init + + # EBI_CSA: CS0 = NOR, CS1 = SDRAM + mww 0xffffff60 0x02 + + csb337_nor_init + csb337_sdram_init + + # Update CP15 control register ... we don't seem to be able to + # read/modify/write its value through a TCL variable, so just + # write it. Fields are zero unless listed here ... and note + # that OpenOCD numbers this register "2", not "1" (!). + # + # - Core to use Async Clocking mode (so it uses 184 MHz most + # of the time instead of limiting to the master clock rate): + # iA(31) = 1, nF(30) = 1 + # - Icache on (it's disabled now, slowing i-fetches) + # I(12) = 1 + # - Reserved/ones + # 6:3 = 1 + # - Alignment traps enabled + # A(1) = 1 + arm920t cp15 2 0xc000107a +} + +$_TARGETNAME configure -event reset-init {csb337_reset_init} + +# vim:syntax tcl Property changes on: trunk/tcl/board/csb337.cfg ___________________________________________________________________ Name: eol:style + native Modified: trunk/tcl/target/str912.cfg =================================================================== --- trunk/tcl/target/str912.cfg 2009-06-08 22:18:16 UTC (rev 2133) +++ trunk/tcl/target/str912.cfg 2009-06-09 00:58:23 UTC (rev 2134) @@ -1,4 +1,6 @@ # script for str9 +# For more information about the configuration files, take a look at: +# openocd.texi if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME @@ -19,52 +21,74 @@ jtag_ntrst_delay 100 #use combined on interfaces or targets that can't set TRST/SRST separately -reset_config trst_and_srst +#reset_config trst_and_srst if { [info exists FLASHTAPID ] } { set _FLASHTAPID $FLASHTAPID } else { set _FLASHTAPID 0x04570041 } -jtag newtap $_CHIPNAME flash -irlen 8 -ircapture 0x1 -irmask 0x1 -expected-id $_FLASHTAPID +jtag newtap $_CHIPNAME flash \ + -irlen 8 -ircapture 0x1 -irmask 0x1 \ + -expected-id $_FLASHTAPID if { [info exists CPUTAPID ] } { set _CPUTAPID $CPUTAPID } else { set _CPUTAPID 0x25966041 } -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID +jtag newtap $_CHIPNAME cpu \ + -irlen 4 -ircapture 0x1 -irmask 0xf \ + -expected-id $_CPUTAPID if { [info exists BSTAPID ] } { - set _BSTAPID $BSTAPID + set _BSTAPID1 $BSTAPID + set _BSTAPID2 $BSTAPID } else { - set _BSTAPID 0x1457f041 + set _BSTAPID1 0x1457f041 + set _BSTAPID2 0x2457f041 } -jtag newtap $_CHIPNAME bs -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID +jtag newtap $_CHIPNAME bs \ + -irlen 5 -ircapture 0x1 -irmask 0x1 \ + -expected-id $_BSTAPID1 -expected-id $_BSTAPID2 set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME arm966e -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm966e +target create $_TARGETNAME arm966e \ + -endian $_ENDIAN \ + -chain-position $_TARGETNAME \ + -variant arm966e $_TARGETNAME configure -event reset-start { jtag_rclk 16 } -$_TARGETNAME configure -event reset-init { - # We can increase speed now that we know the target is halted. - #jtag_rclk 3000 - - # -- Enable 96K RAM - # PFQBC enabled / DTCM & AHB wait-states disabled - mww 0x5C002034 0x0191 +proc str9x_config { } { + # -- Enable 96K RAM w/: + # PFQBC enabled / DTCM & AHB wait-states disabled + mww 0x5C002034 0x0191 + # PFQBC disabled / DTCM & AHB wait-states enabled + #mww 0x5C002034 0x0196 - str9x flash_config 0 4 2 0 0x80000 - flash protect 0 0 7 off + # 256K/32k + str9x flash_config 0 3 2 0 0x40000 + # 512K/32K + #str9x flash_config 0 4 2 0 0x80000 } -$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x50000000 -work-area-size 16384 -work-area-backup 0 +proc str9x_init { } { + # enable RTCK + jtag_rclk 0 + str9x_config +} +$_TARGETNAME configure -event reset-init str9x_init + +$_TARGETNAME configure \ + -work-area-virt 0 \ + -work-area-phys 0x50000000 \ + -work-area-size 16384 \ + -work-area-backup 0 + #flash bank str9x <base> <size> 0 0 <target#> <variant> -flash bank str9x 0x00000000 0x00080000 0 0 0 -flash bank str9x 0x00080000 0x00008000 0 0 0 +flash bank str9x 0x00000000 0x00040000 0 0 0 +flash bank str9x 0x00040000 0x00008000 0 0 0 -# For more information about the configuration files, take a look at: -# openocd.texi |
From: <kc...@ma...> - 2009-06-09 00:18:36
|
Author: kc8apf Date: 2009-06-09 00:18:16 +0200 (Tue, 09 Jun 2009) New Revision: 2133 Modified: trunk/guess-rev.sh Log: Fix eol-style on guess-rev.sh Property changes on: trunk/guess-rev.sh ___________________________________________________________________ Name: svn:eol-style - LF + native |
From: oharboe at B. <oh...@ma...> - 2009-06-08 16:13:33
|
Author: oharboe Date: 2009-06-08 16:13:32 +0200 (Mon, 08 Jun 2009) New Revision: 2132 Added: trunk/src/jtag/zy1000/ trunk/src/jtag/zy1000/jtag_minidriver.h trunk/src/jtag/zy1000/zy1000.c Removed: trunk/src/jtag/zy1000.c zy1000/trunk/build/include/jtag_minidriver.h Modified: trunk/configure.in trunk/src/jtag/Makefile.am Log: update zy1000 to latest minidriver work Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-06-08 13:57:13 UTC (rev 2131) +++ trunk/configure.in 2009-06-08 14:13:32 UTC (rev 2132) @@ -400,13 +400,12 @@ build_minidriver=no AC_MSG_CHECKING([whether to enable ZY1000 minidriver]) if test $build_ecosboard = yes; then - # check for that project's header file in the current header search path - AC_CHECK_HEADERS(jtag_minidriver.h, [build_minidriver=yes], - AC_MSG_WARN([The --enable-ecosboard option needs the out-of-tree 'jtag_minidriver.h']) - AC_MSG_ERROR([The out-of-tree jtag_minidriver.h cannot be found.]) - ) + if test $build_minidriver = yes; then + AC_MSG_ERROR([Multiple minidriver options have been enabled.]) + fi + AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1, + [Define to 1 if you have the <jtag_minidriver.h> header file.]) build_minidriver=yes - AC_DEFINE(BUILD_MINIDRIVER_DUMMY, 1, [Use the dummy minidriver.]) fi AC_MSG_RESULT($build_ecosboard) Modified: trunk/src/jtag/Makefile.am =================================================================== --- trunk/src/jtag/Makefile.am 2009-06-08 13:57:13 UTC (rev 2131) +++ trunk/src/jtag/Makefile.am 2009-06-08 14:13:32 UTC (rev 2132) @@ -46,7 +46,8 @@ endif if ECOSBOARD -ECOSBOARDFILES = zy1000.c +ECOSBOARDFILES = zy1000/zy1000.c +AM_CPPFLAGS += -I$(srcdir)/zy1000 else ECOSBOARDFILES = endif Copied: trunk/src/jtag/zy1000/jtag_minidriver.h (from rev 2108, zy1000/trunk/build/include/jtag_minidriver.h) Copied: trunk/src/jtag/zy1000/zy1000.c (from rev 2130, trunk/src/jtag/zy1000.c) Deleted: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-06-08 13:57:13 UTC (rev 2131) +++ trunk/src/jtag/zy1000.c 2009-06-08 14:13:32 UTC (rev 2132) @@ -1,809 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007-2008 by vind Harboe * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "embeddedice.h" -#include "minidriver.h" -#include "interface.h" - -#include <cyg/hal/hal_io.h> // low level i/o -#include <cyg/hal/hal_diag.h> - - -#define ZYLIN_VERSION "1.52" -#define ZYLIN_DATE __DATE__ -#define ZYLIN_TIME __TIME__ -#define ZYLIN_OPENOCD "$Revision$" -#define ZYLIN_OPENOCD_VERSION "Zylin JTAG ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE " " ZYLIN_TIME -const char *zylin_config_dir="/config/settings"; - -/* low level command set - */ -int zy1000_read(void); -static void zy1000_write(int tck, int tms, int tdi); -void zy1000_reset(int trst, int srst); - - -int zy1000_speed(int speed); -int zy1000_register_commands(struct command_context_s *cmd_ctx); -int zy1000_init(void); -int zy1000_quit(void); - -/* interface commands */ -int zy1000_handle_zy1000_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -static int zy1000_khz(int khz, int *jtag_speed) -{ - if (khz==0) - { - *jtag_speed=0; - } - else - { - *jtag_speed=64000/khz; - } - return ERROR_OK; -} - -static int zy1000_speed_div(int speed, int *khz) -{ - if (speed==0) - { - *khz = 0; - } - else - { - *khz=64000/speed; - } - - return ERROR_OK; -} - -static bool readPowerDropout(void) -{ - cyg_uint32 state; - // sample and clear power dropout - HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x80); - HAL_READ_UINT32(ZY1000_JTAG_BASE+0x10, state); - bool powerDropout; - powerDropout = (state & 0x80) != 0; - return powerDropout; -} - - -static bool readSRST(void) -{ - cyg_uint32 state; - // sample and clear SRST sensing - HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x00000040); - HAL_READ_UINT32(ZY1000_JTAG_BASE+0x10, state); - bool srstAsserted; - srstAsserted = (state & 0x40) != 0; - return srstAsserted; -} - -static int zy1000_srst_asserted(int *srst_asserted) -{ - *srst_asserted=readSRST(); - return ERROR_OK; -} - -static int zy1000_power_dropout(int *dropout) -{ - *dropout=readPowerDropout(); - return ERROR_OK; -} - - -jtag_interface_t zy1000_interface = -{ - .name = "ZY1000", - .execute_queue = NULL, - .speed = zy1000_speed, - .register_commands = zy1000_register_commands, - .init = zy1000_init, - .quit = zy1000_quit, - .khz = zy1000_khz, - .speed_div = zy1000_speed_div, - .power_dropout = zy1000_power_dropout, - .srst_asserted = zy1000_srst_asserted, -}; - -static void zy1000_write(int tck, int tms, int tdi) -{ - -} - -int zy1000_read(void) -{ - return -1; -} - -extern bool readSRST(void); - -void zy1000_reset(int trst, int srst) -{ - LOG_DEBUG("zy1000 trst=%d, srst=%d", trst, srst); - if(!srst) - { - ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x00000001); - } - else - { - /* Danger!!! if clk!=0 when in - * idle in TAP_IDLE, reset halt on str912 will fail. - */ - ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000001); - } - - if(!trst) - { - ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x00000002); - } - else - { - /* assert reset */ - ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000002); - } - - if (trst||(srst&&(jtag_reset_config & RESET_SRST_PULLS_TRST))) - { - waitIdle(); - /* we're now in the RESET state until trst is deasserted */ - ZY1000_POKE(ZY1000_JTAG_BASE+0x20, TAP_RESET); - } else - { - /* We'll get RCLK failure when we assert TRST, so clear any false positives here */ - ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x400); - } - - /* wait for srst to float back up */ - if (!srst) - { - int i; - for (i=0; i<1000; i++) - { - // We don't want to sense our own reset, so we clear here. - // There is of course a timing hole where we could loose - // a "real" reset. - if (!readSRST()) - break; - - /* wait 1ms */ - alive_sleep(1); - } - - if (i==1000) - { - LOG_USER("SRST didn't deassert after %dms", i); - } else if (i>1) - { - LOG_USER("SRST took %dms to deassert", i); - } - } -} - -int zy1000_speed(int speed) -{ - if(speed == 0) - { - /*0 means RCLK*/ - speed = 0; - ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x100); - LOG_DEBUG("jtag_speed using RCLK"); - } - else - { - if(speed > 8190 || speed < 2) - { - LOG_USER("valid ZY1000 jtag_speed=[8190,2]. Divisor is 64MHz / even values between 8190-2, i.e. min 7814Hz, max 32MHz"); - return ERROR_INVALID_ARGUMENTS; - } - - LOG_USER("jtag_speed %d => JTAG clk=%f", speed, 64.0/(float)speed); - ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x100); - ZY1000_POKE(ZY1000_JTAG_BASE+0x1c, speed&~1); - } - return ERROR_OK; -} - -static bool savePower; - - -static void setPower(bool power) -{ - savePower = power; - if (power) - { - HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x14, 0x8); - } else - { - HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x8); - } -} - -int handle_power_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -{ - if (argc > 1) - { - return ERROR_INVALID_ARGUMENTS; - } - - if (argc == 1) - { - if (strcmp(args[0], "on") == 0) - { - setPower(1); - } - else if (strcmp(args[0], "off") == 0) - { - setPower(0); - } else - { - command_print(cmd_ctx, "arg is \"on\" or \"off\""); - return ERROR_INVALID_ARGUMENTS; - } - } - - command_print(cmd_ctx, "Target power %s", savePower ? "on" : "off"); - - return ERROR_OK; -} - - -/* Give TELNET a way to find out what version this is */ -static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv) -{ - if ((argc < 1) || (argc > 2)) - return JIM_ERR; - char buff[128]; - const char *version_str=NULL; - - if (argc == 1) - { - version_str=ZYLIN_OPENOCD_VERSION; - } else - { - const char *str = Jim_GetString(argv[1], NULL); - if (strcmp("openocd", str) == 0) - { - int revision; - revision = atol(ZYLIN_OPENOCD+strlen("XRevision: ")); - sprintf(buff, "%d", revision); - version_str=buff; - } - else if (strcmp("zy1000", str) == 0) - { - version_str=ZYLIN_VERSION; - } - else if (strcmp("date", str) == 0) - { - version_str=ZYLIN_DATE; - } - else - { - return JIM_ERR; - } - } - - Jim_SetResult(interp, Jim_NewStringObj(interp, version_str, -1)); - - return JIM_OK; -} - - -static int -zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, - int argc, - Jim_Obj * const *argv) -{ - if (argc != 1) - { - Jim_WrongNumArgs(interp, 1, argv, "powerstatus"); - return JIM_ERR; - } - - cyg_uint32 status; - ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, status); - - Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80)!=0)); - - return JIM_OK; -} - -int zy1000_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY, - "power <on/off> - turn power switch to target on/off. No arguments - print status."); - - Jim_CreateCommand(interp, "zy1000_version", jim_zy1000_version, NULL, NULL); - - - Jim_CreateCommand(interp, "powerstatus", zylinjtag_Jim_Command_powerstatus, NULL, NULL); - - return ERROR_OK; -} - - - - -int zy1000_init(void) -{ - LOG_USER("%s", ZYLIN_OPENOCD_VERSION); - - ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x30); // Turn on LED1 & LED2 - - setPower(true); // on by default - - - /* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */ - zy1000_reset(0, 0); - zy1000_speed(jtag_speed); - - return ERROR_OK; -} - -int zy1000_quit(void) -{ - - return ERROR_OK; -} - - - -int interface_jtag_execute_queue(void) -{ - cyg_uint32 empty; - - waitIdle(); - ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, empty); - /* clear JTAG error register */ - ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x400); - - if ((empty&0x400)!=0) - { - LOG_WARNING("RCLK timeout"); - /* the error is informative only as we don't want to break the firmware if there - * is a false positive. - */ -// return ERROR_FAIL; - } - return ERROR_OK; -} - - - - - -static cyg_uint32 getShiftValue(void) -{ - cyg_uint32 value; - waitIdle(); - ZY1000_PEEK(ZY1000_JTAG_BASE+0xc, value); - VERBOSE(LOG_INFO("getShiftValue %08x", value)); - return value; -} -#if 0 -static cyg_uint32 getShiftValueFlip(void) -{ - cyg_uint32 value; - waitIdle(); - ZY1000_PEEK(ZY1000_JTAG_BASE+0x18, value); - VERBOSE(LOG_INFO("getShiftValue %08x (flipped)", value)); - return value; -} -#endif - -#if 0 -static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endState, int repeat, cyg_uint32 value) -{ - VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", tap_state_name(state), tap_state_name(endState), repeat, value)); - cyg_uint32 a,b; - a=state; - b=endState; - ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<15)|(repeat<<8)|(a<<4)|b); - VERBOSE(getShiftValueFlip()); -} -#endif - -extern int jtag_check_value(u8 *captured, void *priv); - -static __inline void scanFields(int num_fields, scan_field_t *fields, tap_state_t shiftState, tap_state_t end_state) -{ - int i; - int j; - int k; - - for (i = 0; i < num_fields; i++) - { - cyg_uint32 value; - - static u8 *in_buff=NULL; /* pointer to buffer for scanned data */ - static int in_buff_size=0; - u8 *inBuffer=NULL; - - - // figure out where to store the input data - int num_bits=fields[i].num_bits; - if (fields[i].in_value!=NULL) - { - inBuffer=fields[i].in_value; - } - - // here we shuffle N bits out/in - j=0; - while (j<num_bits) - { - tap_state_t pause_state; - int l; - k=num_bits-j; - pause_state=(shiftState==TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT; - if (k>32) - { - k=32; - /* we have more to shift out */ - } else if (i == num_fields-1) - { - /* this was the last to shift out this time */ - pause_state=end_state; - } - - // we have (num_bits+7)/8 bytes of bits to toggle out. - // bits are pushed out LSB to MSB - value=0; - if (fields[i].out_value!=NULL) - { - for (l=0; l<k; l+=8) - { - value|=fields[i].out_value[(j+l)/8]<<l; - } - } - /* mask away unused bits for easier debugging */ - value&=~(((u32)0xffffffff)<<k); - - shiftValueInner(shiftState, pause_state, k, value); - - if (inBuffer!=NULL) - { - // data in, LSB to MSB - value=getShiftValue(); - // we're shifting in data to MSB, shift data to be aligned for returning the value - value >>= 32-k; - - for (l=0; l<k; l+=8) - { - inBuffer[(j+l)/8]=(value>>l)&0xff; - } - } - j+=k; - } - } -} - -int interface_jtag_set_end_state(tap_state_t state) -{ - return ERROR_OK; -} - - -int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_state_t state) -{ - - int j; - int scan_size = 0; - jtag_tap_t *tap, *nextTap; - for(tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) - { - nextTap=jtag_tap_next_enabled(tap); - tap_state_t end_state; - if (nextTap==NULL) - { - end_state = state; - } else - { - end_state = TAP_IRSHIFT; - } - - int found = 0; - - scan_size = tap->ir_length; - - /* search the list */ - for (j=0; j < num_fields; j++) - { - if (tap == fields[j].tap) - { - found = 1; - - scanFields(1, fields+j, TAP_IRSHIFT, end_state); - /* update device information */ - buf_cpy(fields[j].out_value, tap->cur_instr, scan_size); - - tap->bypass = 0; - break; - } - } - - if (!found) - { - /* if a device isn't listed, set it to BYPASS */ - u8 ones[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; - - scan_field_t tmp; - memset(&tmp, 0, sizeof(tmp)); - tmp.out_value = ones; - tmp.num_bits = scan_size; - scanFields(1, &tmp, TAP_IRSHIFT, end_state); - /* update device information */ - buf_cpy(tmp.out_value, tap->cur_instr, scan_size); - tap->bypass = 1; - } - } - - return ERROR_OK; -} - - - - - -int interface_jtag_add_plain_ir_scan(int num_fields, const scan_field_t *fields, tap_state_t state) -{ - scanFields(num_fields, fields, TAP_IRSHIFT, state); - - return ERROR_OK; -} - -/*extern jtag_command_t **jtag_get_last_command_p(void);*/ - -int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_state_t state) -{ - - int j; - jtag_tap_t *tap, *nextTap; - for(tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) - { - nextTap=jtag_tap_next_enabled(tap); - int found=0; - tap_state_t end_state; - if (nextTap==NULL) - { - end_state = state; - } else - { - end_state = TAP_DRSHIFT; - } - - for (j=0; j < num_fields; j++) - { - if (tap == fields[j].tap) - { - found = 1; - - scanFields(1, fields+j, TAP_DRSHIFT, end_state); - } - } - if (!found) - { - scan_field_t tmp; - /* program the scan field to 1 bit length, and ignore it's value */ - tmp.num_bits = 1; - tmp.out_value = NULL; - tmp.in_value = NULL; - - scanFields(1, &tmp, TAP_DRSHIFT, end_state); - } - else - { - } - } - return ERROR_OK; -} - -int interface_jtag_add_plain_dr_scan(int num_fields, const scan_field_t *fields, tap_state_t state) -{ - scanFields(num_fields, fields, TAP_DRSHIFT, state); - return ERROR_OK; -} - - -int interface_jtag_add_tlr() -{ - setCurrentState(TAP_RESET); - return ERROR_OK; -} - - - - -extern int jtag_nsrst_delay; -extern int jtag_ntrst_delay; - -int interface_jtag_add_reset(int req_trst, int req_srst) -{ - zy1000_reset(req_trst, req_srst); - return ERROR_OK; -} - -static int zy1000_jtag_add_clocks(int num_cycles, tap_state_t state, tap_state_t clockstate) -{ - /* num_cycles can be 0 */ - setCurrentState(clockstate); - - /* execute num_cycles, 32 at the time. */ - int i; - for (i=0; i<num_cycles; i+=32) - { - int num; - num=32; - if (num_cycles-i<num) - { - num=num_cycles-i; - } - shiftValueInner(clockstate, clockstate, num, 0); - } - -#if !TEST_MANUAL() - /* finish in end_state */ - setCurrentState(state); -#else - tap_state_t t=TAP_IDLE; - /* test manual drive code on any target */ - int tms; - u8 tms_scan = tap_get_tms_path(t, state); - int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - - for (i = 0; i < tms_count; i++) - { - tms = (tms_scan >> i) & 1; - waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x28, tms); - } - waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x20, state); -#endif - - - return ERROR_OK; -} - -int interface_jtag_add_runtest(int num_cycles, tap_state_t state) -{ - return zy1000_jtag_add_clocks(num_cycles, state, TAP_IDLE); -} - -int interface_jtag_add_clocks(int num_cycles) -{ - return zy1000_jtag_add_clocks(num_cycles, cmd_queue_cur_state, cmd_queue_cur_state); -} - -int interface_jtag_add_sleep(u32 us) -{ - jtag_sleep(us); - return ERROR_OK; -} - -int interface_jtag_add_pathmove(int num_states, const tap_state_t *path) -{ - int state_count; - int tms = 0; - - /*wait for the fifo to be empty*/ - waitIdle(); - - state_count = 0; - - tap_state_t cur_state=cmd_queue_cur_state; - - while (num_states) - { - if (tap_state_transition(cur_state, false) == path[state_count]) - { - tms = 0; - } - else if (tap_state_transition(cur_state, true) == path[state_count]) - { - tms = 1; - } - else - { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_name(cur_state), tap_state_name(path[state_count])); - exit(-1); - } - - waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x28, tms); - - cur_state = path[state_count]; - state_count++; - num_states--; - } - - waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x20, cur_state); - return ERROR_OK; -} - - - -void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count) -{ -// static int const reg_addr=0x5; - tap_state_t end_state=jtag_get_end_state(); - if (jtag_tap_next_enabled(jtag_tap_next_enabled(NULL))==NULL) - { - /* better performance via code duplication */ - if (little) - { - int i; - for (i = 0; i < count; i++) - { - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 1)); - shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1<<5)); - buffer+=4; - } - } else - { - int i; - for (i = 0; i < count; i++) - { - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, 32, fast_target_buffer_get_u32(buffer, 0)); - shiftValueInner(TAP_DRSHIFT, end_state, 6, reg_addr|(1<<5)); - buffer+=4; - } - } - } - else - { - int i; - for (i = 0; i < count; i++) - { - embeddedice_write_reg_inner(tap, reg_addr, fast_target_buffer_get_u32(buffer, little)); - buffer += 4; - } - } -} - -int loadFile(const char *fileName, void **data, int *len); - -/* boolean parameter stored on config */ -int boolParam(char *var) -{ - bool result = false; - char *name = alloc_printf("%s/%s", zylin_config_dir, var); - if (name == NULL) - return result; - - void *data; - int len; - if (loadFile(name, &data, &len) == ERROR_OK) - { - if (len > 1) - len = 1; - result = strncmp((char *) data, "1", len) == 0; - free(data); - } - free(name); - return result; -} - - Deleted: zy1000/trunk/build/include/jtag_minidriver.h =================================================================== --- zy1000/trunk/build/include/jtag_minidriver.h 2009-06-08 13:57:13 UTC (rev 2131) +++ zy1000/trunk/build/include/jtag_minidriver.h 2009-06-08 14:13:32 UTC (rev 2132) @@ -1,210 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007-2008 by vind Harboe * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include <cyg/hal/hal_io.h> // low level i/o - -//#define VERBOSE(a) a -#define VERBOSE(a) - -/* used to test manual mode */ -#define TEST_MANUAL() 0 - -#if 0 -int diag_printf( const char *fmt, ... ); -#define ZY1000_POKE(a, b) HAL_WRITE_UINT32(a, b); diag_printf("poke 0x%08x,0x%08x\n", a, b) -#define ZY1000_PEEK(a, b) HAL_READ_UINT32(a, b); diag_printf("peek 0x%08x=0x%08x\n", a, b) -#else -#define ZY1000_POKE(a, b) HAL_WRITE_UINT32(a, b) -#define ZY1000_PEEK(a, b) HAL_READ_UINT32(a, b) -#endif - -// FIFO empty? -static __inline__ void waitIdle(void) -{ - cyg_uint32 empty; - do - { - ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, empty); - } while ((empty & 0x100)==0); -} - -static __inline__ void waitQueue(void) -{ -// waitIdle(); -} - -static void sampleShiftRegister(void) -{ -#if 0 - cyg_uint32 dummy; - waitIdle(); - ZY1000_PEEK(ZY1000_JTAG_BASE+0xc, dummy); -#endif -} - -/* -O3 will inline this for us */ -static void setCurrentState(enum tap_state state) -{ - cyg_uint32 a; - a=state; - int repeat=0; - if (state==TAP_RESET) - { - // The FPGA nor we know the current state of the CPU TAP - // controller. This will move it to TAP for sure. - // - // 5 should be enough here, 7 is what OpenOCD uses - repeat=7; - } - waitQueue(); - sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|a); - -} - -/* - * Enter state and cause repeat transitions *out* of that state. So if the endState!=state, then - * the transition from state to endState counts as a transition out of state. - */ -static __inline__ void shiftValueInner(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value) -{ - cyg_uint32 a,b; - a=state; - b=endState; - waitQueue(); - sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value); -#if 1 -#if TEST_MANUAL() - if ((state==TAP_DRSHIFT)&&(endState!=TAP_DRSHIFT)) - { - int i; - setCurrentState(state); - for (i=0; i<repeat; i++) - { - int tms; - tms=0; - if ((i==repeat-1)&&(state!=endState)) - { - tms=1; - } - /* shift out value */ - waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x28, (((value>>i)&1)<<1)|tms); - } - waitIdle(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x28, 0); - waitIdle(); - //ZY1000_POKE(ZY1000_JTAG_BASE+0x20, TAP_DRSHIFT); // set this state and things break => expected - ZY1000_POKE(ZY1000_JTAG_BASE+0x20, TAP_DRPAUSE); // set this and things will work => expected. Not setting this is not sufficient to make things break. - setCurrentState(endState); - } else - { - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|b); - } -#else - /* fast version */ - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|b); -#endif -#else - /* maximum debug version */ - if ((repeat>0)&&((state==TAP_DRSHIFT)||(state==TAP_SI))) - { - int i; - /* sample shift register for every bit. */ - for (i=0; i<repeat-1; i++) - { - sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value>>i); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<8)|(a<<4)|a); - } - sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value>>(repeat-1)); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1<<8)|(a<<4)|b); - } else - { - sampleShiftRegister(); - ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat<<8)|(a<<4)|b); - } - sampleShiftRegister(); -#endif -} - - - -static __inline__ void interface_jtag_add_dr_out_core(jtag_tap_t *target_tap, - int num_fields, - const int *num_bits, - const u32 *value, - enum tap_state end_state) -{ - enum tap_state pause_state = TAP_DRSHIFT; - - jtag_tap_t *tap, *nextTap; - for(tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) - { - nextTap=jtag_tap_next_enabled(tap); - if (nextTap==NULL) - { - pause_state = end_state; - } - if (tap == target_tap) - { - int j; - for (j=0; j<(num_fields-1); j++) - { - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[j], value[j]); - } - shiftValueInner(TAP_DRSHIFT, pause_state, num_bits[j], value[j]); - } else - { - /* program the scan field to 1 bit length, and ignore it's value */ - shiftValueInner(TAP_DRSHIFT, pause_state, 1, 0); - } - } -} - -static __inline__ void interface_jtag_add_dr_out(jtag_tap_t *target_tap, - int num_fields, - const int *num_bits, - const u32 *value, - enum tap_state end_state) -{ - - int singletap=(jtag_tap_next_enabled(jtag_tap_next_enabled(NULL))==NULL); - if ((singletap)&&(num_fields==3)) - { - /* used by embeddedice_write_reg_inner() */ - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[1], value[1]); - shiftValueInner(TAP_DRSHIFT, end_state, num_bits[2], value[2]); - } else if ((singletap)&&(num_fields==2)) - { - /* used by arm7 code */ - shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); - shiftValueInner(TAP_DRSHIFT, end_state, num_bits[1], value[1]); - } else - { - interface_jtag_add_dr_out_core(target_tap, num_fields, num_bits, value, end_state); - } -} - -#define interface_jtag_add_callback(callback, in) callback(in) - -#define interface_jtag_add_callback4(callback, in, data1, data2, data3) jtag_set_error(callback(in, data1, data2, data3)) |
From: oharboe at B. <oh...@ma...> - 2009-06-08 15:57:13
|
Author: oharboe Date: 2009-06-08 15:57:13 +0200 (Mon, 08 Jun 2009) New Revision: 2131 Modified: trunk/ trunk/configure.in Log: Zach Welch wrote a fix for configure problems under Cygwin. ltmain.sh is added to svn ignore Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - autom4te.cache .project aclocal.m4 config.guess config.h.in config.sub configure depcomp install-sh Makefile.in missing compile ltmain.sh.lnk + autom4te.cache .project aclocal.m4 config.guess config.h.in config.sub configure depcomp install-sh Makefile.in missing compile ltmain.sh.lnk ltmain.sh Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-06-08 13:16:57 UTC (rev 2130) +++ trunk/configure.in 2009-06-08 13:57:13 UTC (rev 2131) @@ -1014,16 +1014,16 @@ AC_MSG_RESULT([$EXEEXT_FOR_BUILD]) AC_SUBST(EXEEXT_FOR_BUILD) -AC_OUTPUT([ - Makefile - src/Makefile - src/helper/Makefile - src/jtag/Makefile - src/xsvf/Makefile - src/svf/Makefile - src/target/Makefile - src/server/Makefile - src/flash/Makefile - src/pld/Makefile - doc/Makefile - ]) +AC_OUTPUT(dnl + Makefile dnl + src/Makefile dnl + src/helper/Makefile dnl + src/jtag/Makefile dnl + src/xsvf/Makefile dnl + src/svf/Makefile dnl + src/target/Makefile dnl + src/server/Makefile dnl + src/flash/Makefile dnl + src/pld/Makefile dnl + doc/Makefile dnl + ) |
From: <zw...@ma...> - 2009-06-08 15:17:00
|
Author: zwelch Date: 2009-06-08 15:16:57 +0200 (Mon, 08 Jun 2009) New Revision: 2130 Modified: trunk/doc/openocd.texi Log: Add documentation for new interface_list command to user guide. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-08 13:12:17 UTC (rev 2129) +++ trunk/doc/openocd.texi 2009-06-08 13:16:57 UTC (rev 2130) @@ -1336,6 +1336,11 @@ target. @end deffn +@deffn Command {interface_list} +List the interface drivers that have been built into +the running copy of OpenOCD. +@end deffn + @deffn Command {jtag interface} Returns the name of the interface driver being used. @end deffn |
From: <zw...@ma...> - 2009-06-08 15:12:20
|
Author: zwelch Date: 2009-06-08 15:12:17 +0200 (Mon, 08 Jun 2009) New Revision: 2129 Modified: trunk/src/jtag/jtag.c Log: Factor interface list to its own command: - Add handle_interface_list_command, used by handle_interface_command. - Display output of new list to command console. - Change first index of displayed drivers to 1; it's only cosmetic. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 13:12:12 UTC (rev 2128) +++ trunk/src/jtag/jtag.c 2009-06-08 13:12:17 UTC (rev 2129) @@ -223,6 +223,8 @@ int jtag_speed = 0; /* jtag commands */ +static int handle_interface_list_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc); static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -1601,6 +1603,9 @@ register_command(cmd_ctx, NULL, "interface", handle_interface_command, COMMAND_CONFIG, "try to configure interface"); + register_command(cmd_ctx, NULL, + "interface_list", &handle_interface_list_command, + COMMAND_ANY, "list all built-in interfaces"); register_command(cmd_ctx, NULL, "jtag_speed", handle_jtag_speed_command, COMMAND_ANY, "(DEPRECATED) set jtag speed (if supported)"); register_command(cmd_ctx, NULL, "jtag_khz", handle_jtag_khz_command, @@ -1837,11 +1842,24 @@ * didn't match one of the compiled-in interfaces */ LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]); - LOG_ERROR("The following built-in JTAG interfaces are available:"); + handle_interface_list_command(cmd_ctx, cmd, args, argc); + return ERROR_JTAG_INVALID_INTERFACE; +} + +static int handle_interface_list_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) +{ + if (strcmp(cmd, "interface_list") == 0 && argc > 0) + return ERROR_COMMAND_SYNTAX_ERROR; + + command_print(cmd_ctx, "The following JTAG interfaces are available:"); for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) - LOG_ERROR("%u: %s", i, jtag_interfaces[i]->name); + { + const char *name = jtag_interfaces[i]->name; + command_print(cmd_ctx, "%u: %s", i + 1, name); + } - return ERROR_JTAG_INVALID_INTERFACE; + return ERROR_OK; } static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) |
From: <zw...@ma...> - 2009-06-08 15:12:15
|
Author: zwelch Date: 2009-06-08 15:12:12 +0200 (Mon, 08 Jun 2009) New Revision: 2128 Modified: trunk/src/jtag/jtag.c Log: Cleanup and simplify handle_interface_command: - Reduce indent: invert logic of strcmp test. - Reduce scope: declare variables upon first use in loops. - Reduce unsaid: compare end of table with NULL. - Remove superfluous braces around blocks with one statment. - Improve language that introduces the list of built-in drivers. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:58:28 UTC (rev 2127) +++ trunk/src/jtag/jtag.c 2009-06-08 13:12:12 UTC (rev 2128) @@ -1796,11 +1796,9 @@ return ERROR_OK; } -static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_interface_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - int i; - int retval; - /* check whether the interface is already configured */ if (jtag_interface) { @@ -1809,52 +1807,39 @@ } /* interface name is a mandatory argument */ - if (argc < 1 || args[0][0] == '\0') - { + if (argc != 1 || args[0][0] == '\0') return ERROR_COMMAND_SYNTAX_ERROR; - } - for (i=0; jtag_interfaces[i]; i++) + for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) { - if (strcmp(args[0], jtag_interfaces[i]->name) == 0) - { - if ((retval = jtag_interfaces[i]->register_commands(cmd_ctx)) != ERROR_OK) - { + if (strcmp(args[0], jtag_interfaces[i]->name) != 0) + continue; + + int retval = jtag_interfaces[i]->register_commands(cmd_ctx); + if (ERROR_OK != retval) return retval; - } - jtag_interface = jtag_interfaces[i]; + jtag_interface = jtag_interfaces[i]; - if (jtag_interface->khz == NULL) - { - jtag_interface->khz = default_khz; - } - if (jtag_interface->speed_div == NULL) - { - jtag_interface->speed_div = default_speed_div; - } - if (jtag_interface->power_dropout == NULL) - { - jtag_interface->power_dropout = default_power_dropout; - } - if (jtag_interface->srst_asserted == NULL) - { - jtag_interface->srst_asserted = default_srst_asserted; - } + if (jtag_interface->khz == NULL) + jtag_interface->khz = default_khz; + if (jtag_interface->speed_div == NULL) + jtag_interface->speed_div = default_speed_div; + if (jtag_interface->power_dropout == NULL) + jtag_interface->power_dropout = default_power_dropout; + if (jtag_interface->srst_asserted == NULL) + jtag_interface->srst_asserted = default_srst_asserted; - return ERROR_OK; - } + return ERROR_OK; } /* no valid interface was found (i.e. the configuration option, * didn't match one of the compiled-in interfaces */ - LOG_ERROR("No valid jtag interface found (%s)", args[0]); - LOG_ERROR("compiled-in jtag interfaces:"); - for (i = 0; jtag_interfaces[i]; i++) - { - LOG_ERROR("%i: %s", i, jtag_interfaces[i]->name); - } + LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]); + LOG_ERROR("The following built-in JTAG interfaces are available:"); + for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) + LOG_ERROR("%u: %s", i, jtag_interfaces[i]->name); return ERROR_JTAG_INVALID_INTERFACE; } |
From: <zw...@ma...> - 2009-06-08 12:58:37
|
Author: zwelch Date: 2009-06-08 12:58:28 +0200 (Mon, 08 Jun 2009) New Revision: 2127 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_sleep: - Add todo for removing keep_alive: is this a layering violation? - Use jtag_set_error instead of accessing jtag_error directly. - Remove superfluous retval temporary variable and empty return. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:58:13 UTC (rev 2126) +++ trunk/src/jtag/jtag.c 2009-06-08 10:58:28 UTC (rev 2127) @@ -783,11 +783,9 @@ void jtag_add_sleep(u32 us) { - keep_alive(); /* we might be running on a very slow JTAG clk */ - int retval=interface_jtag_add_sleep(us); - if (retval!=ERROR_OK) - jtag_error=retval; - return; + /// @todo Here, keep_alive() appears to be a layering violation!!! + keep_alive(); + jtag_set_error(interface_jtag_add_sleep(us)); } int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits) |
From: <zw...@ma...> - 2009-06-08 12:58:24
|
Author: zwelch Date: 2009-06-08 12:58:13 +0200 (Mon, 08 Jun 2009) New Revision: 2126 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_reset: - Use jtag_set_error instead of accessing jtag_error directly. - Remove superfluous retval temporary variable. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:57:51 UTC (rev 2125) +++ trunk/src/jtag/jtag.c 2009-06-08 10:58:13 UTC (rev 2126) @@ -665,7 +665,6 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst) { int trst_with_tlr = 0; - int retval; /* FIX!!! there are *many* different cases here. A better * approach is needed for legal combinations of transitions... @@ -689,7 +688,7 @@ if (((jtag_reset_config & RESET_SRST_PULLS_TRST) && (req_srst == 1)) && (!req_tlr_or_trst)) { LOG_ERROR("BUG: requested reset would assert trst"); - jtag_error=ERROR_FAIL; + jtag_set_error(ERROR_FAIL); return; } @@ -702,7 +701,7 @@ if (req_srst && !(jtag_reset_config & RESET_HAS_SRST)) { LOG_ERROR("BUG: requested SRST assertion, but the current configuration doesn't support this"); - jtag_error=ERROR_FAIL; + jtag_set_error(ERROR_FAIL); return; } @@ -722,10 +721,10 @@ jtag_srst = req_srst; - retval = interface_jtag_add_reset(jtag_trst, jtag_srst); - if (retval!=ERROR_OK) + int retval = interface_jtag_add_reset(jtag_trst, jtag_srst); + if (retval != ERROR_OK) { - jtag_error=retval; + jtag_set_error(retval); return; } jtag_execute_queue(); |
From: <zw...@ma...> - 2009-06-08 12:58:10
|
Author: zwelch Date: 2009-06-08 12:57:51 +0200 (Mon, 08 Jun 2009) New Revision: 2125 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_clocks: - Use jtag_set_error instead of accessing jtag_error directly. - Improve error language and whitespace. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:57:39 UTC (rev 2124) +++ trunk/src/jtag/jtag.c 2009-06-08 10:57:51 UTC (rev 2125) @@ -645,25 +645,20 @@ } -void jtag_add_clocks( int num_cycles ) +void jtag_add_clocks(int num_cycles) { - int retval; - - if( !tap_is_state_stable(cmd_queue_cur_state) ) + if (!tap_is_state_stable(cmd_queue_cur_state)) { - LOG_ERROR( "jtag_add_clocks() was called with TAP in non-stable state \"%s\"", - tap_state_name(cmd_queue_cur_state) ); - jtag_error = ERROR_JTAG_NOT_STABLE_STATE; + LOG_ERROR("jtag_add_clocks() called with TAP in unstable state \"%s\"", + tap_state_name(cmd_queue_cur_state)); + jtag_set_error(ERROR_JTAG_NOT_STABLE_STATE); return; } - if( num_cycles > 0 ) + if (num_cycles > 0) { jtag_checks(); - - retval = interface_jtag_add_clocks(num_cycles); - if (retval != ERROR_OK) - jtag_error=retval; + jtag_set_error(interface_jtag_add_clocks(num_cycles)); } } |
From: <zw...@ma...> - 2009-06-08 12:57:47
|
Author: zwelch Date: 2009-06-08 12:57:39 +0200 (Mon, 08 Jun 2009) New Revision: 2124 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_runtest: - Use jtag_set_error instead of accessing jtag_error directly. - Eliminate superfluous comment and temporary variable. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:57:18 UTC (rev 2123) +++ trunk/src/jtag/jtag.c 2009-06-08 10:57:39 UTC (rev 2124) @@ -640,14 +640,8 @@ void jtag_add_runtest(int num_cycles, tap_state_t state) { - int retval; - jtag_prelude(state); - - /* executed by sw or hw fifo */ - retval=interface_jtag_add_runtest(num_cycles, state); - if (retval!=ERROR_OK) - jtag_error=retval; + jtag_set_error(interface_jtag_add_runtest(num_cycles, state)); } |
From: <zw...@ma...> - 2009-06-08 12:57:37
|
Author: zwelch Date: 2009-06-08 12:57:18 +0200 (Mon, 08 Jun 2009) New Revision: 2123 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_pathmove: - Use jtag_set_error instead of accessing jtag_error directly. - Eliminate superfluous retval temporary variable. - Reduce scope of loop induction variable. - Wrap to fit within 80 columns. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:57:10 UTC (rev 2122) +++ trunk/src/jtag/jtag.c 2009-06-08 10:57:18 UTC (rev 2123) @@ -606,8 +606,6 @@ void jtag_add_pathmove(int num_states, const tap_state_t *path) { tap_state_t cur_state = cmd_queue_cur_state; - int i; - int retval; /* the last state has to be a stable state */ if (!tap_is_state_stable(path[num_states - 1])) @@ -616,7 +614,7 @@ exit(-1); } - for (i=0; i<num_states; i++) + for (int i = 0; i < num_states; i++) { if (path[i] == TAP_RESET) { @@ -627,7 +625,8 @@ if ( tap_state_transition(cur_state, true) != path[i] && tap_state_transition(cur_state, false) != path[i]) { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_name(cur_state), tap_state_name(path[i])); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", + tap_state_name(cur_state), tap_state_name(path[i])); exit(-1); } cur_state = path[i]; @@ -635,10 +634,8 @@ jtag_checks(); - retval = interface_jtag_add_pathmove(num_states, path); + jtag_set_error(interface_jtag_add_pathmove(num_states, path)); cmd_queue_cur_state = path[num_states - 1]; - if (retval!=ERROR_OK) - jtag_error=retval; } void jtag_add_runtest(int num_cycles, tap_state_t state) |
From: <zw...@ma...> - 2009-06-08 12:57:16
|
Author: zwelch Date: 2009-06-08 12:57:10 +0200 (Mon, 08 Jun 2009) New Revision: 2122 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_tlr: - Use jtag_set_error instead of accessing jtag_error directly. - Eliminate superfluous temporary variable. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:56:49 UTC (rev 2121) +++ trunk/src/jtag/jtag.c 2009-06-08 10:57:10 UTC (rev 2122) @@ -599,12 +599,7 @@ void jtag_add_tlr(void) { jtag_prelude(TAP_RESET); - - int retval; - retval=interface_jtag_add_tlr(); - if (retval!=ERROR_OK) - jtag_error=retval; - + jtag_set_error(interface_jtag_add_tlr()); jtag_call_event_callbacks(JTAG_TRST_ASSERTED); } |
From: <zw...@ma...> - 2009-06-08 12:57:04
|
Author: zwelch Date: 2009-06-08 12:56:49 +0200 (Mon, 08 Jun 2009) New Revision: 2121 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_plain_dr_scan: - Use jtag_set_error instead of accessing jtag_error directly. - Wrap function arguments to fit everything in 80 columns. - Move retval variable to location of first use. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:56:36 UTC (rev 2120) +++ trunk/src/jtag/jtag.c 2009-06-08 10:56:49 UTC (rev 2121) @@ -568,23 +568,19 @@ jtag_set_error(retval); } - - /** - * Duplicate the scan fields passed into the function into a DR SCAN command - * - * This function assumes that the caller handles extra fields for bypassed TAPs - * + * Duplicate the scan fields passed into the function into a DR SCAN + * command. Unlike jtag_add_dr_scan(), this function assumes that the + * caller handles extra fields for bypassed TAPs. */ -void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields, + tap_state_t state) { - int retval; - jtag_prelude(state); - retval=interface_jtag_add_plain_dr_scan(in_num_fields, in_fields, state); - if (retval!=ERROR_OK) - jtag_error=retval; + int retval; + retval = interface_jtag_add_plain_dr_scan(in_num_fields, in_fields, state); + jtag_set_error(retval); } void jtag_add_dr_out(jtag_tap_t* tap, |
From: <zw...@ma...> - 2009-06-08 12:56:45
|
Author: zwelch Date: 2009-06-08 12:56:36 +0200 (Mon, 08 Jun 2009) New Revision: 2120 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_dr_scan: - Use jtag_set_error instead of accessing jtag_error directly. - Wrap function arguments to fit everything in 80 columns. - Move retval variable to location of first use. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:56:25 UTC (rev 2119) +++ trunk/src/jtag/jtag.c 2009-06-08 10:56:36 UTC (rev 2120) @@ -553,23 +553,19 @@ /** - * Generate a DR SCAN using the fields passed to the function - * - * For not bypassed TAPs the function checks in_fields and uses fields specified there. - * For bypassed TAPs the function generates a dummy 1bit field. - * - * The bypass status of TAPs is set by jtag_add_ir_scan(). - * + * Generate a DR SCAN using the fields passed to the function. + * For connected TAPs, the function checks in_fields and uses fields + * specified there. For bypassed TAPs, the function generates a dummy + * 1-bit field. The bypass status of TAPs is set by jtag_add_ir_scan(). */ -void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields, + tap_state_t state) { - int retval; - jtag_prelude(state); - retval=interface_jtag_add_dr_scan(in_num_fields, in_fields, state); - if (retval!=ERROR_OK) - jtag_error=retval; + int retval; + retval = interface_jtag_add_dr_scan(in_num_fields, in_fields, state); + jtag_set_error(retval); } |
From: <zw...@ma...> - 2009-06-08 12:56:31
|
Author: zwelch Date: 2009-06-08 12:56:25 +0200 (Mon, 08 Jun 2009) New Revision: 2119 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_plain_ir_scan: - Use jtag_set_error instead of accessing jtag_error directly. - Wrap function arguments to fit everything in 80 columns. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:56:18 UTC (rev 2118) +++ trunk/src/jtag/jtag.c 2009-06-08 10:56:25 UTC (rev 2119) @@ -474,15 +474,14 @@ * This function assumes that the caller handles extra fields for bypassed TAPs * */ -void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields, + tap_state_t state) { - int retval; - jtag_prelude(state); - retval=interface_jtag_add_plain_ir_scan(in_num_fields, in_fields, state); - if (retval!=ERROR_OK) - jtag_error=retval; + int retval = interface_jtag_add_plain_ir_scan( + in_num_fields, in_fields, state); + jtag_set_error(retval); } void jtag_add_callback(jtag_callback1_t f, u8 *in) |
From: <zw...@ma...> - 2009-06-08 12:56:22
|
Author: zwelch Date: 2009-06-08 12:56:18 +0200 (Mon, 08 Jun 2009) New Revision: 2118 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_add_ir_scan_noverify: - Use jtag_set_error instead of accessing jtag_error directly. - Wrap and rename function arguments to fit everything in 80 columns. - Move retval variable to location of first use. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:56:07 UTC (rev 2117) +++ trunk/src/jtag/jtag.c 2009-06-08 10:56:18 UTC (rev 2118) @@ -428,15 +428,13 @@ interface_jtag_alloc_in_value32(field); } -void jtag_add_ir_scan_noverify(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +void jtag_add_ir_scan_noverify(int in_count, const scan_field_t *in_fields, + tap_state_t state) { - int retval; jtag_prelude(state); - retval=interface_jtag_add_ir_scan(in_num_fields, in_fields, state); - if (retval!=ERROR_OK) - jtag_error=retval; - + int retval = interface_jtag_add_ir_scan(in_count, in_fields, state); + jtag_set_error(retval); } |
From: <zw...@ma...> - 2009-06-08 12:56:12
|
Author: zwelch Date: 2009-06-08 12:56:07 +0200 (Mon, 08 Jun 2009) New Revision: 2117 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Simplify jtag_execute_queue: - Add static inline jtag_error_clear helper to return and clear jtag_error. - Use new helper to shrink body of function to two lines. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:55:54 UTC (rev 2116) +++ trunk/src/jtag/jtag.c 2009-06-08 10:56:07 UTC (rev 2117) @@ -914,11 +914,8 @@ int jtag_execute_queue(void) { - int retval; jtag_execute_queue_noclear(); - retval=jtag_error; - jtag_error=ERROR_OK; - return retval; + return jtag_error_clear(); } static int jtag_reset_callback(enum jtag_event event, void *priv) Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-08 10:55:54 UTC (rev 2116) +++ trunk/src/jtag/jtag.h 2009-06-08 10:56:07 UTC (rev 2117) @@ -561,8 +561,17 @@ jtag_error=error; } +/** + * Resets jtag_error to ERROR_OK, returning its previous value. + * @returns The previous value of @c jtag_error. + */ +static inline int jtag_error_clear(void) +{ + int temp = jtag_error; + jtag_error = ERROR_OK; + return temp; +} - /* can be implemented by hw+sw */ extern int jtag_power_dropout(int* dropout); extern int jtag_srst_asserted(int* srst_asserted); |
From: <zw...@ma...> - 2009-06-08 12:56:04
|
Author: zwelch Date: 2009-06-08 12:55:54 +0200 (Mon, 08 Jun 2009) New Revision: 2116 Modified: trunk/src/jtag/jtag.c Log: Simplify jtag_execute_queue_noclear: - Replace jtag_error logic with equivalent call to jtag_set_error. - Remove superfluous comment and temporary return variable. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:55:44 UTC (rev 2115) +++ trunk/src/jtag/jtag.c 2009-06-08 10:55:54 UTC (rev 2116) @@ -903,17 +903,8 @@ void jtag_execute_queue_noclear(void) { - /* each flush can take as much as 1-2ms on high bandwidth low latency interfaces. - * E.g. a JTAG over TCP/IP or USB.... - */ jtag_flush_queue_count++; - - int retval=interface_jtag_execute_queue(); - /* we keep the first error */ - if ((jtag_error==ERROR_OK)&&(retval!=ERROR_OK)) - { - jtag_error=retval; - } + jtag_set_error(interface_jtag_execute_queue()); } int jtag_get_flush_queue_count(void) |
From: <zw...@ma...> - 2009-06-08 12:55:48
|
Author: zwelch Date: 2009-06-08 12:55:44 +0200 (Mon, 08 Jun 2009) New Revision: 2115 Modified: trunk/src/jtag/jtag.c Log: Cleanup handle_runtest_command: - Make command argument require exactly one argument; do not allow extras. - Remove superfluous whitespace at end of function. - Wrap function arguments to fit in 80 columns. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:55:36 UTC (rev 2114) +++ trunk/src/jtag/jtag.c 2009-06-08 10:55:44 UTC (rev 2115) @@ -2234,18 +2234,16 @@ return ERROR_OK; } -static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_runtest_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - if (argc < 1) - { + if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; - } jtag_add_runtest(strtol(args[0], NULL, 0), jtag_get_end_state()); jtag_execute_queue(); return ERROR_OK; - } /* |
From: <zw...@ma...> - 2009-06-08 12:55:42
|
Author: zwelch Date: 2009-06-08 12:55:36 +0200 (Mon, 08 Jun 2009) New Revision: 2114 Modified: trunk/src/jtag/jtag.c Log: Clean up handle_jtag_reset_command: - Make command require exactly two arguments; do not allow more than two. - Move temporary variable declarations closer to point of first use. - Remove superfluous braces around single statments. - Wrap to 80 column width. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:55:24 UTC (rev 2113) +++ trunk/src/jtag/jtag.c 2009-06-08 10:55:36 UTC (rev 2114) @@ -2203,33 +2203,27 @@ } -static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - int trst = -1; - int srst = -1; - - if (argc < 2) - { + if (argc != 2) return ERROR_COMMAND_SYNTAX_ERROR; - } + int trst = -1; if (args[0][0] == '1') trst = 1; else if (args[0][0] == '0') trst = 0; else - { return ERROR_COMMAND_SYNTAX_ERROR; - } + int srst = -1; if (args[1][0] == '1') srst = 1; else if (args[1][0] == '0') srst = 0; else - { return ERROR_COMMAND_SYNTAX_ERROR; - } if (jtag_interface_init(cmd_ctx) != ERROR_OK) return ERROR_JTAG_INIT_FAILED; |
From: <zw...@ma...> - 2009-06-08 12:55:34
|
Author: zwelch Date: 2009-06-08 12:55:24 +0200 (Mon, 08 Jun 2009) New Revision: 2113 Modified: trunk/src/jtag/jtag.c Log: Extend handle_jtag_n{s,t}rst_delay_command routines: - Add support to display the reset delays too, like the other commands. - Always show the values, so users can see if they are being redundant. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:55:13 UTC (rev 2112) +++ trunk/src/jtag/jtag.c 2009-06-08 10:55:24 UTC (rev 2113) @@ -2115,24 +2115,22 @@ static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc != 1) - { - LOG_ERROR("jtag_nsrst_delay <ms> -- command requires one argument"); + if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; - } - jtag_set_nsrst_delay(strtoul(args[0], NULL, 0)); + if (argc == 1) + jtag_set_nsrst_delay(strtoul(args[0], NULL, 0)); + command_print(cmd_ctx, "jtag_nsrst_delay: %u", jtag_get_nsrst_delay()); return ERROR_OK; } static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc != 1) - { - LOG_ERROR("jtag_ntrst_delay <ms> -- command requires one argument"); + if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; - } - jtag_set_ntrst_delay(strtoul(args[0], NULL, 0)); + if (argc == 1) + jtag_set_ntrst_delay(strtoul(args[0], NULL, 0)); + command_print(cmd_ctx, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay()); return ERROR_OK; } |
From: <zw...@ma...> - 2009-06-08 12:55:20
|
Author: zwelch Date: 2009-06-08 12:55:13 +0200 (Mon, 08 Jun 2009) New Revision: 2112 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Add accessors to retrieve values of jtag_n{s,t}rst_delay variables. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:54:52 UTC (rev 2111) +++ trunk/src/jtag/jtag.c 2009-06-08 10:55:13 UTC (rev 2112) @@ -2709,9 +2709,15 @@ { jtag_nsrst_delay = delay; } +unsigned jtag_get_nsrst_delay(void) +{ + return jtag_nsrst_delay; +} void jtag_set_ntrst_delay(unsigned delay) { jtag_ntrst_delay = delay; } - - +unsigned jtag_get_ntrst_delay(void) +{ + return jtag_ntrst_delay; +} Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-08 10:54:52 UTC (rev 2111) +++ trunk/src/jtag/jtag.h 2009-06-08 10:55:13 UTC (rev 2112) @@ -644,10 +644,16 @@ /// @returns the number of times the scan queue has been flushed int jtag_get_flush_queue_count(void); + void jtag_set_nsrst_delay(unsigned delay); +unsigned jtag_get_nsrst_delay(void); + void jtag_set_ntrst_delay(unsigned delay); +unsigned jtag_get_ntrst_delay(void); + void jtag_set_speed_khz(unsigned speed); unsigned jtag_get_speed_khz(void); + void jtag_set_verify(bool enable); bool jtag_will_verify(void); |
From: <zw...@ma...> - 2009-06-08 12:55:11
|
Author: zwelch Date: 2009-06-08 12:54:52 +0200 (Mon, 08 Jun 2009) New Revision: 2111 Modified: trunk/src/jtag/jtag.c Log: Update JTAG reset delay command handlers: - Fixes for error handling: - Return a syntax error instead of calling exit(-1). - Return error when more than one argument is provided too. - Remove useless braces and indent after the if/return statements. - Wrap function arguments to fit in 80 columns. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:54:41 UTC (rev 2110) +++ trunk/src/jtag/jtag.c 2009-06-08 10:54:52 UTC (rev 2111) @@ -2112,33 +2112,27 @@ return ERROR_OK; } -static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - if (argc < 1) + if (argc != 1) { - LOG_ERROR("jtag_nsrst_delay <ms> command takes one required argument"); - exit(-1); + LOG_ERROR("jtag_nsrst_delay <ms> -- command requires one argument"); + return ERROR_COMMAND_SYNTAX_ERROR; } - else - { - jtag_set_nsrst_delay(strtoul(args[0], NULL, 0)); - } - + jtag_set_nsrst_delay(strtoul(args[0], NULL, 0)); return ERROR_OK; } -static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - if (argc < 1) + if (argc != 1) { - LOG_ERROR("jtag_ntrst_delay <ms> command takes one required argument"); - exit(-1); + LOG_ERROR("jtag_ntrst_delay <ms> -- command requires one argument"); + return ERROR_COMMAND_SYNTAX_ERROR; } - else - { - jtag_set_ntrst_delay(strtoul(args[0], NULL, 0)); - } - + jtag_set_ntrst_delay(strtoul(args[0], NULL, 0)); return ERROR_OK; } |
From: <zw...@ma...> - 2009-06-08 12:54:49
|
Author: zwelch Date: 2009-06-08 12:54:41 +0200 (Mon, 08 Jun 2009) New Revision: 2110 Modified: trunk/src/jtag/jtag.c Log: Cleanup the handle_jtag_khz_command routine: - Separate retval assignments from logical tests. - Simplify logical tests. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-06-08 10:54:06 UTC (rev 2109) +++ trunk/src/jtag/jtag.c 2009-06-08 10:54:41 UTC (rev 2110) @@ -2167,41 +2167,39 @@ static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - int retval=ERROR_OK; - LOG_DEBUG("handle jtag khz"); + if (argc > 1) + return ERROR_COMMAND_SYNTAX_ERROR; + int retval = ERROR_OK; int cur_speed = 0; - if(argc == 1) + if (argc == 1) { + LOG_DEBUG("handle jtag khz"); + jtag_set_speed_khz(strtoul(args[0], NULL, 0)); if (jtag != NULL) { LOG_DEBUG("have interface set up"); int speed_div1; - if ((retval=jtag->khz(jtag_get_speed_khz(), &speed_div1))!=ERROR_OK) + retval = jtag->khz(jtag_get_speed_khz(), &speed_div1); + if (ERROR_OK != retval) { jtag_set_speed_khz(0); return retval; } - cur_speed = jtag_speed = speed_div1; - retval=jtag->speed(cur_speed); - } else - { - hasKHz = true; + retval = jtag->speed(cur_speed); } - } else if (argc==0) - { - } else - { - return ERROR_COMMAND_SYNTAX_ERROR; + else + hasKHz = true; } - cur_speed = jtag_get_speed_khz(); - if (jtag!=NULL) + cur_speed = jtag_get_speed_khz(); + if (jtag != NULL) { - if ((retval=jtag->speed_div(jtag_speed, &cur_speed))!=ERROR_OK) + retval = jtag->speed_div(jtag_speed, &cur_speed); + if (ERROR_OK != retval) return retval; } |