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
(54) |
Sep
(47) |
Oct
(15) |
Nov
(47) |
Dec
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-22 12:46:39
|
Author: oharboe
Date: 2009-04-22 12:46:37 +0200 (Wed, 22 Apr 2009)
New Revision: 1506
Modified:
trunk/src/jtag/jtag.h
Log:
Zach Welch <zw...@su...> reorder enum tap_state
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-04-22 10:09:15 UTC (rev 1505)
+++ trunk/src/jtag/jtag.h 2009-04-22 10:46:37 UTC (rev 1506)
@@ -41,20 +41,37 @@
#endif
-/* 16 Tap States, from page 21 of ASSET InterTech, Inc.'s svf.pdf
+/*
+ * Tap states from ARM7TDMI-S Technical reference manual.
+ * Also, validated against several other ARM core technical manuals.
+ *
+ * N.B. tap_get_tms_path() was changed to reflect this corrected
+ * numbering and ordering of the TAP states.
*/
-enum tap_state {
- TAP_RESET = 0, TAP_IDLE = 8,
- TAP_DRSELECT = 1, TAP_DRCAPTURE = 2, TAP_DRSHIFT = 3, TAP_DREXIT1 = 4,
- TAP_DRPAUSE = 5, TAP_DREXIT2 = 6, TAP_DRUPDATE = 7,
- TAP_IRSELECT = 9, TAP_IRCAPTURE = 10, TAP_IRSHIFT = 11, TAP_IREXIT1 = 12,
- TAP_IRPAUSE = 13, TAP_IREXIT2 = 14, TAP_IRUPDATE = 15,
+typedef enum tap_state
+{
+ TAP_DREXIT2 = 0x0,
+ TAP_DREXIT1 = 0x1,
+ TAP_DRSHIFT = 0x2,
+ TAP_DRPAUSE = 0x3,
+ TAP_IRSELECT = 0x4,
+ TAP_DRUPDATE = 0x5,
+ TAP_DRCAPTURE = 0x6,
+ TAP_DRSELECT = 0x7,
+ TAP_IREXIT2 = 0x8,
+ TAP_IREXIT1 = 0x9,
+ TAP_IRSHIFT = 0xa,
+ TAP_IRPAUSE = 0xb,
+ TAP_IDLE = 0xc,
+ TAP_IRUPDATE = 0xd,
+ TAP_IRCAPTURE = 0xe,
+ TAP_RESET = 0x0f,
- TAP_NUM_STATES = 16, TAP_INVALID = -1,
-};
+ TAP_NUM_STATES = 0x10,
-typedef enum tap_state tap_state_t;
-
+ TAP_INVALID = -1,
+} tap_state_t;
+
typedef struct tap_transition_s
{
tap_state_t high;
|
|
From: <ml...@ma...> - 2009-04-22 12:09:29
|
Author: mlu
Date: 2009-04-22 12:09:15 +0200 (Wed, 22 Apr 2009)
New Revision: 1505
Modified:
trunk/src/helper/binarybuffer.c
Log:
Fix str_to_buf problem, thanks Andy Chenee
Modified: trunk/src/helper/binarybuffer.c
===================================================================
--- trunk/src/helper/binarybuffer.c 2009-04-22 07:34:47 UTC (rev 1504)
+++ trunk/src/helper/binarybuffer.c 2009-04-22 10:09:15 UTC (rev 1505)
@@ -244,7 +244,7 @@
int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix)
{
char *charbuf;
- char tmp;
+ u32 tmp;
float factor;
u8 *b256_buf;
int b256_len;
@@ -303,7 +303,7 @@
tmp = (tmp - 'A' + 10);
else continue; /* skip characters other than [0-9,a-f,A-F] */
- if (tmp >= radix)
+ if (tmp >= (u32)radix)
continue; /* skip digits invalid for the current radix */
for (j = 0; j < b256_len; j++)
|
|
From: <kc...@ma...> - 2009-04-22 09:34:54
|
Author: kc8apf Date: 2009-04-22 09:34:47 +0200 (Wed, 22 Apr 2009) New Revision: 1504 Modified: trunk/src/jtag/jlink.c Log: Shrink JLink buffer sizes to specified 2KB courtesy of Jeff Williams <je...@ga...> and Zach Welch <zw...@su...> Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-22 07:32:09 UTC (rev 1503) +++ trunk/src/jtag/jlink.c 2009-04-22 07:34:47 UTC (rev 1504) @@ -42,8 +42,9 @@ #define JLINK_USB_TIMEOUT 1000 -#define JLINK_IN_BUFFER_SIZE 8192 -#define JLINK_OUT_BUFFER_SIZE 8192 +// See Section 1.3.2 of the Segger JLink USB protocol manual +#define JLINK_IN_BUFFER_SIZE 2048 +#define JLINK_OUT_BUFFER_SIZE 2048 #define JLINK_EMU_RESULT_BUFFER_SIZE 64 /* Global USB buffers */ |
|
From: <kc...@ma...> - 2009-04-22 09:32:12
|
Author: kc8apf
Date: 2009-04-22 09:32:09 +0200 (Wed, 22 Apr 2009)
New Revision: 1503
Modified:
trunk/configure.in
Log:
Add D2XX support for OS X courtesy of Piotr Esden-Tempski <pi...@es...>
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-04-22 07:31:16 UTC (rev 1502)
+++ trunk/configure.in 2009-04-22 07:32:09 UTC (rev 1503)
@@ -28,6 +28,7 @@
is_cygwin=no
is_mingw=no
is_win32=no
+is_darwin=no
build_release=yes
AC_ARG_ENABLE(release,
@@ -110,10 +111,11 @@
)
#========================================
-# FTD2XXX support comes in 3 forms.
+# FTD2XXX support comes in 4 forms.
# (1) win32 - via a zip file
# (2) linux - via a tar file
# (3) linux/cygwin/mingw - via libftdi
+# (4) darwin - installed under /usr/local
#
# In case (1) and (2) we need to know where the package was unpacked.
@@ -350,6 +352,7 @@
fi
AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
+ AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
;;
*-mingw*)
is_mingw=yes
@@ -359,11 +362,22 @@
AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
+ AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
;;
+ *darwin*)
+ is_darwin=yes
+
+ parport_use_giveio=no
+
+ AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
+ AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
+ AC_DEFINE(IS_DARWIN, 1, [1 if building for Darwin.])
+ ;;
*)
parport_use_giveio=no
AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
+ AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
;;
esac
@@ -559,16 +573,39 @@
fi
fi
-if test $is_win32 = no; then
+if test $is_darwin = yes ; then
+if test "${with_ftd2xx_win32_zipdir+set}" = set
+then
+ AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
+fi
+if test "${with_ftd2xx_linux_tardir+set}" = set
+then
+ AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
+fi
+if test $build_ft2232_ftd2xx = yes ; then
+ AC_MSG_CHECKING([for libftd2xx.a (darwin)])
+
+ if test ! -f /usr/local/include/ftd2xx.h ; then
+ AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
+ fi
+
+ CFLAGS="$CFLAGS -I/usr/local/include"
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+ LIBS="$LIBS -lftd2xx"
+ AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
+fi
+fi
+
+if test $is_win32 = no && test $is_darwin = no ; then
+
if test "${with_ftd2xx_win32_zipdir+set}" = set
then
AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
fi
if test $build_ft2232_ftd2xx = yes ; then
- # Must be linux -
- # Cause FTDICHIP does not supply a MAC-OS version
+ # Must be linux
if test $host_os != linux-gnu && test $host_os != linux ; then
AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
fi
@@ -728,6 +765,7 @@
AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
+AM_CONDITIONAL(IS_DARWIN, test $is_darwin = yes)
AM_CONDITIONAL(BITQ, test $build_bitq = yes)
AC_LANG_C
|
|
From: <kc...@ma...> - 2009-04-22 09:31:22
|
Author: kc8apf
Date: 2009-04-22 09:31:16 +0200 (Wed, 22 Apr 2009)
New Revision: 1502
Modified:
trunk/src/target/target.c
Log:
Fix use of wrong format conversion for size_t (%zu instead of %u)
Modified: trunk/src/target/target.c
===================================================================
--- trunk/src/target/target.c 2009-04-22 06:56:59 UTC (rev 1501)
+++ trunk/src/target/target.c 2009-04-22 07:31:16 UTC (rev 1502)
@@ -2495,7 +2495,7 @@
{
size_t written = fwrite(data, len, 1, f);
if (written != len)
- LOG_ERROR("failed to write %u bytes: %s", len, strerror(errno));
+ LOG_ERROR("failed to write %zu bytes: %s", len, strerror(errno));
}
static void writeLong(FILE *f, int l)
|
|
From: <kc...@ma...> - 2009-04-22 08:57:02
|
Author: kc8apf
Date: 2009-04-22 08:56:59 +0200 (Wed, 22 Apr 2009)
New Revision: 1501
Modified:
trunk/src/jtag/jtag.c
Log:
fix jtag run/idle state name courtesy of Jeff Williams <je...@ga...> and Zach Welch <zw...@su...>
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-04-22 06:55:34 UTC (rev 1500)
+++ trunk/src/jtag/jtag.c 2009-04-22 06:56:59 UTC (rev 1501)
@@ -3248,7 +3248,7 @@
switch( state )
{
case TAP_RESET: ret = "RESET"; break;
- case TAP_IDLE: ret = "IDLE"; break;
+ case TAP_IDLE: ret = "RUN/IDLE"; break;
case TAP_DRSELECT: ret = "DRSELECT"; break;
case TAP_DRCAPTURE: ret = "DRCAPTURE"; break;
case TAP_DRSHIFT: ret = "DRSHIFT"; break;
|
|
From: <kc...@ma...> - 2009-04-22 08:55:38
|
Author: kc8apf
Date: 2009-04-22 08:55:34 +0200 (Wed, 22 Apr 2009)
New Revision: 1500
Modified:
trunk/src/jtag/jlink.c
Log:
refactor jlink_execute_queue courtesy of Zach Welch <zw...@su...>
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2009-04-22 06:16:53 UTC (rev 1499)
+++ trunk/src/jtag/jlink.c 2009-04-22 06:55:34 UTC (rev 1500)
@@ -130,95 +130,113 @@
.quit = jlink_quit
};
-static int jlink_execute_queue(void)
+static void jlink_execute_end_state(jtag_command_t *cmd)
{
- jtag_command_t *cmd = jtag_command_queue;
- int scan_size;
- enum scan_type type;
- u8 *buffer;
+ DEBUG_JTAG_IO("end_state: %i", cmd->cmd.end_state->end_state);
- while (cmd != NULL)
- {
- switch (cmd->type)
- {
- case JTAG_END_STATE:
- DEBUG_JTAG_IO("end_state: %i", cmd->cmd.end_state->end_state);
+ if (cmd->cmd.end_state->end_state != TAP_INVALID)
+ jlink_end_state(cmd->cmd.end_state->end_state);
+}
- if (cmd->cmd.end_state->end_state != TAP_INVALID)
- {
- jlink_end_state(cmd->cmd.end_state->end_state);
- }
- break;
+static void jlink_execute_runtest(jtag_command_t *cmd)
+{
+ DEBUG_JTAG_IO("runtest %i cycles, end in %i",
+ cmd->cmd.runtest->num_cycles,
+ cmd->cmd.runtest->end_state);
- case JTAG_RUNTEST:
- DEBUG_JTAG_IO( "runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \
- cmd->cmd.runtest->end_state);
+ if (cmd->cmd.runtest->end_state != TAP_INVALID)
+ jlink_end_state(cmd->cmd.runtest->end_state);
- if (cmd->cmd.runtest->end_state != TAP_INVALID)
- {
- jlink_end_state(cmd->cmd.runtest->end_state);
- }
- jlink_runtest(cmd->cmd.runtest->num_cycles);
- break;
+ jlink_runtest(cmd->cmd.runtest->num_cycles);
+}
- case JTAG_STATEMOVE:
- DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
+static void jlink_execute_statemove(jtag_command_t *cmd)
+{
+ DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
- if (cmd->cmd.statemove->end_state != TAP_INVALID)
- {
- jlink_end_state(cmd->cmd.statemove->end_state);
- }
- jlink_state_move();
- break;
+ if (cmd->cmd.statemove->end_state != TAP_INVALID)
+ {
+ jlink_end_state(cmd->cmd.statemove->end_state);
+ }
+ jlink_state_move();
+}
- case JTAG_PATHMOVE:
- DEBUG_JTAG_IO("pathmove: %i states, end in %i", \
- cmd->cmd.pathmove->num_states, \
- cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
+static void jlink_execute_pathmove(jtag_command_t *cmd)
+{
+ DEBUG_JTAG_IO("pathmove: %i states, end in %i",
+ cmd->cmd.pathmove->num_states,
+ cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
- jlink_path_move(cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path);
- break;
+ jlink_path_move(cmd->cmd.pathmove->num_states,
+ cmd->cmd.pathmove->path);
+}
- case JTAG_SCAN:
- DEBUG_JTAG_IO("scan end in %i", cmd->cmd.scan->end_state);
+static void jlink_execute_scan(jtag_command_t *cmd)
+{
+ int scan_size;
+ enum scan_type type;
+ u8 *buffer;
- if (cmd->cmd.scan->end_state != TAP_INVALID)
- {
- jlink_end_state(cmd->cmd.scan->end_state);
- }
+ DEBUG_JTAG_IO("scan end in %i", cmd->cmd.scan->end_state);
- scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
- DEBUG_JTAG_IO("scan input, length = %d", scan_size);
+ if (cmd->cmd.scan->end_state != TAP_INVALID)
+ jlink_end_state(cmd->cmd.scan->end_state);
+ scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
+ DEBUG_JTAG_IO("scan input, length = %d", scan_size);
+
#ifdef _DEBUG_USB_COMMS_
- jlink_debug_buffer(buffer, (scan_size + 7) / 8);
+ jlink_debug_buffer(buffer, (scan_size + 7) / 8);
#endif
- type = jtag_scan_type(cmd->cmd.scan);
- jlink_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size, cmd->cmd.scan);
- break;
+ type = jtag_scan_type(cmd->cmd.scan);
+ jlink_scan(cmd->cmd.scan->ir_scan,
+ type, buffer, scan_size, cmd->cmd.scan);
+}
- case JTAG_RESET:
- DEBUG_JTAG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
+static void jlink_execute_reset(jtag_command_t *cmd)
+{
+ DEBUG_JTAG_IO("reset trst: %i srst %i",
+ cmd->cmd.reset->trst, cmd->cmd.reset->srst);
- jlink_tap_execute();
+ jlink_tap_execute();
- if (cmd->cmd.reset->trst == 1)
- {
- tap_set_state(TAP_RESET);
- }
- jlink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
- break;
+ if (cmd->cmd.reset->trst == 1)
+ tap_set_state(TAP_RESET);
- case JTAG_SLEEP:
- DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
- jlink_tap_execute();
- jtag_sleep(cmd->cmd.sleep->us);
- break;
+ jlink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
+}
- default:
- LOG_ERROR("BUG: unknown JTAG command type encountered");
- exit(-1);
- }
+static void jlink_execute_sleep(jtag_command_t *cmd)
+{
+ DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
+ jlink_tap_execute();
+ jtag_sleep(cmd->cmd.sleep->us);
+}
+
+static void jlink_execute_command(jtag_command_t *cmd)
+{
+ switch (cmd->type)
+ {
+ case JTAG_END_STATE: jlink_execute_end_state(cmd); break;
+ case JTAG_RUNTEST: jlink_execute_runtest(cmd); break;
+ case JTAG_STATEMOVE: jlink_execute_statemove(cmd); break;
+ case JTAG_PATHMOVE: jlink_execute_pathmove(cmd); break;
+ case JTAG_SCAN: jlink_execute_scan(cmd); break;
+ case JTAG_RESET: jlink_execute_reset(cmd); break;
+ case JTAG_SLEEP: jlink_execute_sleep(cmd); break;
+ default:
+ LOG_ERROR("BUG: unknown JTAG command type encountered");
+ exit(-1);
+ }
+}
+
+static int jlink_execute_queue(void)
+{
+ jtag_command_t *cmd = jtag_command_queue;
+
+ while (cmd != NULL)
+ {
+ jlink_execute_command(cmd);
cmd = cmd->next;
}
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-22 08:16:59
|
Author: oharboe Date: 2009-04-22 08:16:53 +0200 (Wed, 22 Apr 2009) New Revision: 1499 Removed: trunk/src/target/interface/luminary-libftdi.cfg trunk/src/target/interface/olimex-jtag-tiny-a.cfg Modified: trunk/src/target/interface/calao-usb-a9260-c01.cfg trunk/src/target/interface/flyswatter.cfg trunk/src/target/interface/jtagkey-tiny.cfg trunk/src/target/interface/luminary.cfg trunk/src/target/interface/olimex-arm-usb-ocd.cfg trunk/src/target/interface/olimex-jtag-tiny.cfg trunk/src/target/interface/openocd-usb.cfg trunk/src/target/interface/sheevaplug.cfg Log: Uwe Hermann <uw...@he...> Drop non-A variants of ft2232 targets Modified: trunk/src/target/interface/calao-usb-a9260-c01.cfg =================================================================== --- trunk/src/target/interface/calao-usb-a9260-c01.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/calao-usb-a9260-c01.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -6,7 +6,7 @@ interface ft2232 ft2232_layout jtagkey -ft2232_device_desc "USB-A9260" +ft2232_device_desc "USB-A9260 A" ft2232_vid_pid 0x0403 0x6010 script interface/calao-usb-a9260.cfg script target/at91sam9260minimal.cfg Modified: trunk/src/target/interface/flyswatter.cfg =================================================================== --- trunk/src/target/interface/flyswatter.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/flyswatter.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -5,7 +5,7 @@ # interface ft2232 -ft2232_device_desc "Flyswatter" +ft2232_device_desc "Flyswatter A" ft2232_layout "flyswatter" ft2232_vid_pid 0x0403 0x6010 jtag_speed 1 Modified: trunk/src/target/interface/jtagkey-tiny.cfg =================================================================== --- trunk/src/target/interface/jtagkey-tiny.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/jtagkey-tiny.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -4,8 +4,6 @@ # http://www.amontec.com/jtagkey-tiny.shtml # -interface ft2232 -ft2232_device_desc "Amontec JTAGkey" -ft2232_layout jtagkey -ft2232_vid_pid 0x0403 0xcff8 +# The JTAGkey-tiny uses exactly the same config as the JTAGkey. +source [find interface/jtagkey.cfg] Deleted: trunk/src/target/interface/luminary-libftdi.cfg =================================================================== --- trunk/src/target/interface/luminary-libftdi.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/luminary-libftdi.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -1,11 +0,0 @@ -# -# Luminary Micro Stellaris LM3S811 Evaluation Kit -# -# http://www.luminarymicro.com/products/stellaris_811_evaluation_kits.html -# - -interface ft2232 -ft2232_device_desc "Stellaris Evaluation Board" -ft2232_layout evb_lm3s811 -ft2232_vid_pid 0x0403 0xbcd9 - Modified: trunk/src/target/interface/luminary.cfg =================================================================== --- trunk/src/target/interface/luminary.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/luminary.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -1,5 +1,5 @@ # -# Luminary Micro LM3S811 Evaluation Kit(s) +# Luminary Micro Stellaris LM3S811 Evaluation Kit # # http://www.luminarymicro.com/products/stellaris_811_evaluation_kits.html # @@ -7,4 +7,5 @@ interface ft2232 ft2232_device_desc "Stellaris Evaluation Board A" ft2232_layout evb_lm3s811 +ft2232_vid_pid 0x0403 0xbcd9 Modified: trunk/src/target/interface/olimex-arm-usb-ocd.cfg =================================================================== --- trunk/src/target/interface/olimex-arm-usb-ocd.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/olimex-arm-usb-ocd.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -5,7 +5,7 @@ # interface ft2232 -ft2232_device_desc "Olimex OpenOCD JTAG" +ft2232_device_desc "Olimex OpenOCD JTAG A" ft2232_layout olimex-jtag ft2232_vid_pid 0x15ba 0x0003 Deleted: trunk/src/target/interface/olimex-jtag-tiny-a.cfg =================================================================== --- trunk/src/target/interface/olimex-jtag-tiny-a.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/olimex-jtag-tiny-a.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -1,11 +0,0 @@ -# -# Olimex ARM-USB-TINY -# -# http://www.olimex.com/dev/arm-usb-tiny.html -# - -interface ft2232 -ft2232_device_desc "Olimex OpenOCD JTAG TINY A" -ft2232_layout olimex-jtag -ft2232_vid_pid 0x15ba 0x0004 - Modified: trunk/src/target/interface/olimex-jtag-tiny.cfg =================================================================== --- trunk/src/target/interface/olimex-jtag-tiny.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/olimex-jtag-tiny.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -4,12 +4,8 @@ # http://www.olimex.com/dev/arm-usb-tiny.html # -# TODO: FIXME -# Linux USB tends to see the device description without the 'A' as in target/olimex-jtag-tiny.cfg, -# but Windows still needs the 'A'. This is a replacement for Linux users. - interface ft2232 -ft2232_device_desc "Olimex OpenOCD JTAG TINY" +ft2232_device_desc "Olimex OpenOCD JTAG TINY A" ft2232_layout olimex-jtag ft2232_vid_pid 0x15ba 0x0004 Modified: trunk/src/target/interface/openocd-usb.cfg =================================================================== --- trunk/src/target/interface/openocd-usb.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/openocd-usb.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -6,7 +6,7 @@ interface ft2232 ft2232_vid_pid 0x0403 0x6010 -ft2232_device_desc "Dual RS232" +ft2232_device_desc "Dual RS232 A" ft2232_layout "oocdlink" ft2232_latency 2 # 6/(1+n) Mhz TCLK Modified: trunk/src/target/interface/sheevaplug.cfg =================================================================== --- trunk/src/target/interface/sheevaplug.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/sheevaplug.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -7,5 +7,6 @@ interface ft2232 ft2232_layout sheevaplug ft2232_vid_pid 0x0403 0x6010 +# TODO: Add ft2232_device_desc? jtag_khz 3000 |
|
From: <oh...@ma...> - 2009-04-21 17:39:51
|
Author: oharboe
Date: 2009-04-21 17:39:49 +0200 (Tue, 21 Apr 2009)
New Revision: 1498
Modified:
trunk/src/jtag/jlink.c
Log:
Zach Welch <zw...@su...> refactor
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2009-04-21 12:10:29 UTC (rev 1497)
+++ trunk/src/jtag/jlink.c 2009-04-21 15:39:49 UTC (rev 1498)
@@ -230,31 +230,26 @@
{
int result;
- if (speed <= JLINK_MAX_SPEED)
+ if (speed > JLINK_MAX_SPEED)
{
- /* check for RTCK setting */
- if (speed == 0)
- speed = -1;
+ LOG_INFO("Ignoring speed request: %dkHz exceeds %dkHz maximum",
+ speed, JLINK_MAX_SPEED);
+ return ERROR_OK;
+ }
- usb_out_buffer[0] = EMU_CMD_SET_SPEED;
- usb_out_buffer[1] = (speed >> 0) & 0xff;
- usb_out_buffer[2] = (speed >> 8) & 0xff;
+ /* check for RTCK setting */
+ if (speed == 0)
+ speed = -1;
- result = jlink_usb_write(jlink_jtag_handle, 3);
+ usb_out_buffer[0] = EMU_CMD_SET_SPEED;
+ usb_out_buffer[1] = (speed >> 0) & 0xff;
+ usb_out_buffer[2] = (speed >> 8) & 0xff;
- if (result == 3)
- {
- return ERROR_OK;
- }
- else
- {
- LOG_ERROR("J-Link setting speed failed (%d)", result);
- return ERROR_JTAG_DEVICE_ERROR;
- }
- }
- else
+ result = jlink_usb_write(jlink_jtag_handle, 3);
+ if (result != 3)
{
- LOG_INFO("Requested speed %dkHz exceeds maximum of %dkHz, ignored", speed, JLINK_MAX_SPEED);
+ LOG_ERROR("J-Link setting speed failed (%d)", result);
+ return ERROR_JTAG_DEVICE_ERROR;
}
return ERROR_OK;
@@ -485,53 +480,55 @@
int result;
jlink_simple_command(EMU_CMD_GET_STATE);
- result = jlink_usb_read(jlink_jtag_handle, 8);
- if (result == 8)
+ result = jlink_usb_read(jlink_jtag_handle, 8);
+ if (result != 8)
{
- int vref = usb_in_buffer[0] + (usb_in_buffer[1] << 8);
- LOG_INFO("Vref = %d.%d TCK = %d TDI = %d TDO = %d TMS = %d SRST = %d TRST = %d\n", \
- vref / 1000, vref % 1000, \
- usb_in_buffer[2], usb_in_buffer[3], usb_in_buffer[4], \
- usb_in_buffer[5], usb_in_buffer[6], usb_in_buffer[7]);
-
- if (vref < 1500)
- {
- LOG_ERROR("Vref too low. Check Target Power\n");
- }
- }
- else
- {
LOG_ERROR("J-Link command EMU_CMD_GET_STATE failed (%d)\n", result);
+ return ERROR_JTAG_DEVICE_ERROR;
}
+ int vref = usb_in_buffer[0] + (usb_in_buffer[1] << 8);
+ LOG_INFO("Vref = %d.%d TCK = %d TDI = %d TDO = %d TMS = %d SRST = %d TRST = %d\n", \
+ vref / 1000, vref % 1000, \
+ usb_in_buffer[2], usb_in_buffer[3], usb_in_buffer[4], \
+ usb_in_buffer[5], usb_in_buffer[6], usb_in_buffer[7]);
+
+ if (vref < 1500)
+ LOG_ERROR("Vref too low. Check Target Power\n");
+
return ERROR_OK;
}
static int jlink_get_version_info(void)
{
int result;
- int len = 0;
+ int len;
/* query hardware version */
jlink_simple_command(EMU_CMD_VERSION);
- result = jlink_usb_read(jlink_jtag_handle, 2);
- if (result == 2)
+ result = jlink_usb_read(jlink_jtag_handle, 2);
+ if (2 != result)
{
- len = buf_get_u32(usb_in_buffer, 0, 16);
- result = jlink_usb_read(jlink_jtag_handle, len);
+ LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n",
+ result);
+ return ERROR_JTAG_DEVICE_ERROR;
+ }
- if (result == len)
- {
- usb_in_buffer[result] = 0;
- LOG_INFO("%s", (char *)usb_in_buffer);
- return ERROR_OK;
- }
+ len = buf_get_u32(usb_in_buffer, 0, 16);
+ result = jlink_usb_read(jlink_jtag_handle, len);
+ if (result != len)
+ {
+ LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n",
+ result);
+ return ERROR_JTAG_DEVICE_ERROR;
}
- LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", result);
- return ERROR_JTAG_DEVICE_ERROR;
+ usb_in_buffer[result] = 0;
+ LOG_INFO("%s", (char *)usb_in_buffer);
+
+ return ERROR_OK;
}
static int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
@@ -551,7 +548,7 @@
/* 2048 is the max value we can use here */
#define JLINK_TAP_BUFFER_SIZE 2048
-static int tap_length;
+static unsigned tap_length;
static u8 tms_buffer[JLINK_TAP_BUFFER_SIZE];
static u8 tdi_buffer[JLINK_TAP_BUFFER_SIZE];
static u8 tdo_buffer[JLINK_TAP_BUFFER_SIZE];
@@ -593,40 +590,32 @@
last_tms = tms;
int index = tap_length / 8;
- if (index < JLINK_TAP_BUFFER_SIZE)
+ if (index >= JLINK_TAP_BUFFER_SIZE)
{
- int bit_index = tap_length % 8;
- u8 bit = 1 << bit_index;
+ LOG_ERROR("jlink_tap_append_step: overflow");
+ exit(-1);
+ }
- if (tms)
- {
- tms_buffer[index] |= bit;
- }
- else
- {
- tms_buffer[index] &= ~bit;
- }
+ int bit_index = tap_length % 8;
+ u8 bit = 1 << bit_index;
- if (tdi)
- {
- tdi_buffer[index] |= bit;
- }
- else
- {
- tdi_buffer[index] &= ~bit;
- }
+ if (tms)
+ tms_buffer[index] |= bit;
+ else
+ tms_buffer[index] &= ~bit;
- tap_length++;
- }
+ if (tdi)
+ tdi_buffer[index] |= bit;
else
- {
- LOG_ERROR("jlink_tap_append_step, overflow");
- }
+ tdi_buffer[index] &= ~bit;
+
+ tap_length++;
}
static void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command)
{
- pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
+ pending_scan_result_t *pending_scan_result =
+ &pending_scan_results_buffer[pending_scan_results_length];
int i;
pending_scan_result->first = tap_length;
@@ -636,7 +625,9 @@
for (i = 0; i < length; i++)
{
- jlink_tap_append_step((i < length-1 ? 0 : 1), (buffer[i/8] >> (i%8)) & 1);
+ int tms = i < length - 1 ? 0 : 1;
+ int tdi = buffer[i / 8] & (1 << (i % 8));
+ jlink_tap_append_step(tms, tdi);
}
pending_scan_results_length++;
}
@@ -651,82 +642,79 @@
int i;
int result;
- if (tap_length > 0)
+ if (!tap_length)
+ return ERROR_OK;
+
+ /* Pad last byte so that tap_length is divisible by 8 */
+ while (tap_length % 8 != 0)
{
- /* Pad last byte so that tap_length is divisible by 8 */
- while (tap_length % 8 != 0)
- {
- /* More of the last TMS value keeps us in the same state,
- * analogous to free-running JTAG interfaces. */
- jlink_tap_append_step(last_tms, 0);
- }
+ /* More of the last TMS value keeps us in the same state,
+ * analogous to free-running JTAG interfaces. */
+ jlink_tap_append_step(last_tms, 0);
+ }
- byte_length = tap_length / 8;
+ byte_length = tap_length / 8;
- usb_out_buffer[0] = EMU_CMD_HW_JTAG3;
- usb_out_buffer[1] = 0;
- usb_out_buffer[2] = (tap_length >> 0) & 0xff;
- usb_out_buffer[3] = (tap_length >> 8) & 0xff;
+ usb_out_buffer[0] = EMU_CMD_HW_JTAG3;
+ usb_out_buffer[1] = 0;
+ usb_out_buffer[2] = (tap_length >> 0) & 0xff;
+ usb_out_buffer[3] = (tap_length >> 8) & 0xff;
- tms_offset = 4;
- for (i = 0; i < byte_length; i++)
- {
- usb_out_buffer[tms_offset + i] = tms_buffer[i];
- }
+ tms_offset = 4;
+ for (i = 0; i < byte_length; i++)
+ {
+ usb_out_buffer[tms_offset + i] = tms_buffer[i];
+ }
- tdi_offset = tms_offset + byte_length;
- for (i = 0; i < byte_length; i++)
- {
- usb_out_buffer[tdi_offset + i] = tdi_buffer[i];
- }
+ tdi_offset = tms_offset + byte_length;
+ for (i = 0; i < byte_length; i++)
+ {
+ usb_out_buffer[tdi_offset + i] = tdi_buffer[i];
+ }
- result = jlink_usb_message(jlink_jtag_handle, 4 + 2 * byte_length, byte_length);
+ result = jlink_usb_message(jlink_jtag_handle, 4 + 2 * byte_length, byte_length);
- if (result == byte_length)
- {
- for (i = 0; i < byte_length; i++)
- {
- tdo_buffer[i] = usb_in_buffer[i];
- }
+ if (result != byte_length)
+ {
+ LOG_ERROR("jlink_tap_execute, wrong result %d (expected %d)",
+ result, byte_length);
+ return ERROR_JTAG_QUEUE_FAILED;
+ }
- for (i = 0; i < pending_scan_results_length; i++)
- {
- pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i];
- u8 *buffer = pending_scan_result->buffer;
- int length = pending_scan_result->length;
- int first = pending_scan_result->first;
- scan_command_t *command = pending_scan_result->command;
+ for (i = 0; i < byte_length; i++)
+ tdo_buffer[i] = usb_in_buffer[i];
- /* Copy to buffer */
- buf_set_buf(tdo_buffer, first, buffer, 0, length);
+ for (i = 0; i < pending_scan_results_length; i++)
+ {
+ pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i];
+ u8 *buffer = pending_scan_result->buffer;
+ int length = pending_scan_result->length;
+ int first = pending_scan_result->first;
+ scan_command_t *command = pending_scan_result->command;
- DEBUG_JTAG_IO("pending scan result, length = %d", length);
+ /* Copy to buffer */
+ buf_set_buf(tdo_buffer, first, buffer, 0, length);
+ DEBUG_JTAG_IO("pending scan result, length = %d", length);
+
#ifdef _DEBUG_USB_COMMS_
- jlink_debug_buffer(buffer, byte_length);
+ jlink_debug_buffer(buffer, byte_length);
#endif
- if (jtag_read_buffer(buffer, command) != ERROR_OK)
- {
- jlink_tap_init();
- return ERROR_JTAG_QUEUE_FAILED;
- }
-
- if (pending_scan_result->buffer != NULL)
- {
- free(pending_scan_result->buffer);
- }
- }
- }
- else
+ if (jtag_read_buffer(buffer, command) != ERROR_OK)
{
- LOG_ERROR("jlink_tap_execute, wrong result %d, expected %d", result, byte_length);
+ jlink_tap_init();
return ERROR_JTAG_QUEUE_FAILED;
}
- jlink_tap_init();
+ if (pending_scan_result->buffer != NULL)
+ {
+ free(pending_scan_result->buffer);
+ }
}
+ jlink_tap_init();
+
return ERROR_OK;
}
@@ -792,59 +780,48 @@
int result2;
result = jlink_usb_write(jlink_jtag, out_length);
- if (result == out_length)
+ if (result != out_length)
{
- result = jlink_usb_read(jlink_jtag, in_length);
- if (result == in_length || result == in_length+1)
+ LOG_ERROR("usb_bulk_write failed (requested=%d, result=%d)",
+ out_length, result);
+ return ERROR_JTAG_DEVICE_ERROR;
+ }
+
+ result = jlink_usb_read(jlink_jtag, in_length);
+ if ((result != in_length) && (result != in_length + 1))
+ {
+ LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)",
+ in_length, result);
+ return ERROR_JTAG_DEVICE_ERROR;
+ }
+
+ if (result == in_length)
+ {
+ /* Must read the result from the EMU too */
+ result2 = jlink_usb_read_emu_result(jlink_jtag);
+ if (1 != result2)
{
- if (result == in_length)
- {
- /* Must read the result from the EMU too */
- result2 = jlink_usb_read_emu_result(jlink_jtag);
- if (1 == result2)
- {
- /* Check the result itself */
- if (0 == usb_emu_result_buffer[0])
- {
- return result;
- }
- else
- {
- LOG_ERROR("jlink_usb_read_emu_result (requested=0, result=%d)", usb_emu_result_buffer[0]);
- return -1;
- }
- }
- else
- {
- LOG_ERROR("jlink_usb_read_emu_result len (requested=1, result=%d)", result2);
- return -1;
- }
- }
- else
- {
- /* Check the result itself */
- if (0 == usb_in_buffer[result-1])
- {
- return result-1;
- }
- else
- {
- LOG_ERROR("jlink_usb_read_emu_result (requested=0, result=%d)", usb_in_buffer[result]);
- return -1;
- }
- }
+ LOG_ERROR("jlink_usb_read_emu_result failed "
+ "(requested=1, result=%d)", result2);
+ return ERROR_JTAG_DEVICE_ERROR;
}
- else
- {
- LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", in_length, result);
- return -1;
- }
+
+ /* Check the result itself */
+ result2 = usb_emu_result_buffer[0];
}
else
{
- LOG_ERROR("usb_bulk_write failed (requested=%d, result=%d)", out_length, result);
- return -1;
+ /* Save the result, then remove it from return value */
+ result2 = usb_in_buffer[result--];
}
+
+ if (result2)
+ {
+ LOG_ERROR("jlink_usb_message failed with result=%d)", result2);
+ return ERROR_JTAG_DEVICE_ERROR;
+ }
+
+ return result;
}
/* calls the given usb_bulk_* function, allowing for the data to trickle in with some timeouts */
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 14:10:29
|
Author: oharboe
Date: 2009-04-21 14:10:29 +0200 (Tue, 21 Apr 2009)
New Revision: 1497
Modified:
trunk/src/jtag/ft2232.c
Log:
Zach Welch <zw...@su...> fix ft2232 usb io format warning
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2009-04-21 12:09:35 UTC (rev 1496)
+++ trunk/src/jtag/ft2232.c 2009-04-21 12:10:29 UTC (rev 1497)
@@ -472,9 +472,10 @@
timeval_subtract(&d_inter2, &inter2, &start);
timeval_subtract(&d_end, &end, &start);
- LOG_INFO("inter: %i.%06i, inter2: %i.%06i end: %i.%06i", d_inter.tv_sec, d_inter.tv_usec, d_inter2.tv_sec,
- d_inter2.tv_usec, d_end.tv_sec,
- d_end.tv_usec);
+ LOG_INFO("inter: %u.%06u, inter2: %u.%06u end: %u.%06u",
+ (unsigned)d_inter.tv_sec, (unsigned)d_inter.tv_usec,
+ (unsigned)d_inter2.tv_sec, (unsigned)d_inter2.tv_usec,
+ (unsigned)d_end.tv_sec, (unsigned)d_end.tv_usec);
#endif
ft2232_buffer_size = bytes_read;
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 14:09:36
|
Author: oharboe Date: 2009-04-21 14:09:35 +0200 (Tue, 21 Apr 2009) New Revision: 1496 Modified: trunk/src/jtag/vsllink.c Log: Zach Welch <zw...@su...> add --enable-verbose* options Modified: trunk/src/jtag/vsllink.c =================================================================== --- trunk/src/jtag/vsllink.c 2009-04-21 11:37:15 UTC (rev 1495) +++ trunk/src/jtag/vsllink.c 2009-04-21 12:09:35 UTC (rev 1496) @@ -37,18 +37,6 @@ //#define _VSLLINK_IN_DEBUG_MODE_ -/* enable this to view USB communication - */ -#if 0 -#define _DEBUG_USB_COMMS_ -#endif - -#ifdef _DEBUG_JTAG_IO_ -#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) -#else -#define DEBUG_JTAG_IO(expr ...) -#endif - #define VSLLINK_MODE_NORMAL 0 #define VSLLINK_MODE_DMA 1 |
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 13:37:18
|
Author: oharboe Date: 2009-04-21 13:37:15 +0200 (Tue, 21 Apr 2009) New Revision: 1495 Modified: trunk/configure.in trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/ft2232.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.h Log: Zach Welch <zw...@su...> add --enable-verbose* options Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/configure.in 2009-04-21 11:37:15 UTC (rev 1495) @@ -189,7 +189,52 @@ AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]), [gcc_werror=$enableval], [gcc_werror=$gcc_warnings]) +# set default verbose options, overridden by following options +debug_jtag_io=no +debug_usb_io=no +debug_usb_comms=no +AC_ARG_ENABLE(verbose, + AS_HELP_STRING([--enable-verbose], + [Enable verbose JTAG I/O messages (for debugging).]), + [ + debug_jtag_io=$enableval + debug_usb_io=$enableval + debug_usb_comms=$enableval + ], []) + +AC_ARG_ENABLE(verbose_jtag_io, + AS_HELP_STRING([--enable-verbose-jtag-io], + [Enable verbose JTAG I/O messages (for debugging).]), + [debug_jtag_io=$enableval], []) +AC_ARG_ENABLE(verbose_usb_io, + AS_HELP_STRING([--enable-verbose-usb-io], + [Enable verbose USB I/O messages (for debugging)]), + [debug_usb_io=$enableval], []) +AC_ARG_ENABLE(verbose_usb_comms, + AS_HELP_STRING([--enable-verbose-usb-comms], + [Enable verbose USB communication messages (for debugging)]), + [debug_usb_comms=$enableval], []) + +AC_MSG_CHECKING([whether to enable verbose JTAB I/O messages]); +AC_MSG_RESULT($debug_jtag_io) +if test $debug_jtag_io = yes; then + AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages]) +fi + +AC_MSG_CHECKING([whether to enable verbose USB I/O messages]); +AC_MSG_RESULT($debug_usb_io) +if test $debug_usb_io = yes; then + AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages]) +fi + +AC_MSG_CHECKING([whether to enable verbose USB communication messages]); +AC_MSG_RESULT($debug_usb_comms) +if test $debug_usb_comms = yes; then + AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages]) +fi + + AC_ARG_ENABLE(parport, AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]), [build_parport=$enableval], [build_parport=no]) Modified: trunk/src/jtag/arm-jtag-ew.c =================================================================== --- trunk/src/jtag/arm-jtag-ew.c 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/arm-jtag-ew.c 2009-04-21 11:37:15 UTC (rev 1495) @@ -35,19 +35,6 @@ #include "log.h" -/* enable this to debug communication - */ -#if 1 -#define _DEBUG_USB_COMMS_ -#define _DEBUG_JTAG_IO_ -#endif - -#ifdef _DEBUG_JTAG_IO_ -#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) -#else -#define DEBUG_JTAG_IO(expr ...) -#endif - #define USB_VID 0x15ba #define USB_PID 0x001e Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/ft2232.c 2009-04-21 11:37:15 UTC (rev 1495) @@ -58,18 +58,6 @@ #include <ftdi.h> #endif -/* enable this to debug io latency - */ -#if 0 -#define _DEBUG_USB_IO_ -#endif - -/* enable this to debug communication - */ -#if 0 -#define _DEBUG_USB_COMMS_ -#endif - static int ft2232_execute_queue(void); static int ft2232_speed(int speed); Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/jlink.c 2009-04-21 11:37:15 UTC (rev 1495) @@ -34,18 +34,6 @@ #include "log.h" -/* enable this to debug communication - */ -#if 0 -#define _DEBUG_USB_COMMS_ -#endif - -#ifdef _DEBUG_JTAG_IO_ -#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) -#else -#define DEBUG_JTAG_IO(expr ...) -#endif - #define VID 0x1366 #define PID 0x0101 Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/jtag.h 2009-04-21 11:37:15 UTC (rev 1495) @@ -30,8 +30,10 @@ #include "command.h" -#if 0 -#define _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ +#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) +#else +#define DEBUG_JTAG_IO(expr ...) #endif #ifndef DEBUG_JTAG_IOZ |
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 13:36:00
|
Author: oharboe
Date: 2009-04-21 13:35:58 +0200 (Tue, 21 Apr 2009)
New Revision: 1494
Modified:
trunk/src/target/mips32.h
trunk/src/target/mips32_pracc.c
trunk/src/target/mips32_pracc.h
Log:
Nico Coesel <nc...@de...> MIPS32 speedup patches
Modified: trunk/src/target/mips32.h
===================================================================
--- trunk/src/target/mips32.h 2009-04-21 11:33:29 UTC (rev 1493)
+++ trunk/src/target/mips32.h 2009-04-21 11:35:58 UTC (rev 1494)
@@ -74,6 +74,7 @@
} mips32_core_reg_t;
#define MIPS32_OP_BEQ 0x04
+#define MIPS32_OP_BNE 0x05
#define MIPS32_OP_ADDI 0x08
#define MIPS32_OP_AND 0x24
#define MIPS32_OP_COP0 0x10
@@ -102,6 +103,7 @@
#define MIPS32_AND(reg, off, val) MIPS32_R_INST(0, off, val, reg, 0, MIPS32_OP_AND)
#define MIPS32_B(off) MIPS32_BEQ(0, 0, off)
#define MIPS32_BEQ(src,tar,off) MIPS32_I_INST(MIPS32_OP_BEQ, src, tar, off)
+#define MIPS32_BNE(src,tar,off) MIPS32_I_INST(MIPS32_OP_BNE, src, tar, off)
#define MIPS32_MFC0(gpr, cpr, sel) MIPS32_R_INST(MIPS32_OP_COP0, MIPS32_COP0_MF, gpr, cpr, 0, sel)
#define MIPS32_MTC0(gpr,cpr, sel) MIPS32_R_INST(MIPS32_OP_COP0, MIPS32_COP0_MT, gpr, cpr, 0, sel)
#define MIPS32_LBU(reg, off, base) MIPS32_I_INST(MIPS32_OP_LBU, base, reg, off)
Modified: trunk/src/target/mips32_pracc.c
===================================================================
--- trunk/src/target/mips32_pracc.c 2009-04-21 11:33:29 UTC (rev 1493)
+++ trunk/src/target/mips32_pracc.c 2009-04-21 11:35:58 UTC (rev 1494)
@@ -19,6 +19,57 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+
+/*
+This version has optimized assembly routines for 32 bit operations:
+- read word
+- write word
+- write array of words
+
+One thing to be aware of is that the MIPS32 cpu will execute the
+instruction after a branch instruction (one delay slot).
+
+For example:
+
+
+ LW $2, ($5 +10)
+ B foo
+ LW $1, ($2 +100)
+
+The LW $1, ($2 +100) instruction is also executed. If this is
+not wanted a NOP can be inserted:
+
+ LW $2, ($5 +10)
+ B foo
+ NOP
+ LW $1, ($2 +100)
+
+or the code can be changed to:
+
+ B foo
+ LW $2, ($5 +10)
+ LW $1, ($2 +100)
+
+The original code contained NOPs. I have removed these and moved
+the branches.
+
+I also moved the PRACC_STACK to 0xFF204000. This allows
+the use of 16 bits offsets to get pointers to the input
+and output area relative to the stack. Note that the stack
+isn't really a stack (the stack pointer is not 'moving')
+but a FIFO simulated in software.
+
+These changes result in a 35% speed increase when programming an
+external flash.
+
+More improvement could be gained if the registers do no need
+to be preserved but in that case the routines should be aware
+OpenOCD is used as a flash programmer or as a debug tool.
+
+Nico Coesel
+*/
+
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -94,7 +145,7 @@
* to start of debug vector */
data = 0;
- LOG_ERROR("Error reading unexpected address");
+ LOG_ERROR("Error reading unexpected address %8.8x", address);
return ERROR_JTAG_DEVICE_ERROR;
}
@@ -103,10 +154,15 @@
mips_ejtag_drscan_32(ctx->ejtag_info, &data);
/* Clear the access pending bit (let the processor eat!) */
+
ejtag_ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_PRACC;
mips_ejtag_set_instr(ctx->ejtag_info, EJTAG_INST_CONTROL, NULL);
mips_ejtag_drscan_32(ctx->ejtag_info, &ejtag_ctrl);
+
+ jtag_add_clocks(5);
+ jtag_execute_queue();
+
return ERROR_OK;
}
@@ -115,7 +171,7 @@
u32 ejtag_ctrl,data;
int offset;
mips_ejtag_t *ejtag_info = ctx->ejtag_info;
-
+
mips_ejtag_set_instr(ctx->ejtag_info, EJTAG_INST_DATA, NULL);
mips_ejtag_drscan_32(ctx->ejtag_info, &data);
@@ -123,6 +179,9 @@
ejtag_ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_PRACC;
mips_ejtag_set_instr(ctx->ejtag_info, EJTAG_INST_CONTROL, NULL);
mips_ejtag_drscan_32(ctx->ejtag_info, &ejtag_ctrl);
+
+ jtag_add_clocks(5);
+ jtag_execute_queue();
if ((address >= MIPS32_PRACC_PARAM_IN)
&& (address <= MIPS32_PRACC_PARAM_IN + ctx->num_iparam * 4))
@@ -143,7 +202,7 @@
}
else
{
- LOG_ERROR("Error writing unexpected address");
+ LOG_ERROR("Error writing unexpected address %8.8x", address);
return ERROR_JTAG_DEVICE_ERROR;
}
@@ -175,6 +234,8 @@
address = data = 0;
mips_ejtag_set_instr(ejtag_info, EJTAG_INST_ADDRESS, NULL);
mips_ejtag_drscan_32(ejtag_info, &address);
+
+// printf("Adres: %.8x\n", address);
/* Check for read or write */
if (ejtag_ctrl & EJTAG_CTRL_PRNW)
@@ -194,6 +255,7 @@
if ((retval = mips32_pracc_exec_read(&ctx, address)) != ERROR_OK)
return retval;
+
}
if (cycle == 0)
@@ -309,23 +371,16 @@
MIPS32_LUI(15,UPPER16(MIPS32_PRACC_STACK)), /* $15 = MIPS32_PRACC_STACK */
MIPS32_ORI(15,15,LOWER16(MIPS32_PRACC_STACK)),
MIPS32_SW(8,0,15), /* sw $8,($15) */
- MIPS32_SW(9,0,15), /* sw $9,($15) */
- MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)), /* $8 = MIPS32_PRACC_PARAM_IN */
- MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
- MIPS32_LW(8,0,8), /* $8=mem[$8]; read addr */
- MIPS32_LUI(9,UPPER16(MIPS32_PRACC_PARAM_OUT)), /* $9=MIPS32_PRACC_PARAM_OUT */
- MIPS32_ORI(9,9,LOWER16(MIPS32_PRACC_PARAM_OUT)),
+ MIPS32_LW(8,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN), 15), //load R8 @ param_in[0] = address
MIPS32_LW(8,0,8), /* lw $8,0($8), Load $8 with the word @mem[$8] */
- MIPS32_SW(8,0,9), /* sw $8,0($9) */
+ MIPS32_SW(8,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_OUT),15), /* sw $8,0($9) */
- MIPS32_LW(9,0,15), /* lw $9,($15) */
MIPS32_LW(8,0,15), /* lw $8,($15) */
- MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */
+ MIPS32_B(NEG16(9)), //was 17 /* b start */
+ MIPS32_MFC0(15,31,0), //this instruction will be executed (MIPS executes instruction after jump) /* move COP0 DeSave to $15 */
MIPS32_NOP,
- MIPS32_B(NEG16(17)), /* b start */
- MIPS32_NOP,
};
int retval = ERROR_OK;
@@ -520,6 +575,8 @@
int mips32_pracc_write_mem32(mips_ejtag_t *ejtag_info, u32 addr, int count, u32 *buf)
{
+
+//NC: use destination pointer as loop counter (last address is in $10)
u32 code[] = {
/* start: */
MIPS32_MTC0(15,31,0), /* move $15 to COP0 DeSave */
@@ -530,41 +587,33 @@
MIPS32_SW(10,0,15), /* sw $10,($15) */
MIPS32_SW(11,0,15), /* sw $11,($15) */
- MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)), /* $8 = MIPS32_PRACC_PARAM_IN */
- MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
+ MIPS32_ADDI(8,15,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN)), //$8= MIPS32_PRACC_PARAM_IN
MIPS32_LW(9,0,8), /* Load write addr to $9 */
- MIPS32_LW(10,4,8), /* Load write count to $10 */
- MIPS32_ADDI(8,8,8), /* $8+=8 */
- MIPS32_NOP,
- /* loop: */
- MIPS32_BEQ(0,10,9), /* beq $0, $10, end */
- MIPS32_NOP,
-
+ MIPS32_LW(10,4,8), //last address /* Load write count to $10 */
+ MIPS32_ADDI(8,8,8), // $8+=8 beginning of data
+
+//loop:
MIPS32_LW(11,0,8), /* lw $11,0($8), Load $11 with the word @mem[$8] */
MIPS32_SW(11,0,9), /* sw $11,0($9) */
- MIPS32_ADDI(10,10,NEG16(1)), /* $10-- */
MIPS32_ADDI(9,9,4), /* $9+=4 */
- MIPS32_ADDI(8,8,4), /* $8+=4 */
- MIPS32_NOP,
- MIPS32_B(NEG16(9)), /* b loop */
- MIPS32_NOP,
+ MIPS32_BNE(10,9,NEG16(4)), //was 9 BNE $10, 9, loop /* b loop */
+ MIPS32_ADDI(8,8,4), //this instruction is part of the loop (one delay slot)! /* $8+=4 */
/* end: */
MIPS32_LW(11,0,15), /* lw $11,($15) */
MIPS32_LW(10,0,15), /* lw $10,($15) */
MIPS32_LW(9,0,15), /* lw $9,($15) */
MIPS32_LW(8,0,15), /* lw $8,($15) */
+ MIPS32_B(NEG16(21)), //was 30 /* b start */
MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */
- MIPS32_NOP,
- MIPS32_B(NEG16(30)), /* b start */
- MIPS32_NOP,
+ MIPS32_NOP, //this one will not be executed
};
/* TODO remove array */
u32 param_in[count+2];
param_in[0] = addr;
- param_in[1] = count;
-
+ param_in[1] = addr + count * sizeof(u32); //last address
+
memcpy(¶m_in[2], buf, count * sizeof(u32));
mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
@@ -582,20 +631,17 @@
MIPS32_ORI(15,15,LOWER16(MIPS32_PRACC_STACK)),
MIPS32_SW(8,0,15), /* sw $8,($15) */
MIPS32_SW(9,0,15), /* sw $9,($15) */
+
+ MIPS32_LW(8,NEG16((MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN)-4), 15), //load R8 @ param_in[1] = data
+ MIPS32_LW(9,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN), 15), //load R9 @ param_in[0] = address
- MIPS32_LUI(8,UPPER16((MIPS32_PRACC_PARAM_IN+4))), /* $8 = MIPS32_PRACC_PARAM_IN+4 */
- MIPS32_ORI(8,8,LOWER16((MIPS32_PRACC_PARAM_IN+4))),
- MIPS32_LW(9,NEG16(4),8), /* Load write addr to $9 */
-
- MIPS32_LW(8,0,8), /* lw $8,0($8), Load $8 with the word @mem[$8] */
MIPS32_SW(8,0,9), /* sw $8,0($9) */
MIPS32_LW(9,0,15), /* lw $9,($15) */
MIPS32_LW(8,0,15), /* lw $8,($15) */
- MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */
+ MIPS32_B(NEG16(11)), /* b start */
+ MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */
MIPS32_NOP,
- MIPS32_B(NEG16(15)), /* b start */
- MIPS32_NOP,
};
/* TODO remove array */
Modified: trunk/src/target/mips32_pracc.h
===================================================================
--- trunk/src/target/mips32_pracc.h 2009-04-21 11:33:29 UTC (rev 1493)
+++ trunk/src/target/mips32_pracc.h 2009-04-21 11:35:58 UTC (rev 1494)
@@ -25,7 +25,8 @@
#include "mips_ejtag.h"
#define MIPS32_PRACC_TEXT 0xFF200200
-#define MIPS32_PRACC_STACK 0xFF2FFFFC
+//#define MIPS32_PRACC_STACK 0xFF2FFFFC
+#define MIPS32_PRACC_STACK 0xFF204000
#define MIPS32_PRACC_PARAM_IN 0xFF201000
#define MIPS32_PRACC_PARAM_IN_SIZE 0x1000
#define MIPS32_PRACC_PARAM_OUT (MIPS32_PRACC_PARAM_IN + MIPS32_PRACC_PARAM_IN_SIZE)
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 13:33:32
|
Author: oharboe
Date: 2009-04-21 13:33:29 +0200 (Tue, 21 Apr 2009)
New Revision: 1493
Modified:
trunk/src/jtag/jlink.c
Log:
Zach Welch <zw...@su...> fix jlink format warning
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2009-04-21 09:41:41 UTC (rev 1492)
+++ trunk/src/jtag/jlink.c 2009-04-21 11:33:29 UTC (rev 1493)
@@ -963,7 +963,7 @@
snprintf(s, 4, " %02x", buffer[j]);
strcat(line, s);
}
- LOG_DEBUG(line);
+ LOG_DEBUG("%s", line);
}
}
#endif
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 11:41:42
|
Author: oharboe
Date: 2009-04-21 11:41:41 +0200 (Tue, 21 Apr 2009)
New Revision: 1492
Modified:
trunk/src/jtag/jlink.c
Log:
Zach Welch <zw...@su...> factor jlink usb_bulk_*_ex functions
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2009-04-21 09:08:43 UTC (rev 1491)
+++ trunk/src/jtag/jlink.c 2009-04-21 09:41:41 UTC (rev 1492)
@@ -859,15 +859,17 @@
}
}
-static int usb_bulk_write_ex(usb_dev_handle *dev, int ep, char *bytes, int size,
- int timeout) {
-
+/* calls the given usb_bulk_* function, allowing for the data to trickle in with some timeouts */
+static int usb_bulk_with_retries(
+ int (*f)(usb_dev_handle *, int, char *, int, int),
+ usb_dev_handle *dev, int ep,
+ char *bytes, int size, int timeout)
+{
int rc = 0, tries = 3, this_size;
while (tries && size) {
- this_size = usb_bulk_write (dev, ep, bytes, size, timeout);
-
+ this_size = f(dev, ep, bytes, size, timeout);
if (this_size > 0) {
size -= this_size;
@@ -877,36 +879,21 @@
} else
tries --;
}
-
return rc;
-
-
}
-
-static int usb_bulk_read_ex(usb_dev_handle *dev, int ep, char *bytes, int size,
- int timeout) {
-
- int rc = 0, tries = 3, this_size;
-
- while (tries && size) {
-
- this_size = usb_bulk_read (dev, ep, bytes, size, timeout);
-
- if (this_size > 0) {
-
- size -= this_size;
- rc += this_size;
- bytes += this_size;
-
- } else
- tries --;
- }
-
- return rc;
-
+static inline int usb_bulk_write_ex(usb_dev_handle *dev, int ep,
+ char *bytes, int size, int timeout)
+{
+ return usb_bulk_with_retries(&usb_bulk_write,
+ dev, ep, bytes, size, timeout);
}
+static inline int usb_bulk_read_ex(usb_dev_handle *dev, int ep,
+ char *bytes, int size, int timeout)
+{
+ return usb_bulk_with_retries(&usb_bulk_read,
+ dev, ep, bytes, size, timeout);
+}
-
/* Write data from out_buffer to USB. */
static int jlink_usb_write(jlink_jtag_t *jlink_jtag, int out_length)
{
|
|
From: ntfreak at B. <nt...@ma...> - 2009-04-21 11:08:46
|
Author: ntfreak
Date: 2009-04-21 11:08:43 +0200 (Tue, 21 Apr 2009)
New Revision: 1491
Added:
trunk/src/target/interface/vsllink.cfg
Modified:
trunk/src/jtag/vsllink.c
Log:
- vsllink update from SimonQian [sim...@Si...]
Modified: trunk/src/jtag/vsllink.c
===================================================================
--- trunk/src/jtag/vsllink.c 2009-04-21 09:05:02 UTC (rev 1490)
+++ trunk/src/jtag/vsllink.c 2009-04-21 09:08:43 UTC (rev 1491)
@@ -49,12 +49,16 @@
#define DEBUG_JTAG_IO(expr ...)
#endif
-static u16 vsllink_vid;
-static u16 vsllink_pid;
-static u8 vsllink_bulkout;
-static u8 vsllink_bulkin;
+#define VSLLINK_MODE_NORMAL 0
+#define VSLLINK_MODE_DMA 1
-#define VSLLINK_USB_TIMEOUT 10000
+static u16 vsllink_usb_vid;
+static u16 vsllink_usb_pid;
+static u8 vsllink_usb_bulkout;
+static u8 vsllink_usb_bulkin;
+static u8 vsllink_usb_interface;
+static u8 vsllink_mode = VSLLINK_MODE_NORMAL;
+static int VSLLINK_USB_TIMEOUT = 10000;
static int VSLLINK_BufferSize = 1024;
@@ -74,6 +78,7 @@
#define VSLLINK_CMD_HW_JTAGSEQCMD 0xA0
#define VSLLINK_CMD_HW_JTAGHLCMD 0xA1
#define VSLLINK_CMD_HW_SWDCMD 0xA2
+#define VSLLINK_CMD_HW_JTAGRAWCMD 0xA3
#define VSLLINK_CMDJTAGSEQ_TMSBYTE 0x00
#define VSLLINK_CMDJTAGSEQ_TMSCLOCK 0x40
@@ -101,7 +106,7 @@
* 3: Pause-DR
* 4: Shift-IR
* 5: Pause-IR
- *
+ *
* SD->SD and SI->SI have to be caught in interface specific code
*/
static u8 VSLLINK_tap_move[6][6] =
@@ -110,9 +115,9 @@
{0xff, 0x7f, 0x2f, 0x0a, 0x37, 0x16}, /* TLR */
{0xff, 0x00, 0x45, 0x05, 0x4b, 0x0b}, /* RTI */
{0xff, 0x61, 0x00, 0x01, 0x0f, 0x2f}, /* SD */
- {0xff, 0x60, 0x40, 0x5c, 0x3c, 0x5e}, /* PD */
+ {0xfe, 0x60, 0x40, 0x5c, 0x3c, 0x5e}, /* PD */
{0xff, 0x61, 0x07, 0x17, 0x00, 0x01}, /* SI */
- {0xff, 0x60, 0x38, 0x5c, 0x40, 0x5e} /* PI */
+ {0xfe, 0x60, 0x38, 0x5c, 0x40, 0x5e} /* PI */
};
typedef struct insert_insignificant_operation
@@ -175,8 +180,8 @@
typedef struct
{
+ int offset;
int length; /* Number of bits to read */
- int offset;
scan_command_t *command; /* Corresponding scan command */
u8 *buffer;
} pending_scan_result_t;
@@ -200,22 +205,42 @@
static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* Queue command functions */
static void vsllink_end_state(tap_state_t state);
-static void vsllink_state_move(void);
-static void vsllink_path_move(int num_states, tap_state_t *path);
+static void vsllink_state_move_dma(void);
+static void vsllink_state_move_normal(void);
+static void (*vsllink_state_move)(void);
+static void vsllink_path_move_dma(int num_states, tap_state_t *path);
+static void vsllink_path_move_normal(int num_states, tap_state_t *path);
+static void (*vsllink_path_move)(int num_states, tap_state_t *path);
static void vsllink_runtest(int num_cycles);
-static void vsllink_stableclocks(int num_cycles, int tms);
-static void vsllink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
+static void vsllink_stableclocks_dma(int num_cycles, int tms);
+static void vsllink_stableclocks_normal(int num_cycles, int tms);
+static void (*vsllink_stableclocks)(int num_cycles, int tms);
+static void vsllink_scan_dma(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
+static void vsllink_scan_normal(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
+static void (*vsllink_scan)(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command);
static void vsllink_reset(int trst, int srst);
static void vsllink_simple_command(u8 command);
+static int vsllink_connect(void);
+static int vsllink_disconnect(void);
/* VSLLink tap buffer functions */
-static void vsllink_tap_init(void);
-static int vsllink_tap_execute(void);
-static void vsllink_tap_ensure_space(int scans, int bytes);
-static void vsllink_tap_append_scan(int length, u8 *buffer, scan_command_t *command, int offset);
+static void vsllink_tap_append_step(int tms, int tdi);
+static void vsllink_tap_init_dma(void);
+static void vsllink_tap_init_normal(void);
+static void (*vsllink_tap_init)(void);
+static int vsllink_tap_execute_dma(void);
+static int vsllink_tap_execute_normal(void);
+static int (*vsllink_tap_execute)(void);
+static void vsllink_tap_ensure_space_dma(int scans, int length);
+static void vsllink_tap_ensure_space_normal(int scans, int length);
+static void (*vsllink_tap_ensure_space)(int scans, int length);
+static void vsllink_tap_append_scan_dma(int length, u8 *buffer, scan_command_t *command);
+static void vsllink_tap_append_scan_normal(int length, u8 *buffer, scan_command_t *command, int offset);
/* VSLLink lowlevel functions */
typedef struct vsllink_jtag
@@ -236,8 +261,15 @@
static int vsllink_tms_data_len = 0;
static u8* vsllink_tms_cmd_pos;
-static vsllink_jtag_t* vsllink_jtag_handle;
+static int tap_length = 0;
+static int tap_buffer_size = 0;
+static u8 *tms_buffer = NULL;
+static u8 *tdi_buffer = NULL;
+static u8 *tdo_buffer = NULL;
+static int last_tms;
+static vsllink_jtag_t* vsllink_jtag_handle = NULL;
+
/***************************************************************************/
/* External interface implementation */
@@ -253,6 +285,19 @@
.quit = vsllink_quit
};
+static void reset_command_pointer(void)
+{
+ if (vsllink_mode == VSLLINK_MODE_NORMAL)
+ {
+ vsllink_usb_out_buffer[0] = VSLLINK_CMD_HW_JTAGSEQCMD;
+ vsllink_usb_out_buffer_idx = 3;
+ }
+ else
+ {
+ tap_length = 0;
+ }
+}
+
static int vsllink_execute_queue(void)
{
jtag_command_t *cmd = jtag_command_queue;
@@ -262,56 +307,55 @@
DEBUG_JTAG_IO("--------------------------------- vsllink -------------------------------------");
- vsllink_usb_out_buffer[0] = VSLLINK_CMD_HW_JTAGSEQCMD;
- vsllink_usb_out_buffer_idx = 3;
+ reset_command_pointer();
while (cmd != NULL)
{
switch (cmd->type)
{
case JTAG_END_STATE:
DEBUG_JTAG_IO("end_state: %s", tap_state_name(cmd->cmd.end_state->end_state));
-
+
if (cmd->cmd.end_state->end_state != TAP_INVALID)
{
vsllink_end_state(cmd->cmd.end_state->end_state);
}
break;
-
+
case JTAG_RUNTEST:
DEBUG_JTAG_IO( "runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles, \
tap_state_name(cmd->cmd.runtest->end_state));
-
+
if (cmd->cmd.runtest->end_state != TAP_INVALID)
{
vsllink_end_state(cmd->cmd.runtest->end_state);
}
vsllink_runtest(cmd->cmd.runtest->num_cycles);
break;
-
+
case JTAG_STATEMOVE:
DEBUG_JTAG_IO("statemove end in %s", tap_state_name(cmd->cmd.statemove->end_state));
-
+
if (cmd->cmd.statemove->end_state != TAP_INVALID)
{
vsllink_end_state(cmd->cmd.statemove->end_state);
}
vsllink_state_move();
break;
-
+
case JTAG_PATHMOVE:
DEBUG_JTAG_IO("pathmove: %i states, end in %s", \
cmd->cmd.pathmove->num_states, \
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
-
+
vsllink_path_move(cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path);
break;
-
+
case JTAG_SCAN:
if (cmd->cmd.scan->end_state != TAP_INVALID)
{
vsllink_end_state(cmd->cmd.scan->end_state);
}
-
+
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
if (cmd->cmd.scan->ir_scan)
{
@@ -321,37 +365,34 @@
{
DEBUG_JTAG_IO("JTAG Scan write DR(%d bits), end in %s:", scan_size, tap_state_name(cmd->cmd.scan->end_state));
}
-
+
#ifdef _DEBUG_JTAG_IO_
vsllink_debug_buffer(buffer, (scan_size + 7) >> 3);
#endif
-
+
type = jtag_scan_type(cmd->cmd.scan);
-
+
vsllink_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size, cmd->cmd.scan);
break;
-
+
case JTAG_RESET:
DEBUG_JTAG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
-
+
vsllink_tap_execute();
-
+
if (cmd->cmd.reset->trst == 1)
{
tap_set_state(TAP_RESET);
}
vsllink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
-
- vsllink_usb_out_buffer[0] = VSLLINK_CMD_HW_JTAGSEQCMD;
- vsllink_usb_out_buffer_idx = 3;
break;
-
+
case JTAG_SLEEP:
DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
vsllink_tap_execute();
jtag_sleep(cmd->cmd.sleep->us);
break;
-
+
case JTAG_STABLECLOCKS:
DEBUG_JTAG_IO("add %d clocks", cmd->cmd.stableclocks->num_cycles);
switch(tap_get_state())
@@ -375,27 +416,27 @@
}
vsllink_stableclocks(cmd->cmd.stableclocks->num_cycles, scan_size);
break;
-
+
default:
LOG_ERROR("BUG: unknown JTAG command type encountered: %d", cmd->type);
exit(-1);
}
cmd = cmd->next;
}
-
+
return vsllink_tap_execute();
}
static int vsllink_speed(int speed)
{
int result;
-
+
vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_SPEED;
vsllink_usb_out_buffer[1] = (speed >> 0) & 0xff;
vsllink_usb_out_buffer[2] = (speed >> 8) & 0xFF;
-
+
result = vsllink_usb_write(vsllink_jtag_handle, 3);
-
+
if (result == 3)
{
return ERROR_OK;
@@ -405,44 +446,30 @@
LOG_ERROR("VSLLink setting speed failed (%d)", result);
return ERROR_JTAG_DEVICE_ERROR;
}
-
+
return ERROR_OK;
}
static int vsllink_khz(int khz, int *jtag_speed)
{
*jtag_speed = khz;
-
+
return ERROR_OK;
}
static int vsllink_speed_div(int jtag_speed, int *khz)
{
*khz = jtag_speed;
-
+
return ERROR_OK;
}
-static int vsllink_register_commands(struct command_context_s *cmd_ctx)
-{
- register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command,
- COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command,
- COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command,
- COMMAND_CONFIG, NULL);
- register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command,
- COMMAND_CONFIG, NULL);
-
- return ERROR_OK;
-}
-
static int vsllink_init(void)
{
- int check_cnt;
+ int check_cnt, to_tmp;
int result;
char version_str[100];
-
+
vsllink_usb_in_buffer = malloc(VSLLINK_BufferSize);
vsllink_usb_out_buffer = malloc(VSLLINK_BufferSize);
if ((vsllink_usb_in_buffer == NULL) || (vsllink_usb_out_buffer == NULL))
@@ -450,34 +477,37 @@
LOG_ERROR("Not enough memory");
exit(-1);
}
-
+
vsllink_jtag_handle = vsllink_usb_open();
-
+
if (vsllink_jtag_handle == 0)
{
LOG_ERROR("Can't find USB JTAG Interface! Please check connection and permissions.");
return ERROR_JTAG_INIT_FAILED;
}
-
+ LOG_DEBUG("vsllink found on %04X:%04X", vsllink_usb_vid, vsllink_usb_pid);
+
+ to_tmp = VSLLINK_USB_TIMEOUT;
+ VSLLINK_USB_TIMEOUT = 100;
check_cnt = 0;
- while (check_cnt < 3)
+ while (check_cnt < 5)
{
- vsllink_simple_command(VSLLINK_CMD_CONN);
+ vsllink_simple_command(0x00);
result = vsllink_usb_read(vsllink_jtag_handle);
-
+
if (result > 2)
{
vsllink_usb_in_buffer[result] = 0;
VSLLINK_BufferSize = vsllink_usb_in_buffer[0] + (vsllink_usb_in_buffer[1] << 8);
strncpy(version_str, (char *)vsllink_usb_in_buffer + 2, sizeof(version_str));
LOG_INFO("%s", version_str);
-
+
// free the pre-alloc memroy
free(vsllink_usb_in_buffer);
free(vsllink_usb_out_buffer);
vsllink_usb_in_buffer = NULL;
vsllink_usb_out_buffer = NULL;
-
+
// alloc new memory
vsllink_usb_in_buffer = malloc(VSLLINK_BufferSize);
vsllink_usb_out_buffer = malloc(VSLLINK_BufferSize);
@@ -490,20 +520,64 @@
{
LOG_INFO("buffer size for USB is %d bytes", VSLLINK_BufferSize);
}
+ // alloc memory for dma mode
+ if (vsllink_mode == VSLLINK_MODE_DMA)
+ {
+ tap_buffer_size = (VSLLINK_BufferSize - 3) / 2;
+ tms_buffer = (u8*)malloc(tap_buffer_size);
+ tdi_buffer = (u8*)malloc(tap_buffer_size);
+ tdo_buffer = (u8*)malloc(tap_buffer_size);
+ if ((tms_buffer == NULL) || (tdi_buffer == NULL) || (tdo_buffer == NULL))
+ {
+ LOG_ERROR("Not enough memory");
+ exit(-1);
+ }
+ }
break;
}
vsllink_simple_command(VSLLINK_CMD_DISCONN);
-
check_cnt++;
}
-
if (check_cnt == 3)
{
// It's dangerout to proced
LOG_ERROR("VSLLink initial failed");
exit(-1);
}
-
+ VSLLINK_USB_TIMEOUT = to_tmp;
+
+ // connect to vsllink
+ vsllink_connect();
+ // initialize function pointers
+ if (vsllink_mode == VSLLINK_MODE_NORMAL)
+ {
+ // normal mode
+ vsllink_state_move = vsllink_state_move_normal;
+ vsllink_path_move = vsllink_path_move_normal;
+ vsllink_stableclocks = vsllink_stableclocks_normal;
+ vsllink_scan = vsllink_scan_normal;
+
+ vsllink_tap_init = vsllink_tap_init_normal;
+ vsllink_tap_execute = vsllink_tap_execute_normal;
+ vsllink_tap_ensure_space = vsllink_tap_ensure_space_normal;
+
+ LOG_INFO("vsllink run in NORMAL mode");
+ }
+ else
+ {
+ // dma mode
+ vsllink_state_move = vsllink_state_move_dma;
+ vsllink_path_move = vsllink_path_move_dma;
+ vsllink_stableclocks = vsllink_stableclocks_dma;
+ vsllink_scan = vsllink_scan_dma;
+
+ vsllink_tap_init = vsllink_tap_init_dma;
+ vsllink_tap_execute = vsllink_tap_execute_dma;
+ vsllink_tap_ensure_space = vsllink_tap_ensure_space_dma;
+
+ LOG_INFO("vsllink run in DMA mode");
+ }
+
// Set SRST and TRST to output, Set USR1 and USR2 to input
vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_PORTDIR;
vsllink_usb_out_buffer[1] = JTAG_PINMSK_SRST | JTAG_PINMSK_TRST | JTAG_PINMSK_USR1 | JTAG_PINMSK_USR2;
@@ -513,13 +587,13 @@
LOG_ERROR("VSLLink USB send data error");
exit(-1);
}
-
+
vsllink_reset(0, 0);
-
+
LOG_INFO("VSLLink JTAG Interface ready");
-
+
vsllink_tap_init();
-
+
return ERROR_OK;
}
@@ -536,31 +610,60 @@
LOG_ERROR("VSLLink USB send data error");
exit(-1);
}
-
+
// disconnect
- vsllink_simple_command(VSLLINK_CMD_DISCONN);
+ vsllink_disconnect();
vsllink_usb_close(vsllink_jtag_handle);
+ vsllink_jtag_handle = NULL;
}
-
+
if (vsllink_usb_in_buffer != NULL)
{
free(vsllink_usb_in_buffer);
+ vsllink_usb_in_buffer = NULL;
}
if (vsllink_usb_out_buffer != NULL)
{
free(vsllink_usb_out_buffer);
+ vsllink_usb_out_buffer = NULL;
}
+
return ERROR_OK;
}
+/***************************************************************************/
+/* Queue command implementations */
+static int vsllink_disconnect(void)
+{
+ vsllink_simple_command(VSLLINK_CMD_DISCONN);
+ return ERROR_OK;
+}
+
+static int vsllink_connect(void)
+{
+ char vsllink_str[100];
+
+ vsllink_usb_out_buffer[0] = VSLLINK_CMD_CONN;
+ vsllink_usb_out_buffer[1] = vsllink_mode;
+ vsllink_usb_message(vsllink_jtag_handle, 2, 0);
+ if (vsllink_usb_read(vsllink_jtag_handle) > 2)
+ {
+ strncpy(vsllink_str, (char *)vsllink_usb_in_buffer + 2, sizeof(vsllink_str));
+ LOG_INFO("%s", vsllink_str);
+ }
+
+ return ERROR_OK;
+}
+
// when vsllink_tms_data_len > 0, vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] is the byte that need to be appended.
// length of VSLLINK_CMDJTAGSEQ_TMSBYTE has been set, no need to set it here.
static void vsllink_append_tms(void)
{
u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
u16 tms2;
- tap_state_t end_state = tap_get_end_state();
-
+ insert_insignificant_operation_t *insert = \
+ &VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())];
+
if (((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_DRPAUSE) && (tap_get_state() != TAP_IRPAUSE)) || \
(vsllink_tms_data_len <= 0) || (vsllink_tms_data_len >= 8) || \
(vsllink_tms_cmd_pos == NULL))
@@ -568,27 +671,24 @@
LOG_ERROR("There MUST be some bugs in the driver");
exit(-1);
}
-
- tms2 = (tms_scan & VSLLINK_BIT_MSK[VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(end_state)].insert_position]) << \
+
+ tms2 = (tms_scan & VSLLINK_BIT_MSK[insert->insert_position]) << \
vsllink_tms_data_len;
- if (VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(end_state)].insert_value == 1)
+ if (insert->insert_value == 1)
{
tms2 |= VSLLINK_BIT_MSK[8 - vsllink_tms_data_len] << \
- (vsllink_tms_data_len + VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(end_state)].insert_position);
+ (vsllink_tms_data_len + insert->insert_position);
}
- tms2 |= (tms_scan >> VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(end_state)].insert_position) << \
- (8 + VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(end_state)].insert_position);
-
+ tms2 |= (tms_scan >> insert->insert_position) << \
+ (8 + insert->insert_position);
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (tms2 >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms2 >> 8) & 0xff;
-
+
vsllink_tms_data_len = 0;
vsllink_tms_cmd_pos = NULL;
}
-/***************************************************************************/
-/* Queue command implementations */
-
static void vsllink_end_state(tap_state_t state)
{
if (tap_is_state_stable(state))
@@ -603,7 +703,7 @@
}
/* Goes to the end state. */
-static void vsllink_state_move(void)
+static void vsllink_state_move_normal(void)
{
if (vsllink_tms_data_len > 0)
{
@@ -612,19 +712,65 @@
else
{
vsllink_tap_ensure_space(0, 2);
-
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_TMSBYTE;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
}
-
+
tap_set_state(tap_get_end_state());
}
+static void vsllink_state_move_dma(void)
+{
+ int i, insert_length = (tap_length % 8) ? (8 - (tap_length % 8)) : 0;
+ insert_insignificant_operation_t *insert = \
+ &VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())];
+ u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
+
+ vsllink_tap_ensure_space(0, 8);
+
+ if (tap_get_state() == TAP_RESET)
+ {
+ for (i = 0; i < 8; i++)
+ {
+ vsllink_tap_append_step(1, 0);
+ }
+ }
+
+ if (insert_length > 0)
+ {
+ vsllink_tap_ensure_space(0, 16);
+
+ for (i = 0; i < insert->insert_position; i++)
+ {
+ vsllink_tap_append_step((tms_scan >> i) & 1, 0);
+ }
+ for (i = 0; i < insert_length; i++)
+ {
+ vsllink_tap_append_step(insert->insert_value, 0);
+ }
+ for (i = insert->insert_position; i < 8; i++)
+ {
+ vsllink_tap_append_step((tms_scan >> i) & 1, 0);
+ }
+ }
+ else
+ {
+ vsllink_tap_ensure_space(0, 8);
+
+ for (i = 0; i < 8; i++)
+ {
+ vsllink_tap_append_step((tms_scan >> i) & 1, 0);
+ }
+ }
+
+ tap_set_state(tap_get_end_state());
+}
// write tms from current vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx]
static void vsllink_add_path(int start, int num, tap_state_t *path)
{
int i;
-
+
for (i = start; i < (start + num); i++)
{
if ((i & 7) == 0)
@@ -635,7 +781,7 @@
}
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = 0;
}
-
+
if (path[i - start] == tap_state_transition(tap_get_state(), true))
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] |= 1 << (i & 7);
@@ -656,14 +802,14 @@
vsllink_usb_out_buffer_idx++;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] = 0;
}
-
+
tap_set_end_state(tap_get_state());
}
-static void vsllink_path_move(int num_states, tap_state_t *path)
+static void vsllink_path_move_normal(int num_states, tap_state_t *path)
{
int i, tms_len, tms_cmd_pos, path_idx = 0;
-
+
if (vsllink_tms_data_len > 0)
{
// there are vsllink_tms_data_len more tms bits to be shifted
@@ -714,7 +860,7 @@
// end last tms shift command
vsllink_add_path(vsllink_tms_data_len, num_states, path);
}
-
+
vsllink_tms_data_len = (vsllink_tms_data_len + num_states) & 7;
if (vsllink_tms_data_len == 0)
{
@@ -725,19 +871,19 @@
else
{
vsllink_add_path(vsllink_tms_data_len, 16 - vsllink_tms_data_len, path);
-
+
path += 16 - vsllink_tms_data_len;
num_states -= 16 - vsllink_tms_data_len;
vsllink_tms_data_len = 0;
vsllink_tms_cmd_pos = NULL;
}
}
-
+
if (num_states > 0)
{
// Normal operation, don't need to append tms data
vsllink_tms_data_len = num_states & 7;
-
+
while (num_states > 0)
{
if (num_states > ((VSLLINK_CMDJTAGSEQ_LENMSK + 1) * 8))
@@ -752,13 +898,13 @@
vsllink_tap_ensure_space(0, tms_len + 2);
tms_cmd_pos = vsllink_usb_out_buffer_idx;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_TMSBYTE | (tms_len - 1);
-
+
vsllink_add_path(0, i, path + path_idx);
-
+
path_idx += i;
num_states -= i;
}
-
+
if (vsllink_tms_data_len > 0)
{
if (tms_len < (VSLLINK_CMDJTAGSEQ_LENMSK + 1))
@@ -769,7 +915,7 @@
else
{
vsllink_usb_out_buffer[tms_cmd_pos]--;
-
+
tms_len = vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx];
vsllink_tap_ensure_space(0, 3);
vsllink_tms_cmd_pos = &vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx];
@@ -779,12 +925,71 @@
}
}
}
+static void vsllink_path_move_dma(int num_states, tap_state_t *path)
+{
+ int i, j = 0;
+
+ if (tap_length & 7)
+ {
+ if ((8 - (tap_length & 7)) < num_states)
+ {
+ j = 8 - (tap_length & 7);
+ }
+ else
+ {
+ j = num_states;
+ }
+ for (i = 0; i < j; i++)
+ {
+ if (path[i] == tap_state_transition(tap_get_state(), false))
+ {
+ vsllink_tap_append_step(0, 0);
+ }
+ else if (path[i] == tap_state_transition(tap_get_state(), true))
+ {
+ vsllink_tap_append_step(1, 0);
+ }
+ else
+ {
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_name(tap_get_state()), tap_state_name(path[i]));
+ exit(-1);
+ }
+ tap_set_state(path[i]);
+ }
+ num_states -= j;
+ }
+
+ if (num_states > 0)
+ {
+ vsllink_tap_ensure_space(0, num_states);
+
+ for (i = 0; i < num_states; i++)
+ {
+ if (path[j + i] == tap_state_transition(tap_get_state(), false))
+ {
+ vsllink_tap_append_step(0, 0);
+ }
+ else if (path[j + i] == tap_state_transition(tap_get_state(), true))
+ {
+ vsllink_tap_append_step(1, 0);
+ }
+ else
+ {
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_name(tap_get_state()), tap_state_name(path[i]));
+ exit(-1);
+ }
+ tap_set_state(path[j + i]);
+ }
+ }
+
+ tap_set_end_state(tap_get_state());
+}
-static void vsllink_stableclocks(int num_cycles, int tms)
+static void vsllink_stableclocks_normal(int num_cycles, int tms)
{
int tms_len;
u16 tms_append_byte;
-
+
if (vsllink_tms_data_len > 0)
{
// there are vsllink_tms_data_len more tms bits to be shifted
@@ -850,7 +1055,7 @@
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF);
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8);
}
-
+
vsllink_tms_data_len = tms_len & 7;
if (vsllink_tms_data_len == 0)
{
@@ -863,14 +1068,14 @@
// more shifts will be needed
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] |= (u8)(tms_append_byte & 0xFF);
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (u8)(tms_append_byte >> 8);
-
+
num_cycles -= 16 - vsllink_tms_data_len;
vsllink_tms_data_len = 0;
vsllink_tms_cmd_pos = NULL;
}
}
// from here vsllink_tms_data_len == 0 or num_cycles == 0
-
+
if (vsllink_tms_data_len > 0)
{
// num_cycles == 0
@@ -903,17 +1108,17 @@
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 8) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 16) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tms_len >> 24) & 0xff;
-
+
vsllink_usb_in_want_length += 1;
pending_scan_results_buffer[pending_scan_results_length].buffer = NULL;
pending_scan_results_length++;
-
+
if (tms_len > 0xFFFF)
{
vsllink_tap_execute();
}
}
-
+
// post-process
vsllink_tms_data_len = num_cycles & 7;
if (vsllink_tms_data_len > 0)
@@ -934,20 +1139,62 @@
}
}
}
+static void vsllink_stableclocks_dma(int num_cycles, int tms)
+{
+ int i, cur_cycles;
+
+ if (tap_length & 7)
+ {
+ if ((8 - (tap_length & 7)) < num_cycles)
+ {
+ cur_cycles = 8 - (tap_length & 7);
+ }
+ else
+ {
+ cur_cycles = num_cycles;
+ }
+ for (i = 0; i < cur_cycles; i++)
+ {
+ vsllink_tap_append_step(tms, 0);
+ }
+ num_cycles -= cur_cycles;
+ }
+
+ while (num_cycles > 0)
+ {
+ if (num_cycles > 8 * tap_buffer_size)
+ {
+ cur_cycles = 8 * tap_buffer_size;
+ }
+ else
+ {
+ cur_cycles = num_cycles;
+ }
+
+ vsllink_tap_ensure_space(0, cur_cycles);
+
+ for (i = 0; i < cur_cycles; i++)
+ {
+ vsllink_tap_append_step(tms, 0);
+ }
+
+ num_cycles -= cur_cycles;
+ }
+}
static void vsllink_runtest(int num_cycles)
{
tap_state_t saved_end_state = tap_get_end_state();
-
+
if (tap_get_state() != TAP_IDLE)
{
// enter into IDLE state
vsllink_end_state(TAP_IDLE);
vsllink_state_move();
}
-
+
vsllink_stableclocks(num_cycles, 0);
-
+
// post-process
// set end_state
vsllink_end_state(saved_end_state);
@@ -958,29 +1205,29 @@
}
}
-static void vsllink_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
+static void vsllink_scan_normal(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
{
tap_state_t saved_end_state;
u8 bits_left, tms_tmp, tdi_len;
int i;
-
+
if (0 == scan_size )
{
return;
}
-
+
tdi_len = ((scan_size + 7) >> 3);
if ((tdi_len + 7) > VSLLINK_BufferSize)
{
LOG_ERROR("Your implementation of VSLLink has not enough buffer");
exit(-1);
}
-
+
saved_end_state = tap_get_end_state();
-
+
/* Move to appropriate scan state */
vsllink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT);
-
+
if (vsllink_tms_data_len > 0)
{
if (tap_get_state() == tap_get_end_state())
@@ -1002,16 +1249,16 @@
tms_tmp = vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx];
*vsllink_tms_cmd_pos -= 2;
}
-
+
vsllink_tap_ensure_space(1, tdi_len + 7);
- // VSLLINK_CMDJTAGSEQ_SCAN ored by 1 means that tms_before is valid
+ // VSLLINK_CMDJTAGSEQ_SCAN ored by 1 means that tms_before is valid
// which is merged from the last tms shift command
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN | 1;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1)>> 8) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = tms_tmp;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = buffer[0] << (8 - vsllink_tms_data_len);
-
+
for (i = 0; i < tdi_len; i++)
{
buffer[i] >>= 8 - vsllink_tms_data_len;
@@ -1020,40 +1267,40 @@
buffer[i] += buffer[i + 1] << vsllink_tms_data_len;
}
}
-
- vsllink_tap_append_scan(scan_size - vsllink_tms_data_len, buffer, command, vsllink_tms_data_len);
+
+ vsllink_tap_append_scan_normal(scan_size - vsllink_tms_data_len, buffer, command, vsllink_tms_data_len);
scan_size -= 8 - vsllink_tms_data_len;
vsllink_tms_data_len = 0;
}
else
{
- vsllink_append_tms();
+ vsllink_state_move();
vsllink_tap_ensure_space(1, tdi_len + 5);
-
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tdi_len >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = (tdi_len >> 8) & 0xff;
-
- vsllink_tap_append_scan(scan_size, buffer, command, 0);
+
+ vsllink_tap_append_scan_normal(scan_size, buffer, command, 0);
}
}
else
{
vsllink_tap_ensure_space(1, tdi_len + 7);
-
+
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN | 1;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 0) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1)>> 8) & 0xff;
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 0;
-
- vsllink_tap_append_scan(scan_size, buffer, command, 8);
+
+ vsllink_tap_append_scan_normal(scan_size, buffer, command, 8);
}
vsllink_end_state(saved_end_state);
-
+
bits_left = scan_size & 0x07;
tap_set_state(ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE);
-
+
if (bits_left > 0)
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 1 << (bits_left - 1);
@@ -1062,7 +1309,7 @@
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 1 << 7;
}
-
+
if (tap_get_state() != tap_get_end_state())
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
@@ -1071,16 +1318,44 @@
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = 0;
}
-
+
tap_set_state(tap_get_end_state());
}
+static void vsllink_scan_dma(int ir_scan, enum scan_type type, u8 *buffer, int scan_size, scan_command_t *command)
+{
+ tap_state_t saved_end_state;
+
+ saved_end_state = tap_get_end_state();
+
+ /* Move to appropriate scan state */
+ vsllink_end_state(ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT);
+
+ vsllink_state_move();
+ vsllink_end_state(saved_end_state);
+
+ /* Scan */
+ vsllink_tap_ensure_space(1, (scan_size + 7) & ~0x00000007);
+ vsllink_tap_append_scan_dma(scan_size, buffer, command);
+
+ tap_set_state(ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE);
+ while (tap_length % 8 != 0)
+ {
+ // more 0s in Pause
+ vsllink_tap_append_step(0, 0);
+ }
+
+ if (tap_get_state() != tap_get_end_state())
+ {
+ vsllink_state_move();
+ }
+}
static void vsllink_reset(int trst, int srst)
{
int result;
-
+
LOG_DEBUG("trst: %i, srst: %i", trst, srst);
-
+
/* Signals are active low */
vsllink_usb_out_buffer[0] = VSLLINK_CMD_SET_PORT;
vsllink_usb_out_buffer[1] = JTAG_PINMSK_SRST | JTAG_PINMSK_TRST;
@@ -1093,7 +1368,7 @@
{
vsllink_usb_out_buffer[2] |= JTAG_PINMSK_TRST;
}
-
+
result = vsllink_usb_write(vsllink_jtag_handle, 3);
if (result != 3)
{
@@ -1104,92 +1379,202 @@
static void vsllink_simple_command(u8 command)
{
int result;
-
+
DEBUG_JTAG_IO("0x%02x", command);
-
+
vsllink_usb_out_buffer[0] = command;
result = vsllink_usb_write(vsllink_jtag_handle, 1);
-
+
if (result != 1)
{
LOG_ERROR("VSLLink command 0x%02x failed (%d)", command, result);
}
}
-static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int vsllink_register_commands(struct command_context_s *cmd_ctx)
{
+ register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command,
+ COMMAND_CONFIG, NULL);
+ register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command,
+ COMMAND_CONFIG, NULL);
+ register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command,
+ COMMAND_CONFIG, NULL);
+ register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command,
+ COMMAND_CONFIG, NULL);
+ register_command(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command,
+ COMMAND_CONFIG, NULL);
+ register_command(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command,
+ COMMAND_CONFIG, NULL);
+
+ return ERROR_OK;
+}
+
+static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
if (argc != 1) {
LOG_ERROR("parameter error, should be one parameter for VID");
+ return ERROR_FAIL;
+ }
+
+ if (!strcmp(args[0], "normal"))
+ {
+ vsllink_mode = VSLLINK_MODE_NORMAL;
+ }
+ else if (!strcmp(args[0], "dma"))
+ {
+ vsllink_mode = VSLLINK_MODE_DMA;
+ }
+ else
+ {
+ LOG_ERROR("invalid vsllink_mode: %s", args[0]);
+ return ERROR_FAIL;
+ }
+
+ return ERROR_OK;
+}
+
+static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 1)
+ {
+ LOG_ERROR("parameter error, should be one parameter for VID");
return ERROR_OK;
}
-
- vsllink_vid = strtol(args[0], NULL, 0);
-
+
+ vsllink_usb_vid = strtol(args[0], NULL, 0);
+
return ERROR_OK;
}
static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- if (argc != 1) {
+ if (argc != 1)
+ {
LOG_ERROR("parameter error, should be one parameter for PID");
return ERROR_OK;
}
-
- vsllink_pid = strtol(args[0], NULL, 0);
-
+
+ vsllink_usb_pid = strtol(args[0], NULL, 0);
+
return ERROR_OK;
}
static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- if (argc != 1) {
+ if (argc != 1)
+ {
LOG_ERROR("parameter error, should be one parameter for BULKIN endpoint");
return ERROR_OK;
}
-
- vsllink_bulkin = strtol(args[0], NULL, 0) | 0x80;
-
+
+ vsllink_usb_bulkin = strtol(args[0], NULL, 0) | 0x80;
+
return ERROR_OK;
}
static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- if (argc != 1) {
+ if (argc != 1)
+ {
LOG_ERROR("parameter error, should be one parameter for BULKOUT endpoint");
return ERROR_OK;
}
+
+ vsllink_usb_bulkout = strtol(args[0], NULL, 0);
+
+ return ERROR_OK;
+}
- vsllink_bulkout = strtol(args[0], NULL, 0);
-
+static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+{
+ if (argc != 1)
+ {
+ LOG_ERROR("parameter error, should be one parameter for interface number");
+ return ERROR_OK;
+ }
+
+ vsllink_usb_interface = strtol(args[0], NULL, 0);
+
return ERROR_OK;
}
/***************************************************************************/
/* VSLLink tap functions */
-static void vsllink_tap_init(void)
+static void vsllink_tap_init_normal(void)
{
vsllink_usb_out_buffer_idx = 0;
vsllink_usb_in_want_length = 0;
pending_scan_results_length = 0;
}
+static void vsllink_tap_init_dma(void)
+{
+ tap_length = 0;
+ pending_scan_results_length = 0;
+}
-static void vsllink_tap_ensure_space(int scans, int bytes)
+static void vsllink_tap_ensure_space_normal(int scans, int length)
{
int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length;
int available_bytes = VSLLINK_BufferSize - vsllink_usb_out_buffer_idx;
-
- if (scans > available_scans || bytes > available_bytes)
+
+ if (scans > available_scans || length > available_bytes)
{
vsllink_tap_execute();
}
}
+static void vsllink_tap_ensure_space_dma(int scans, int length)
+{
+ int available_scans = MAX_PENDING_SCAN_RESULTS - pending_scan_results_length;
+ int available_bytes = tap_buffer_size * 8 - tap_length;
+
+ if (scans > available_scans || length > available_bytes)
+ {
+ vsllink_tap_execute();
+ }
+}
-static void vsllink_tap_append_scan(int length, u8 *buffer, scan_command_t *command, int offset)
+static void vsllink_tap_append_step(int tms, int tdi)
{
+ last_tms = tms;
+ int index = tap_length / 8;
+
+ if (index < tap_buffer_size)
+ {
+ int bit_index = tap_length % 8;
+ u8 bit = 1 << bit_index;
+
+ if (tms)
+ {
+ tms_buffer[index] |= bit;
+ }
+ else
+ {
+ tms_buffer[index] &= ~bit;
+ }
+
+ if (tdi)
+ {
+ tdi_buffer[index] |= bit;
+ }
+ else
+ {
+ tdi_buffer[index] &= ~bit;
+ }
+
+ tap_length++;
+ }
+ else
+ {
+ LOG_ERROR("buffer overflow, tap_length=%d", tap_length);
+ }
+}
+
+static void vsllink_tap_append_scan_normal(int length, u8 *buffer, scan_command_t *command, int offset)
+{
pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
int i;
-
+
if (offset > 0)
{
vsllink_usb_in_want_length += ((length + 7) >> 3) + 1;
@@ -1202,30 +1587,47 @@
pending_scan_result->offset = offset;
pending_scan_result->command = command;
pending_scan_result->buffer = buffer;
-
+
for (i = 0; i < ((length + 7) >> 3); i++)
{
vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = buffer[i];
}
-
+
pending_scan_results_length++;
}
+static void vsllink_tap_append_scan_dma(int length, u8 *buffer, scan_command_t *command)
+{
+ pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
+ int i;
+
+ pending_scan_result->offset = tap_length;
+ pending_scan_result->length = length;
+ pending_scan_result->command = command;
+ pending_scan_result->buffer = buffer;
+
+ for (i = 0; i < length; i++)
+ {
+ vsllink_tap_append_step((i < length-1 ? 0 : 1), (buffer[i/8] >> (i%8)) & 1);
+ }
+
+ pending_scan_results_length++;
+}
/* Pad and send a tap sequence to the device, and receive the answer.
* For the purpose of padding we assume that we are in reset or idle or pause state. */
-static int vsllink_tap_execute(void)
+static int vsllink_tap_execute_normal(void)
{
int i;
int result;
int first = 0;
-
+
if (vsllink_tms_data_len > 0)
{
if((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_IRPAUSE) && (tap_get_state() != TAP_DRPAUSE))
{
LOG_WARNING("%s is not in RESET or IDLE or PAUSR state", tap_state_name(tap_get_state()));
}
-
+
if (vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx] & (1 << (vsllink_tms_data_len - 1)))
{
// last tms bit is '1'
@@ -1241,7 +1643,7 @@
vsllink_tms_data_len = 0;
}
}
-
+
if (vsllink_usb_out_buffer_idx > 3)
{
if (vsllink_usb_out_buffer[0] == VSLLINK_CMD_HW_JTAGSEQCMD)
@@ -1249,9 +1651,9 @@
vsllink_usb_out_buffer[1] = (vsllink_usb_out_buffer_idx >> 0) & 0xff;
vsllink_usb_out_buffer[2] = (vsllink_usb_out_buffer_idx >> 8) & 0xff;
}
-
+
result = vsllink_usb_message(vsllink_jtag_handle, vsllink_usb_out_buffer_idx, vsllink_usb_in_want_length);
-
+
if (result == vsllink_usb_in_want_length)
{
for (i = 0; i < pending_scan_results_length; i++)
@@ -1261,24 +1663,24 @@
int length = pending_scan_result->length;
int offset = pending_scan_result->offset;
scan_command_t *command = pending_scan_result->command;
-
+
if (buffer != NULL)
{
// IRSHIFT or DRSHIFT
buf_set_buf(vsllink_usb_in_buffer, first * 8 + offset, buffer, 0, length);
first += (length + offset + 7) >> 3;
-
+
DEBUG_JTAG_IO("JTAG scan read(%d bits):", length);
#ifdef _DEBUG_JTAG_IO_
vsllink_debug_buffer(buffer, (length + 7) >> 3);
#endif
-
+
if (jtag_read_buffer(buffer, command) != ERROR_OK)
{
vsllink_tap_init();
return ERROR_JTAG_QUEUE_FAILED;
}
-
+
free(pending_scan_result->buffer);
pending_scan_result->buffer = NULL;
}
@@ -1293,68 +1695,162 @@
LOG_ERROR("vsllink_tap_execute, wrong result %d, expected %d", result, vsllink_usb_in_want_length);
return ERROR_JTAG_QUEUE_FAILED;
}
-
+
vsllink_tap_init();
}
-
- vsllink_usb_out_buffer[0] = VSLLINK_CMD_HW_JTAGSEQCMD;
- vsllink_usb_out_buffer_idx = 3;
-
+ reset_command_pointer();
+
return ERROR_OK;
}
+static int vsllink_tap_execute_dma(void)
+{
+ int byte_length;
+ int i;
+ int result;
+
+ if (tap_length > 0)
+ {
+ /* Pad last byte so that tap_length is divisible by 8 */
+ while (tap_length % 8 != 0)
+ {
+ /* More of the last TMS value keeps us in the same state,
+ * analogous to free-running JTAG interfaces. */
+ vsllink_tap_append_step(last_tms, 0);
+ }
+ byte_length = tap_length / 8;
+
+ vsllink_usb_out_buffer[0] = VSLLINK_CMD_HW_JTAGRAWCMD;
+ vsllink_usb_out_buffer[1] = ((byte_length * 2 + 3) >> 0) & 0xff; // package size
+ vsllink_usb_out_buffer[2] = ((byte_length * 2 + 3) >> 8) & 0xff;
+
+ memcpy(&vsllink_usb_out_buffer[3], tdi_buffer, byte_length);
+ memcpy(&vsllink_usb_out_buffer[3 + byte_length], tms_buffer, byte_length);
+
+ result = vsllink_usb_message(vsllink_jtag_handle, 3 + 2 * byte_length, byte_length);
+ if (result == byte_length)
+ {
+ for (i = 0; i < pending_scan_results_length; i++)
+ {
+ pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i];
+ u8 *buffer = pending_scan_result->buffer;
+ int length = pending_scan_result->length;
+ int first = pending_scan_result->offset;
+
+ scan_command_t *command = pending_scan_result->command;
+ buf_set_buf(vsllink_usb_in_buffer, first, buffer, 0, length);
+
+ DEBUG_JTAG_IO("JTAG scan read(%d bits, from %d bits):", length, first);
+#ifdef _DEBUG_JTAG_IO_
+ vsllink_debug_buffer(buffer, (length + 7) >> 3);
+#endif
+
+ if (jtag_read_buffer(buffer, command) != ERROR_OK)
+ {
+ vsllink_tap_init();
+ return ERROR_JTAG_QUEUE_FAILED;
+ }
+
+ if (pending_scan_result->buffer != NULL)
+ {
+ free(pending_scan_result->buffer);
+ }
+ }
+ }
+ else
+ {
+ LOG_ERROR("vsllink_tap_execute, wrong result %d, expected %d", result, byte_length);
+ return ERROR_JTAG_QUEUE_FAILED;
+ }
+
+ vsllink_tap_init();
+ }
+
+ return ERROR_OK;
+}
/*****************************************************************************/
/* VSLLink USB low-level functions */
-vsllink_jtag_t* vsllink_usb_open(void)
+static vsllink_jtag_t* vsllink_usb_open(void)
{
struct usb_bus *busses;
struct usb_bus *bus;
struct usb_device *dev;
-
+ int ret;
+
vsllink_jtag_t *result;
-
+
result = (vsllink_jtag_t*) malloc(sizeof(vsllink_jtag_t));
-
+
usb_init();
usb_find_busses();
usb_find_devices();
-
+
busses = usb_get_busses();
-
+
/* find vsllink_jtag device in usb bus */
-
+
for (bus = busses; bus; bus = bus->next)
{
for (dev = bus->devices; dev; dev = dev->next)
{
- if ((dev->descriptor.idVendor == vsllink_vid) && (dev->descriptor.idProduct == vsllink_pid))
+ if ((dev->descriptor.idVendor == vsllink_usb_vid) && (dev->descriptor.idProduct == vsllink_usb_pid))
{
result->usb_handle = usb_open(dev);
-
+ if (NULL == result->usb_handle)
+ {
+ LOG_ERROR("failed to open %04X:%04X, not enough permissions?", vsllink_usb_vid, vsllink_usb_pid);
+ exit(-1);
+ }
+
/* usb_set_configuration required under win32 */
- usb_set_configuration(result->usb_handle, dev->config[0].bConfigurationValue);
- usb_claim_interface(result->usb_handle, 0);
-
+ ret = usb_set_configuration(result->usb_handle, dev->config[0].bConfigurationValue);
+ if (ret != 0)
+ {
+ LOG_ERROR("fail to set configuration to %d, %d returned, not enough permissions?", dev->config[0].bConfigurationValue, ret);
+ exit(-1);
+ }
+ ret = usb_claim_interface(result->usb_handle, vsllink_usb_interface);
+ if (ret != 0)
+ {
+ LOG_ERROR("fail to claim interface %d, %d returned", vsllink_usb_interface, ret);
+ exit(-1);
+ }
+
#if 0
- /*
+ /*
* This makes problems under Mac OS X. And is not needed
* under Windows. Hopefully this will not break a linux build
*/
usb_set_altinterface(result->usb_handle, 0);
-#endif
+#endif
return result;
}
}
}
-
+
free(result);
return NULL;
}
static void vsllink_usb_close(vsllink_jtag_t *vsllink_jtag)
{
- usb_close(vsllink_jtag->usb_handle);
+ int ret;
+
+ ret = usb_release_interface(vsllink_jtag->usb_handle, vsllink_usb_interface);
+ if (ret != 0)
+ {
+ LOG_ERROR("fail to release interface %d, %d returned", vsllink_usb_interface, ret);
+ exit(-1);
+ }
+
+ ret = usb_close(vsllink_jtag->usb_handle);
+ if (ret != 0)
+ {
+ LOG_ERROR("fail to close usb, %d returned", ret);
+ exit(-1);
+ }
+
free(vsllink_jtag);
}
@@ -1362,7 +1858,7 @@
static int vsllink_usb_message(vsllink_jtag_t *vsllink_jtag, int out_length, int in_length)
{
int result;
-
+
result = vsllink_usb_write(vsllink_jtag, out_length);
if (result == out_length)
{
@@ -1392,18 +1888,18 @@
static int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length)
{
int result;
-
+
if (out_length > VSLLINK_BufferSize)
{
LOG_ERROR("vsllink_jtag_write illegal out_length=%d (max=%d)", out_length, VSLLINK_BufferSize);
return -1;
}
-
- result = usb_bulk_write(vsllink_jtag->usb_handle, vsllink_bulkout, \
+
+ result = usb_bulk_write(vsllink_jtag->usb_handle, vsllink_usb_bulkout, \
(char *)vsllink_usb_out_buffer, out_length, VSLLINK_USB_TIMEOUT);
-
+
DEBUG_JTAG_IO("vsllink_usb_write, out_length = %d, result = %d", out_length, result);
-
+
#ifdef _DEBUG_USB_COMMS_
LOG_DEBUG("USB out:");
vsllink_debug_buffer(vsllink_usb_out_buffer, out_length);
@@ -1419,11 +1915,11 @@
/* Read data from USB into in_buffer. */
static int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag)
{
- int result = usb_bulk_read(vsllink_jtag->usb_handle, vsllink_bulkin, \
+ int result = usb_bulk_read(vsllink_jtag->usb_handle, vsllink_usb_bulkin, \
(char *)vsllink_usb_in_buffer, VSLLINK_BufferSize, VSLLINK_USB_TIMEOUT);
-
+
DEBUG_JTAG_IO("vsllink_usb_read, result = %d", result);
-
+
#ifdef _DEBUG_USB_COMMS_
LOG_DEBUG("USB in:");
vsllink_debug_buffer(vsllink_usb_in_buffer, result);
@@ -1440,7 +1936,7 @@
char s[4];
int i;
int j;
-
+
for (i = 0; i < length; i += BYTES_PER_LINE)
{
snprintf(line, 5, "%04x", i);
Added: trunk/src/target/interface/vsllink.cfg
===================================================================
--- trunk/src/target/interface/vsllink.cfg 2009-04-21 09:05:02 UTC (rev 1490)
+++ trunk/src/target/interface/vsllink.cfg 2009-04-21 09:08:43 UTC (rev 1491)
@@ -0,0 +1,25 @@
+#
+# Versaloon Link -- VSLLink
+#
+# http://www.simonqian.com/en/Versaloon
+#
+
+interface vsllink
+
+#vsllink_usb_vid 0x03EB
+#vsllink_usb_pid 0x2103
+#vsllink_usb_bulkin 0x02
+#vsllink_usb_bulkout 0x02
+#vsllink_usb_interface 0
+
+vsllink_usb_vid 0x0483
+vsllink_usb_pid 0x5740
+vsllink_usb_bulkin 0x02
+vsllink_usb_bulkout 0x03
+vsllink_usb_interface 1
+
+# vsllink mode, dma or normal
+# for low jtag_khz, use normal
+# for high jtag_khz, use dma
+#vsllink_mode dma
+vsllink_mode normal
Property changes on: trunk/src/target/interface/vsllink.cfg
___________________________________________________________________
Name: svn:eol-style
+ native
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 11:05:03
|
Author: oharboe
Date: 2009-04-21 11:05:02 +0200 (Tue, 21 Apr 2009)
New Revision: 1490
Modified:
trunk/configure.in
Log:
Zach Welch <zw...@su...> improve Linux ftd2xx configure-time support
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-04-21 09:02:42 UTC (rev 1489)
+++ trunk/configure.in 2009-04-21 09:05:02 UTC (rev 1490)
@@ -522,7 +522,6 @@
fi
if test $build_ft2232_ftd2xx = yes ; then
- AC_MSG_CHECKING([for libftd2xx.a (linux)])
# Must be linux -
# Cause FTDICHIP does not supply a MAC-OS version
if test $host_os != linux-gnu && test $host_os != linux ; then
@@ -531,30 +530,26 @@
# Are we given a TAR directory?
if test "${with_ftd2xx_linux_tardir+set}" = set
then
+ AC_MSG_CHECKING([uninstalled ftd2xx distribution])
# The .H file is simple..
- f=$with_ftd2xx_linux_tardir/ftd2xx.h
- if test ! -f $f ; then
- AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: $f])
+ FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
+ if test ! -f "${FTD2XX_H}"; then
+ AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
fi
CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
- if test $with_ftd2xx_lib = shared
- then
- LDFLAGS="$LDFLAGS -L$with_ftd2xx_linux_tardir"
- LIBS="$LIBS -lftd2xx"
- AC_MSG_RESULT([ Assuming: -L$with_ftd2xx_linux_tardir -lftd2xx])
- else
+ FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
+ FTD2XX_LIB="-lftd2xx"
+ if test $with_ftd2xx_lib != shared; then
# Test #1 - Future proof - if/when ftdichip fixes their distro.
# Try it with the simple ".a" suffix.
- f=$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a
- if test -f $f ; then
- # Yea we are done
- LDFLAGS="$LDFLAGS -L$with_ftd2xx_linux_tardir/static_lib"
- LIBS="$LIBS -lftd2xx"
+ FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a"
+ if test -f "${FTD2XX_LIB}"; then
+ FTD2XX_LDFLAGS="${FTD2XX_LDFLAGS}/static_lib"
else
# Test Number2.
# Grr.. perhaps it exists as a version number?
- f="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
- count=`ls $f | wc -l`
+ FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
+ count=`ls ${FTD2XX_LIB} | wc -l`
if test $count -gt 1 ; then
AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
fi
@@ -563,17 +558,20 @@
fi
# Because the "-l" rules do not understand version numbers...
# we will just stuff the absolute path onto the LIBS variable
- f=`ls $f`
- #
- LIBS="$LIBS $f -lpthread"
- # No need to bother with LDFLAGS...
+ FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
+ FTD2XX_LDFLAGS=""
fi
- AC_MSG_RESULT([Found: $f])
fi
+ LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
+ LIBS="${LIBS} ${FTD2XX_LIB}"
+ AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
else
- LIBS="$LIBS -lftd2xx"
- AC_MSG_RESULT([Assumed: installed])
- AC_MSG_WARN([The (linux) FTDICHIP.COM files ftd2xx.h and libftd2xx.so are assumed to be in a proper place])
+ AC_CHECK_HEADER([ftd2xx.h],[],[
+ AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
+ ])
+ AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
+ AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
+ ],[])
fi
fi
fi
@@ -583,7 +581,7 @@
# Before we go any further - make sure we can *BUILD* and *RUN*
# a simple app with the "ftd2xx.lib" file - in what ever form we where given
# We should be able to compile, link and run this test program now
- AC_MSG_CHECKING([Test: Build & Link with ftd2xx])
+ AC_MSG_CHECKING([whether ftd2xx library works])
#
# Save the LDFLAGS for later..
|
|
From: ntfreak at B. <nt...@ma...> - 2009-04-21 11:02:42
|
Author: ntfreak Date: 2009-04-21 11:02:42 +0200 (Tue, 21 Apr 2009) New Revision: 1489 Modified: trunk/src/helper/Makefile.am trunk/src/server/Makefile.am Log: - fix signed/unsigned build errors under win32. Thanks Zach Welch <zw...@su...> Modified: trunk/src/helper/Makefile.am =================================================================== --- trunk/src/helper/Makefile.am 2009-04-21 08:51:07 UTC (rev 1488) +++ trunk/src/helper/Makefile.am 2009-04-21 09:02:42 UTC (rev 1489) @@ -18,6 +18,11 @@ libhelper_a_SOURCES += ioutil.c endif +libhelper_a_CFLAGS = +if IS_MINGW +# FD_* macros are sloppy with their signs on MinGW32 platform +libhelper_a_CFLAGS += -Wno-sign-compare +endif noinst_HEADERS = binarybuffer.h configuration.h types.h log.h command.h \ time_support.h replacements.h fileio.h jim.h jim-eventloop.h \ Modified: trunk/src/server/Makefile.am =================================================================== --- trunk/src/server/Makefile.am 2009-04-21 08:51:07 UTC (rev 1488) +++ trunk/src/server/Makefile.am 2009-04-21 09:02:42 UTC (rev 1489) @@ -8,6 +8,11 @@ libserver_a_SOURCES += httpd.c endif +libserver_a_CFLAGS = +if IS_MINGW +# FD_* macros are sloppy with their signs on MinGW32 platform +libserver_a_CFLAGS += -Wno-sign-compare +endif # tcl server addons noinst_HEADERS += tcl_server.h |
|
From: ntfreak at B. <nt...@ma...> - 2009-04-21 10:51:09
|
Author: ntfreak
Date: 2009-04-21 10:51:07 +0200 (Tue, 21 Apr 2009)
New Revision: 1488
Modified:
trunk/src/helper/jim.c
Log:
- remove environ warning under win32 build
Modified: trunk/src/helper/jim.c
===================================================================
--- trunk/src/helper/jim.c 2009-04-21 06:23:47 UTC (rev 1487)
+++ trunk/src/helper/jim.c 2009-04-21 08:51:07 UTC (rev 1488)
@@ -11976,7 +11976,10 @@
char *val;
if (argc == 1) {
+
+#ifndef _WIN32
extern char **environ;
+#endif
int i;
Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0);
|
|
From: oharboe at B. <oh...@ma...> - 2009-04-21 08:23:49
|
Author: oharboe
Date: 2009-04-21 08:23:47 +0200 (Tue, 21 Apr 2009)
New Revision: 1487
Modified:
trunk/src/jtag/at91rm9200.c
Log:
Zach Welch <zw...@su...> add static keywords to at91rm9200
Modified: trunk/src/jtag/at91rm9200.c
===================================================================
--- trunk/src/jtag/at91rm9200.c 2009-04-21 05:42:18 UTC (rev 1486)
+++ trunk/src/jtag/at91rm9200.c 2009-04-21 06:23:47 UTC (rev 1487)
@@ -101,14 +101,14 @@
u32 SRST_MASK; /* SRST bitmask */
};
-struct device_t devices[] =
+static struct device_t devices[] =
{
{ "rea_ecr", PIOD, P27, PIOA, NC, PIOD, P23, PIOD, P24, PIOD, P26, PIOC, P5 },
{ .name = NULL },
};
/* configuration */
-char* at91rm9200_device;
+static char* at91rm9200_device;
/* interface variables
*/
|
|
From: <oh...@ma...> - 2009-04-21 07:42:21
|
Author: oharboe
Date: 2009-04-21 07:42:18 +0200 (Tue, 21 Apr 2009)
New Revision: 1486
Modified:
trunk/src/helper/jim.c
Log:
Zach Welch <zw...@su...> fix unused return value warnings (2 of 4)
Modified: trunk/src/helper/jim.c
===================================================================
--- trunk/src/helper/jim.c 2009-04-21 05:39:36 UTC (rev 1485)
+++ trunk/src/helper/jim.c 2009-04-21 05:42:18 UTC (rev 1486)
@@ -133,7 +133,9 @@
buf[sizeof(buf)-1] = 0;
#else
char *buf;
- vasprintf( &buf, fmt, ap );
+ int result;
+ result = vasprintf( &buf, fmt, ap );
+ if (result < 0) exit(-1);
#endif
return buf;
}
@@ -8953,7 +8955,7 @@
const int cwd_len=2048;
char *cwd=malloc(cwd_len);
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- getcwd( cwd, cwd_len );
+ if (!getcwd( cwd, cwd_len )) strcpy(cwd, "unknown");
Jim_AppendStrings(interp, Jim_GetResult(interp),
"Error loading script \"", filename, "\"",
" cwd: ", cwd,
|
|
From: <oh...@ma...> - 2009-04-21 07:39:42
|
Author: oharboe Date: 2009-04-21 07:39:36 +0200 (Tue, 21 Apr 2009) New Revision: 1485 Modified: trunk/src/flash/at91sam7.c trunk/src/flash/pic32mx.c Log: Zach Welch <zw...@su...> fix at91sam7 uninitialized variable warnings Modified: trunk/src/flash/at91sam7.c =================================================================== --- trunk/src/flash/at91sam7.c 2009-04-21 05:36:53 UTC (rev 1484) +++ trunk/src/flash/at91sam7.c 2009-04-21 05:39:36 UTC (rev 1485) @@ -322,11 +322,11 @@ u16 bnk, sec; u16 arch; u32 cidr; - u8 banks_num; - u16 num_nvmbits; - u16 sectors_num; - u16 pages_per_sector; - u16 page_size; + u8 banks_num = 0; + u16 num_nvmbits = 0; + u16 sectors_num = 0; + u16 pages_per_sector = 0; + u16 page_size = 0; u32 ext_freq; u32 bank_size; u32 base_address = 0; Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-04-21 05:36:53 UTC (rev 1484) +++ trunk/src/flash/pic32mx.c 2009-04-21 05:39:36 UTC (rev 1485) @@ -611,7 +611,7 @@ mips32_common_t *mips32 = target->arch_info; mips_ejtag_t *ejtag_info = &mips32->ejtag_info; int i; - u16 num_pages; + u16 num_pages = 0; u32 device_id; int page_size; @@ -704,7 +704,7 @@ mips32_common_t *mips32 = target->arch_info; mips_ejtag_t *ejtag_info = &mips32->ejtag_info; u32 device_id; - int printed, i; + int printed = 0, i; device_id = ejtag_info->idcode; |
|
From: <oh...@ma...> - 2009-04-21 07:36:58
|
Author: oharboe
Date: 2009-04-21 07:36:53 +0200 (Tue, 21 Apr 2009)
New Revision: 1484
Modified:
trunk/src/flash/str9x.c
Log:
Zach Welch <zw...@su...> fix str9x type-punned pointer
Modified: trunk/src/flash/str9x.c
===================================================================
--- trunk/src/flash/str9x.c 2009-04-21 05:35:51 UTC (rev 1483)
+++ trunk/src/flash/str9x.c 2009-04-21 05:36:53 UTC (rev 1484)
@@ -194,6 +194,7 @@
int i;
u32 adr;
u32 status = 0;
+ u16 hstatus = 0;
if (bank->target->state != TARGET_HALTED)
{
@@ -212,10 +213,11 @@
{
return retval;
}
- if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+ if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK)
{
return retval;
}
+ status = hstatus;
}
else
{
@@ -237,10 +239,11 @@
{
return retval;
}
- if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+ if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK)
{
return retval;
}
+ status = hstatus;
}
/* read array command */
|
|
From: <oh...@ma...> - 2009-04-21 07:35:57
|
Author: oharboe
Date: 2009-04-21 07:35:51 +0200 (Tue, 21 Apr 2009)
New Revision: 1483
Modified:
trunk/configure.in
Log:
Zach Welch <zw...@su...> add -Wformat-security (4 of 4)
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-04-21 05:35:10 UTC (rev 1482)
+++ trunk/configure.in 2009-04-21 05:35:51 UTC (rev 1483)
@@ -692,7 +692,7 @@
AC_PROG_RANLIB
# set default gcc warnings
-GCC_WARNINGS="-Wall -Wstrict-prototypes"
+GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security"
if test "${gcc_wextra}" = yes; then
GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
fi
|
|
From: <oh...@ma...> - 2009-04-21 07:35:13
|
Author: oharboe
Date: 2009-04-21 07:35:10 +0200 (Tue, 21 Apr 2009)
New Revision: 1482
Modified:
trunk/src/target/target.c
Log:
Zach Welch <zw...@su...>fix unused return value warnings (3 of 4)
Modified: trunk/src/target/target.c
===================================================================
--- trunk/src/target/target.c 2009-04-21 05:33:47 UTC (rev 1481)
+++ trunk/src/target/target.c 2009-04-21 05:35:10 UTC (rev 1482)
@@ -2491,20 +2491,27 @@
return retval;
}
+static void writeData(FILE *f, const void *data, size_t len)
+{
+ size_t written = fwrite(data, len, 1, f);
+ if (written != len)
+ LOG_ERROR("failed to write %u bytes: %s", len, strerror(errno));
+}
+
static void writeLong(FILE *f, int l)
{
int i;
for (i=0; i<4; i++)
{
char c=(l>>(i*8))&0xff;
- fwrite(&c, 1, 1, f);
+ writeData(f, &c, 1);
}
}
static void writeString(FILE *f, char *s)
{
- fwrite(s, 1, strlen(s), f);
+ writeData(f, s, strlen(s));
}
/* Dump a gmon.out histogram file. */
@@ -2514,13 +2521,14 @@
FILE *f=fopen(filename, "w");
if (f==NULL)
return;
- fwrite("gmon", 1, 4, f);
+ writeString(f, "gmon");
writeLong(f, 0x00000001); /* Version */
writeLong(f, 0); /* padding */
writeLong(f, 0); /* padding */
writeLong(f, 0); /* padding */
- fwrite("", 1, 1, f); /* GMON_TAG_TIME_HIST */
+ u8 zero = 0; /* GMON_TAG_TIME_HIST */
+ writeData(f, &zero, 1);
/* figure out bucket size */
u32 min=samples[0];
@@ -2569,9 +2577,7 @@
writeLong(f, 64000000); /* 64MHz */
writeString(f, "seconds");
for (i=0; i<(15-strlen("seconds")); i++)
- {
- fwrite("", 1, 1, f); /* padding */
- }
+ writeData(f, &zero, 1);
writeString(f, "s");
/*append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size) */
@@ -2591,7 +2597,7 @@
data[i*2+1]=(val>>8)&0xff;
}
free(buckets);
- fwrite(data, 1, length*2, f);
+ writeData(f, data, length * 2);
free(data);
} else
{
|