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: <zw...@ma...> - 2009-05-11 05:59:21
|
Author: zwelch
Date: 2009-05-11 05:59:02 +0200 (Mon, 11 May 2009)
New Revision: 1706
Modified:
trunk/src/helper/binarybuffer.c
trunk/src/helper/command.c
trunk/src/helper/command.h
trunk/src/helper/configuration.c
trunk/src/helper/configuration.h
trunk/src/helper/fileio.c
trunk/src/helper/fileio.h
trunk/src/helper/log.c
trunk/src/helper/log.h
trunk/src/helper/options.c
trunk/src/helper/time_support.c
Log:
Audit and eliminate redundant helper #include directives.
Modified: trunk/src/helper/binarybuffer.c
===================================================================
--- trunk/src/helper/binarybuffer.c 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/binarybuffer.c 2009-05-11 03:59:02 UTC (rev 1706)
@@ -24,12 +24,7 @@
#include "config.h"
#endif
-#include <stdlib.h>
-#include <string.h>
-
-#include "types.h"
#include "log.h"
-
#include "binarybuffer.h"
const unsigned char bit_reverse_table256[] =
Modified: trunk/src/helper/command.c
===================================================================
--- trunk/src/helper/command.c 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/command.c 2009-05-11 03:59:02 UTC (rev 1706)
@@ -30,22 +30,14 @@
#include "config.h"
#endif
-#include "replacements.h"
+// @todo the inclusion of target.h here is a layering violation
#include "target.h"
#include "command.h"
#include "configuration.h"
-
#include "log.h"
#include "time_support.h"
#include "jim-eventloop.h"
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
int fast_and_dangerous = 0;
Jim_Interp *interp = NULL;
Modified: trunk/src/helper/command.h
===================================================================
--- trunk/src/helper/command.h 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/command.h 2009-05-11 03:59:02 UTC (rev 1706)
@@ -23,7 +23,16 @@
#ifndef COMMAND_H
#define COMMAND_H
+/* Integrate the JIM TCL interpretor into the command processing. */
+#if BUILD_ECOSBOARD
#include <stdio.h>
+#include <stdarg.h>
+/* Jim is provied by eCos */
+#include <cyg/jimtcl/jim.h>
+#else
+#define JIM_EMBEDDED
+#include "jim.h"
+#endif
enum command_mode
{
@@ -87,16 +96,6 @@
extern int fast_and_dangerous;
-/* Integrate the JIM TCL interpretor into the command processing. */
-#include <stdarg.h>
-#if BUILD_ECOSBOARD
-/* Jim is provied by eCos */
-#include <cyg/jimtcl/jim.h>
-#else
-#define JIM_EMBEDDED
-#include "jim.h"
-#endif
-
extern Jim_Interp *interp;
void register_jim(command_context_t *context, const char *name, int (*cmd)(Jim_Interp *interp, int argc, Jim_Obj *const *argv), const char *help);
Modified: trunk/src/helper/configuration.c
===================================================================
--- trunk/src/helper/configuration.c 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/configuration.c 2009-05-11 03:59:02 UTC (rev 1706)
@@ -24,14 +24,9 @@
#include "config.h"
#endif
-#include "types.h"
-#include "command.h"
#include "configuration.h"
#include "log.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
static size_t num_config_files;
static char** config_file_names;
Modified: trunk/src/helper/configuration.h
===================================================================
--- trunk/src/helper/configuration.h 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/configuration.h 2009-05-11 03:59:02 UTC (rev 1706)
@@ -24,7 +24,6 @@
#define CONFIGURATION_H
#include "command.h"
-#include "types.h"
extern int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[]);
extern int parse_config_file(struct command_context_s *cmd_ctx);
Modified: trunk/src/helper/fileio.c
===================================================================
--- trunk/src/helper/fileio.c 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/fileio.c 2009-05-11 03:59:02 UTC (rev 1706)
@@ -27,21 +27,10 @@
#include "config.h"
#endif
-#include "types.h"
-#include "replacements.h"
#include "log.h"
#include "configuration.h"
-
#include "fileio.h"
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <ctype.h>
-
static inline int fileio_open_local(fileio_t *fileio)
{
char access[4];
Modified: trunk/src/helper/fileio.h
===================================================================
--- trunk/src/helper/fileio.h 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/fileio.h 2009-05-11 03:59:02 UTC (rev 1706)
@@ -28,15 +28,8 @@
#define FILEIO_MAX_ERROR_STRING (128)
-#include "types.h"
+#include "replacements.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <ctype.h>
-
enum fileio_type
{
FILEIO_TEXT,
Modified: trunk/src/helper/log.c
===================================================================
--- trunk/src/helper/log.c 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/log.c 2009-05-11 03:59:02 UTC (rev 1706)
@@ -27,18 +27,10 @@
#include "config.h"
#endif
-#include "replacements.h"
-
#include "log.h"
-#include "configuration.h"
#include "time_support.h"
-#include "command.h"
#include "server.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
#include <stdarg.h>
#ifdef _DEBUG_FREE_SPACE_
Modified: trunk/src/helper/log.h
===================================================================
--- trunk/src/helper/log.h 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/log.h 2009-05-11 03:59:02 UTC (rev 1706)
@@ -29,8 +29,6 @@
#include "replacements.h"
#include "command.h"
-#include <stdarg.h>
-
/* logging priorities
* LOG_LVL_SILENT - turn off all output. In lieu of try+catch this can be used as a
* feeble ersatz.
Modified: trunk/src/helper/options.c
===================================================================
--- trunk/src/helper/options.c 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/options.c 2009-05-11 03:59:02 UTC (rev 1706)
@@ -24,18 +24,11 @@
#include "config.h"
#endif
-#include "replacements.h"
-
-#include "types.h"
-#include "command.h"
#include "configuration.h"
#include "log.h"
#include "server.h"
-#include <stdio.h>
-#include <stdlib.h>
#include <getopt.h>
-#include <string.h>
static int help_flag, version_flag;
Modified: trunk/src/helper/time_support.c
===================================================================
--- trunk/src/helper/time_support.c 2009-05-11 03:48:32 UTC (rev 1705)
+++ trunk/src/helper/time_support.c 2009-05-11 03:59:02 UTC (rev 1706)
@@ -27,13 +27,10 @@
#include "config.h"
#endif
-#include "replacements.h"
#include "time_support.h"
#include "log.h"
-#include <stdlib.h>
-
/* calculate difference between two struct timeval values */
int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
{
|
|
From: <zw...@ma...> - 2009-05-11 05:48:36
|
Author: zwelch Date: 2009-05-11 05:48:32 +0200 (Mon, 11 May 2009) New Revision: 1705 Modified: trunk/src/helper/ioutil.c Log: Simplify #include directives in ioutil.c, use new header checks. Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-05-11 03:47:56 UTC (rev 1704) +++ trunk/src/helper/ioutil.c 2009-05-11 03:48:32 UTC (rev 1705) @@ -24,48 +24,39 @@ #endif #include "log.h" -#include "types.h" -#include "configuration.h" -#include "target.h" +#include "time_support.h" -#include "command.h" - -#include <time_support.h> -#include <sys/time.h> -#include <strings.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#if !BUILD_ECOSBOARD -#include <malloc.h> +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> #endif -#include <errno.h> - - -#include <fcntl.h> -#include <sys/stat.h> +#ifdef HAVE_DIRENT_H #include <dirent.h> -#include <netinet/tcp.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <net/if.h> -#include <arpa/inet.h> -#include <sys/socket.h> +#endif +#ifdef HAVE_NETDB_H #include <netdb.h> -#include <netinet/in.h> -#include <unistd.h> -#include <arpa/inet.h> -#include <stdio.h> -#include <string.h> - -#if !defined(__CYGWIN__) +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +//#ifdef HAVE_NETINET_TCP_H +//#include <netinet/tcp.h> +//#endif +#ifdef HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#ifdef HAVE_IFADDRS_H #include <ifaddrs.h> #endif +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#endif +//#ifdef HAVE_STRINGS_H +//#include <strings.h> +//#endif -#include <unistd.h> -#include <stdio.h> int handle_rm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) |
|
From: <zw...@ma...> - 2009-05-11 05:48:03
|
Author: zwelch Date: 2009-05-11 05:47:56 +0200 (Mon, 11 May 2009) New Revision: 1704 Modified: trunk/configure.in Log: Add remaining header checks to be used in subsequent patches. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-05-11 03:35:25 UTC (rev 1703) +++ trunk/configure.in 2009-05-11 03:47:56 UTC (rev 1704) @@ -8,18 +8,25 @@ AC_SEARCH_LIBS([ioperm], [ioperm]) AC_SEARCH_LIBS([dlopen], [dl]) +AC_CHECK_HEADERS(arpa/inet.h) AC_CHECK_HEADERS(elf.h) +AC_CHECK_HEADERS(dirent.h) AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(ifaddrs.h) AC_CHECK_HEADERS(jtag_minidriver.h) AC_CHECK_HEADERS(malloc.h) +AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(netinet/in.h) +AC_CHECK_HEADERS(netinet/tcp.h) +AC_CHECK_HEADERS(net/if.h) AC_CHECK_HEADERS(pthread.h) AC_CHECK_HEADERS(strings.h) +AC_CHECK_HEADERS(sys/ioctl.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/poll.h) AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/socket.h) +AC_CHECK_HEADERS(sys/stat.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/types.h) AC_CHECK_HEADERS(unistd.h) |
|
From: <zw...@ma...> - 2009-05-11 05:35:32
|
Author: zwelch
Date: 2009-05-11 05:35:25 +0200 (Mon, 11 May 2009)
New Revision: 1703
Modified:
trunk/configure.in
trunk/src/helper/log.c
Log:
Add --enable-malloc-logging configure option and update log.c to match.
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-05-11 02:52:00 UTC (rev 1702)
+++ trunk/configure.in 2009-05-11 03:35:25 UTC (rev 1703)
@@ -250,6 +250,19 @@
fi
+debug_malloc=no
+AC_ARG_ENABLE(malloc_logging,
+ AS_HELP_STRING([--enable-malloc-logging],
+ [Include free space in logging messages (requires malloc.h).]),
+ [debug_malloc=$enableval], [])
+
+AC_MSG_CHECKING([whether to enable malloc free space logging]);
+AC_MSG_RESULT($debug_malloc)
+if test $debug_malloc = yes; then
+ AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
+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/helper/log.c
===================================================================
--- trunk/src/helper/log.c 2009-05-11 02:52:00 UTC (rev 1702)
+++ trunk/src/helper/log.c 2009-05-11 03:35:25 UTC (rev 1703)
@@ -41,10 +41,13 @@
#include <unistd.h>
#include <stdarg.h>
-#define PRINT_MEM() 0
-#if PRINT_MEM()
+#ifdef _DEBUG_FREE_SPACE_
+#ifdef HAVE_MALLOC_H
#include <malloc.h>
+#else
+#error "malloc.h is required to use --enable-malloc-logging"
#endif
+#endif
int debug_level = -1;
@@ -99,16 +102,16 @@
{
/* print with count and time information */
int t=(int)(timeval_ms()-start);
-#if PRINT_MEM()
+#ifdef _DEBUG_FREE_SPACE_
struct mallinfo info;
info = mallinfo();
#endif
fprintf(log_output, "%s%d %d %s:%d %s()"
-#if PRINT_MEM()
+#ifdef _DEBUG_FREE_SPACE_
" %d"
#endif
": %s", log_strings[level+1], count, t, file, line, function,
-#if PRINT_MEM()
+#ifdef _DEBUG_FREE_SPACE_
info.fordblks,
#endif
string);
|
|
From: <zw...@ma...> - 2009-05-11 04:52:10
|
Author: zwelch
Date: 2009-05-11 04:52:00 +0200 (Mon, 11 May 2009)
New Revision: 1702
Added:
trunk/src/helper/system.h
Modified:
trunk/configure.in
trunk/src/helper/Makefile.am
trunk/src/helper/replacements.h
Log:
Factor system #includes out of replacements.h into new system.h.
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-05-11 02:29:53 UTC (rev 1701)
+++ trunk/configure.in 2009-05-11 02:52:00 UTC (rev 1702)
@@ -9,15 +9,20 @@
AC_SEARCH_LIBS([dlopen], [dl])
AC_CHECK_HEADERS(elf.h)
+AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(ifaddrs.h)
AC_CHECK_HEADERS(jtag_minidriver.h)
AC_CHECK_HEADERS(malloc.h)
+AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(sys/param.h)
+AC_CHECK_HEADERS(sys/poll.h)
+AC_CHECK_HEADERS(sys/select.h)
+AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/time.h)
-AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/types.h)
+AC_CHECK_HEADERS(unistd.h)
AC_HEADER_ASSERT
AC_HEADER_STDBOOL
Modified: trunk/src/helper/Makefile.am
===================================================================
--- trunk/src/helper/Makefile.am 2009-05-11 02:29:53 UTC (rev 1701)
+++ trunk/src/helper/Makefile.am 2009-05-11 02:52:00 UTC (rev 1702)
@@ -32,7 +32,7 @@
noinst_HEADERS = binarybuffer.h configuration.h types.h log.h command.h \
time_support.h replacements.h fileio.h jim.h jim-eventloop.h \
- startup.tcl bin2char.c
+ system.h startup.tcl bin2char.c
bin2char$(EXEEXT_FOR_BUILD): bin2char.c
${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} $(srcdir)/bin2char.c -o $@
Modified: trunk/src/helper/replacements.h
===================================================================
--- trunk/src/helper/replacements.h 2009-05-11 02:29:53 UTC (rev 1701)
+++ trunk/src/helper/replacements.h 2009-05-11 02:52:00 UTC (rev 1702)
@@ -31,36 +31,8 @@
#endif
#include "types.h"
+#include "system.h"
-#if BUILD_ECOSBOARD
-#include <pkgconf/system.h>
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h> /* select, FD_SET and friends (POSIX.1-2001) */
-#endif
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h> /* FD_SET and friends (pre-POSIX.1-2001) */
-#endif
-
-/* include necessary headers for socket functionality */
-#ifdef _WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#else
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h> /* for MIN/MAX macros */
-#endif
-
/* MIN,MAX macros */
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
Added: trunk/src/helper/system.h
===================================================================
--- trunk/src/helper/system.h 2009-05-11 02:29:53 UTC (rev 1701)
+++ trunk/src/helper/system.h 2009-05-11 02:52:00 UTC (rev 1702)
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Dominic Rath <Dom...@gm...> *
+ * Copyright (C) 2007-2008 by Øyvind Harboe <oyv...@zy...> *
+ * Copyright (C) 2008 by Spencer Oliver <sp...@sp...> *
+ * Copyright (C) 2009 by Zachary T Welch <zw...@su...> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+// standard C library header files
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+// +++ AC_HEADER_TIME +++
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+// --- AC_HEADER_TIME ---
+
+// +++ platform specific headers +++
+#if BUILD_ECOSBOARD == 1
+#include <pkgconf/system.h>
+#endif
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+// --- platform specific headers ---
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_POLL_H
+#include <sys/poll.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h> /* select, FD_SET and friends (POSIX.1-2001) */
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h> /* for MIN/MAX macros */
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#endif // SYSTEM_H
|
|
From: <zw...@ma...> - 2009-05-11 04:29:56
|
Author: zwelch Date: 2009-05-11 04:29:53 +0200 (Mon, 11 May 2009) New Revision: 1701 Modified: trunk/src/helper/types.h Log: Finish portability support for AC_HEADER_STDBOOL configure macro. Modified: trunk/src/helper/types.h =================================================================== --- trunk/src/helper/types.h 2009-05-11 02:27:16 UTC (rev 1700) +++ trunk/src/helper/types.h 2009-05-11 02:29:53 UTC (rev 1701) @@ -54,15 +54,20 @@ #else /* HAVE_STDBOOL_H */ #define __bool_true_false_are_defined 1 +#ifndef HAVE__BOOL #ifndef __cplusplus #define false 0 #define true 1 -#define bool _Bool typedef int _Bool; +#else +typedef bool _Bool; #endif /* __cplusplus */ +#endif /* HAVE__BOOL */ +#define bool _Bool + #endif /* HAVE_STDBOOL_H */ /* DANGER!!!! here be dragons! |
|
From: <zw...@ma...> - 2009-05-11 04:27:44
|
Author: zwelch
Date: 2009-05-11 04:27:16 +0200 (Mon, 11 May 2009)
New Revision: 1700
Modified:
trunk/src/ecosboard.c
trunk/src/flash/flash.c
trunk/src/flash/mflash.c
trunk/src/helper/fileio.c
trunk/src/helper/fileio.h
trunk/src/helper/ioutil.c
trunk/src/jtag/gw16012.c
trunk/src/jtag/parport.c
trunk/src/jtag/rlink/rlink.h
trunk/src/openocd.c
trunk/src/pld/pld.c
trunk/src/pld/xilinx_bit.c
trunk/src/server/httpd.c
trunk/src/server/server.c
trunk/src/server/server.h
trunk/src/svf/svf.c
trunk/src/target/arm7_9_common.c
trunk/src/target/avrt.c
trunk/src/target/target.c
trunk/src/target/xscale.c
trunk/src/xsvf/xsvf.c
Log:
Remove redundant sys/types.h #include directives (now in types.h).
Modified: trunk/src/ecosboard.c
===================================================================
--- trunk/src/ecosboard.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/ecosboard.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -39,7 +39,6 @@
#include <time_support.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
Modified: trunk/src/flash/flash.c
===================================================================
--- trunk/src/flash/flash.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/flash/flash.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -42,7 +42,6 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <inttypes.h>
Modified: trunk/src/flash/mflash.c
===================================================================
--- trunk/src/flash/mflash.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/flash/mflash.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -25,7 +25,6 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <inttypes.h>
Modified: trunk/src/helper/fileio.c
===================================================================
--- trunk/src/helper/fileio.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/helper/fileio.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -38,7 +38,6 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
Modified: trunk/src/helper/fileio.h
===================================================================
--- trunk/src/helper/fileio.h 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/helper/fileio.h 2009-05-11 02:27:16 UTC (rev 1700)
@@ -33,7 +33,6 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
Modified: trunk/src/helper/ioutil.c
===================================================================
--- trunk/src/helper/ioutil.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/helper/ioutil.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -32,7 +32,6 @@
#include <time_support.h>
#include <sys/time.h>
-#include <sys/types.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
@@ -53,7 +52,6 @@
#include <netinet/in.h>
#include <net/if.h>
#include <arpa/inet.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
Modified: trunk/src/jtag/gw16012.c
===================================================================
--- trunk/src/jtag/gw16012.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/jtag/gw16012.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -33,7 +33,6 @@
/* -ino: 060521-1036 */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#include <sys/types.h>
#include <machine/sysarch.h>
#include <machine/cpufunc.h>
#define ioperm(startport,length,enable)\
Modified: trunk/src/jtag/parport.c
===================================================================
--- trunk/src/jtag/parport.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/jtag/parport.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -33,7 +33,6 @@
/* -ino: 060521-1036 */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#include <sys/types.h>
#include <machine/sysarch.h>
#include <machine/cpufunc.h>
#define ioperm(startport,length,enable)\
Modified: trunk/src/jtag/rlink/rlink.h
===================================================================
--- trunk/src/jtag/rlink/rlink.h 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/jtag/rlink/rlink.h 2009-05-11 02:27:16 UTC (rev 1700)
@@ -19,7 +19,6 @@
***************************************************************************/
#include "types.h"
-#include <sys/types.h>
typedef
struct rlink_speed_table_s {
Modified: trunk/src/openocd.c
===================================================================
--- trunk/src/openocd.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/openocd.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -47,7 +47,6 @@
#include "tcl_server.h"
#include <sys/time.h>
-#include <sys/types.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
Modified: trunk/src/pld/pld.c
===================================================================
--- trunk/src/pld/pld.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/pld/pld.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -32,7 +32,6 @@
#include <stdlib.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
Modified: trunk/src/pld/xilinx_bit.c
===================================================================
--- trunk/src/pld/xilinx_bit.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/pld/xilinx_bit.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
Modified: trunk/src/server/httpd.c
===================================================================
--- trunk/src/server/httpd.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/server/httpd.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -40,12 +40,10 @@
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
-#include <sys/types.h>
#include <fcntl.h>
#include <pthread.h>
#include <signal.h>
-#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <microhttpd.h>
Modified: trunk/src/server/server.c
===================================================================
--- trunk/src/server/server.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/server/server.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -40,7 +40,6 @@
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
-#include <sys/types.h>
#include <fcntl.h>
#include <signal.h>
#ifndef _WIN32
Modified: trunk/src/server/server.h
===================================================================
--- trunk/src/server/server.h 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/server/server.h 2009-05-11 02:27:16 UTC (rev 1700)
@@ -30,8 +30,6 @@
#include "binarybuffer.h"
#include "replacements.h"
-#include <sys/types.h>
-
enum connection_type
{
CONNECTION_TCP,
Modified: trunk/src/svf/svf.c
===================================================================
--- trunk/src/svf/svf.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/svf/svf.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -42,7 +42,6 @@
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
Modified: trunk/src/target/arm7_9_common.c
===================================================================
--- trunk/src/target/arm7_9_common.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/target/arm7_9_common.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -48,7 +48,6 @@
#include <string.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
Modified: trunk/src/target/avrt.c
===================================================================
--- trunk/src/target/avrt.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/target/avrt.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -37,7 +37,6 @@
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
Modified: trunk/src/target/target.c
===================================================================
--- trunk/src/target/target.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/target/target.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -46,7 +46,6 @@
#include <stdlib.h>
#include <inttypes.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
Modified: trunk/src/target/xscale.c
===================================================================
--- trunk/src/target/xscale.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/target/xscale.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -44,7 +44,6 @@
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
Modified: trunk/src/xsvf/xsvf.c
===================================================================
--- trunk/src/xsvf/xsvf.c 2009-05-11 02:24:58 UTC (rev 1699)
+++ trunk/src/xsvf/xsvf.c 2009-05-11 02:27:16 UTC (rev 1700)
@@ -49,7 +49,6 @@
#include <stdlib.h>
#include <unistd.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
|
|
From: <zw...@ma...> - 2009-05-11 04:25:09
|
Author: zwelch Date: 2009-05-11 04:24:58 +0200 (Mon, 11 May 2009) New Revision: 1699 Modified: trunk/configure.in trunk/src/helper/types.h Log: Add configure check for sys/types.h; include in our types.h. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-05-11 00:57:19 UTC (rev 1698) +++ trunk/configure.in 2009-05-11 02:24:58 UTC (rev 1699) @@ -17,6 +17,7 @@ AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/select.h) +AC_CHECK_HEADERS(sys/types.h) AC_HEADER_ASSERT AC_HEADER_STDBOOL Modified: trunk/src/helper/types.h =================================================================== --- trunk/src/helper/types.h 2009-05-11 00:57:19 UTC (rev 1698) +++ trunk/src/helper/types.h 2009-05-11 02:24:58 UTC (rev 1699) @@ -27,6 +27,10 @@ #include "config.h" #endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + #ifndef u8 typedef unsigned char u8; #endif |
|
From: <zw...@ma...> - 2009-05-11 02:57:31
|
Author: zwelch Date: 2009-05-11 02:57:19 +0200 (Mon, 11 May 2009) New Revision: 1698 Modified: trunk/configure.in Log: Add AC_HEADER_ASSERT macro to configure; provides --disable-assert option. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-05-11 00:49:51 UTC (rev 1697) +++ trunk/configure.in 2009-05-11 00:57:19 UTC (rev 1698) @@ -18,6 +18,7 @@ AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/select.h) +AC_HEADER_ASSERT AC_HEADER_STDBOOL AC_HEADER_TIME |
|
From: <zw...@ma...> - 2009-05-11 02:49:56
|
Author: zwelch Date: 2009-05-11 02:49:51 +0200 (Mon, 11 May 2009) New Revision: 1697 Modified: trunk/configure.in Log: Use AC_HEADER_STDBOOL macro instead of AC_CHEACK_HEADERS(stdbool.h). Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-05-11 00:44:59 UTC (rev 1696) +++ trunk/configure.in 2009-05-11 00:49:51 UTC (rev 1697) @@ -13,12 +13,12 @@ AC_CHECK_HEADERS(jtag_minidriver.h) AC_CHECK_HEADERS(malloc.h) AC_CHECK_HEADERS(pthread.h) -AC_CHECK_HEADERS(stdbool.h) AC_CHECK_HEADERS(strings.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/select.h) +AC_HEADER_STDBOOL AC_HEADER_TIME AC_C_BIGENDIAN |
|
From: <zw...@ma...> - 2009-05-11 02:45:05
|
Author: zwelch Date: 2009-05-11 02:44:59 +0200 (Mon, 11 May 2009) New Revision: 1696 Modified: trunk/configure.in Log: OpenOCD now requires autoconf 2.60 to process AC_PROG_CC_C99 macro. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-05-10 22:03:57 UTC (rev 1695) +++ trunk/configure.in 2009-05-11 00:44:59 UTC (rev 1696) @@ -1,4 +1,4 @@ -AC_PREREQ(2.59) +AC_PREREQ(2.60) AC_INIT([openocd], [0.2.0-in-development], [OpenOCD Mailing List <ope...@li...>]) AC_CONFIG_SRCDIR([src/openocd.c]) |
|
From: <zw...@ma...> - 2009-05-11 00:04:10
|
Author: zwelch
Date: 2009-05-11 00:03:57 +0200 (Mon, 11 May 2009)
New Revision: 1695
Modified:
trunk/Makefile.am
trunk/bootstrap
trunk/configure.in
trunk/src/Makefile.am
trunk/src/flash/Makefile.am
trunk/src/helper/Makefile.am
trunk/src/jtag/Makefile.am
trunk/src/pld/Makefile.am
trunk/src/server/Makefile.am
trunk/src/svf/Makefile.am
trunk/src/target/Makefile.am
trunk/src/xsvf/Makefile.am
Log:
Extend autotools build to create shared library libopenocd with libtool:
- Add libtoolize step too bootstrap script; creates ltmain.sh script.
- Add AC_PROG_LIBTOOL to configure.in to add libtool support to build.
- Change Makefile.am library rules from static (_a) to libtool (_la).
- Install libopenocd.{la,so,a} in $(libdir); update openocd link rules.
- Extend MAINTAINERCLEANFILES in top-level Makefile.am to remove ltmain.sh.
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -20,6 +20,7 @@
config.h.in \
config.h.in~ \
compile \
+ ltmain.sh \
missing \
aclocal.m4 \
install-sh
Modified: trunk/bootstrap
===================================================================
--- trunk/bootstrap 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/bootstrap 2009-05-10 22:03:57 UTC (rev 1695)
@@ -1,5 +1,6 @@
aclocal \
&& autoheader \
+&& libtoolize --automake \
&& automake --foreign --add-missing --copy \
&& autoconf
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/configure.in 2009-05-10 22:03:57 UTC (rev 1695)
@@ -787,6 +787,7 @@
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_RANLIB
+AC_PROG_LIBTOOL
# Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -1,3 +1,6 @@
+SUBDIRS = helper jtag xsvf svf target server flash pld
+
+lib_LTLIBRARIES = libopenocd.la
bin_PROGRAMS = openocd
if ECOSBOARD
@@ -6,8 +9,11 @@
MAINFILE = main.c
endif
-openocd_SOURCES = $(MAINFILE) openocd.c
+openocd_SOURCES = $(MAINFILE)
+openocd_LDADD = libopenocd.la
+libopenocd_la_SOURCES = openocd.c
+
# set the include path found by configure
AM_CPPFLAGS = \
-I$(top_srcdir)/src \
@@ -21,22 +27,21 @@
-I$(top_srcdir)/src/pld
# pass path to prefix path
-openocd_CPPFLAGS = \
+libopenocd_la_CPPFLAGS = \
-DPKGLIBDIR=\"$(pkglibdir)\" \
-DPKGBLDDATE=\"`date +%F-%R`\"
if RELEASE
-openocd_CPPFLAGS += -DRELSTR=\"Release\" -DPKGBLDREV=\"\"
+libopenocd_la_CPPFLAGS += -DRELSTR=\"Release\" -DPKGBLDREV=\"\"
else
-openocd_CPPFLAGS += -DRELSTR=\"svn:\" -DPKGBLDREV=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
+libopenocd_la_CPPFLAGS += -DRELSTR=\"svn:\" -DPKGBLDREV=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
endif
# add default CPPFLAGS
-openocd_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
+libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
# the library search path.
-openocd_LDFLAGS = $(all_libraries)
-SUBDIRS = helper jtag xsvf svf target server flash pld
+libopenocd_la_LDFLAGS = $(all_libraries)
if IS_MINGW
MINGWLDADD = -lwsock32
@@ -72,16 +77,19 @@
endif
endif
-openocd_LDADD = $(top_builddir)/src/xsvf/libxsvf.a $(top_builddir)/src/svf/libsvf.a \
- $(top_builddir)/src/target/libtarget.a $(top_builddir)/src/jtag/libjtag.a \
- $(top_builddir)/src/helper/libhelper.a \
- $(top_builddir)/src/server/libserver.a $(top_builddir)/src/helper/libhelper.a \
- $(top_builddir)/src/flash/libflash.a $(top_builddir)/src/target/libtarget.a \
- $(top_builddir)/src/pld/libpld.a \
+libopenocd_la_LIBADD = \
+ $(top_builddir)/src/xsvf/libxsvf.la \
+ $(top_builddir)/src/svf/libsvf.la \
+ $(top_builddir)/src/pld/libpld.la \
+ $(top_builddir)/src/jtag/libjtag.la \
+ $(top_builddir)/src/flash/libflash.la \
+ $(top_builddir)/src/target/libtarget.la \
+ $(top_builddir)/src/server/libserver.la \
+ $(top_builddir)/src/helper/libhelper.la \
$(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
if HTTPD
-openocd_LDADD += -lmicrohttpd
+libopenocd_la_LIBADD += -lmicrohttpd
endif
nobase_dist_pkglib_DATA = \
Modified: trunk/src/flash/Makefile.am
===================================================================
--- trunk/src/flash/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/flash/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -4,8 +4,8 @@
-I$(top_srcdir)/src/target
METASOURCES = AUTO
-noinst_LIBRARIES = libflash.a
-libflash_a_SOURCES = \
+noinst_LTLIBRARIES = libflash.la
+libflash_la_SOURCES = \
flash.c lpc2000.c cfi.c non_cfi.c at91sam7.c \
str7x.c str9x.c aduc702x.c nand.c nand_ecc.c \
lpc3180_nand_controller.c stellaris.c str9xpec.c stm32x.c tms470.c \
Modified: trunk/src/helper/Makefile.am
===================================================================
--- trunk/src/helper/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/helper/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -5,7 +5,7 @@
-DPKGLIBDIR=\"$(pkglibdir)\"
METASOURCES = AUTO
-noinst_LIBRARIES = libhelper.a
+noinst_LTLIBRARIES = libhelper.la
if ECOSBOARD
CONFIGFILES =
@@ -15,19 +15,19 @@
-libhelper_a_SOURCES = \
+libhelper_la_SOURCES = \
binarybuffer.c $(CONFIGFILES) configuration.c \
log.c command.c time_support.c \
replacements.c fileio.c startup_tcl.c
if IOUTIL
-libhelper_a_SOURCES += ioutil.c
+libhelper_la_SOURCES += ioutil.c
endif
-libhelper_a_CFLAGS =
+libhelper_la_CFLAGS =
if IS_MINGW
# FD_* macros are sloppy with their signs on MinGW32 platform
-libhelper_a_CFLAGS += -Wno-sign-compare
+libhelper_la_CFLAGS += -Wno-sign-compare
endif
noinst_HEADERS = binarybuffer.h configuration.h types.h log.h command.h \
Modified: trunk/src/jtag/Makefile.am
===================================================================
--- trunk/src/jtag/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/jtag/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -3,7 +3,7 @@
-I$(top_srcdir)/src/target
METASOURCES = AUTO
-noinst_LIBRARIES = libjtag.a
+noinst_LTLIBRARIES = libjtag.la
if BITBANG
BITBANGFILES = bitbang.c
@@ -109,8 +109,12 @@
ARMJTAGEWFILES =
endif
-libjtag_a_SOURCES = jtag.c $(BITBANGFILES) $(PARPORTFILES) $(DUMMYFILES) $(FT2232FILES) $(AMTJTAGACCELFILES) $(EP93XXFILES) \
- $(AT91RM9200FILES) $(GW16012FILES) $(BITQFILES) $(PRESTOFILES) $(USBPROGFILES) $(ECOSBOARDFILES) $(JLINKFILES) $(RLINKFILES) $(VSLLINKFILES) $(ARMJTAGEWFILES)
+libjtag_la_SOURCES = jtag.c \
+ $(BITBANGFILES) $(PARPORTFILES) $(DUMMYFILES) \
+ $(FT2232FILES) $(AMTJTAGACCELFILES) $(EP93XXFILES) \
+ $(AT91RM9200FILES) $(GW16012FILES) $(BITQFILES) \
+ $(PRESTOFILES) $(USBPROGFILES) $(ECOSBOARDFILES) \
+ $(JLINKFILES) $(RLINKFILES) $(VSLLINKFILES) $(ARMJTAGEWFILES)
noinst_HEADERS = bitbang.h jtag.h bitq.h rlink/dtc_cmd.h rlink/ep1_cmd.h rlink/rlink.h rlink/st7.h
Modified: trunk/src/pld/Makefile.am
===================================================================
--- trunk/src/pld/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/pld/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -4,8 +4,8 @@
-I$(top_srcdir)/src/jtag
METASOURCES = AUTO
-noinst_LIBRARIES = libpld.a
+noinst_LTLIBRARIES = libpld.la
noinst_HEADERS = pld.h xilinx_bit.h virtex2.h
-libpld_a_SOURCES = pld.c xilinx_bit.c virtex2.c
+libpld_la_SOURCES = pld.c xilinx_bit.c virtex2.c
MAINTAINERCLEANFILES = Makefile.in
Modified: trunk/src/server/Makefile.am
===================================================================
--- trunk/src/server/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/server/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -6,23 +6,23 @@
-DPKGLIBDIR=\"$(pkglibdir)\"
METASOURCES = AUTO
-noinst_LIBRARIES = libserver.a
+noinst_LTLIBRARIES = libserver.la
noinst_HEADERS = server.h telnet_server.h gdb_server.h
-libserver_a_SOURCES = server.c telnet_server.c gdb_server.c
+libserver_la_SOURCES = server.c telnet_server.c gdb_server.c
if HTTPD
-libserver_a_SOURCES += httpd.c
+libserver_la_SOURCES += httpd.c
endif
-libserver_a_CFLAGS =
+libserver_la_CFLAGS =
if IS_MINGW
# FD_* macros are sloppy with their signs on MinGW32 platform
-libserver_a_CFLAGS += -Wno-sign-compare
+libserver_la_CFLAGS += -Wno-sign-compare
endif
# tcl server addons
noinst_HEADERS += tcl_server.h
-libserver_a_SOURCES += tcl_server.c
+libserver_la_SOURCES += tcl_server.c
if HTTPD
nobase_dist_pkglib_DATA = $(wildcard $(srcdir)/httpd/*.tcl $(srcdir)/httpd/*.css $(srcdir)/httpd/menu_cuts/*.png)
Modified: trunk/src/svf/Makefile.am
===================================================================
--- trunk/src/svf/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/svf/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -4,8 +4,8 @@
-I$(top_srcdir)/src/jtag
METASOURCES = AUTO
-noinst_LIBRARIES = libsvf.a
+noinst_LTLIBRARIES = libsvf.la
noinst_HEADERS = svf.h
-libsvf_a_SOURCES = svf.c
+libsvf_la_SOURCES = svf.c
MAINTAINERCLEANFILES = Makefile.in
Modified: trunk/src/target/Makefile.am
===================================================================
--- trunk/src/target/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/target/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -11,8 +11,9 @@
-I$(top_srcdir)/src/xsvf
METASOURCES = AUTO
-noinst_LIBRARIES = libtarget.a
-libtarget_a_SOURCES = target.c register.c breakpoints.c armv4_5.c embeddedice.c etm.c arm7tdmi.c arm9tdmi.c \
+noinst_LTLIBRARIES = libtarget.la
+libtarget_la_SOURCES = target.c register.c breakpoints.c \
+ armv4_5.c embeddedice.c etm.c arm7tdmi.c arm9tdmi.c \
arm_jtag.c arm7_9_common.c algorithm.c arm920t.c arm720t.c armv4_5_mmu.c armv4_5_cache.c arm_disassembler.c \
arm966e.c arm926ejs.c feroceon.c etb.c xscale.c arm_simulator.c image.c armv7m.c cortex_m3.c cortex_a8.c arm_adi_v5.c \
etm_dummy.c $(OOCD_TRACE_FILES) target_request.c trace.c arm11.c arm11_dbgtap.c mips32.c mips_m4k.c \
Modified: trunk/src/xsvf/Makefile.am
===================================================================
--- trunk/src/xsvf/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
+++ trunk/src/xsvf/Makefile.am 2009-05-10 22:03:57 UTC (rev 1695)
@@ -4,8 +4,8 @@
-I$(top_srcdir)/src/jtag
METASOURCES = AUTO
-noinst_LIBRARIES = libxsvf.a
+noinst_LTLIBRARIES = libxsvf.la
noinst_HEADERS = xsvf.h
-libxsvf_a_SOURCES = xsvf.c
+libxsvf_la_SOURCES = xsvf.c
MAINTAINERCLEANFILES = Makefile.in
|
|
From: <zw...@ma...> - 2009-05-10 23:33:59
|
Author: zwelch
Date: 2009-05-10 23:33:53 +0200 (Sun, 10 May 2009)
New Revision: 1694
Removed:
trunk/src/helper/tclapi.c
trunk/src/helper/tclapi.h
Modified:
trunk/src/helper/Makefile.am
trunk/src/openocd.c
Log:
Reverse revision 1691: all of its functionality has migrated elsewhere.
Modified: trunk/src/helper/Makefile.am
===================================================================
--- trunk/src/helper/Makefile.am 2009-05-10 20:10:11 UTC (rev 1693)
+++ trunk/src/helper/Makefile.am 2009-05-10 21:33:53 UTC (rev 1694)
@@ -17,7 +17,7 @@
libhelper_a_SOURCES = \
binarybuffer.c $(CONFIGFILES) configuration.c \
- log.c command.c time_support.c tclapi.c \
+ log.c command.c time_support.c \
replacements.c fileio.c startup_tcl.c
if IOUTIL
Deleted: trunk/src/helper/tclapi.c
===================================================================
--- trunk/src/helper/tclapi.c 2009-05-10 20:10:11 UTC (rev 1693)
+++ trunk/src/helper/tclapi.c 2009-05-10 21:33:53 UTC (rev 1694)
@@ -1,516 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2007,2008 vind Harboe *
- * Copyright (C) 2008 Duane Ellis *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "tclapi.h"
-#include "../target/target.h"
-#include "../jtag/jtag.h"
-#include "../flash/flash.h"
-
-#include <string.h>
-
-
-static int new_int_array_element(Jim_Interp * interp, const char *varname, int idx, u32 val)
-{
- char *namebuf;
- Jim_Obj *nameObjPtr, *valObjPtr;
- int result;
-
- namebuf = alloc_printf("%s(%d)", varname, idx);
- if (!namebuf)
- return JIM_ERR;
-
- nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
- valObjPtr = Jim_NewIntObj(interp, val);
- if (!nameObjPtr || !valObjPtr)
- {
- free(namebuf);
- return JIM_ERR;
- }
-
- Jim_IncrRefCount(nameObjPtr);
- Jim_IncrRefCount(valObjPtr);
- result = Jim_SetVariable(interp, nameObjPtr, valObjPtr);
- Jim_DecrRefCount(interp, nameObjPtr);
- Jim_DecrRefCount(interp, valObjPtr);
- free(namebuf);
- /* printf("%s(%d) <= 0%08x\n", varname, idx, val); */
- return result;
-}
-
-static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- target_t *target;
- command_context_t *context;
- long l;
- u32 width;
- int len;
- u32 addr;
- unsigned count;
- u32 v;
- const char *varname;
- u8 buffer[4096];
- unsigned i, n;
- int e, retval;
-
- /* argv[1] = name of array to receive the data
- * argv[2] = desired width
- * argv[3] = memory address
- * argv[4] = count of times to read
- */
- if (argc != 5) {
- Jim_WrongNumArgs(interp, 1, argv, "varname width addr nelems");
- return JIM_ERR;
- }
- varname = Jim_GetString(argv[1], &len);
- /* given "foo" get space for worse case "foo(%d)" .. add 20 */
-
- e = Jim_GetLong(interp, argv[2], &l);
- width = l;
- if (e != JIM_OK) {
- return e;
- }
-
- e = Jim_GetLong(interp, argv[3], &l);
- addr = l;
- if (e != JIM_OK) {
- return e;
- }
- e = Jim_GetLong(interp, argv[4], &l);
- len = l;
- if (e != JIM_OK) {
- return e;
- }
- switch (width) {
- case 8:
- width = 1;
- break;
- case 16:
- width = 2;
- break;
- case 32:
- width = 4;
- break;
- default:
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings( interp, Jim_GetResult(interp), "Invalid width param, must be 8/16/32", NULL );
- return JIM_ERR;
- }
- if (len == 0) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: zero width read?", NULL);
- return JIM_ERR;
- }
- if ((addr + (len * width)) < addr) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: addr + len - wraps to zero?", NULL);
- return JIM_ERR;
- }
- /* absurd transfer size? */
- if (len > 65536) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: absurd > 64K item request", NULL);
- return JIM_ERR;
- }
-
- if ((width == 1) ||
- ((width == 2) && ((addr & 1) == 0)) ||
- ((width == 4) && ((addr & 3) == 0))) {
- /* all is well */
- } else {
- char buf[100];
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- sprintf(buf, "mem2array address: 0x%08x is not aligned for %d byte reads", addr, width);
- Jim_AppendStrings(interp, Jim_GetResult(interp), buf , NULL);
- return JIM_ERR;
- }
-
- context = Jim_GetAssocData(interp, "context");
- if (context == NULL)
- {
- LOG_ERROR("mem2array: no command context");
- return JIM_ERR;
- }
- target = get_current_target(context);
- if (target == NULL)
- {
- LOG_ERROR("mem2array: no current target");
- return JIM_ERR;
- }
-
- /* Transfer loop */
-
- /* index counter */
- n = 0;
- /* assume ok */
- e = JIM_OK;
- while (len) {
- /* Slurp... in buffer size chunks */
-
- count = len; /* in objects.. */
- if (count > (sizeof(buffer)/width)) {
- count = (sizeof(buffer)/width);
- }
-
- retval = target->type->read_memory( target, addr, width, count, buffer );
- if (retval != ERROR_OK) {
- /* BOO !*/
- LOG_ERROR("mem2array: Read @ 0x%08x, w=%d, cnt=%d, failed", addr, width, count);
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: cannot read memory", NULL);
- e = JIM_ERR;
- len = 0;
- } else {
- v = 0; /* shut up gcc */
- for (i = 0 ;i < count ;i++, n++) {
- switch (width) {
- case 4:
- v = target_buffer_get_u32(target, &buffer[i*width]);
- break;
- case 2:
- v = target_buffer_get_u16(target, &buffer[i*width]);
- break;
- case 1:
- v = buffer[i] & 0x0ff;
- break;
- }
- new_int_array_element(interp, varname, n, v);
- }
- len -= count;
- }
- }
-
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
-
- return JIM_OK;
-}
-
-static int get_int_array_element(Jim_Interp * interp, const char *varname, int idx, u32 *val)
-{
- char *namebuf;
- Jim_Obj *nameObjPtr, *valObjPtr;
- int result;
- long l;
-
- namebuf = alloc_printf("%s(%d)", varname, idx);
- if (!namebuf)
- return JIM_ERR;
-
- nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
- if (!nameObjPtr)
- {
- free(namebuf);
- return JIM_ERR;
- }
-
- Jim_IncrRefCount(nameObjPtr);
- valObjPtr = Jim_GetVariable(interp, nameObjPtr, JIM_ERRMSG);
- Jim_DecrRefCount(interp, nameObjPtr);
- free(namebuf);
- if (valObjPtr == NULL)
- return JIM_ERR;
-
- result = Jim_GetLong(interp, valObjPtr, &l);
- /* printf("%s(%d) => 0%08x\n", varname, idx, val); */
- *val = l;
- return result;
-}
-
-static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- target_t *target;
- command_context_t *context;
- long l;
- u32 width;
- int len;
- u32 addr;
- u32 count;
- u32 v;
- const char *varname;
- u8 buffer[4096];
- int n, e, retval;
-
- /* argv[1] = name of array to get the data
- * argv[2] = desired width
- * argv[3] = memory address
- * argv[4] = count to write
- */
- if (argc != 5) {
- Jim_WrongNumArgs(interp, 1, argv, "varname width addr nelems");
- return JIM_ERR;
- }
- varname = Jim_GetString(argv[1], &len);
- /* given "foo" get space for worse case "foo(%d)" .. add 20 */
-
- e = Jim_GetLong(interp, argv[2], &l);
- width = l;
- if (e != JIM_OK) {
- return e;
- }
-
- e = Jim_GetLong(interp, argv[3], &l);
- addr = l;
- if (e != JIM_OK) {
- return e;
- }
- e = Jim_GetLong(interp, argv[4], &l);
- len = l;
- if (e != JIM_OK) {
- return e;
- }
- switch (width) {
- case 8:
- width = 1;
- break;
- case 16:
- width = 2;
- break;
- case 32:
- width = 4;
- break;
- default:
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings( interp, Jim_GetResult(interp), "Invalid width param, must be 8/16/32", NULL );
- return JIM_ERR;
- }
- if (len == 0) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: zero width read?", NULL);
- return JIM_ERR;
- }
- if ((addr + (len * width)) < addr) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: addr + len - wraps to zero?", NULL);
- return JIM_ERR;
- }
- /* absurd transfer size? */
- if (len > 65536) {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: absurd > 64K item request", NULL);
- return JIM_ERR;
- }
-
- if ((width == 1) ||
- ((width == 2) && ((addr & 1) == 0)) ||
- ((width == 4) && ((addr & 3) == 0))) {
- /* all is well */
- } else {
- char buf[100];
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- sprintf(buf, "array2mem address: 0x%08x is not aligned for %d byte reads", addr, width);
- Jim_AppendStrings(interp, Jim_GetResult(interp), buf , NULL);
- return JIM_ERR;
- }
-
- context = Jim_GetAssocData(interp, "context");
- if (context == NULL)
- {
- LOG_ERROR("array2mem: no command context");
- return JIM_ERR;
- }
- target = get_current_target(context);
- if (target == NULL)
- {
- LOG_ERROR("array2mem: no current target");
- return JIM_ERR;
- }
-
- /* Transfer loop */
-
- /* index counter */
- n = 0;
- /* assume ok */
- e = JIM_OK;
- while (len) {
- /* Slurp... in buffer size chunks */
-
- count = len; /* in objects.. */
- if (count > (sizeof(buffer)/width)) {
- count = (sizeof(buffer)/width);
- }
-
- v = 0; /* shut up gcc */
- for (unsigned i = 0 ;i < count ;i++, n++) {
- get_int_array_element(interp, varname, n, &v);
- switch (width) {
- case 4:
- target_buffer_set_u32(target, &buffer[i*width], v);
- break;
- case 2:
- target_buffer_set_u16(target, &buffer[i*width], v);
- break;
- case 1:
- buffer[i] = v & 0x0ff;
- break;
- }
- }
- len -= count;
-
- retval = target->type->write_memory(target, addr, width, count, buffer);
- if (retval != ERROR_OK) {
- /* BOO !*/
- LOG_ERROR("array2mem: Write @ 0x%08x, w=%d, cnt=%d, failed", addr, width, count);
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: cannot read memory", NULL);
- e = JIM_ERR;
- len = 0;
- }
- }
-
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
-
- return JIM_OK;
-}
-
-int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args)
-{
- int retval;
- scan_field_t *fields;
- int num_fields;
- int field_count = 0;
- int i, e;
- long device;
-
- /* args[1] = device
- * args[2] = num_bits
- * args[3] = hex string
- * ... repeat num bits and hex string ...
- */
- if ((argc < 4) || ((argc % 2)!=0))
- {
- Jim_WrongNumArgs(interp, 1, args, "<device> <num_bits1> <value1> <num_bits2> <value2> ...");
- return JIM_ERR;
- }
-
- for (i = 2; i < argc; i+=2)
- {
- long bits;
-
- e = Jim_GetLong(interp, args[i], &bits);
- if (e != JIM_OK)
- return e;
- }
-
- e = Jim_GetLong(interp, args[1], &device);
- if (e != JIM_OK)
- return e;
-
- num_fields=(argc-2)/2;
- fields = malloc(sizeof(scan_field_t) * num_fields);
- for (i = 2; i < argc; i+=2)
- {
- long bits;
- int len;
- const char *str;
-
- Jim_GetLong(interp, args[i], &bits);
- str = Jim_GetString(args[i+1], &len);
-
- fields[field_count].num_bits = bits;
- fields[field_count].out_value = malloc(CEIL(bits, 8));
- str_to_buf(str, len, fields[field_count].out_value, bits, 0);
- fields[field_count].in_value = fields[field_count].out_value;
- }
-
- jtag_add_dr_scan(num_fields, fields, TAP_INVALID);
- retval = jtag_execute_queue();
- if (retval != ERROR_OK)
- {
- Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
- Jim_AppendStrings(interp, Jim_GetResult(interp), "drscan: jtag execute failed", NULL);
- return JIM_ERR;
- }
-
- field_count=0;
- Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
- for (i = 2; i < argc; i+=2)
- {
- long bits;
- char *str;
-
- Jim_GetLong(interp, args[i], &bits);
- str = buf_to_str(fields[field_count].in_value, bits, 16);
- free(fields[field_count].out_value);
-
- Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str)));
- free(str);
- field_count++;
- }
-
- Jim_SetResult(interp, list);
-
- free(fields);
-
- return JIM_OK;
-}
-
-static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
-
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "no arguments to flash_banks command");
- return JIM_ERR;
- }
-
- unsigned flash_banks = flash_get_bank_count();
- if (!flash_banks)
- {
- return JIM_ERR;
- }
-
- Jim_Obj *list=Jim_NewListObj(interp, NULL, 0);
- for (unsigned i = 0; i < flash_banks; i++)
- {
- flash_bank_t *p = get_flash_bank_by_num(i);
- Jim_Obj *elem=Jim_NewListObj(interp, NULL, 0);
-
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "name", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->driver->name, -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "base", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->base));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "size", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->size));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "bus_width", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->bus_width));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "chip_width", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->chip_width));
-
- Jim_ListAppendElement(interp, list, elem);
- }
-
- Jim_SetResult(interp, list);
-
- return JIM_OK;
-}
-
-int tclapi_register_commands(struct command_context_s *cmd_ctx)
-{
- register_jim(cmd_ctx, "ocd_mem2array", &jim_mem2array,
- "read memory and return as a TCL array for script processing");
- register_jim(cmd_ctx, "ocd_array2mem", &jim_array2mem,
- "convert a TCL array to memory locations and write the values");
- register_jim(cmd_ctx, "drscan", &Jim_Command_drscan,
- "execute DR scan <device> <num_bits> <value> <num_bits1> <value2> ...");
- register_jim(cmd_ctx, "ocd_flash_banks", &jim_flash_banks,
- "return information about the flash banks");
- return ERROR_OK;
-}
Deleted: trunk/src/helper/tclapi.h
===================================================================
--- trunk/src/helper/tclapi.h 2009-05-10 20:10:11 UTC (rev 1693)
+++ trunk/src/helper/tclapi.h 2009-05-10 21:33:53 UTC (rev 1694)
@@ -1,26 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2009 by Zachary T Welch <zw...@su...> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifndef TCLAPI_H
-#define TCLAPI_H
-
-#include "command.h"
-
-int tclapi_register_commands(struct command_context_s *ctx);
-
-#endif // TCLAPI_H
Modified: trunk/src/openocd.c
===================================================================
--- trunk/src/openocd.c 2009-05-10 20:10:11 UTC (rev 1693)
+++ trunk/src/openocd.c 2009-05-10 21:33:53 UTC (rev 1694)
@@ -41,7 +41,6 @@
#include "mflash.h"
#include "command.h"
-#include "tclapi.h"
#include "server.h"
#include "telnet_server.h"
#include "gdb_server.h"
@@ -203,7 +202,6 @@
telnet_register_commands(cmd_ctx);
gdb_register_commands(cmd_ctx);
tcl_register_commands(cmd_ctx); /* tcl server commands */
- tclapi_register_commands(cmd_ctx); /* misc tcl commands */
log_register_commands(cmd_ctx);
jtag_register_commands(cmd_ctx);
xsvf_register_commands(cmd_ctx);
|
|
From: <zw...@ma...> - 2009-05-10 22:10:16
|
Author: zwelch
Date: 2009-05-10 22:10:11 +0200 (Sun, 10 May 2009)
New Revision: 1693
Modified:
trunk/configure.in
Log:
Extend configure script to check for environ declaration in stdlib.h.
Patch contributed by Martin Thomas <mt...@rh...>.
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-05-10 19:48:09 UTC (rev 1692)
+++ trunk/configure.in 2009-05-10 20:10:11 UTC (rev 1693)
@@ -788,11 +788,12 @@
AM_PROG_CC_C_O
AC_PROG_RANLIB
-# Look for environ alternatives. Possibility #1: is environ in unistd.h?
-AC_MSG_CHECKING([for environ in unistd.h])
+# Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
+AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
AC_COMPILE_IFELSE([
#define _GNU_SOURCE
#include <unistd.h>
+#include <stdlib.h>
int main(int argc, char **argv) { char **ep = environ; }
], [
AC_MSG_RESULT([yes])
|
|
From: oharboe at B. <oh...@ma...> - 2009-05-10 21:48:13
|
Author: oharboe
Date: 2009-05-10 21:48:09 +0200 (Sun, 10 May 2009)
New Revision: 1692
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
zy1000/trunk/build/include/jtag_minidriver.h
Log:
Wrote up post processing JTAG API. Not used yet, but reference implementation will be used in subsequent explanations of new scheme + patches to use it.
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-05-10 19:44:38 UTC (rev 1691)
+++ trunk/src/jtag/jtag.c 2009-05-10 19:48:09 UTC (rev 1692)
@@ -76,6 +76,24 @@
int jtag_trst = 0;
int jtag_srst = 0;
+#ifndef HAVE_JTAG_MINIDRIVER_H
+struct jtag_callback_entry
+{
+ struct jtag_callback_entry *next;
+
+ jtag_callback_t callback;
+ u8 *in;
+ jtag_callback_data_t data1;
+ jtag_callback_data_t data2;
+
+};
+
+
+static struct jtag_callback_entry *jtag_callback_queue_head = NULL;
+static struct jtag_callback_entry *jtag_callback_queue_tail = NULL;
+#endif
+
+
jtag_command_t *jtag_command_queue = NULL;
jtag_command_t **last_comand_pointer = &jtag_command_queue;
static jtag_tap_t *jtag_all_taps = NULL;
@@ -1434,8 +1452,47 @@
return type;
}
-int MINIDRIVER(interface_jtag_execute_queue)(void)
+
+#ifndef HAVE_JTAG_MINIDRIVER_H
+/* add callback to end of queue */
+void jtag_add_callback3(jtag_callback_t callback, u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2)
{
+ struct jtag_callback_entry *entry=cmd_queue_alloc(sizeof(struct jtag_callback_entry));
+
+ entry->next=NULL;
+ entry->callback=callback;
+ entry->in=in;
+ entry->data1=data1;
+ entry->data2=data2;
+
+ if (jtag_callback_queue_head==NULL)
+ {
+ jtag_callback_queue_head=entry;
+ jtag_callback_queue_tail=entry;
+ } else
+ {
+ jtag_callback_queue_tail->next=entry;
+ jtag_callback_queue_tail=entry;
+ }
+}
+
+
+static int jtag_convert_to_callback3(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2)
+{
+ ((jtag_callback1_t)data1)(in);
+ return ERROR_OK;
+}
+
+void jtag_add_callback(jtag_callback1_t callback, u8 *in)
+{
+ jtag_add_callback3(jtag_convert_to_callback3, in, (jtag_callback_data_t)callback, 0);
+}
+#endif
+
+#ifndef HAVE_JTAG_MINIDRIVER_H
+
+int interface_jtag_execute_queue(void)
+{
int retval;
if (jtag==NULL)
@@ -1446,13 +1503,28 @@
retval = jtag->execute_queue();
+ if (retval == ERROR_OK)
+ {
+ struct jtag_callback_entry *entry;
+ for (entry=jtag_callback_queue_head; entry!=NULL; entry=entry->next)
+ {
+ retval=entry->callback(entry->in, entry->data1, entry->data2);
+ if (retval!=ERROR_OK)
+ break;
+ }
+ }
+
cmd_queue_free();
+ jtag_callback_queue_head = NULL;
+ jtag_callback_queue_tail = NULL;
+
jtag_command_queue = NULL;
last_comand_pointer = &jtag_command_queue;
return retval;
}
+#endif
void jtag_execute_queue_noclear(void)
{
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-05-10 19:44:38 UTC (rev 1691)
+++ trunk/src/jtag/jtag.h 2009-05-10 19:48:09 UTC (rev 1692)
@@ -568,6 +568,70 @@
extern void jtag_add_plain_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
extern int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
+
+/* Simplest/typical callback - do some conversion on the data clocked in.
+ * This callback is for such conversion that can not fail.
+ * For conversion types or checks that can
+ * fail, use the jtag_callback_t variant */
+typedef void (*jtag_callback1_t)(u8 *in);
+
+#ifndef HAVE_JTAG_MINIDRIVER_H
+/* A simpler version of jtag_add_callback3 */
+extern void jtag_add_callback(jtag_callback1_t, u8 *in);
+#else
+/* implemented by minidriver */
+#endif
+
+/* This type can store an integer safely by a normal cast on 64 and
+ * 32 bit systems. */
+typedef void *jtag_callback_data_t;
+
+/* The generic callback mechanism.
+ *
+ * The callback is invoked with three arguments. The first argument is
+ * the pointer to the data clocked in.
+ */
+typedef int (*jtag_callback_t)(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2);
+
+
+/* This callback can be executed immediately the queue has been flushed. Note that
+ * the JTAG queue can either be executed synchronously or asynchronously. Typically
+ * for USB the queue is executed asynchronously. For low latency interfaces, the
+ * queue may be executed synchronously.
+ *
+ * These callbacks are typically executed *after* the *entire* JTAG queue has been
+ * executed for e.g. USB interfaces.
+ *
+ * The callbacks are guaranteeed to be invoked in the order that they were queued.
+ *
+ * The strange name is due to C's lack of overloading using function arguments
+ *
+ * The callback mechansim is very general and does not really make any assumptions
+ * about what the callback does and what the arguments are.
+ *
+ * in - typically used to point to the data to operate on. More often than not
+ * this will be the data clocked in during a shift operation
+ *
+ * data1 - an integer that is big enough to be used either as an 'int' or
+ * cast to/from a pointer
+ *
+ * data2 - an integer that is big enough to be used either as an 'int' or
+ * cast to/from a pointer
+ *
+ * Why stop at 'data2' for arguments? Somewhat historical reasons. This is
+ * sufficient to implement the jtag_check_value_mask(), besides the
+ * line is best drawn somewhere...
+ *
+ * If the execution of the queue fails before the callbacks, then the
+ * callbacks may or may not be invoked depending on driver implementation.
+ */
+#ifndef HAVE_JTAG_MINIDRIVER_H
+extern void jtag_add_callback3(jtag_callback_t, u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2);
+#else
+/* implemented by minidriver */
+#endif
+
+
/* run a TAP_RESET reset. End state is TAP_RESET, regardless
* of start state.
*/
Modified: zy1000/trunk/build/include/jtag_minidriver.h
===================================================================
--- zy1000/trunk/build/include/jtag_minidriver.h 2009-05-10 19:44:38 UTC (rev 1691)
+++ zy1000/trunk/build/include/jtag_minidriver.h 2009-05-10 19:48:09 UTC (rev 1692)
@@ -208,3 +208,6 @@
}
}
+#define jtag_add_callback(callback, in) callback(in)
+
+#define jtag_add_callback3(callback, in, data1, data2) jtag_set_error(callback(in, data1, data2))
|
|
From: <zw...@ma...> - 2009-05-10 21:44:49
|
Author: zwelch
Date: 2009-05-10 21:44:38 +0200 (Sun, 10 May 2009)
New Revision: 1691
Added:
trunk/src/helper/tclapi.c
trunk/src/helper/tclapi.h
Modified:
trunk/src/helper/Makefile.am
trunk/src/openocd.c
Log:
Revive tclapi.c from r1650:
* Remove superfluous #include directives.
* Fix warnings and API usage to cure its bit rot.
* Build into libhelper library (for now).
Add tclapi.h to export tclapi_register_commands().
Register tclapi commands in openocd.c:setup_command_handler().
Modified: trunk/src/helper/Makefile.am
===================================================================
--- trunk/src/helper/Makefile.am 2009-05-10 19:02:07 UTC (rev 1690)
+++ trunk/src/helper/Makefile.am 2009-05-10 19:44:38 UTC (rev 1691)
@@ -15,7 +15,9 @@
-libhelper_a_SOURCES = binarybuffer.c $(CONFIGFILES) configuration.c log.c command.c time_support.c \
+libhelper_a_SOURCES = \
+ binarybuffer.c $(CONFIGFILES) configuration.c \
+ log.c command.c time_support.c tclapi.c \
replacements.c fileio.c startup_tcl.c
if IOUTIL
Copied: trunk/src/helper/tclapi.c (from rev 1650, trunk/src/helper/tclapi.c)
===================================================================
--- trunk/src/helper/tclapi.c 2009-05-07 20:19:04 UTC (rev 1650)
+++ trunk/src/helper/tclapi.c 2009-05-10 19:44:38 UTC (rev 1691)
@@ -0,0 +1,516 @@
+/***************************************************************************
+ * Copyright (C) 2007,2008 vind Harboe *
+ * Copyright (C) 2008 Duane Ellis *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tclapi.h"
+#include "../target/target.h"
+#include "../jtag/jtag.h"
+#include "../flash/flash.h"
+
+#include <string.h>
+
+
+static int new_int_array_element(Jim_Interp * interp, const char *varname, int idx, u32 val)
+{
+ char *namebuf;
+ Jim_Obj *nameObjPtr, *valObjPtr;
+ int result;
+
+ namebuf = alloc_printf("%s(%d)", varname, idx);
+ if (!namebuf)
+ return JIM_ERR;
+
+ nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
+ valObjPtr = Jim_NewIntObj(interp, val);
+ if (!nameObjPtr || !valObjPtr)
+ {
+ free(namebuf);
+ return JIM_ERR;
+ }
+
+ Jim_IncrRefCount(nameObjPtr);
+ Jim_IncrRefCount(valObjPtr);
+ result = Jim_SetVariable(interp, nameObjPtr, valObjPtr);
+ Jim_DecrRefCount(interp, nameObjPtr);
+ Jim_DecrRefCount(interp, valObjPtr);
+ free(namebuf);
+ /* printf("%s(%d) <= 0%08x\n", varname, idx, val); */
+ return result;
+}
+
+static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+ target_t *target;
+ command_context_t *context;
+ long l;
+ u32 width;
+ int len;
+ u32 addr;
+ unsigned count;
+ u32 v;
+ const char *varname;
+ u8 buffer[4096];
+ unsigned i, n;
+ int e, retval;
+
+ /* argv[1] = name of array to receive the data
+ * argv[2] = desired width
+ * argv[3] = memory address
+ * argv[4] = count of times to read
+ */
+ if (argc != 5) {
+ Jim_WrongNumArgs(interp, 1, argv, "varname width addr nelems");
+ return JIM_ERR;
+ }
+ varname = Jim_GetString(argv[1], &len);
+ /* given "foo" get space for worse case "foo(%d)" .. add 20 */
+
+ e = Jim_GetLong(interp, argv[2], &l);
+ width = l;
+ if (e != JIM_OK) {
+ return e;
+ }
+
+ e = Jim_GetLong(interp, argv[3], &l);
+ addr = l;
+ if (e != JIM_OK) {
+ return e;
+ }
+ e = Jim_GetLong(interp, argv[4], &l);
+ len = l;
+ if (e != JIM_OK) {
+ return e;
+ }
+ switch (width) {
+ case 8:
+ width = 1;
+ break;
+ case 16:
+ width = 2;
+ break;
+ case 32:
+ width = 4;
+ break;
+ default:
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings( interp, Jim_GetResult(interp), "Invalid width param, must be 8/16/32", NULL );
+ return JIM_ERR;
+ }
+ if (len == 0) {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: zero width read?", NULL);
+ return JIM_ERR;
+ }
+ if ((addr + (len * width)) < addr) {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: addr + len - wraps to zero?", NULL);
+ return JIM_ERR;
+ }
+ /* absurd transfer size? */
+ if (len > 65536) {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: absurd > 64K item request", NULL);
+ return JIM_ERR;
+ }
+
+ if ((width == 1) ||
+ ((width == 2) && ((addr & 1) == 0)) ||
+ ((width == 4) && ((addr & 3) == 0))) {
+ /* all is well */
+ } else {
+ char buf[100];
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ sprintf(buf, "mem2array address: 0x%08x is not aligned for %d byte reads", addr, width);
+ Jim_AppendStrings(interp, Jim_GetResult(interp), buf , NULL);
+ return JIM_ERR;
+ }
+
+ context = Jim_GetAssocData(interp, "context");
+ if (context == NULL)
+ {
+ LOG_ERROR("mem2array: no command context");
+ return JIM_ERR;
+ }
+ target = get_current_target(context);
+ if (target == NULL)
+ {
+ LOG_ERROR("mem2array: no current target");
+ return JIM_ERR;
+ }
+
+ /* Transfer loop */
+
+ /* index counter */
+ n = 0;
+ /* assume ok */
+ e = JIM_OK;
+ while (len) {
+ /* Slurp... in buffer size chunks */
+
+ count = len; /* in objects.. */
+ if (count > (sizeof(buffer)/width)) {
+ count = (sizeof(buffer)/width);
+ }
+
+ retval = target->type->read_memory( target, addr, width, count, buffer );
+ if (retval != ERROR_OK) {
+ /* BOO !*/
+ LOG_ERROR("mem2array: Read @ 0x%08x, w=%d, cnt=%d, failed", addr, width, count);
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: cannot read memory", NULL);
+ e = JIM_ERR;
+ len = 0;
+ } else {
+ v = 0; /* shut up gcc */
+ for (i = 0 ;i < count ;i++, n++) {
+ switch (width) {
+ case 4:
+ v = target_buffer_get_u32(target, &buffer[i*width]);
+ break;
+ case 2:
+ v = target_buffer_get_u16(target, &buffer[i*width]);
+ break;
+ case 1:
+ v = buffer[i] & 0x0ff;
+ break;
+ }
+ new_int_array_element(interp, varname, n, v);
+ }
+ len -= count;
+ }
+ }
+
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+
+ return JIM_OK;
+}
+
+static int get_int_array_element(Jim_Interp * interp, const char *varname, int idx, u32 *val)
+{
+ char *namebuf;
+ Jim_Obj *nameObjPtr, *valObjPtr;
+ int result;
+ long l;
+
+ namebuf = alloc_printf("%s(%d)", varname, idx);
+ if (!namebuf)
+ return JIM_ERR;
+
+ nameObjPtr = Jim_NewStringObj(interp, namebuf, -1);
+ if (!nameObjPtr)
+ {
+ free(namebuf);
+ return JIM_ERR;
+ }
+
+ Jim_IncrRefCount(nameObjPtr);
+ valObjPtr = Jim_GetVariable(interp, nameObjPtr, JIM_ERRMSG);
+ Jim_DecrRefCount(interp, nameObjPtr);
+ free(namebuf);
+ if (valObjPtr == NULL)
+ return JIM_ERR;
+
+ result = Jim_GetLong(interp, valObjPtr, &l);
+ /* printf("%s(%d) => 0%08x\n", varname, idx, val); */
+ *val = l;
+ return result;
+}
+
+static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+ target_t *target;
+ command_context_t *context;
+ long l;
+ u32 width;
+ int len;
+ u32 addr;
+ u32 count;
+ u32 v;
+ const char *varname;
+ u8 buffer[4096];
+ int n, e, retval;
+
+ /* argv[1] = name of array to get the data
+ * argv[2] = desired width
+ * argv[3] = memory address
+ * argv[4] = count to write
+ */
+ if (argc != 5) {
+ Jim_WrongNumArgs(interp, 1, argv, "varname width addr nelems");
+ return JIM_ERR;
+ }
+ varname = Jim_GetString(argv[1], &len);
+ /* given "foo" get space for worse case "foo(%d)" .. add 20 */
+
+ e = Jim_GetLong(interp, argv[2], &l);
+ width = l;
+ if (e != JIM_OK) {
+ return e;
+ }
+
+ e = Jim_GetLong(interp, argv[3], &l);
+ addr = l;
+ if (e != JIM_OK) {
+ return e;
+ }
+ e = Jim_GetLong(interp, argv[4], &l);
+ len = l;
+ if (e != JIM_OK) {
+ return e;
+ }
+ switch (width) {
+ case 8:
+ width = 1;
+ break;
+ case 16:
+ width = 2;
+ break;
+ case 32:
+ width = 4;
+ break;
+ default:
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings( interp, Jim_GetResult(interp), "Invalid width param, must be 8/16/32", NULL );
+ return JIM_ERR;
+ }
+ if (len == 0) {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: zero width read?", NULL);
+ return JIM_ERR;
+ }
+ if ((addr + (len * width)) < addr) {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: addr + len - wraps to zero?", NULL);
+ return JIM_ERR;
+ }
+ /* absurd transfer size? */
+ if (len > 65536) {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "array2mem: absurd > 64K item request", NULL);
+ return JIM_ERR;
+ }
+
+ if ((width == 1) ||
+ ((width == 2) && ((addr & 1) == 0)) ||
+ ((width == 4) && ((addr & 3) == 0))) {
+ /* all is well */
+ } else {
+ char buf[100];
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ sprintf(buf, "array2mem address: 0x%08x is not aligned for %d byte reads", addr, width);
+ Jim_AppendStrings(interp, Jim_GetResult(interp), buf , NULL);
+ return JIM_ERR;
+ }
+
+ context = Jim_GetAssocData(interp, "context");
+ if (context == NULL)
+ {
+ LOG_ERROR("array2mem: no command context");
+ return JIM_ERR;
+ }
+ target = get_current_target(context);
+ if (target == NULL)
+ {
+ LOG_ERROR("array2mem: no current target");
+ return JIM_ERR;
+ }
+
+ /* Transfer loop */
+
+ /* index counter */
+ n = 0;
+ /* assume ok */
+ e = JIM_OK;
+ while (len) {
+ /* Slurp... in buffer size chunks */
+
+ count = len; /* in objects.. */
+ if (count > (sizeof(buffer)/width)) {
+ count = (sizeof(buffer)/width);
+ }
+
+ v = 0; /* shut up gcc */
+ for (unsigned i = 0 ;i < count ;i++, n++) {
+ get_int_array_element(interp, varname, n, &v);
+ switch (width) {
+ case 4:
+ target_buffer_set_u32(target, &buffer[i*width], v);
+ break;
+ case 2:
+ target_buffer_set_u16(target, &buffer[i*width], v);
+ break;
+ case 1:
+ buffer[i] = v & 0x0ff;
+ break;
+ }
+ }
+ len -= count;
+
+ retval = target->type->write_memory(target, addr, width, count, buffer);
+ if (retval != ERROR_OK) {
+ /* BOO !*/
+ LOG_ERROR("array2mem: Write @ 0x%08x, w=%d, cnt=%d, failed", addr, width, count);
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "mem2array: cannot read memory", NULL);
+ e = JIM_ERR;
+ len = 0;
+ }
+ }
+
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+
+ return JIM_OK;
+}
+
+int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args)
+{
+ int retval;
+ scan_field_t *fields;
+ int num_fields;
+ int field_count = 0;
+ int i, e;
+ long device;
+
+ /* args[1] = device
+ * args[2] = num_bits
+ * args[3] = hex string
+ * ... repeat num bits and hex string ...
+ */
+ if ((argc < 4) || ((argc % 2)!=0))
+ {
+ Jim_WrongNumArgs(interp, 1, args, "<device> <num_bits1> <value1> <num_bits2> <value2> ...");
+ return JIM_ERR;
+ }
+
+ for (i = 2; i < argc; i+=2)
+ {
+ long bits;
+
+ e = Jim_GetLong(interp, args[i], &bits);
+ if (e != JIM_OK)
+ return e;
+ }
+
+ e = Jim_GetLong(interp, args[1], &device);
+ if (e != JIM_OK)
+ return e;
+
+ num_fields=(argc-2)/2;
+ fields = malloc(sizeof(scan_field_t) * num_fields);
+ for (i = 2; i < argc; i+=2)
+ {
+ long bits;
+ int len;
+ const char *str;
+
+ Jim_GetLong(interp, args[i], &bits);
+ str = Jim_GetString(args[i+1], &len);
+
+ fields[field_count].num_bits = bits;
+ fields[field_count].out_value = malloc(CEIL(bits, 8));
+ str_to_buf(str, len, fields[field_count].out_value, bits, 0);
+ fields[field_count].in_value = fields[field_count].out_value;
+ }
+
+ jtag_add_dr_scan(num_fields, fields, TAP_INVALID);
+ retval = jtag_execute_queue();
+ if (retval != ERROR_OK)
+ {
+ Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
+ Jim_AppendStrings(interp, Jim_GetResult(interp), "drscan: jtag execute failed", NULL);
+ return JIM_ERR;
+ }
+
+ field_count=0;
+ Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
+ for (i = 2; i < argc; i+=2)
+ {
+ long bits;
+ char *str;
+
+ Jim_GetLong(interp, args[i], &bits);
+ str = buf_to_str(fields[field_count].in_value, bits, 16);
+ free(fields[field_count].out_value);
+
+ Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str)));
+ free(str);
+ field_count++;
+ }
+
+ Jim_SetResult(interp, list);
+
+ free(fields);
+
+ return JIM_OK;
+}
+
+static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+
+ if (argc != 1) {
+ Jim_WrongNumArgs(interp, 1, argv, "no arguments to flash_banks command");
+ return JIM_ERR;
+ }
+
+ unsigned flash_banks = flash_get_bank_count();
+ if (!flash_banks)
+ {
+ return JIM_ERR;
+ }
+
+ Jim_Obj *list=Jim_NewListObj(interp, NULL, 0);
+ for (unsigned i = 0; i < flash_banks; i++)
+ {
+ flash_bank_t *p = get_flash_bank_by_num(i);
+ Jim_Obj *elem=Jim_NewListObj(interp, NULL, 0);
+
+ Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "name", -1));
+ Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->driver->name, -1));
+ Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "base", -1));
+ Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->base));
+ Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "size", -1));
+ Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->size));
+ Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "bus_width", -1));
+ Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->bus_width));
+ Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "chip_width", -1));
+ Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->chip_width));
+
+ Jim_ListAppendElement(interp, list, elem);
+ }
+
+ Jim_SetResult(interp, list);
+
+ return JIM_OK;
+}
+
+int tclapi_register_commands(struct command_context_s *cmd_ctx)
+{
+ register_jim(cmd_ctx, "ocd_mem2array", &jim_mem2array,
+ "read memory and return as a TCL array for script processing");
+ register_jim(cmd_ctx, "ocd_array2mem", &jim_array2mem,
+ "convert a TCL array to memory locations and write the values");
+ register_jim(cmd_ctx, "drscan", &Jim_Command_drscan,
+ "execute DR scan <device> <num_bits> <value> <num_bits1> <value2> ...");
+ register_jim(cmd_ctx, "ocd_flash_banks", &jim_flash_banks,
+ "return information about the flash banks");
+ return ERROR_OK;
+}
Added: trunk/src/helper/tclapi.h
===================================================================
--- trunk/src/helper/tclapi.h 2009-05-10 19:02:07 UTC (rev 1690)
+++ trunk/src/helper/tclapi.h 2009-05-10 19:44:38 UTC (rev 1691)
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 2009 by Zachary T Welch <zw...@su...> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef TCLAPI_H
+#define TCLAPI_H
+
+#include "command.h"
+
+int tclapi_register_commands(struct command_context_s *ctx);
+
+#endif // TCLAPI_H
Modified: trunk/src/openocd.c
===================================================================
--- trunk/src/openocd.c 2009-05-10 19:02:07 UTC (rev 1690)
+++ trunk/src/openocd.c 2009-05-10 19:44:38 UTC (rev 1691)
@@ -41,6 +41,7 @@
#include "mflash.h"
#include "command.h"
+#include "tclapi.h"
#include "server.h"
#include "telnet_server.h"
#include "gdb_server.h"
@@ -202,6 +203,7 @@
telnet_register_commands(cmd_ctx);
gdb_register_commands(cmd_ctx);
tcl_register_commands(cmd_ctx); /* tcl server commands */
+ tclapi_register_commands(cmd_ctx); /* misc tcl commands */
log_register_commands(cmd_ctx);
jtag_register_commands(cmd_ctx);
xsvf_register_commands(cmd_ctx);
|
|
From: oharboe at B. <oh...@ma...> - 2009-05-10 21:02:10
|
Author: oharboe
Date: 2009-05-10 21:02:07 +0200 (Sun, 10 May 2009)
New Revision: 1690
Modified:
trunk/src/target/arm720t.c
trunk/src/target/arm7_9_common.c
trunk/src/target/arm7_9_common.h
trunk/src/target/arm7tdmi.c
trunk/src/target/arm920t.c
trunk/src/target/arm926ejs.c
trunk/src/target/arm9tdmi.c
trunk/src/target/armv4_5.c
trunk/src/target/armv4_5.h
trunk/src/target/armv4_5_cache.c
trunk/src/target/armv4_5_mmu.c
Log:
David Brownell <da...@pa...> whitespace fixes.
Modified: trunk/src/target/arm720t.c
===================================================================
--- trunk/src/target/arm720t.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/arm720t.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -113,13 +113,12 @@
fields[0].num_bits = 1;
fields[0].out_value = &instruction_buf;
fields[0].in_value = NULL;
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = out_buf;
fields[1].in_value = NULL;
-
+
if (in)
{
u8 tmp[4];
Modified: trunk/src/target/arm7_9_common.c
===================================================================
--- trunk/src/target/arm7_9_common.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/arm7_9_common.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -1287,7 +1287,7 @@
/* iterate through processor modes (User, FIQ, IRQ, SVC, ABT, UND)
* SYS shares registers with User, so we don't touch SYS
*/
- for(i = 0; i < 6; i++)
+ for (i = 0; i < 6; i++)
{
u32 mask = 0;
u32* reg_p[16];
Modified: trunk/src/target/arm7_9_common.h
===================================================================
--- trunk/src/target/arm7_9_common.h 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/arm7_9_common.h 2009-05-10 19:02:07 UTC (rev 1690)
@@ -41,10 +41,10 @@
typedef struct arm7_9_common_s
{
u32 common_magic;
-
+
arm_jtag_t jtag_info;
reg_cache_t *eice_cache;
-
+
u32 arm_bkpt;
u16 thumb_bkpt;
int sw_breakpoints_added;
@@ -58,32 +58,32 @@
int dbgreq_adjust_pc;
int use_dbgrq;
int need_bypass_before_restart;
-
+
etm_context_t *etm_ctx;
-
+
int has_single_step;
int has_monitor_mode;
int has_vector_catch;
-
+
int debug_entry_from_reset;
-
+
struct working_area_s *dcc_working_area;
-
+
int fast_memory_access;
int dcc_downloads;
int (*examine_debug_reason)(target_t *target);
-
+
void (*change_to_arm)(target_t *target, u32 *r0, u32 *pc);
-
+
void (*read_core_regs)(target_t *target, u32 mask, u32 *core_regs[16]);
void (*read_core_regs_target_buffer)(target_t *target, u32 mask, void *buffer, int size);
void (*read_xpsr)(target_t *target, u32 *xpsr, int spsr);
-
+
void (*write_xpsr)(target_t *target, u32 xpsr, int spsr);
void (*write_xpsr_im8)(target_t *target, u8 xpsr_im, int rot, int spsr);
void (*write_core_regs)(target_t *target, u32 mask, u32 core_regs[16]);
-
+
void (*load_word_regs)(target_t *target, u32 mask);
void (*load_hword_reg)(target_t *target, int num);
void (*load_byte_reg)(target_t *target, int num);
@@ -91,22 +91,22 @@
void (*store_word_regs)(target_t *target, u32 mask);
void (*store_hword_reg)(target_t *target, int num);
void (*store_byte_reg)(target_t *target, int num);
-
+
void (*write_pc)(target_t *target, u32 pc);
void (*branch_resume)(target_t *target);
void (*branch_resume_thumb)(target_t *target);
-
+
void (*enable_single_step)(target_t *target, u32 next_pc);
void (*disable_single_step)(target_t *target);
-
+
void (*set_special_dbgrq)(target_t *target);
void (*pre_debug_entry)(target_t *target);
void (*post_debug_entry)(target_t *target);
-
+
void (*pre_restore_context)(target_t *target);
void (*post_restore_context)(target_t *target);
-
+
armv4_5_common_t armv4_5_common;
void *arch_info;
Modified: trunk/src/target/arm7tdmi.c
===================================================================
--- trunk/src/target/arm7tdmi.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/arm7tdmi.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -115,13 +115,11 @@
fields[0].num_bits = 1;
fields[0].out_value = NULL;
fields[0].in_value = &breakpoint;
-
fields[1].tap = arm7_9->jtag_info.tap;
fields[1].num_bits = 32;
fields[1].out_value = NULL;
fields[1].in_value = databus;
-
if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
{
@@ -194,15 +192,12 @@
fields[0].num_bits = 1;
fields[0].out_value = NULL;
fields[0].in_value = NULL;
-
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = NULL;
u8 tmp[4];
fields[1].in_value = tmp;
-
jtag_add_dr_scan_now(2, fields, TAP_INVALID);
@@ -286,14 +281,12 @@
fields[0].num_bits = 1;
fields[0].out_value = NULL;
fields[0].in_value = NULL;
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = NULL;
u8 tmp[4];
fields[1].in_value = tmp;
-
jtag_add_dr_scan_now(2, fields, TAP_INVALID);
Modified: trunk/src/target/arm920t.c
===================================================================
--- trunk/src/target/arm920t.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/arm920t.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -114,25 +114,21 @@
fields[0].num_bits = 1;
fields[0].out_value = &access_type_buf;
fields[0].in_value = NULL;
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = NULL;
fields[1].in_value = NULL;
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 6;
fields[2].out_value = ®_addr_buf;
fields[2].in_value = NULL;
-
fields[3].tap = jtag_info->tap;
fields[3].num_bits = 1;
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;
-
jtag_add_dr_scan(4, fields, TAP_INVALID);
@@ -171,43 +167,23 @@
fields[0].tap = jtag_info->tap;
fields[0].num_bits = 1;
fields[0].out_value = &access_type_buf;
-
fields[0].in_value = NULL;
-
-
-
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = value_buf;
-
fields[1].in_value = NULL;
-
-
-
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 6;
fields[2].out_value = ®_addr_buf;
-
fields[2].in_value = NULL;
-
-
-
-
fields[3].tap = jtag_info->tap;
fields[3].num_bits = 1;
fields[3].out_value = &nr_w_buf;
-
fields[3].in_value = NULL;
-
-
-
-
jtag_add_dr_scan(4, fields, TAP_INVALID);
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
@@ -238,43 +214,23 @@
fields[0].tap = jtag_info->tap;
fields[0].num_bits = 1;
fields[0].out_value = &access_type_buf;
-
fields[0].in_value = NULL;
-
-
-
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = cp15_opcode_buf;
-
fields[1].in_value = NULL;
-
-
-
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 6;
fields[2].out_value = ®_addr_buf;
-
fields[2].in_value = NULL;
-
-
-
-
fields[3].tap = jtag_info->tap;
fields[3].num_bits = 1;
fields[3].out_value = &nr_w_buf;
-
fields[3].in_value = NULL;
-
-
-
-
jtag_add_dr_scan(4, fields, TAP_INVALID);
arm9tdmi_clock_out(jtag_info, arm_opcode, 0, NULL, 0);
@@ -621,7 +577,7 @@
arm920t_common_t *arm920t = arm9tdmi->arch_info;
reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT];
- if((retval = target_halt(target)) != ERROR_OK)
+ if ((retval = target_halt(target)) != ERROR_OK)
{
return retval;
}
@@ -633,7 +589,7 @@
if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0)
{
embeddedice_read_reg(dbg_stat);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -676,7 +632,7 @@
arm920t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled = 0;
arm920t->armv4_5_mmu.armv4_5_cache.i_cache_enabled = 0;
- if((retval = target_call_event_callbacks(target, TARGET_EVENT_HALTED)) != ERROR_OK)
+ if ((retval = target_call_event_callbacks(target, TARGET_EVENT_HALTED)) != ERROR_OK)
{
return retval;
}
@@ -814,7 +770,7 @@
/* disable MMU and Caches */
arm920t_read_cp15_physical(target, ARM920T_CP15_PHYS_ADDR(0, 0x1, 0), &cp15_ctrl);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -877,7 +833,7 @@
/* read D RAM and CAM content */
arm9tdmi_read_core_regs(target, 0x3fe, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -963,7 +919,7 @@
/* read I RAM and CAM content */
arm9tdmi_read_core_regs(target, 0x3fe, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1066,7 +1022,7 @@
/* disable MMU and Caches */
arm920t_read_cp15_physical(target, ARM920T_CP15_PHYS_ADDR(0, 0x1, 0), &cp15_ctrl);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1076,7 +1032,7 @@
/* read CP15 test state register */
arm920t_read_cp15_physical(target, ARM920T_CP15_PHYS_ADDR(0, 0xf, 0), &cp15c15);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1097,7 +1053,7 @@
/* read D TLB lockdown stored to r1 */
arm9tdmi_read_core_regs(target, 0x2, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1126,7 +1082,7 @@
/* read D TLB CAM content stored to r2-r9 */
arm9tdmi_read_core_regs(target, 0x3fc, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1161,7 +1117,7 @@
/* read D TLB RAM content stored to r2 and r3 */
arm9tdmi_read_core_regs(target, 0xc, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1193,7 +1149,7 @@
/* read I TLB lockdown stored to r1 */
arm9tdmi_read_core_regs(target, 0x2, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1222,7 +1178,7 @@
/* read I TLB CAM content stored to r2-r9 */
arm9tdmi_read_core_regs(target, 0x3fc, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1257,7 +1213,7 @@
/* read I TLB RAM content stored to r2 and r3 */
arm9tdmi_read_core_regs(target, 0xc, regs_p);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -1347,7 +1303,7 @@
command_print(cmd_ctx, "couldn't access reg %i", address);
return ERROR_OK;
}
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
Modified: trunk/src/target/arm926ejs.c
===================================================================
--- trunk/src/target/arm926ejs.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/arm926ejs.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -133,7 +133,7 @@
buf_set_u32(address_buf, 0, 14, address);
jtag_add_end_state(TAP_IDLE);
- if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
{
return retval;
}
@@ -151,20 +151,16 @@
fields[1].out_value = &access;
fields[1].in_value = &access;
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 14;
fields[2].out_value = address_buf;
fields[2].in_value = NULL;
-
-
fields[3].tap = jtag_info->tap;
fields[3].num_bits = 1;
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;
-
jtag_add_dr_scan(4, fields, TAP_INVALID);
/*TODO: add timeout*/
@@ -177,7 +173,7 @@
*value=le_to_h_u32(tmp);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -209,7 +205,7 @@
buf_set_u32(value_buf, 0, 32, value);
jtag_add_end_state(TAP_IDLE);
- if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
{
return retval;
}
@@ -218,43 +214,23 @@
fields[0].tap = jtag_info->tap;
fields[0].num_bits = 32;
fields[0].out_value = value_buf;
-
fields[0].in_value = NULL;
-
-
-
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 1;
fields[1].out_value = &access;
-
fields[1].in_value = &access;
-
-
-
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 14;
fields[2].out_value = address_buf;
-
fields[2].in_value = NULL;
-
-
-
-
fields[3].tap = jtag_info->tap;
fields[3].num_bits = 1;
fields[3].out_value = &nr_w_buf;
-
fields[3].in_value = NULL;
-
-
-
-
jtag_add_dr_scan(4, fields, TAP_INVALID);
/*TODO: add timeout*/
do
@@ -263,7 +239,7 @@
access = 0;
nr_w_buf = 0;
jtag_add_dr_scan(4, fields, TAP_INVALID);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -595,7 +571,7 @@
arm926ejs_common_t *arm926ejs = arm9tdmi->arch_info;
reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT];
- if((retval = target_halt(target)) != ERROR_OK)
+ if ((retval = target_halt(target)) != ERROR_OK)
{
return retval;
}
@@ -607,7 +583,7 @@
if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0)
{
embeddedice_read_reg(dbg_stat);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -812,7 +788,7 @@
command_print(cmd_ctx, "couldn't access register");
return ERROR_OK;
}
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
Modified: trunk/src/target/arm9tdmi.c
===================================================================
--- trunk/src/target/arm9tdmi.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/arm9tdmi.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -128,41 +128,26 @@
fields[0].tap = arm7_9->jtag_info.tap;
fields[0].num_bits = 32;
fields[0].out_value = NULL;
-
fields[0].in_value = databus;
-
-
-
-
fields[1].tap = arm7_9->jtag_info.tap;
fields[1].num_bits = 3;
fields[1].out_value = NULL;
-
fields[1].in_value = &debug_reason;
-
-
-
-
fields[2].tap = arm7_9->jtag_info.tap;
fields[2].num_bits = 32;
fields[2].out_value = NULL;
-
fields[2].in_value = instructionbus;
-
-
-
-
- if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
{
return retval;
}
arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL);
jtag_add_dr_scan(3, fields, TAP_DRPAUSE);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -206,7 +191,7 @@
buf_set_u32(&sysspeed_buf, 2, 1, 1);
jtag_add_end_state(TAP_DRPAUSE);
- if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
{
return retval;
}
@@ -217,20 +202,16 @@
fields[0].num_bits = 32;
fields[0].out_value = out_buf;
fields[0].in_value = NULL;
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 3;
fields[1].out_value = &sysspeed_buf;
fields[1].in_value = NULL;
-
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 32;
fields[2].out_value = instr_buf;
fields[2].in_value = NULL;
-
if (in)
{
@@ -249,7 +230,7 @@
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -273,7 +254,7 @@
scan_field_t fields[3];
jtag_add_end_state(TAP_DRPAUSE);
- if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
{
return retval;
}
@@ -285,19 +266,16 @@
fields[0].out_value = NULL;
u8 tmp[4];
fields[0].in_value = tmp;
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 3;
fields[1].out_value = NULL;
fields[1].in_value = NULL;
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 32;
fields[2].out_value = NULL;
fields[2].in_value = NULL;
-
jtag_add_dr_scan_now(3, fields, TAP_INVALID);
@@ -307,7 +285,7 @@
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -338,7 +316,7 @@
scan_field_t fields[3];
jtag_add_end_state(TAP_DRPAUSE);
- if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
{
return retval;
}
@@ -350,19 +328,16 @@
fields[0].out_value = NULL;
u8 tmp[4];
fields[0].in_value = tmp;
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 3;
fields[1].out_value = NULL;
fields[1].in_value = NULL;
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 32;
fields[2].out_value = NULL;
fields[2].in_value = NULL;
-
jtag_add_dr_scan_now(3, fields, TAP_INVALID);
@@ -373,7 +348,7 @@
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -435,7 +410,7 @@
/* NOP fetched, BX in Execute (1) */
arm9tdmi_clock_out(jtag_info, ARMV4_5_T_NOP, 0, NULL, 0);
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return;
}
@@ -1047,7 +1022,7 @@
for (i = 0; i < argc; i++)
{
/* go through list of vectors */
- for(j = 0; arm9tdmi_vectors[j].name; j++)
+ for (j = 0; arm9tdmi_vectors[j].name; j++)
{
if (strcmp(args[i], arm9tdmi_vectors[j].name) == 0)
{
Modified: trunk/src/target/armv4_5.c
===================================================================
--- trunk/src/target/armv4_5.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/armv4_5.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -428,23 +428,23 @@
for (i = 0; i < count; i++)
{
- if(thumb)
+ if (thumb)
{
- if((retval = target_read_u16(target, address, &thumb_opcode)) != ERROR_OK)
+ if ((retval = target_read_u16(target, address, &thumb_opcode)) != ERROR_OK)
{
return retval;
}
- if((retval = thumb_evaluate_opcode(thumb_opcode, address, &cur_instruction)) != ERROR_OK)
+ if ((retval = thumb_evaluate_opcode(thumb_opcode, address, &cur_instruction)) != ERROR_OK)
{
return retval;
}
}
else {
- if((retval = target_read_u32(target, address, &opcode)) != ERROR_OK)
+ if ((retval = target_read_u32(target, address, &opcode)) != ERROR_OK)
{
return retval;
}
- if((retval = arm_evaluate_opcode(opcode, address, &cur_instruction)) != ERROR_OK)
+ if ((retval = arm_evaluate_opcode(opcode, address, &cur_instruction)) != ERROR_OK)
{
return retval;
}
@@ -502,7 +502,7 @@
int retval;
armv4_5_common_t *armv4_5 = target->arch_info;
- if((retval = target_wait_state(target, TARGET_HALTED, timeout_ms)) != ERROR_OK)
+ if ((retval = target_wait_state(target, TARGET_HALTED, timeout_ms)) != ERROR_OK)
{
return retval;
}
@@ -564,7 +564,7 @@
for (i = 0; i < num_mem_params; i++)
{
- if((retval = target_write_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
+ if ((retval = target_write_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
{
return retval;
}
@@ -585,7 +585,7 @@
exit(-1);
}
- if((retval = armv4_5_set_core_reg(reg, reg_params[i].value)) != ERROR_OK)
+ if ((retval = armv4_5_set_core_reg(reg, reg_params[i].value)) != ERROR_OK)
{
return retval;
}
@@ -616,7 +616,7 @@
return ERROR_TARGET_FAILURE;
}
- if((retval = target_resume(target, 0, entry_point, 1, 1)) != ERROR_OK)
+ if ((retval = target_resume(target, 0, entry_point, 1, 1)) != ERROR_OK)
{
return retval;
}
@@ -631,7 +631,7 @@
for (i = 0; i < num_mem_params; i++)
{
if (mem_params[i].direction != PARAM_OUT)
- if((retvaltemp = target_read_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
+ if ((retvaltemp = target_read_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
{
retval = retvaltemp;
}
Modified: trunk/src/target/armv4_5.h
===================================================================
--- trunk/src/target/armv4_5.h 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/armv4_5.h 2009-05-10 19:02:07 UTC (rev 1690)
@@ -29,10 +29,10 @@
typedef enum armv4_5_mode
{
- ARMV4_5_MODE_USR = 16,
- ARMV4_5_MODE_FIQ = 17,
- ARMV4_5_MODE_IRQ = 18,
- ARMV4_5_MODE_SVC = 19,
+ ARMV4_5_MODE_USR = 16,
+ ARMV4_5_MODE_FIQ = 17,
+ ARMV4_5_MODE_IRQ = 18,
+ ARMV4_5_MODE_SVC = 19,
ARMV4_5_MODE_ABT = 23,
ARMV4_5_MODE_UND = 27,
ARMV4_5_MODE_SYS = 31,
@@ -58,7 +58,7 @@
cache->reg_list[armv4_5_core_reg_map[mode][num]]
/* offsets into armv4_5 core register cache */
-enum
+enum
{
ARMV4_5_CPSR = 31,
ARMV4_5_SPSR_FIQ = 32,
@@ -85,7 +85,7 @@
typedef struct armv4_5_algorithm_s
{
int common_magic;
-
+
enum armv4_5_mode core_mode;
enum armv4_5_state core_state;
} armv4_5_algorithm_t;
@@ -113,7 +113,7 @@
case ARMV4_5_MODE_UND: return 5; break;
case ARMV4_5_MODE_SYS: return 6; break;
case ARMV4_5_MODE_ANY: return 0; break; /* map MODE_ANY to user mode */
- default:
+ default:
LOG_ERROR("invalid mode value encountered");
return -1;
}
@@ -122,7 +122,7 @@
/* map linear number to mode bits */
static __inline enum armv4_5_mode armv4_5_number_to_mode(int number)
{
- switch(number)
+ switch (number)
{
case 0: return ARMV4_5_MODE_USR; break;
case 1: return ARMV4_5_MODE_FIQ; break;
@@ -131,7 +131,7 @@
case 4: return ARMV4_5_MODE_ABT; break;
case 5: return ARMV4_5_MODE_UND; break;
case 6: return ARMV4_5_MODE_SYS; break;
- default:
+ default:
LOG_ERROR("mode index out of bounds");
return ARMV4_5_MODE_ANY;
}
@@ -149,7 +149,7 @@
/* ARM mode instructions
*/
-
+
/* Store multiple increment after
* Rn: base register
* List: for each bit in list: store register
@@ -239,7 +239,7 @@
* CRm: second coprocessor operand
* op2: Second coprocessor opcode
*/
-#define ARMV4_5_MRC(CP, op1, Rd, CRn, CRm, op2) (0xee100010 | (CRm) | ((op2) << 5) | ((CP) << 8) | ((Rd) << 12) | ((CRn) << 16) | ((op1) << 21))
+#define ARMV4_5_MRC(CP, op1, Rd, CRn, CRm, op2) (0xee100010 | (CRm) | ((op2) << 5) | ((CP) << 8) | ((Rd) << 12) | ((CRn) << 16) | ((op1) << 21))
/* Move to coprocessor from ARM register
* CP: Coprocessor number
@@ -249,7 +249,7 @@
* CRm: second coprocessor operand
* op2: Second coprocessor opcode
*/
-#define ARMV4_5_MCR(CP, op1, Rd, CRn, CRm, op2) (0xee000010 | (CRm) | ((op2) << 5) | ((CP) << 8) | ((Rd) << 12) | ((CRn) << 16) | ((op1) << 21))
+#define ARMV4_5_MCR(CP, op1, Rd, CRn, CRm, op2) (0xee000010 | (CRm) | ((op2) << 5) | ((CP) << 8) | ((Rd) << 12) | ((CRn) << 16) | ((op1) << 21))
/* Breakpoint instruction (ARMv5)
* Im: 16-bit immediate
@@ -259,7 +259,7 @@
/* Thumb mode instructions
*/
-
+
/* Store register (Thumb mode)
* Rd: source register
* Rn: base register
@@ -277,12 +277,12 @@
* List: for each bit in list: store register
*/
#define ARMV4_5_T_LDMIA(Rn, List) ((0xc800 | ((Rn) << 8) | (List)) | ((0xc800 | ((Rn) << 8) | List) << 16))
-
+
/* Load register with PC relative addressing
* Rd: register to load
*/
-#define ARMV4_5_T_LDR_PCREL(Rd) ((0x4800 | ((Rd) << 8)) | ((0x4800 | ((Rd) << 8)) << 16))
-
+#define ARMV4_5_T_LDR_PCREL(Rd) ((0x4800 | ((Rd) << 8)) | ((0x4800 | ((Rd) << 8)) << 16))
+
/* Move hi register (Thumb mode)
* Rd: destination register
* Rm: source register
Modified: trunk/src/target/armv4_5_cache.c
===================================================================
--- trunk/src/target/armv4_5_cache.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/armv4_5_cache.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -63,7 +63,7 @@
M = (cache_type_reg & 0x4) >> 2;
len = (cache_type_reg & 0x3);
multiplier = 2 + M;
-
+
if ((assoc != 0) || (M != 1)) /* assoc 0 and M 1 means cache absent */
{
/* cache is present */
@@ -85,7 +85,7 @@
{
cache->i_size = cache->d_u_size;
}
-
+
return ERROR_OK;
}
@@ -96,21 +96,21 @@
command_print(cmd_ctx, "cache not yet identified");
return ERROR_OK;
}
-
- command_print(cmd_ctx, "cache type: 0x%1.1x, %s", armv4_5_cache->ctype,
+
+ command_print(cmd_ctx, "cache type: 0x%1.1x, %s", armv4_5_cache->ctype,
(armv4_5_cache->separate) ? "separate caches" : "unified cache");
- command_print(cmd_ctx, "D-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
+ command_print(cmd_ctx, "D-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
armv4_5_cache->d_u_size.linelen,
armv4_5_cache->d_u_size.associativity,
armv4_5_cache->d_u_size.nsets,
armv4_5_cache->d_u_size.cachesize);
- command_print(cmd_ctx, "I-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
+ command_print(cmd_ctx, "I-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
armv4_5_cache->i_size.linelen,
armv4_5_cache->i_size.associativity,
armv4_5_cache->i_size.nsets,
armv4_5_cache->i_size.cachesize);
-
+
return ERROR_OK;
}
Modified: trunk/src/target/armv4_5_mmu.c
===================================================================
--- trunk/src/target/armv4_5_mmu.c 2009-05-10 19:01:03 UTC (rev 1689)
+++ trunk/src/target/armv4_5_mmu.c 2009-05-10 19:02:07 UTC (rev 1690)
@@ -89,9 +89,9 @@
(first_lvl_descriptor & 0xfffff000) | ((va & 0x000ffc00) >> 8),
4, 1, (u8*)&second_lvl_descriptor);
}
-
+
second_lvl_descriptor = target_buffer_get_u32(target, (u8*)&second_lvl_descriptor);
-
+
LOG_DEBUG("2nd lvl desc: %8.8x", second_lvl_descriptor);
if ((second_lvl_descriptor & 0x3) == 0)
@@ -163,14 +163,14 @@
/* disable MMU and data (or unified) cache */
armv4_5_mmu->disable_mmu_caches(target, 1, 1, 0);
-
+
retval = armv4_5_mmu->write_memory(target, address, size, count, buffer);
/* reenable MMU / cache */
armv4_5_mmu->enable_mmu_caches(target, armv4_5_mmu->mmu_enabled,
armv4_5_mmu->armv4_5_cache.d_u_cache_enabled,
armv4_5_mmu->armv4_5_cache.i_cache_enabled);
-
+
return retval;
}
@@ -182,7 +182,7 @@
u32 cb;
int domain;
u32 ap;
-
+
if (target->state != TARGET_HALTED)
{
command_print(cmd_ctx, "target must be stopped for \"virt2phys\" command");
@@ -211,11 +211,11 @@
}
return ERROR_OK;
}
-
+
command_print(cmd_ctx, "0x%8.8x -> 0x%8.8x, type: %s, cb: %i, domain: %i, ap: %2.2x",
va, pa, armv4_5_mmu_page_type_names[type], cb, domain, ap);
- }
-
+ }
+
return ERROR_OK;
}
@@ -272,7 +272,7 @@
break;
case ERROR_TARGET_NOT_HALTED:
command_print(cmd_ctx, "error: target must be halted for memory accesses");
- break;
+ break;
case ERROR_TARGET_DATA_ABORT:
command_print(cmd_ctx, "error: access caused data abort, system possibly corrupted");
break;
@@ -287,7 +287,7 @@
{
if (i%8 == 0)
output_len += snprintf(output + output_len, 128 - output_len, "0x%8.8x: ", address + (i*size));
-
+
switch (size)
{
case 4:
@@ -309,7 +309,7 @@
}
free(buffer);
-
+
return ERROR_OK;
}
@@ -365,7 +365,7 @@
break;
default:
command_print(cmd_ctx, "error: unknown error");
- }
+ }
return ERROR_OK;
}
|
|
From: oharboe at B. <oh...@ma...> - 2009-05-10 21:01:04
|
Author: oharboe
Date: 2009-05-10 21:01:03 +0200 (Sun, 10 May 2009)
New Revision: 1689
Modified:
trunk/src/target/arm966e.c
Log:
David Brownell <da...@pa...> whitespace fixes. Testing out on one file first...
Modified: trunk/src/target/arm966e.c
===================================================================
--- trunk/src/target/arm966e.c 2009-05-10 18:01:50 UTC (rev 1688)
+++ trunk/src/target/arm966e.c 2009-05-10 19:01:03 UTC (rev 1689)
@@ -178,7 +178,7 @@
u8 nr_w_buf = 0;
jtag_add_end_state(TAP_IDLE);
- if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
{
return retval;
}
@@ -188,19 +188,16 @@
fields[0].num_bits = 32;
fields[0].out_value = NULL;
fields[0].in_value = NULL;
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 6;
fields[1].out_value = ®_addr_buf;
fields[1].in_value = NULL;
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 1;
fields[2].out_value = &nr_w_buf;
fields[2].in_value = NULL;
-
jtag_add_dr_scan(3, fields, TAP_INVALID);
@@ -213,7 +210,7 @@
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
@@ -237,7 +234,7 @@
buf_set_u32(value_buf, 0, 32, value);
jtag_add_end_state(TAP_IDLE);
- if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
{
return retval;
}
@@ -246,33 +243,18 @@
fields[0].tap = jtag_info->tap;
fields[0].num_bits = 32;
fields[0].out_value = value_buf;
-
fields[0].in_value = NULL;
-
-
-
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 6;
fields[1].out_value = ®_addr_buf;
-
fields[1].in_value = NULL;
-
-
-
-
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 1;
fields[2].out_value = &nr_w_buf;
-
fields[2].in_value = NULL;
-
-
-
-
jtag_add_dr_scan(3, fields, TAP_INVALID);
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
@@ -319,7 +301,7 @@
command_print(cmd_ctx, "couldn't access reg %i", address);
return ERROR_OK;
}
- if((retval = jtag_execute_queue()) != ERROR_OK)
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
}
|
|
From: oharboe at B. <oh...@ma...> - 2009-05-10 20:01:51
|
Author: oharboe
Date: 2009-05-10 20:01:50 +0200 (Sun, 10 May 2009)
New Revision: 1688
Modified:
trunk/src/target/arm11.c
Log:
David Brownell <da...@pa...> fix warnings
Modified: trunk/src/target/arm11.c
===================================================================
--- trunk/src/target/arm11.c 2009-05-10 12:55:16 UTC (rev 1687)
+++ trunk/src/target/arm11.c 2009-05-10 18:01:50 UTC (rev 1688)
@@ -1402,7 +1402,7 @@
for (size_t i = 0; i < 16; i++)
{
context[i] = buf_get_u32((u8*)(&arm11->reg_values[i]),0,32);
- LOG_DEBUG("Save %i: 0x%x",i,context[i]);
+ LOG_DEBUG("Save %zi: 0x%x",i,context[i]);
}
cpsr = buf_get_u32((u8*)(arm11->reg_values+ARM11_RC_CPSR),0,32);
|
|
From: <oh...@ma...> - 2009-05-10 14:55:18
|
Author: oharboe
Date: 2009-05-10 14:55:16 +0200 (Sun, 10 May 2009)
New Revision: 1687
Modified:
trunk/src/helper/fileio.c
trunk/src/helper/fileio.h
Log:
Michael Bruck <mb...@di...> use more const
Modified: trunk/src/helper/fileio.c
===================================================================
--- trunk/src/helper/fileio.c 2009-05-09 09:30:00 UTC (rev 1686)
+++ trunk/src/helper/fileio.c 2009-05-10 12:55:16 UTC (rev 1687)
@@ -43,9 +43,7 @@
#include <errno.h>
#include <ctype.h>
-int fileio_dispatch_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read);
-
-int fileio_open_local(fileio_t *fileio)
+static inline int fileio_open_local(fileio_t *fileio)
{
char access[4];
@@ -112,7 +110,7 @@
return ERROR_OK;
}
-int fileio_open(fileio_t *fileio, char *url, enum fileio_access access, enum fileio_type type)
+int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, enum fileio_type type)
{
int retval = ERROR_OK;
@@ -125,7 +123,7 @@
return retval;
}
-int fileio_close_local(fileio_t *fileio)
+static inline int fileio_close_local(fileio_t *fileio)
{
int retval;
if ((retval = fclose(fileio->file)) != 0)
@@ -169,7 +167,7 @@
return ERROR_OK;
}
-int fileio_local_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read)
+static inline int fileio_local_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read)
{
*size_read = fread(buffer, 1, size, fileio->file);
@@ -194,7 +192,7 @@
return ERROR_OK;
}
-int fileio_local_fgets(fileio_t *fileio, u32 size, char *buffer)
+static inline int fileio_local_fgets(fileio_t *fileio, u32 size, char *buffer)
{
if( fgets(buffer, size, fileio->file) == NULL)
return ERROR_FILEIO_OPERATION_FAILED;
@@ -207,14 +205,14 @@
return fileio_local_fgets(fileio, size, buffer);
}
-int fileio_local_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written)
+static inline int fileio_local_write(fileio_t *fileio, u32 size, const u8 *buffer, u32 *size_written)
{
*size_written = fwrite(buffer, 1, size, fileio->file);
return ERROR_OK;
}
-int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written)
+int fileio_write(fileio_t *fileio, u32 size, const u8 *buffer, u32 *size_written)
{
int retval;
Modified: trunk/src/helper/fileio.h
===================================================================
--- trunk/src/helper/fileio.h 2009-05-09 09:30:00 UTC (rev 1686)
+++ trunk/src/helper/fileio.h 2009-05-10 12:55:16 UTC (rev 1687)
@@ -62,12 +62,12 @@
FILE *file;
} fileio_t;
-extern int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written);
+extern int fileio_write(fileio_t *fileio, u32 size, const u8 *buffer, u32 *size_written);
extern int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read);
extern int fileio_fgets(fileio_t *fileio, u32 size, char *buffer);
extern int fileio_seek(fileio_t *fileio, u32 position);
extern int fileio_close(fileio_t *fileio);
-extern int fileio_open(fileio_t *fileio, char *url, enum fileio_access access, enum fileio_type type);
+extern int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, enum fileio_type type);
extern int fileio_read_u32(fileio_t *fileio, u32 *data);
extern int fileio_write_u32(fileio_t *fileio, u32 data);
|
|
From: <oh...@ma...> - 2009-05-09 11:30:04
|
Author: oharboe
Date: 2009-05-09 11:30:00 +0200 (Sat, 09 May 2009)
New Revision: 1686
Modified:
trunk/src/helper/binarybuffer.c
trunk/src/helper/binarybuffer.h
Log:
Michael Bruck <mb...@di...> use more const
Modified: trunk/src/helper/binarybuffer.c
===================================================================
--- trunk/src/helper/binarybuffer.c 2009-05-09 07:36:19 UTC (rev 1685)
+++ trunk/src/helper/binarybuffer.c 2009-05-09 09:30:00 UTC (rev 1686)
@@ -53,7 +53,7 @@
};
-u8* buf_cpy(u8 *from, u8 *to, int size)
+u8* buf_cpy(const u8 *from, u8 *to, int size)
{
unsigned int num_bytes = CEIL(size, 8);
unsigned int i;
@@ -73,7 +73,7 @@
return to;
}
-int buf_cmp(u8 *buf1, u8 *buf2, int size)
+int buf_cmp(const u8 *buf1, const u8 *buf2, int size)
{
int num_bytes = CEIL(size, 8);
int i;
@@ -100,7 +100,7 @@
return 0;
}
-int buf_cmp_mask(u8 *buf1, u8 *buf2, u8 *mask, int size)
+int buf_cmp_mask(const u8 *buf1, const u8 *buf2, const u8 *mask, int size)
{
int num_bytes = CEIL(size, 8);
int i;
@@ -143,7 +143,7 @@
return buf;
}
-u8* buf_set_buf(u8 *src, int src_start, u8 *dst, int dst_start, int len)
+u8* buf_set_buf(const u8 *src, int src_start, u8 *dst, int dst_start, int len)
{
int src_idx = src_start, dst_idx = dst_start;
int i;
Modified: trunk/src/helper/binarybuffer.h
===================================================================
--- trunk/src/helper/binarybuffer.h 2009-05-09 07:36:19 UTC (rev 1685)
+++ trunk/src/helper/binarybuffer.h 2009-05-09 09:30:00 UTC (rev 1686)
@@ -30,7 +30,7 @@
*/
/* inlining this will help show what fn that is taking time during profiling. */
-static __inline void buf_set_u32(u8* buffer, unsigned int first, unsigned int num, u32 value)
+static inline void buf_set_u32(u8* buffer, unsigned int first, unsigned int num, u32 value)
{
if ((num==32)&&(first==0))
{
@@ -51,7 +51,7 @@
}
}
}
-static __inline u32 buf_get_u32(u8* buffer, unsigned int first, unsigned int num)
+static inline u32 buf_get_u32(const u8* buffer, unsigned int first, unsigned int num)
{
if ((num==32)&&(first==0))
{
@@ -73,12 +73,12 @@
extern u32 flip_u32(u32 value, unsigned int num);
-extern int buf_cmp(u8 *buf1, u8 *buf2, int size);
-extern int buf_cmp_mask(u8 *buf1, u8 *buf2, u8 *mask, int size);
-extern u8* buf_cpy(u8 *from, u8 *to, int size);
+extern int buf_cmp(const u8 *buf1, const u8 *buf2, int size);
+extern int buf_cmp_mask(const u8 *buf1, const u8 *buf2, const u8 *mask, int size);
+extern u8* buf_cpy(const u8 *from, u8 *to, int size);
extern u8* buf_set_ones(u8 *buf, int count);
-extern u8* buf_set_buf(u8 *src, int src_start, u8 *dst, int dst_start, int len);
+extern u8* buf_set_buf(const u8 *src, int src_start, u8 *dst, int dst_start, int len);
extern int str_to_buf(const char *str, int len, u8 *bin_buf, int buf_size, int radix);
extern char* buf_to_str(const u8 *buf, int size, int radix);
@@ -89,7 +89,7 @@
#define CEIL(m, n) ((m + n - 1) / n)
/* read a u32 from a buffer in target memory endianness */
-static __inline u32 fast_target_buffer_get_u32(u8 *buffer, int little)
+static inline u32 fast_target_buffer_get_u32(const u8 *buffer, int little)
{
if (little)
return le_to_h_u32(buffer);
|
|
From: <oh...@ma...> - 2009-05-09 09:36:22
|
Author: oharboe
Date: 2009-05-09 09:36:19 +0200 (Sat, 09 May 2009)
New Revision: 1685
Modified:
trunk/src/target/arm11.c
trunk/src/target/arm11.h
trunk/src/target/arm11_dbgtap.c
Log:
Michael Bruck <mb...@di...> ARM11 C99 updates
Modified: trunk/src/target/arm11.c
===================================================================
--- trunk/src/target/arm11.c 2009-05-08 21:03:28 UTC (rev 1684)
+++ trunk/src/target/arm11.c 2009-05-09 07:36:19 UTC (rev 1685)
@@ -373,12 +373,11 @@
{
FNC_INFO;
- {size_t i;
- for(i = 0; i < asizeof(arm11->reg_values); i++)
+ for (size_t i = 0; i < asizeof(arm11->reg_values); i++)
{
arm11->reg_list[i].valid = 1;
arm11->reg_list[i].dirty = 0;
- }}
+ }
/* Save DSCR */
CHECK_RETVAL(arm11_read_DSCR(arm11, &R(DSCR)));
@@ -454,12 +453,11 @@
/** \todo TODO: handle other mode registers */
- {size_t i;
- for (i = 0; i < 15; i++)
+ for (size_t i = 0; i < 15; i++)
{
/* MCR p14,0,R?,c0,c5,0 */
arm11_run_instr_data_from_core(arm11, 0xEE000E15 | (i << 12), &R(RX + i), 1);
- }}
+ }
/* save rDTR */
@@ -528,8 +526,7 @@
return;
}
- {size_t i;
- for(i = 0; i < ARM11_REGCACHE_COUNT; i++)
+ for (size_t i = 0; i < ARM11_REGCACHE_COUNT; i++)
{
if (!arm11->reg_list[i].valid)
{
@@ -548,7 +545,7 @@
LOG_DEBUG("%8s %08x (INVALID)", arm11_reg_defs[i].name, arm11->reg_values[i]);
}
}
- }}
+ }
}
/** Restore processor state
@@ -565,8 +562,8 @@
/** \todo TODO: handle other mode registers */
/* restore R1 - R14 */
- {size_t i;
- for (i = 1; i < 15; i++)
+
+ for (size_t i = 1; i < 15; i++)
{
if (!arm11->reg_list[ARM11_RC_RX + i].dirty)
continue;
@@ -575,7 +572,7 @@
arm11_run_instr_data_to_core1(arm11, 0xee100e15 | (i << 12), R(RX + i));
// LOG_DEBUG("RESTORE R" ZU " %08x", i, R(RX + i));
- }}
+ }
arm11_run_instr_data_finish(arm11);
@@ -650,15 +647,14 @@
void arm11_record_register_history(arm11_common_t * arm11)
{
- {size_t i;
- for(i = 0; i < ARM11_REGCACHE_COUNT; i++)
+ for (size_t i = 0; i < ARM11_REGCACHE_COUNT; i++)
{
arm11->reg_history[i].value = arm11->reg_values[i];
arm11->reg_history[i].valid = arm11->reg_list[i].valid;
arm11->reg_list[i].valid = 0;
arm11->reg_list[i].dirty = 0;
- }}
+ }
}
@@ -1072,22 +1068,20 @@
*reg_list_size = ARM11_GDB_REGISTER_COUNT;
*reg_list = malloc(sizeof(reg_t*) * ARM11_GDB_REGISTER_COUNT);
- {size_t i;
- for (i = 16; i < 24; i++)
+ for (size_t i = 16; i < 24; i++)
{
(*reg_list)[i] = &arm11_gdb_dummy_fp_reg;
- }}
+ }
(*reg_list)[24] = &arm11_gdb_dummy_fps_reg;
- {size_t i;
- for (i = 0; i < ARM11_REGCACHE_COUNT; i++)
+ for (size_t i = 0; i < ARM11_REGCACHE_COUNT; i++)
{
if (arm11_reg_defs[i].gdb_num == -1)
continue;
(*reg_list)[arm11_reg_defs[i].gdb_num] = arm11->reg_list + i;
- }}
+ }
return ERROR_OK;
}
@@ -1123,8 +1117,7 @@
/** \todo TODO: check if dirty is the right choice to force a rewrite on arm11_resume() */
arm11->reg_list[ARM11_RC_R1].dirty = 1;
- {size_t i;
- for (i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
/* ldrb r1, [r0], #1 */
/* ldrb r1, [r0] */
@@ -1136,7 +1129,7 @@
arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1);
*buffer++ = res;
- }}
+ }
break;
@@ -1144,8 +1137,7 @@
{
arm11->reg_list[ARM11_RC_R1].dirty = 1;
- size_t i;
- for (i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
/* ldrh r1, [r0], #2 */
arm11_run_instr_no_data1(arm11,
@@ -1206,8 +1198,7 @@
{
arm11->reg_list[ARM11_RC_R1].dirty = 1;
- {size_t i;
- for (i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
/* MRC p14,0,r1,c0,c5,0 */
arm11_run_instr_data_to_core1(arm11, 0xee101e15, *buffer++);
@@ -1216,7 +1207,7 @@
/* strb r1, [r0] */
arm11_run_instr_no_data1(arm11,
!arm11_config_memrw_no_increment ? 0xe4c01001 : 0xe5c01000);
- }}
+ }
break;
}
@@ -1225,8 +1216,7 @@
{
arm11->reg_list[ARM11_RC_R1].dirty = 1;
- size_t i;
- for (i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
u16 value;
memcpy(&value, buffer + count * sizeof(u16), sizeof(u16));
@@ -1389,7 +1379,6 @@
u32 context[16];
u32 cpsr;
int exit_breakpoint_size = 0;
- int i;
int retval = ERROR_OK;
LOG_DEBUG("Running algorithm");
@@ -1410,7 +1399,7 @@
// return ERROR_FAIL;
// Save regs
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
{
context[i] = buf_get_u32((u8*)(&arm11->reg_values[i]),0,32);
LOG_DEBUG("Save %i: 0x%x",i,context[i]);
@@ -1419,13 +1408,13 @@
cpsr = buf_get_u32((u8*)(arm11->reg_values+ARM11_RC_CPSR),0,32);
LOG_DEBUG("Save CPSR: 0x%x", cpsr);
- for (i = 0; i < num_mem_params; i++)
+ for (int i = 0; i < num_mem_params; i++)
{
target_write_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value);
}
// Set register parameters
- for (i = 0; i < num_reg_params; i++)
+ for (int i = 0; i < num_reg_params; i++)
{
reg_t *reg = register_get_by_name(arm11->core_cache, reg_params[i].reg_name, 0);
if (!reg)
@@ -1495,13 +1484,13 @@
goto del_breakpoint;
}
- for (i = 0; i < num_mem_params; i++)
+ for (int i = 0; i < num_mem_params; i++)
{
if (mem_params[i].direction != PARAM_OUT)
target_read_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value);
}
- for (i = 0; i < num_reg_params; i++)
+ for (int i = 0; i < num_reg_params; i++)
{
if (reg_params[i].direction != PARAM_OUT)
{
@@ -1527,7 +1516,7 @@
restore:
// Restore context
- for (i = 0; i < 16; i++)
+ for (size_t i = 0; i < 16; i++)
{
LOG_DEBUG("restoring register %s with value 0x%8.8x",
arm11->reg_list[i].name, context[i]);
@@ -1897,8 +1886,7 @@
u32 values[6];
- {size_t i;
- for (i = 0; i < (read ? 5 : 6); i++)
+ for (size_t i = 0; i < (read ? 5 : 6); i++)
{
values[i] = strtoul(args[i + 1], NULL, 0);
@@ -1909,7 +1897,7 @@
read ? arm11_mrc_syntax : arm11_mcr_syntax);
return -1;
}
- }}
+ }
u32 instr = 0xEE000010 |
(values[0] << 8) |
Modified: trunk/src/target/arm11.h
===================================================================
--- trunk/src/target/arm11.h 2009-05-08 21:03:28 UTC (rev 1684)
+++ trunk/src/target/arm11.h 2009-05-09 07:36:19 UTC (rev 1685)
@@ -252,14 +252,14 @@
void arm11_add_IR (arm11_common_t * arm11, u8 instr, tap_state_t state);
void arm11_add_debug_SCAN_N (arm11_common_t * arm11, u8 chain, tap_state_t state);
void arm11_add_debug_INST (arm11_common_t * arm11, u32 inst, u8 * flag, tap_state_t state);
-int arm11_read_DSCR (arm11_common_t * arm11, u32 *dscr);
+int arm11_read_DSCR (arm11_common_t * arm11, u32 *dscr);
int arm11_write_DSCR (arm11_common_t * arm11, u32 dscr);
enum target_debug_reason arm11_get_DSCR_debug_reason(u32 dscr);
void arm11_run_instr_data_prepare (arm11_common_t * arm11);
void arm11_run_instr_data_finish (arm11_common_t * arm11);
-int arm11_run_instr_no_data (arm11_common_t * arm11, u32 * opcode, size_t count);
+int arm11_run_instr_no_data (arm11_common_t * arm11, u32 * opcode, size_t count);
void arm11_run_instr_no_data1 (arm11_common_t * arm11, u32 opcode);
int arm11_run_instr_data_to_core (arm11_common_t * arm11, u32 opcode, u32 * data, size_t count);
int arm11_run_instr_data_to_core_noack (arm11_common_t * arm11, u32 opcode, u32 * data, size_t count);
Modified: trunk/src/target/arm11_dbgtap.c
===================================================================
--- trunk/src/target/arm11_dbgtap.c 2009-05-08 21:03:28 UTC (rev 1684)
+++ trunk/src/target/arm11_dbgtap.c 2009-05-09 07:36:19 UTC (rev 1685)
@@ -549,14 +549,13 @@
size_t error_count = 0;
- {size_t i;
- for (i = 0; i < asizeof(Readies); i++)
+ for (size_t i = 0; i < asizeof(Readies); i++)
{
if (Readies[i] != 1)
{
error_count++;
}
- }}
+ }
if (error_count)
LOG_ERROR("Transfer errors " ZU, error_count);
@@ -699,8 +698,7 @@
arm11_setup_field(arm11, 32, &DataOut, &DataIn, chain7_fields + 1);
arm11_setup_field(arm11, 7, &AddressOut, &AddressIn, chain7_fields + 2);
- {size_t i;
- for (i = 0; i < count + 1; i++)
+ for (size_t i = 0; i < count + 1; i++)
{
if (i < count)
{
@@ -746,13 +744,12 @@
}
}
}
- }}
+ }
- {size_t i;
- for (i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
JTAG_DEBUG("SC7 %02d: %02x %s %08x", i, actions[i].address, actions[i].write ? "<=" : "=>", actions[i].value);
- }}
+ }
return ERROR_OK;
}
@@ -767,23 +764,20 @@
arm11_sc7_action_t clear_bw[arm11->brp + arm11->wrp + 1];
arm11_sc7_action_t * pos = clear_bw;
- {size_t i;
- for (i = 0; i < asizeof(clear_bw); i++)
+ for (size_t i = 0; i < asizeof(clear_bw); i++)
{
clear_bw[i].write = true;
clear_bw[i].value = 0;
- }}
+ }
- {size_t i;
- for (i = 0; i < arm11->brp; i++)
+ for (size_t i = 0; i < arm11->brp; i++)
(pos++)->address = ARM11_SC7_BCR0 + i;
- }
- {size_t i;
- for (i = 0; i < arm11->wrp; i++)
+
+ for (size_t i = 0; i < arm11->wrp; i++)
(pos++)->address = ARM11_SC7_WCR0 + i;
- }
+
(pos++)->address = ARM11_SC7_VCR;
arm11_sc7_run(arm11, clear_bw, asizeof(clear_bw));
|
|
From: oharboe at B. <oh...@ma...> - 2009-05-08 23:03:29
|
Author: oharboe
Date: 2009-05-08 23:03:28 +0200 (Fri, 08 May 2009)
New Revision: 1684
Modified:
trunk/src/target/etb.h
trunk/src/target/etm.c
Log:
whitespace fixes
Modified: trunk/src/target/etb.h
===================================================================
--- trunk/src/target/etb.h 2009-05-08 20:48:28 UTC (rev 1683)
+++ trunk/src/target/etb.h 2009-05-08 21:03:28 UTC (rev 1684)
@@ -48,7 +48,7 @@
jtag_tap_t *tap;
u32 cur_scan_chain;
reg_cache_t *reg_cache;
-
+
/* ETB parameters */
u32 ram_depth;
u32 ram_width;
Modified: trunk/src/target/etm.c
===================================================================
--- trunk/src/target/etm.c 2009-05-08 20:48:28 UTC (rev 1683)
+++ trunk/src/target/etm.c 2009-05-08 21:03:28 UTC (rev 1684)
@@ -280,6 +280,7 @@
arm7_9_common_t *arm7_9 = armv4_5->arch_info;
etm_context_t *etm_ctx = arm7_9->etm_ctx;
reg_t *etm_ctrl_reg = &arm7_9->etm_ctx->reg_cache->reg_list[ETM_CTRL];
+
/* initialize some ETM control register settings */
etm_get_reg(etm_ctrl_reg);
etm_ctrl_value = buf_get_u32(etm_ctrl_reg->value, 0, etm_ctrl_reg->size);
@@ -309,6 +310,7 @@
int etm_get_reg(reg_t *reg)
{
int retval;
+
if ((retval = etm_read_reg(reg)) != ERROR_OK)
{
LOG_ERROR("BUG: error scheduling etm register read");
@@ -340,21 +342,18 @@
fields[0].num_bits = 32;
fields[0].out_value = reg->value;
fields[0].in_value = NULL;
-
fields[1].tap = etm_reg->jtag_info->tap;
fields[1].num_bits = 7;
fields[1].out_value = malloc(1);
buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
fields[1].in_value = NULL;
-
fields[2].tap = etm_reg->jtag_info->tap;
fields[2].num_bits = 1;
fields[2].out_value = malloc(1);
buf_set_u32(fields[2].out_value, 0, 1, 0);
fields[2].in_value = NULL;
-
jtag_add_dr_scan(3, fields, TAP_INVALID);
@@ -378,6 +377,7 @@
int etm_set_reg(reg_t *reg, u32 value)
{
int retval;
+
if ((retval = etm_write_reg(reg, value)) != ERROR_OK)
{
LOG_ERROR("BUG: error scheduling etm register write");
@@ -394,6 +394,7 @@
int etm_set_reg_w_exec(reg_t *reg, u8 *buf)
{
int retval;
+
etm_set_reg(reg, buf_get_u32(buf, 0, reg->size));
if ((retval = jtag_execute_queue()) != ERROR_OK)
@@ -423,10 +424,6 @@
fields[0].in_value = NULL;
-
-
-
-
fields[1].tap = etm_reg->jtag_info->tap;
fields[1].num_bits = 7;
fields[1].out_value = malloc(1);
@@ -434,10 +431,6 @@
fields[1].in_value = NULL;
-
-
-
-
fields[2].tap = etm_reg->jtag_info->tap;
fields[2].num_bits = 1;
fields[2].out_value = malloc(1);
@@ -445,10 +438,6 @@
fields[2].in_value = NULL;
-
-
-
-
jtag_add_dr_scan(3, fields, TAP_INVALID);
free(fields[0].out_value);
@@ -1648,7 +1637,7 @@
fileio_read_u32(&file, &etm_ctx->trace_depth);
etm_ctx->trace_data = malloc(sizeof(etmv1_trace_data_t) * etm_ctx->trace_depth);
- if(etm_ctx->trace_data == NULL)
+ if (etm_ctx->trace_data == NULL)
{
command_print(cmd_ctx, "not enough memory to perform operation");
fileio_close(&file);
@@ -1816,7 +1805,7 @@
if ((retval = etmv1_analyze_trace(etm_ctx, cmd_ctx)) != ERROR_OK)
{
- switch(retval)
+ switch (retval)
{
case ERROR_ETM_ANALYSIS_FAILED:
command_print(cmd_ctx, "further analysis failed (corrupted trace data or just end of data");
|
|
From: oharboe at B. <oh...@ma...> - 2009-05-08 22:48:28
|
Author: oharboe
Date: 2009-05-08 22:48:28 +0200 (Fri, 08 May 2009)
New Revision: 1683
Modified:
trunk/src/jtag/jtag.c
Log:
plugged bug w/irlen > 32 introduce in 1672
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-05-08 20:44:52 UTC (rev 1682)
+++ trunk/src/jtag/jtag.c 2009-05-08 20:48:28 UTC (rev 1683)
@@ -574,7 +574,11 @@
for (j = 0; j < num_fields; j++)
{
jtag_tap_t *tap=fields[j].tap;
- jtag_check_value_mask(fields+j, tap->expected, tap->expected_mask);
+ if (fields[j].in_value!=NULL)
+ {
+ /* we verify max 32 bit long irlens. */
+ jtag_check_value_mask(fields+j, tap->expected, tap->expected_mask);
+ }
if (modified[j])
{
|
|
From: oharboe at B. <oh...@ma...> - 2009-05-08 22:44:52
|
Author: oharboe
Date: 2009-05-08 22:44:52 +0200 (Fri, 08 May 2009)
New Revision: 1682
Modified:
trunk/src/target/etb.c
trunk/src/target/etm.h
Log:
whitespace fixes
Modified: trunk/src/target/etb.c
===================================================================
--- trunk/src/target/etb.c 2009-05-08 20:36:09 UTC (rev 1681)
+++ trunk/src/target/etb.c 2009-05-08 20:44:52 UTC (rev 1682)
@@ -58,6 +58,7 @@
static int etb_set_instr(etb_t *etb, u32 new_instr)
{
jtag_tap_t *tap;
+
tap = etb->tap;
if (tap==NULL)
return ERROR_FAIL;
@@ -73,10 +74,6 @@
field.in_value = NULL;
-
-
-
-
jtag_add_ir_scan(1, &field, TAP_INVALID);
free(field.out_value);
@@ -87,7 +84,7 @@
static int etb_scann(etb_t *etb, u32 new_scan_chain)
{
- if(etb->cur_scan_chain != new_scan_chain)
+ if (etb->cur_scan_chain != new_scan_chain)
{
scan_field_t field;
@@ -98,10 +95,6 @@
field.in_value = NULL;
-
-
-
-
/* select INTEST instruction */
etb_set_instr(etb, 0x2);
jtag_add_dr_scan(1, &field, TAP_INVALID);
@@ -159,6 +152,7 @@
static int etb_get_reg(reg_t *reg)
{
int retval;
+
if ((retval = etb_read_reg(reg)) != ERROR_OK)
{
LOG_ERROR("BUG: error scheduling etm register read");
@@ -188,25 +182,21 @@
fields[0].out_value = NULL;
u8 tmp[4];
fields[0].in_value = tmp;
-
fields[1].tap = etb->tap;
fields[1].num_bits = 7;
fields[1].out_value = malloc(1);
buf_set_u32(fields[1].out_value, 0, 7, 4);
fields[1].in_value = NULL;
-
fields[2].tap = etb->tap;
fields[2].num_bits = 1;
fields[2].out_value = malloc(1);
buf_set_u32(fields[2].out_value, 0, 1, 0);
fields[2].in_value = NULL;
-
jtag_add_dr_scan(3, fields, TAP_INVALID);
-
for (i = 0; i < num_frames; i++)
{
/* ensure nR/W reamins set to read */
@@ -246,35 +236,20 @@
fields[0].tap = etb_reg->etb->tap;
fields[0].num_bits = 32;
fields[0].out_value = reg->value;
-
fields[0].in_value = NULL;
-
-
-
-
fields[1].tap = etb_reg->etb->tap;
fields[1].num_bits = 7;
fields[1].out_value = malloc(1);
buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
-
fields[1].in_value = NULL;
-
-
-
-
fields[2].tap = etb_reg->etb->tap;
fields[2].num_bits = 1;
fields[2].out_value = malloc(1);
buf_set_u32(fields[2].out_value, 0, 1, 0);
-
fields[2].in_value = NULL;
-
-
-
-
jtag_add_dr_scan(3, fields, TAP_INVALID);
/* read the identification register in the second run, to make sure we
@@ -301,6 +276,7 @@
int etb_set_reg(reg_t *reg, u32 value)
{
int retval;
+
if ((retval = etb_write_reg(reg, value)) != ERROR_OK)
{
LOG_ERROR("BUG: error scheduling etm register write");
@@ -317,6 +293,7 @@
int etb_set_reg_w_exec(reg_t *reg, u8 *buf)
{
int retval;
+
etb_set_reg(reg, buf_get_u32(buf, 0, reg->size));
if ((retval = jtag_execute_queue()) != ERROR_OK)
@@ -343,24 +320,14 @@
fields[0].num_bits = 32;
fields[0].out_value = malloc(4);
buf_set_u32(fields[0].out_value, 0, 32, value);
-
fields[0].in_value = NULL;
-
-
-
-
fields[1].tap = etb_reg->etb->tap;
fields[1].num_bits = 7;
fields[1].out_value = malloc(1);
buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
-
fields[1].in_value = NULL;
-
-
-
-
fields[2].tap = etb_reg->etb->tap;
fields[2].num_bits = 1;
fields[2].out_value = malloc(1);
@@ -368,12 +335,6 @@
fields[2].in_value = NULL;
-
-
-
-
- jtag_add_dr_scan(3, fields, TAP_INVALID);
-
free(fields[0].out_value);
free(fields[1].out_value);
free(fields[2].out_value);
@@ -424,12 +385,12 @@
}
tap = jtag_TapByString( args[1] );
- if( tap == NULL ){
+ if (tap == NULL)
+ {
command_print(cmd_ctx, "Tap: %s does not exist", args[1] );
return ERROR_FAIL;
}
-
if (arm7_9->etm_ctx)
{
etb_t *etb = malloc(sizeof(etb_t));
Modified: trunk/src/target/etm.h
===================================================================
--- trunk/src/target/etm.h 2009-05-08 20:36:09 UTC (rev 1681)
+++ trunk/src/target/etm.h 2009-05-08 20:44:52 UTC (rev 1682)
@@ -62,7 +62,7 @@
ETM_SEQUENCER_STATE = 0x67,
ETM_EXTERNAL_OUTPUT = 0x68,
ETM_CONTEXTID_COMPARATOR_VALUE = 0x6c,
- ETM_CONTEXTID_COMPARATOR_MASK = 0x6f,
+ ETM_CONTEXTID_COMPARATOR_MASK = 0x6f,
};
typedef struct etm_reg_s
@@ -77,7 +77,7 @@
ETM_PORT_4BIT = 0x00,
ETM_PORT_8BIT = 0x10,
ETM_PORT_16BIT = 0x20,
- ETM_PORT_WIDTH_MASK = 0x70,
+ ETM_PORT_WIDTH_MASK = 0x70,
/* Port modes */
ETM_PORT_NORMAL = 0x00000,
ETM_PORT_MUXED = 0x10000,
@@ -146,11 +146,11 @@
etm_capture_driver_t *capture_driver; /* driver used to access ETM data */
void *capture_driver_priv; /* capture driver private data */
u32 trigger_percent; /* percent of trace buffer to be filled after the trigger */
- trace_status_t capture_status; /* current state of capture run */
+ trace_status_t capture_status; /* current state of capture run */
etmv1_trace_data_t *trace_data; /* trace data */
u32 trace_depth; /* number of trace cycles to be analyzed, 0 if no trace data available */
etm_portmode_t portmode; /* normal, multiplexed or demultiplexed */
- etmv1_tracemode_t tracemode; /* type of information the trace contains (data, addres, contextID, ...) */
+ etmv1_tracemode_t tracemode; /* type of information the trace contains (data, addres, contextID, ...) */
armv4_5_state_t core_state; /* current core state (ARM, Thumb, Jazelle) */
image_t *image; /* source for target opcodes */
u32 pipe_index; /* current trace cycle */
@@ -158,10 +158,10 @@
int data_half; /* port half on a 16 bit port */
u32 current_pc; /* current program counter */
u32 pc_ok; /* full PC has been acquired */
- u32 last_branch; /* last branch address output */
+ u32 last_branch; /* last branch address output */
u32 last_branch_reason; /* branch reason code for the last branch encountered */
u32 last_ptr; /* address of the last data access */
- u32 ptr_ok; /* whether last_ptr is valid */
+ u32 ptr_ok; /* whether last_ptr is valid */
u32 context_id; /* context ID of the code being traced */
u32 last_instruction; /* index of last instruction executed (to calculate cycle timings) */
} etm_context_t;
|