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
|
Sep
|
Oct
|
Nov
|
Dec
|
From: ntfreak at B. <nt...@ma...> - 2008-12-15 10:43:27
|
Author: ntfreak Date: 2008-12-15 10:43:26 +0100 (Mon, 15 Dec 2008) New Revision: 1242 Modified: trunk/doc/openocd.texi trunk/src/helper/Makefile.am trunk/src/helper/log.c trunk/src/helper/options.c trunk/src/server/gdb_server.c trunk/src/server/server.c trunk/src/server/server.h trunk/src/server/tcl_server.c trunk/src/server/telnet_server.c trunk/src/target/target.c Log: - add ability for openocd to communicate to gdb using pipes (stdin/stdout). - this is enabled by new command line option option --pipe. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/doc/openocd.texi 2008-12-15 09:43:26 UTC (rev 1242) @@ -15,7 +15,7 @@ @itemize @bullet @item Copyright @copyright{} 2008 The OpenOCD Project -@item Copyright @copyright{} 2007-2008 Spen @email{spen@@spen-soft.co.uk} +@item Copyright @copyright{} 2007-2008 Spencer Oliver @email{spen@@spen-soft.co.uk} @item Copyright @copyright{} 2008 Oyvind Harboe @email{oyvind.harboe@@zylin.com} @item Copyright @copyright{} 2008 Duane Ellis @email{openocd@@duaneellis.com} @end itemize @@ -411,9 +411,10 @@ --debug | -d set debug level <0-3> --log_output | -l redirect log output to file <name> --command | -c run <command> +--pipe | -p use pipes when talking to gdb @end verbatim -By default openocd reads the file configuration file ``openocd.cfg'' +By default OpenOCD reads the file configuration file ``openocd.cfg'' in the current directory. To specify a different (or multiple) configuration file, you can use the ``-f'' option. For example: @@ -445,6 +446,9 @@ the @option{-s <search>} switch. The current directory and the OpenOCD target library is in the search path by default. +For details on the @option{-p} option. @xref{Connecting to GDB}. +Option @option{-p} is not currently supported under native win32. + Note! OpenOCD will launch the GDB & telnet server even if it can not establish a connection with the target. In general, it is possible for the JTAG controller to be unresponsive until the target is set up @@ -455,7 +459,7 @@ @cindex configuration @section Outline -There are 4 basic ways of ``configurating'' openocd to run, they are: +There are 4 basic ways of ``configurating'' OpenOCD to run, they are: @enumerate @item A small openocd.cfg file which ``sources'' other configuration files @@ -671,7 +675,7 @@ every chip. If the @t{-expected-id} is nonzero, OpenOCD attempts to verify the tap id number verses configuration file and may issue an error or warning like this. The hope is this will help pin point -problem openocd configurations. +problem OpenOCD configurations. @example Info: JTAG tap: sam7x256.cpu tap/device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3) @@ -904,7 +908,7 @@ JIM-Tcl commands, and (older) the orginal command interpretor. @item @b{Commands} -@* At the openocd telnet command line (or via the GDB mon command) one +@* At the OpenOCD telnet command line (or via the GDB mon command) one can type a Tcl for() loop, set variables, etc. @item @b{Historical Note} @@ -1145,7 +1149,7 @@ @b{TODO:} Confirm the following: On windows the name needs to end with a ``space A''? Or not? It has to do with the FTD2xx driver. When must this be added and when must it not be added? Why can't the code in the -interface or in openocd automatically add this if needed? -- Duane. +interface or in OpenOCD automatically add this if needed? -- Duane. @item @b{ft2232_serial} <@var{serial-number}> @cindex ft2232_serial @@ -1527,7 +1531,7 @@ circuit and skipped. -From OpenOCDs view point, a JTAG TAP is in one of 3 states: +From OpenOCD's view point, a JTAG TAP is in one of 3 states: @itemize @bullet @item @b{Enabled - Not In ByPass} and has a variable bit length @@ -1640,7 +1644,7 @@ puts [format "The button is %s" $x] @end example -In OpenOCDs terms, the ``target'' is an object just like a Tcl/Tk +In OpenOCD's terms, the ``target'' is an object just like a Tcl/Tk button. Commands avaialble as a ``target object'' are: @comment START targetobj commands. @@ -1841,7 +1845,7 @@ @item @b{-work-area-size [ADDRESS]} specify/set the work area @item @b{-work-area-backup [0|1]} does the work area get backed up @item @b{-endian [big|little]} -@item @b{-variant [NAME]} some chips have varients openocd needs to know about +@item @b{-variant [NAME]} some chips have varients OpenOCD needs to know about @item @b{-chain-position DOTTED.NAME} the tap name this target refers to. @end itemize Example: @@ -1870,7 +1874,7 @@ @* None (this is also used as the ARM946) @item @b{cortex_m3} @* use variant <@var{-variant lm3s}> when debugging luminary lm3s targets. This will cause -openocd to use a software reset rather than asserting SRST to avoid a issue with clearing +OpenOCD to use a software reset rather than asserting SRST to avoid a issue with clearing the debug registers. This is fixed in Fury Rev B, DustDevil Rev B, Tempest, these revisions will be detected and the normal reset behaviour used. @item @b{xscale} @@ -1880,9 +1884,9 @@ @item @b{mips_m4k} @* Use variant @option{ejtag_srst} when debugging targets that do not provide a functional SRST line on the EJTAG connector. This causes -openocd to instead use an EJTAG software reset command to reset the +OpenOCD to instead use an EJTAG software reset command to reset the processor. You still need to enable @option{srst} on the reset -configuration command to enable openocd hardware reset functionality. +configuration command to enable OpenOCD hardware reset functionality. @comment END varients @end itemize @section working_area - Command Removed @@ -2004,7 +2008,7 @@ @end itemize @section flash bank command -The @b{flash bank} command is used to configure one or more flash chips (or banks in openocd terms) +The @b{flash bank} command is used to configure one or more flash chips (or banks in OpenOCD terms) @example @b{flash bank} <@var{driver}> <@var{base}> <@var{size}> <@var{chip_width}> @@ -2170,7 +2174,7 @@ @end itemize Note: Before using the str9xpec driver here is some background info to help -you better understand how the drivers works. Openocd has two flash drivers for +you better understand how the drivers works. OpenOCD has two flash drivers for the str9. @enumerate @item @@ -2793,41 +2797,52 @@ OpenOCD complies with the remote gdbserver protocol, and as such can be used to debug remote targets. -@section Connecting to gdb -@cindex Connecting to gdb +@section Connecting to GDB +@cindex Connecting to GDB +@anchor{Connecting to GDB} Use GDB 6.7 or newer with OpenOCD if you run into trouble. For instance 6.3 has a known bug where it produces bogus memory access errors, which has since been fixed: look up 1836 in @url{http://sourceware.org/cgi-bin/gnatsweb.pl?database=gdb} - -A connection is typically started as follows: +@*OpenOCD can communicate with GDB in two ways: +@enumerate +@item +A socket (tcp) connection is typically started as follows: @example target remote localhost:3333 @end example -This would cause gdb to connect to the gdbserver on the local pc using port 3333. +This would cause GDB to connect to the gdbserver on the local pc using port 3333. +@item +A pipe connection is typically started as follows: +@example +target remote openocd --pipe +@end example +This would cause GDB to run OpenOCD and communicate using pipes (stdin/stdout). +Using this method has the advantage of GDB starting/stopping OpenOCD for debug session. +@end enumerate -To see a list of available OpenOCD commands type @option{monitor help} on the -gdb commandline. +@*To see a list of available OpenOCD commands type @option{monitor help} on the +GDB commandline. OpenOCD supports the gdb @option{qSupported} packet, this enables information -to be sent by the gdb server (openocd) to gdb. Typical information includes +to be sent by the gdb server (OpenOCD) to GDB. Typical information includes packet size and device memory map. -Previous versions of OpenOCD required the following gdb options to increase -the packet size and speed up gdb communication. +Previous versions of OpenOCD required the following GDB options to increase +the packet size and speed up GDB communication. @example set remote memory-write-packet-size 1024 set remote memory-write-packet-size fixed set remote memory-read-packet-size 1024 set remote memory-read-packet-size fixed @end example -This is now handled in the @option{qSupported} PacketSize. +This is now handled in the @option{qSupported} PacketSize and should not be required. -@section Programming using gdb -@cindex Programming using gdb +@section Programming using GDB +@cindex Programming using GDB -By default the target memory map is sent to gdb, this can be disabled by +By default the target memory map is sent to GDB, this can be disabled by the following OpenOCD config option: @example gdb_memory_map disable @@ -2836,34 +2851,34 @@ in OpenOCD. For faster performance you should also configure a valid working area. -Informing gdb of the memory map of the target will enable gdb to protect any +Informing GDB of the memory map of the target will enable GDB to protect any flash area of the target and use hardware breakpoints by default. This means that the OpenOCD option @option{gdb_breakpoint_override} is not required when using a memory map. @xref{gdb_breakpoint_override}. -To view the configured memory map in gdb, use the gdb command @option{info mem} -All other unasigned addresses within gdb are treated as RAM. +To view the configured memory map in GDB, use the gdb command @option{info mem} +All other unasigned addresses within GDB are treated as RAM. GDB 6.8 and higher set any memory area not in the memory map as inaccessible, -this can be changed to the old behaviour by using the following gdb command. +this can be changed to the old behaviour by using the following GDB command. @example set mem inaccessible-by-default off @end example -If @option{gdb_flash_program enable} is also used, gdb will be able to +If @option{gdb_flash_program enable} is also used, GDB will be able to program any flash memory using the vFlash interface. -gdb will look at the target memory map when a load command is given, if any +GDB will look at the target memory map when a load command is given, if any areas to be programmed lie within the target flash area the vFlash packets will be used. -If the target needs configuring before gdb programming, an event +If the target needs configuring before GDB programming, an event script can be executed. @example $_TARGETNAME configure -event EVENTNAME BODY @end example -To verify any flash programming the gdb command @option{compare-sections} +To verify any flash programming the GDB command @option{compare-sections} can be used. @node TCL scripting API @@ -3598,7 +3613,7 @@ OpenOCD comes with a target configuration script library. These scripts can be used as-is or serve as a starting point. -The target library is published together with the openocd executable and +The target library is published together with the OpenOCD executable and the path to the target library is in the OpenOCD script search path. Similarly there are example scripts for configuring the JTAG interface. Modified: trunk/src/helper/Makefile.am =================================================================== --- trunk/src/helper/Makefile.am 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/helper/Makefile.am 2008-12-15 09:43:26 UTC (rev 1242) @@ -1,4 +1,4 @@ -INCLUDES = -I$(top_srcdir)/src $(all_includes) -I$(top_srcdir)/src/target +INCLUDES = -I$(top_srcdir)/src $(all_includes) -I$(top_srcdir)/src/target -I$(top_srcdir)/src/server METASOURCES = AUTO AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" -DPKGLIBDIR=\"$(pkglibdir)\" @CPPFLAGS@ noinst_LIBRARIES = libhelper.a Modified: trunk/src/helper/log.c =================================================================== --- trunk/src/helper/log.c 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/helper/log.c 2008-12-15 09:43:26 UTC (rev 1242) @@ -31,6 +31,7 @@ #include "configuration.h" #include "time_support.h" #include "command.h" +#include "server.h" #include <stdio.h> #include <stdlib.h> @@ -108,9 +109,11 @@ #endif string); } - else + else if(server_use_pipes == 0) { - if (strcmp(string, "\n")!=0) + /* if we are using gdb through pipes then we do not want any output + * to the pipe otherwise we get repeated strings */ + if (strcmp(string, "\n") != 0) { /* print human readable output - but skip empty lines */ fprintf(log_output, "%s%s", @@ -203,6 +206,18 @@ if (debug_level > 3) debug_level = 3; + if (debug_level >= LOG_LVL_DEBUG && server_use_pipes == 1) + { + /* if we are enabling debug info then we need to write to a log file + * otherwise the pipe will get full and cause issues with gdb */ + FILE* file = fopen("openocd.log", "w"); + if (file) + { + log_output = file; + LOG_WARNING("enabling log output as we are using pipes"); + } + } + return ERROR_OK; } Modified: trunk/src/helper/options.c =================================================================== --- trunk/src/helper/options.c 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/helper/options.c 2008-12-15 09:43:26 UTC (rev 1242) @@ -24,10 +24,13 @@ #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> @@ -43,8 +46,9 @@ {"debug", optional_argument, 0, 'd'}, {"file", required_argument, 0, 'f'}, {"search", required_argument, 0, 's'}, - {"log_output", required_argument, 0, 'l'}, + {"log_output", required_argument, 0, 'l'}, {"command", required_argument, 0, 'c'}, + {"pipe", no_argument, 0, 'p'}, {0, 0, 0, 0} }; @@ -95,7 +99,7 @@ /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long(argc, argv, "hvd::l:f:s:c:", long_options, &option_index); + c = getopt_long(argc, argv, "hvd::l:f:s:c:p", long_options, &option_index); /* Detect the end of the options. */ if (c == -1) @@ -140,7 +144,20 @@ add_config_command(optarg); } break; - + case 'p': /* --pipe | -p */ +#if BUILD_ECOSBOARD == 1 + /* pipes unsupported on hosted platforms */ + LOG_WARNING("pipes not supported on this platform"); +#else +#ifdef IS_MINGW + /* pipes currently unsupported on win32 */ + LOG_WARNING("pipes currently unsupported on win32"); + exit(1); +#else + server_use_pipes = 1; +#endif +#endif + break; } } @@ -154,6 +171,7 @@ LOG_OUTPUT("--debug | -d\tset debug level <0-3>\n"); LOG_OUTPUT("--log_output | -l\tredirect log output to file <name>\n"); LOG_OUTPUT("--command | -c\trun <command>\n"); + LOG_OUTPUT("--pipe | -p\tuse pipes for gdb communication\n"); exit(-1); } @@ -161,7 +179,7 @@ { /* Nothing to do, version gets printed automatically. */ exit(-1); - } - + } + return ERROR_OK; } Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/server/gdb_server.c 2008-12-15 09:43:26 UTC (rev 1242) @@ -169,10 +169,18 @@ for (;;) { - retval=check_pending(connection, 1, NULL); - if (retval!=ERROR_OK) - return retval; - gdb_con->buf_cnt = read_socket(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE); + if (connection->service->type == CONNECTION_PIPE) + { + gdb_con->buf_cnt = read(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE); + } + else + { + retval = check_pending(connection, 1, NULL); + if (retval != ERROR_OK) + return retval; + gdb_con->buf_cnt = read_socket(connection->fd, gdb_con->buffer, GDB_BUFFER_SIZE); + } + if (gdb_con->buf_cnt > 0) { break; @@ -268,11 +276,22 @@ gdb_connection_t *gdb_con = connection->priv; if (gdb_con->closed) return ERROR_SERVER_REMOTE_CLOSED; - - if (write_socket(connection->fd, data, len) == len) + + if (connection->service->type == CONNECTION_PIPE) { - return ERROR_OK; + /* write to stdout */ + if (write(STDOUT_FILENO, data, len) == len) + { + return ERROR_OK; + } } + else + { + if (write_socket(connection->fd, data, len) == len) + { + return ERROR_OK; + } + } gdb_con->closed = 1; return ERROR_SERVER_REMOTE_CLOSED; } @@ -2158,7 +2177,7 @@ if (retval == ERROR_SERVER_REMOTE_CLOSED) return retval; - /* logging does not propagate the error, yet can set th gdb_con->closed flag */ + /* logging does not propagate the error, yet can set the gdb_con->closed flag */ if (gdb_con->closed) return ERROR_SERVER_REMOTE_CLOSED; @@ -2177,34 +2196,37 @@ return ERROR_OK; } - if (gdb_port == 0) + if (gdb_port == 0 && server_use_pipes == 0) { LOG_WARNING("no gdb port specified, using default port 3333"); gdb_port = 3333; } - while (target) + if (server_use_pipes) { - char service_name[8]; - - snprintf(service_name, 8, "gdb-%2.2i", target->target_number); - + /* only a single gdb connection when using a pipe */ + gdb_service = malloc(sizeof(gdb_service_t)); gdb_service->target = target; - add_service("gdb", CONNECTION_GDB, - gdb_port + target->target_number, - 1, gdb_new_connection, gdb_input, - gdb_connection_closed, - gdb_service); + add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service); - LOG_DEBUG("gdb service for target %s at port %i", - target->type->name, - gdb_port + target->target_number); + LOG_DEBUG("gdb service for target %s using pipes", target->type->name); + } + else + { + while (target) + { + gdb_service = malloc(sizeof(gdb_service_t)); + gdb_service->target = target; - target = target->next; + add_service("gdb", CONNECTION_TCP, gdb_port + target->target_number, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service); + + LOG_DEBUG("gdb service for target %s at port %i", target->type->name, gdb_port + target->target_number); + target = target->next; + } } - + return ERROR_OK; } Modified: trunk/src/server/server.c =================================================================== --- trunk/src/server/server.c 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/server/server.c 2008-12-15 09:43:26 UTC (rev 1242) @@ -53,6 +53,9 @@ static int shutdown_openocd = 0; int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +/* set when using pipes rather than tcp */ +int server_use_pipes = 0; + int add_connection(service_t *service, command_context_t *cmd_ctx) { unsigned int address_size; @@ -69,28 +72,44 @@ c->priv = NULL; c->next = NULL; - address_size = sizeof(c->sin); - - c->fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size); - - /* This increases performance dramatically for e.g. GDB load which - * does not have a sliding window protocol. */ - retval=setsockopt(c->fd, /* socket affected */ - IPPROTO_TCP, /* set option at TCP level */ - TCP_NODELAY, /* name of option */ - (char *)&flag, /* the cast is historical cruft */ - sizeof(int)); /* length of option value */ + if (service->type == CONNECTION_TCP) + { + address_size = sizeof(c->sin); - LOG_INFO("accepting '%s' connection from %i", service->name, c->sin.sin_port); - if ((retval = service->new_connection(c)) == ERROR_OK) - { + c->fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size); + + /* This increases performance dramatically for e.g. GDB load which + * does not have a sliding window protocol. */ + retval=setsockopt(c->fd, /* socket affected */ + IPPROTO_TCP, /* set option at TCP level */ + TCP_NODELAY, /* name of option */ + (char *)&flag, /* the cast is historical cruft */ + sizeof(int)); /* length of option value */ + + LOG_INFO("accepting '%s' connection from %i", service->name, c->sin.sin_port); + if ((retval = service->new_connection(c)) != ERROR_OK) + { + close_socket(c->fd); + LOG_ERROR("attempted '%s' connection rejected", service->name); + free(c); + return retval; + } } - else + else if (service->type == CONNECTION_PIPE) { - close_socket(c->fd); - LOG_ERROR("attempted '%s' connection rejected", service->name); - free(c); - return retval; +#ifndef _WIN32 + c->fd = service->fd; + + /* do not check for new connections again on stdin */ + service->fd = -1; +#endif + LOG_INFO("accepting '%s' connection from pipe", service->name); + if ((retval = service->new_connection(c)) != ERROR_OK) + { + LOG_ERROR("attempted '%s' connection rejected", service->name); + free(c); + return retval; + } } /* add to the end of linked list */ @@ -113,7 +132,8 @@ if (c->fd == connection->fd) { service->connection_closed(c); - close_socket(c->fd); + if (service->type == CONNECTION_TCP) + close_socket(c->fd); command_done(c->cmd_ctx); /* delete connection */ @@ -150,45 +170,68 @@ c->priv = priv; c->next = NULL; - if ((c->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) + if (type == CONNECTION_TCP) { - LOG_ERROR("error creating socket: %s", strerror(errno)); - exit(-1); - } - - setsockopt(c->fd, SOL_SOCKET, SO_REUSEADDR, (void*)&so_reuseaddr_option, sizeof(int)); - - socket_nonblock(c->fd); - - memset(&c->sin, 0, sizeof(c->sin)); - c->sin.sin_family = AF_INET; - c->sin.sin_addr.s_addr = INADDR_ANY; - c->sin.sin_port = htons(port); - - if (bind(c->fd, (struct sockaddr *)&c->sin, sizeof(c->sin)) == -1) - { - LOG_ERROR("couldn't bind to socket: %s", strerror(errno)); - exit(-1); - } - + if ((c->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) + { + LOG_ERROR("error creating socket: %s", strerror(errno)); + exit(-1); + } + + setsockopt(c->fd, SOL_SOCKET, SO_REUSEADDR, (void*)&so_reuseaddr_option, sizeof(int)); + + socket_nonblock(c->fd); + + memset(&c->sin, 0, sizeof(c->sin)); + c->sin.sin_family = AF_INET; + c->sin.sin_addr.s_addr = INADDR_ANY; + c->sin.sin_port = htons(port); + + if (bind(c->fd, (struct sockaddr *)&c->sin, sizeof(c->sin)) == -1) + { + LOG_ERROR("couldn't bind to socket: %s", strerror(errno)); + exit(-1); + } + #ifndef _WIN32 - int segsize=65536; - setsockopt(c->fd, IPPROTO_TCP, TCP_MAXSEG, &segsize, sizeof(int)); + int segsize=65536; + setsockopt(c->fd, IPPROTO_TCP, TCP_MAXSEG, &segsize, sizeof(int)); #endif - int window_size = 128 * 1024; - - /* These setsockopt()s must happen before the listen() */ + int window_size = 128 * 1024; - setsockopt(c->fd, SOL_SOCKET, SO_SNDBUF, - (char *)&window_size, sizeof(window_size)); - setsockopt(c->fd, SOL_SOCKET, SO_RCVBUF, - (char *)&window_size, sizeof(window_size)); - - if (listen(c->fd, 1) == -1) + /* These setsockopt()s must happen before the listen() */ + + setsockopt(c->fd, SOL_SOCKET, SO_SNDBUF, + (char *)&window_size, sizeof(window_size)); + setsockopt(c->fd, SOL_SOCKET, SO_RCVBUF, + (char *)&window_size, sizeof(window_size)); + + if (listen(c->fd, 1) == -1) + { + LOG_ERROR("couldn't listen on socket: %s", strerror(errno)); + exit(-1); + } + } + else if (type == CONNECTION_PIPE) { - LOG_ERROR("couldn't listen on socket: %s", strerror(errno)); - exit(-1); + /* use stdin */ + c->fd = STDIN_FILENO; + +#ifdef _WIN32 + /* for win32 set stdin/stdout to binary mode */ + if (_setmode(_fileno(stdout), _O_BINARY) < 0) + LOG_WARNING("cannot change stdout mode to binary"); + if (_setmode(_fileno(stdin), _O_BINARY) < 0) + LOG_WARNING("cannot change stdin mode to binary"); +#else + socket_nonblock(c->fd); +#endif } + else + { + LOG_ERROR("unknown connection type: %d", type); + exit(1); + } /* add to the end of linked list */ for (p = &services; *p; p = &(*p)->next); @@ -310,14 +353,18 @@ #ifndef _WIN32 #if BUILD_ECOSBOARD == 0 - /* add STDIN to read_fds */ - FD_SET(fileno(stdin), &read_fds); + if (server_use_pipes == 0) + { + /* add STDIN to read_fds */ + FD_SET(fileno(stdin), &read_fds); + } #endif #endif openocd_sleep_prelude(); kept_alive(); - // Only while we're sleeping we'll let others run + + /* Only while we're sleeping we'll let others run */ retval = select(fd_max + 1, &read_fds, NULL, NULL, &tv); openocd_sleep_postlude(); @@ -371,11 +418,14 @@ } else { - struct sockaddr_in sin; - unsigned int address_size = sizeof(sin); - int tmp_fd; - tmp_fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size); - close_socket(tmp_fd); + if (service->type != CONNECTION_PIPE) + { + struct sockaddr_in sin; + unsigned int address_size = sizeof(sin); + int tmp_fd; + tmp_fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size); + close_socket(tmp_fd); + } LOG_INFO("rejected '%s' connection, no more connections allowed", service->name); } } @@ -389,11 +439,16 @@ { if ((FD_ISSET(c->fd, &read_fds)) || c->input_pending) { - if (service->input(c) != ERROR_OK) + if ((retval = service->input(c)) != ERROR_OK) { connection_t *next = c->next; + if (service->type == CONNECTION_PIPE) + { + /* if connection uses a pipe then shutdown openocd on error */ + shutdown_openocd = 1; + } remove_connection(service, c); - LOG_INFO("dropped '%s' connection", service->name); + LOG_INFO("dropped '%s' connection - error %d", service->name, retval); c = next; continue; } @@ -405,11 +460,15 @@ #ifndef _WIN32 #if BUILD_ECOSBOARD == 0 - if (FD_ISSET(fileno(stdin), &read_fds)) + /* check for data on stdin if not using pipes */ + if (server_use_pipes == 0) { - if (getc(stdin) == 'x') + if (FD_ISSET(fileno(stdin), &read_fds)) { - shutdown_openocd = 1; + if (getc(stdin) == 'x') + { + shutdown_openocd = 1; + } } } #endif @@ -459,7 +518,6 @@ signal(SIGBREAK, sig_handler); signal(SIGABRT, sig_handler); #endif - return ERROR_OK; } Modified: trunk/src/server/server.h =================================================================== --- trunk/src/server/server.h 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/server/server.h 2008-12-15 09:43:26 UTC (rev 1242) @@ -34,9 +34,8 @@ enum connection_type { - CONNECTION_GDB, - CONNECTION_TELNET, - CONNECTION_TCL, + CONNECTION_TCP, + CONNECTION_PIPE }; typedef struct connection_s @@ -76,6 +75,8 @@ extern int server_loop(command_context_t *command_context); extern int server_register_commands(command_context_t *context); +extern int server_use_pipes; + #define ERROR_SERVER_REMOTE_CLOSED (-400) #define ERROR_CONNECTION_REJECTED (-401) Modified: trunk/src/server/tcl_server.c =================================================================== --- trunk/src/server/tcl_server.c 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/server/tcl_server.c 2008-12-15 09:43:26 UTC (rev 1242) @@ -179,7 +179,7 @@ tcl_port = 6666; } - retval = add_service("tcl", CONNECTION_TCL, tcl_port, 1, tcl_new_connection, tcl_input, tcl_closed, NULL); + retval = add_service("tcl", CONNECTION_TCP, tcl_port, 1, tcl_new_connection, tcl_input, tcl_closed, NULL); return retval; } Modified: trunk/src/server/telnet_server.c =================================================================== --- trunk/src/server/telnet_server.c 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/server/telnet_server.c 2008-12-15 09:43:26 UTC (rev 1242) @@ -615,7 +615,7 @@ telnet_service->banner = banner; - add_service("telnet", CONNECTION_TELNET, telnet_port, 1, telnet_new_connection, telnet_input, telnet_connection_closed, telnet_service); + add_service("telnet", CONNECTION_TCP, telnet_port, 1, telnet_new_connection, telnet_input, telnet_connection_closed, telnet_service); return ERROR_OK; } Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2008-12-15 09:05:16 UTC (rev 1241) +++ trunk/src/target/target.c 2008-12-15 09:43:26 UTC (rev 1242) @@ -232,7 +232,6 @@ { .name = NULL, .value = -1 }, }; - const Jim_Nvp nvp_target_endian[] = { { .name = "big", .value = TARGET_BIG_ENDIAN }, { .name = "little", .value = TARGET_LITTLE_ENDIAN }, @@ -249,8 +248,7 @@ { .name = NULL , .value = -1 }, }; -static int -max_target_number( void ) +static int max_target_number(void) { target_t *t; int x; @@ -267,8 +265,7 @@ } /* determine the number of the new target */ -static int -new_target_number( void ) +static int new_target_number(void) { target_t *t; int x; |
From: <oh...@ma...> - 2008-12-15 10:05:19
|
Author: oharboe Date: 2008-12-15 10:05:16 +0100 (Mon, 15 Dec 2008) New Revision: 1241 Modified: trunk/src/ecosboard.c trunk/src/target/target.c Log: fast_load profiling tool moved to target.c Modified: trunk/src/ecosboard.c =================================================================== --- trunk/src/ecosboard.c 2008-12-14 20:33:01 UTC (rev 1240) +++ trunk/src/ecosboard.c 2008-12-15 09:05:16 UTC (rev 1241) @@ -121,197 +121,7 @@ char hwaddr[512]; -struct FastLoad -{ - u32 address; - u8 *data; - int length; -}; - -static int fastload_num; -static struct FastLoad *fastload; - -static void free_fastload() -{ - if (fastload!=NULL) - { - int i; - for (i=0; i<fastload_num; i++) - { - if (fastload[i].data) - free(fastload[i].data); - } - free(fastload); - fastload=NULL; - } -} - - -int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -{ - u8 *buffer; - u32 buf_cnt; - u32 image_size; - u32 min_address=0; - u32 max_address=0xffffffff; - int i; - int retval; - - image_t image; - - duration_t duration; - char *duration_text; - - if ((argc < 1)||(argc > 5)) - { - return ERROR_COMMAND_SYNTAX_ERROR; - } - - /* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */ - if (argc >= 2) - { - image.base_address_set = 1; - image.base_address = strtoul(args[1], NULL, 0); - } - else - { - image.base_address_set = 0; - } - - - image.start_address_set = 0; - - if (argc>=4) - { - min_address=strtoul(args[3], NULL, 0); - } - if (argc>=5) - { - max_address=strtoul(args[4], NULL, 0)+min_address; - } - - if (min_address>max_address) - { - return ERROR_COMMAND_SYNTAX_ERROR; - } - - duration_start_measure(&duration); - - if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) - { - return ERROR_OK; - } - - image_size = 0x0; - retval = ERROR_OK; - fastload_num=image.num_sections; - fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections); - if (fastload==NULL) - { - image_close(&image); - return ERROR_FAIL; - } - memset(fastload, 0, sizeof(struct FastLoad)*image.num_sections); - for (i = 0; i < image.num_sections; i++) - { - buffer = malloc(image.sections[i].size); - if (buffer == NULL) - { - command_print(cmd_ctx, "error allocating buffer for section (%d bytes)", image.sections[i].size); - break; - } - - if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK) - { - free(buffer); - break; - } - - u32 offset=0; - u32 length=buf_cnt; - - - /* DANGER!!! beware of unsigned comparision here!!! */ - - if ((image.sections[i].base_address+buf_cnt>=min_address)&& - (image.sections[i].base_address<max_address)) - { - if (image.sections[i].base_address<min_address) - { - /* clip addresses below */ - offset+=min_address-image.sections[i].base_address; - length-=offset; - } - - if (image.sections[i].base_address+buf_cnt>max_address) - { - length-=(image.sections[i].base_address+buf_cnt)-max_address; - } - - fastload[i].address=image.sections[i].base_address+offset; - fastload[i].data=malloc(length); - if (fastload[i].data==NULL) - { - free(buffer); - break; - } - memcpy(fastload[i].data, buffer+offset, length); - fastload[i].length=length; - - image_size += length; - command_print(cmd_ctx, "%u byte written at address 0x%8.8x", length, image.sections[i].base_address+offset); - } - - free(buffer); - } - - duration_stop_measure(&duration, &duration_text); - if (retval==ERROR_OK) - { - command_print(cmd_ctx, "Loaded %u bytes in %s", image_size, duration_text); - command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so."); - } - free(duration_text); - - image_close(&image); - - if (retval!=ERROR_OK) - { - free_fastload(); - } - - return retval; -} - -int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -{ - if (argc>0) - return ERROR_COMMAND_SYNTAX_ERROR; - if (fastload==NULL) - { - LOG_ERROR("No image in memory"); - return ERROR_FAIL; - } - int i; - int ms=timeval_ms(); - int size=0; - for (i=0; i<fastload_num;i++) - { - int retval; - target_t *target = get_current_target(cmd_ctx); - if ((retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data)) != ERROR_OK) - { - return retval; - } - size+=fastload[i].length; - } - int after=timeval_ms(); - command_print(cmd_ctx, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0)); - return ERROR_OK; -} - - /* Give TELNET a way to find out what version this is */ int handle_zy1000_version_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) @@ -1969,12 +1779,6 @@ register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY, "remove file"); - register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY, - "same args as load_image, image stored in memory"); - - register_command(cmd_ctx, NULL, "fast_load", handle_fast_load_command, COMMAND_ANY, - "loads active fast load image to current target"); - register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY, "display file content"); Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2008-12-14 20:33:01 UTC (rev 1240) +++ trunk/src/target/target.c 2008-12-15 09:05:16 UTC (rev 1241) @@ -82,6 +82,9 @@ int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc); int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); + static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv); static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv); static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv); @@ -929,6 +932,14 @@ register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "translate a virtual address into a physical address"); register_command(cmd_ctx, NULL, "profile", handle_profile_command, COMMAND_EXEC, "profiling samples the CPU PC"); + register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY, + "same args as load_image, image stored in memory - mainly for profiling purposes"); + + register_command(cmd_ctx, NULL, "fast_load", handle_fast_load_command, COMMAND_ANY, + "loads active fast load image to current target - mainly for profiling purposes"); + + + register_jim(cmd_ctx, "target", jim_target, "configure target" ); @@ -3845,7 +3856,7 @@ /* incase variant is not set */ if (!target->variant) target->variant = strdup(""); - + /* create the target specific commands */ if( target->type->register_commands ){ (*(target->type->register_commands))( cmd_ctx ); @@ -3993,3 +4004,196 @@ return JIM_ERR; } + + +struct FastLoad +{ + u32 address; + u8 *data; + int length; + +}; + +static int fastload_num; +static struct FastLoad *fastload; + +static void free_fastload() +{ + if (fastload!=NULL) + { + int i; + for (i=0; i<fastload_num; i++) + { + if (fastload[i].data) + free(fastload[i].data); + } + free(fastload); + fastload=NULL; + } +} + + + + +int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + u8 *buffer; + u32 buf_cnt; + u32 image_size; + u32 min_address=0; + u32 max_address=0xffffffff; + int i; + int retval; + + image_t image; + + duration_t duration; + char *duration_text; + + if ((argc < 1)||(argc > 5)) + { + return ERROR_COMMAND_SYNTAX_ERROR; + } + + /* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */ + if (argc >= 2) + { + image.base_address_set = 1; + image.base_address = strtoul(args[1], NULL, 0); + } + else + { + image.base_address_set = 0; + } + + + image.start_address_set = 0; + + if (argc>=4) + { + min_address=strtoul(args[3], NULL, 0); + } + if (argc>=5) + { + max_address=strtoul(args[4], NULL, 0)+min_address; + } + + if (min_address>max_address) + { + return ERROR_COMMAND_SYNTAX_ERROR; + } + + duration_start_measure(&duration); + + if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) + { + return ERROR_OK; + } + + image_size = 0x0; + retval = ERROR_OK; + fastload_num=image.num_sections; + fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections); + if (fastload==NULL) + { + image_close(&image); + return ERROR_FAIL; + } + memset(fastload, 0, sizeof(struct FastLoad)*image.num_sections); + for (i = 0; i < image.num_sections; i++) + { + buffer = malloc(image.sections[i].size); + if (buffer == NULL) + { + command_print(cmd_ctx, "error allocating buffer for section (%d bytes)", image.sections[i].size); + break; + } + + if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK) + { + free(buffer); + break; + } + + u32 offset=0; + u32 length=buf_cnt; + + + /* DANGER!!! beware of unsigned comparision here!!! */ + + if ((image.sections[i].base_address+buf_cnt>=min_address)&& + (image.sections[i].base_address<max_address)) + { + if (image.sections[i].base_address<min_address) + { + /* clip addresses below */ + offset+=min_address-image.sections[i].base_address; + length-=offset; + } + + if (image.sections[i].base_address+buf_cnt>max_address) + { + length-=(image.sections[i].base_address+buf_cnt)-max_address; + } + + fastload[i].address=image.sections[i].base_address+offset; + fastload[i].data=malloc(length); + if (fastload[i].data==NULL) + { + free(buffer); + break; + } + memcpy(fastload[i].data, buffer+offset, length); + fastload[i].length=length; + + image_size += length; + command_print(cmd_ctx, "%u byte written at address 0x%8.8x", length, image.sections[i].base_address+offset); + } + + free(buffer); + } + + duration_stop_measure(&duration, &duration_text); + if (retval==ERROR_OK) + { + command_print(cmd_ctx, "Loaded %u bytes in %s", image_size, duration_text); + command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so."); + } + free(duration_text); + + image_close(&image); + + if (retval!=ERROR_OK) + { + free_fastload(); + } + + return retval; +} + +int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + if (argc>0) + return ERROR_COMMAND_SYNTAX_ERROR; + if (fastload==NULL) + { + LOG_ERROR("No image in memory"); + return ERROR_FAIL; + } + int i; + int ms=timeval_ms(); + int size=0; + for (i=0; i<fastload_num;i++) + { + int retval; + target_t *target = get_current_target(cmd_ctx); + if ((retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data)) != ERROR_OK) + { + return retval; + } + size+=fastload[i].length; + } + int after=timeval_ms(); + command_print(cmd_ctx, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0)); + return ERROR_OK; +} |
From: <kc...@ma...> - 2008-12-14 21:33:18
|
Author: kc8apf Date: 2008-12-14 21:33:01 +0100 (Sun, 14 Dec 2008) New Revision: 1240 Modified: trunk/src/jtag/bitbang.c trunk/src/jtag/bitq.c trunk/src/jtag/ft2232.c trunk/src/jtag/gw16012.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h trunk/src/jtag/usbprog.c trunk/src/jtag/zy1000.c Log: - Update tap_state_strings to correspond to SVF state names - Use new jtag_state_name() instead of global tap_state_strings[] Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/bitbang.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -109,7 +109,7 @@ } else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count])); exit(-1); } Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/bitq.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -172,7 +172,7 @@ if (tap_transitions[cur_state].low == cmd->path[i]) bitq_io(0, 0, 0); else if (tap_transitions[cur_state].high == cmd->path[i]) bitq_io(1, 0, 0); else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[i]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[i)]); exit(-1); } Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/ft2232.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -525,7 +525,7 @@ buf_set_u32(&tms_byte, bit_count++, 1, 0x1); else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count])); exit(-1); } Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/gw16012.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -240,7 +240,7 @@ } else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count])); exit(-1); } Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/jlink.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -376,7 +376,7 @@ } else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[i]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[i])); exit(-1); } Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/jtag.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -41,14 +41,6 @@ int jtag_error=ERROR_OK; -char* tap_state_strings[16] = -{ - "tlr", - "sds", "cd", "sd", "e1d", "pd", "e2d", "ud", - "rti", - "sis", "ci", "si", "e1i", "pi", "e2i", "ui" -}; - typedef struct cmd_queue_page_s { void *address; @@ -1004,7 +996,7 @@ if ((tap_transitions[cur_state].low != path[i])&& (tap_transitions[cur_state].high != path[i])) { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[i]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[i])); exit(-1); } cur_state = path[i]; @@ -2656,14 +2648,14 @@ { for (state = 0; state < 16; state++) { - if (strcmp(args[0], tap_state_strings[state]) == 0) + if (strcmp(args[0], jtag_state_name(state)) == 0) { jtag_add_end_state(state); jtag_execute_queue(); } } } - command_print(cmd_ctx, "current endstate: %s", tap_state_strings[cmd_queue_end_state]); + command_print(cmd_ctx, "current endstate: %s", jtag_state_name(cmd_queue_end_state)); return ERROR_OK; } @@ -2915,3 +2907,34 @@ Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name); } } + + +/* map state number to SVF state string */ +const char* jtag_state_name(enum tap_state state) +{ + const char* ret; + + switch( state ) + { + case TAP_RESET: ret = "RESET"; break; + case TAP_IDLE: ret = "IDLE"; break; + case TAP_DRSELECT: ret = "DRSELECT"; break; + case TAP_DRCAPTURE: ret = "DRCAPTURE"; break; + case TAP_DRSHIFT: ret = "DRSHIFT"; break; + case TAP_DREXIT1: ret = "DREXIT1"; break; + case TAP_DRPAUSE: ret = "DRPAUSE"; break; + case TAP_DREXIT2: ret = "DREXIT2"; break; + case TAP_DRUPDATE: ret = "DRUPDATE"; break; + case TAP_IRSELECT: ret = "IRSELECT"; break; + case TAP_IRCAPTURE: ret = "IRCAPTURE"; break; + case TAP_IRSHIFT: ret = "IRSHIFT"; break; + case TAP_IREXIT1: ret = "IREXIT1"; break; + case TAP_IRPAUSE: ret = "IRPAUSE"; break; + case TAP_IREXIT2: ret = "IREXIT2"; break; + case TAP_IRUPDATE: ret = "IRUPDATE"; break; + default: ret = "???"; + } + + return ret; +} + Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/jtag.h 2008-12-14 20:33:01 UTC (rev 1240) @@ -50,7 +50,6 @@ enum tap_state low; } tap_transition_t; -extern char* tap_state_strings[16]; extern int tap_move_map[16]; /* map 16 TAP states to 6 stable states */ extern u8 tap_move[6][6]; /* value scanned to TMS to move from one of six stable states to another */ extern tap_transition_t tap_transitions[16]; /* describe the TAP state diagram */ @@ -529,4 +528,11 @@ interface_jtag_add_dr_out(tap, num_fields, num_bits, value, cmd_queue_end_state); } +/** + * Function jtag_state_name + * Returns a string suitable for display representing the JTAG tap_state + */ +const char* jtag_state_name(enum tap_state state); + + #endif /* JTAG_H */ Modified: trunk/src/jtag/usbprog.c =================================================================== --- trunk/src/jtag/usbprog.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/usbprog.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -282,7 +282,7 @@ } else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(cmd->path[state_count])); exit(-1); } Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2008-12-13 13:11:15 UTC (rev 1239) +++ trunk/src/jtag/zy1000.c 2008-12-14 20:33:01 UTC (rev 1240) @@ -266,51 +266,51 @@ int loadFile(const char *fileName, void **data, int *len) { FILE * pFile; - pFile = fopen (fileName,"rb"); + pFile = fopen(fileName,"rb"); if (pFile==NULL) { LOG_ERROR("Can't open %s\n", fileName); return ERROR_JTAG_DEVICE_ERROR; } - if (fseek (pFile, 0, SEEK_END)!=0) - { + if (fseek(pFile, 0, SEEK_END)!=0) + { LOG_ERROR("Can't open %s\n", fileName); fclose(pFile); return ERROR_JTAG_DEVICE_ERROR; - } - *len=ftell (pFile); - if (*len==-1) - { + } + *len=ftell(pFile); + if (*len==-1) + { LOG_ERROR("Can't open %s\n", fileName); fclose(pFile); return ERROR_JTAG_DEVICE_ERROR; - } + } - if (fseek (pFile, 0, SEEK_SET)!=0) - { + if (fseek(pFile, 0, SEEK_SET)!=0) + { LOG_ERROR("Can't open %s\n", fileName); fclose(pFile); return ERROR_JTAG_DEVICE_ERROR; - } - *data=malloc(*len+1); - if (*data==NULL) - { + } + *data=malloc(*len+1); + if (*data==NULL) + { LOG_ERROR("Can't open %s\n", fileName); fclose(pFile); return ERROR_JTAG_DEVICE_ERROR; - } + } - if (fread(*data, 1, *len, pFile)!=*len) - { + if (fread(*data, 1, *len, pFile)!=*len) + { fclose(pFile); free(*data); LOG_ERROR("Can't open %s\n", fileName); return ERROR_JTAG_DEVICE_ERROR; - } - fclose (pFile); - *(((char *)(*data))+*len)=0; /* sentinel */ + } + fclose(pFile); + *(((char *)(*data))+*len)=0; /* sentinel */ - return ERROR_OK; + return ERROR_OK; @@ -365,7 +365,7 @@ #if 0 static void shiftValueInnerFlip(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value) { - VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", tap_state_strings[state], tap_state_strings[endState], repeat, value)); + VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", jtag_state_name(state), jtag_state_name(endState), repeat, value)); cyg_uint32 a,b; a=state; b=endState; @@ -476,7 +476,7 @@ int r=fields[i].in_handler(inBuffer, fields[i].in_handler_priv, fields+i); if (r!=ERROR_OK) { - /* this will cause jtag_execute_queue() to return an error */ + /* this will cause jtag_execute_queue() to return an error */ jtag_error=r; } } @@ -703,7 +703,7 @@ } else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[path[state_count]]); + LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", jtag_state_name(cur_state), jtag_state_name(path[state_count)]); exit(-1); } |
From: <du...@ma...> - 2008-12-13 14:11:20
|
Author: duane Date: 2008-12-13 14:11:15 +0100 (Sat, 13 Dec 2008) New Revision: 1239 Added: trunk/src/target/target/samsung_s3c2440.cfg Removed: trunk/src/target/target/s3c2440.cfg Log: Updates and fixes from Kees Jongenburger Deleted: trunk/src/target/target/s3c2440.cfg =================================================================== --- trunk/src/target/target/s3c2440.cfg 2008-12-13 12:44:39 UTC (rev 1238) +++ trunk/src/target/target/s3c2440.cfg 2008-12-13 13:11:15 UTC (rev 1239) @@ -1,37 +0,0 @@ -# Target configuration for the Samsung 2440 system on chip -# Tested on a S3C2440 Evaluation board -# Processor : ARM920Tid(wb) rev 0 (v4l) -# Info: JTAG device found: 0x0032409d (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0) -# [Duane Ellis 27/nov/2008: Above 0x0032409d appears to be copy/paste from other places] -# [and I do not believe it to be accurate, hence the 0xffffffff below] - -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME s3c2440 -} - -if { [info exists ENDIAN] } { - set _ENDIAN $ENDIAN -} else { - # this defaults to a bigendian - set _ENDIAN little -} - -if { [info exists CPUTAPID ] } { - set _CPUTAPID $CPUTAPID -} else { - # force an error till we get a good number - set _CPUTAPID 0xFFFFFFFF -} - -#jtag scan chain -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $_CPUTAPID - -set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME arm920t -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm920t -$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x200000 -work-area-size 0x4000 -work-area-backup 1 - -#reset configuration -reset_config trst_and_srst - Copied: trunk/src/target/target/samsung_s3c2440.cfg (from rev 1238, trunk/src/target/target/s3c2440.cfg) =================================================================== --- trunk/src/target/target/s3c2440.cfg 2008-12-13 12:44:39 UTC (rev 1238) +++ trunk/src/target/target/samsung_s3c2440.cfg 2008-12-13 13:11:15 UTC (rev 1239) @@ -0,0 +1,35 @@ +# Target configuration for the Samsung 2440 system on chip +# Tested on a S3C2440 Evaluation board by keesj +# Processor : ARM920Tid(wb) rev 0 (v4l) +# Info: JTAG tap: s3c2440.cpu tap/device found: 0x0032409d (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0) + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME s3c2440 +} + +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + # this defaults to a bigendian + set _ENDIAN little +} + +if { [info exists CPUTAPID ] } { + set _CPUTAPID $CPUTAPID +} else { + # force an error till we get a good number + set _CPUTAPID 0x0032409d +} + +#jtag scan chain +jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $_CPUTAPID + +set _TARGETNAME [format "%s.cpu" $_CHIPNAME] +target create $_TARGETNAME arm920t -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm920t +$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x200000 -work-area-size 0x4000 -work-area-backup 1 + +#reset configuration +reset_config trst_and_srst + Property changes on: trunk/src/target/target/samsung_s3c2440.cfg ___________________________________________________________________ Name: svn:mergeinfo + Name: svn:eol-style + native |
From: ntfreak at B. <nt...@ma...> - 2008-12-13 13:44:42
|
Author: ntfreak Date: 2008-12-13 13:44:39 +0100 (Sat, 13 Dec 2008) New Revision: 1238 Modified: trunk/src/flash/cfi.h trunk/src/flash/ecos.c trunk/src/flash/flash.c trunk/src/flash/lpc2000.c trunk/src/flash/lpc288x.c trunk/src/flash/lpc3180_nand_controller.c trunk/src/flash/mflash.c trunk/src/flash/mflash.h trunk/src/flash/nand.c trunk/src/flash/s3c24xx_regs_nand.h trunk/src/flash/stellaris.h trunk/src/flash/stm32x.h trunk/src/flash/str7x.c trunk/src/flash/str7x.h trunk/src/flash/str9x.h trunk/src/flash/tms470.c trunk/src/helper/bin2char.c trunk/src/helper/binarybuffer.c trunk/src/helper/command.c trunk/src/helper/configuration.c trunk/src/helper/fileio.h trunk/src/helper/log.c trunk/src/helper/log.h trunk/src/helper/options.c trunk/src/helper/replacements.c trunk/src/helper/replacements.h trunk/src/helper/tclapi.c trunk/src/helper/types.h trunk/src/jtag/bitbang.c trunk/src/jtag/bitq.c trunk/src/jtag/dummy.c trunk/src/jtag/ep93xx.c trunk/src/jtag/gw16012.c trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h trunk/src/jtag/presto.c trunk/src/jtag/usbprog.c trunk/src/openocd.c trunk/src/server/gdb_server.c trunk/src/server/server.c trunk/src/server/telnet_server.c 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/arm7tdmi.h trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm926ejs.h trunk/src/target/arm966e.c trunk/src/target/arm9tdmi.c trunk/src/target/arm9tdmi.h trunk/src/target/armv4_5.c trunk/src/target/armv4_5.h trunk/src/target/breakpoints.c trunk/src/target/breakpoints.h trunk/src/target/cortex_m3.c trunk/src/target/cortex_m3.h trunk/src/target/cortex_swjdp.h trunk/src/target/embeddedice.h trunk/src/target/etb.h trunk/src/target/feroceon.c trunk/src/target/image.c trunk/src/target/image.h trunk/src/target/mips32.c trunk/src/target/mips32.h trunk/src/target/mips32_dmaacc.c trunk/src/target/mips32_dmaacc.h trunk/src/target/mips32_pracc.h trunk/src/target/mips_m4k.c trunk/src/target/mips_m4k.h trunk/src/target/oocd_trace.c trunk/src/target/oocd_trace.h trunk/src/target/register.c trunk/src/target/register.h trunk/src/target/target.c trunk/src/target/target.h trunk/src/target/xscale.c Log: - remove target specific variant and use target->variant member - fix build warning in cortex_m3 - code cleanup - remove trailing lf and convert c++ comments Modified: trunk/src/flash/cfi.h =================================================================== --- trunk/src/flash/cfi.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/cfi.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -148,10 +148,10 @@ } cfi_fixup_t; #define CFI_MFR_AMD 0x0001 -#define CFI_MFR_FUJITSU 0x0004 +#define CFI_MFR_FUJITSU 0x0004 #define CFI_MFR_ATMEL 0x001F #define CFI_MFR_ST 0x0020 /* STMicroelectronics */ -#define CFI_MFR_AMIC 0x0037 +#define CFI_MFR_AMIC 0x0037 #define CFI_MFR_SST 0x00BF #define CFI_MFR_MX 0x00C2 Modified: trunk/src/flash/ecos.c =================================================================== --- trunk/src/flash/ecos.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/ecos.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -25,7 +25,6 @@ #include "replacements.h" - #include "flash.h" #include "target.h" @@ -37,8 +36,6 @@ #include "../target/embeddedice.h" #include "types.h" - - int ecosflash_register_commands(struct command_context_s *cmd_ctx); int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); int ecosflash_erase(struct flash_bank_s *bank, int first, int last); @@ -99,42 +96,41 @@ #define FLASH_ERR_DRV_WRONG_PART 0x0d /* Driver does not support device */ #define FLASH_ERR_LOW_VOLTAGE 0x0e /* Not enough juice to complete job */ - char * flash_errmsg(int err) { - switch (err) { - case FLASH_ERR_OK: - return "No error - operation complete"; - case FLASH_ERR_ERASE_SUSPEND: - return "Device is in erase suspend state"; - case FLASH_ERR_PROGRAM_SUSPEND: - return "Device is in program suspend state"; - case FLASH_ERR_INVALID: - return "Invalid FLASH address"; - case FLASH_ERR_ERASE: - return "Error trying to erase"; - case FLASH_ERR_LOCK: - return "Error trying to lock/unlock"; - case FLASH_ERR_PROGRAM: - return "Error trying to program"; - case FLASH_ERR_PROTOCOL: - return "Generic error"; - case FLASH_ERR_PROTECT: - return "Device/region is write-protected"; - case FLASH_ERR_NOT_INIT: - return "FLASH sub-system not initialized"; - case FLASH_ERR_DRV_VERIFY: - return "Data verify failed after operation"; - case FLASH_ERR_DRV_TIMEOUT: - return "Driver timed out waiting for device"; - case FLASH_ERR_DRV_WRONG_PART: - return "Driver does not support device"; - case FLASH_ERR_LOW_VOLTAGE: - return "Device reports low voltage"; - default: - return "Unknown error"; - } + switch (err) { + case FLASH_ERR_OK: + return "No error - operation complete"; + case FLASH_ERR_ERASE_SUSPEND: + return "Device is in erase suspend state"; + case FLASH_ERR_PROGRAM_SUSPEND: + return "Device is in program suspend state"; + case FLASH_ERR_INVALID: + return "Invalid FLASH address"; + case FLASH_ERR_ERASE: + return "Error trying to erase"; + case FLASH_ERR_LOCK: + return "Error trying to lock/unlock"; + case FLASH_ERR_PROGRAM: + return "Error trying to program"; + case FLASH_ERR_PROTOCOL: + return "Generic error"; + case FLASH_ERR_PROTECT: + return "Device/region is write-protected"; + case FLASH_ERR_NOT_INIT: + return "FLASH sub-system not initialized"; + case FLASH_ERR_DRV_VERIFY: + return "Data verify failed after operation"; + case FLASH_ERR_DRV_TIMEOUT: + return "Driver timed out waiting for device"; + case FLASH_ERR_DRV_WRONG_PART: + return "Driver does not support device"; + case FLASH_ERR_LOW_VOLTAGE: + return "Device reports low voltage"; + default: + return "Unknown error"; + } } #endif @@ -185,7 +181,6 @@ return ERROR_OK; } - int loadDriver(ecosflash_flash_bank_t *info) { u32 buf_cnt; @@ -228,7 +223,6 @@ return ERROR_OK; } - static int const OFFSET_ERASE=0x0; static int const OFFSET_ERASE_SIZE=0x8; static int const OFFSET_FLASH=0xc; @@ -236,7 +230,6 @@ static int const OFFSET_GET_WORKAREA=0x18; static int const OFFSET_GET_WORKAREA_SIZE=0x4; - int runCode(ecosflash_flash_bank_t *info, u32 codeStart, u32 codeStop, u32 r0, u32 r1, u32 r2, u32 *result, @@ -334,8 +327,8 @@ int i; - for (i=0; i<len; i+=chunk) - { + for (i=0; i<len; i+=chunk) + { int t=len-i; if (t>chunk) { @@ -343,38 +336,36 @@ } int retval; - retval=target_write_buffer(target, buffer, t, ((u8 *)data)+i); - if (retval != ERROR_OK) - return retval; + retval=target_write_buffer(target, buffer, t, ((u8 *)data)+i); + if (retval != ERROR_OK) + return retval; - u32 flashErr; - retval=runCode(info, - info->start_address+OFFSET_FLASH, - info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE, - buffer, - address+i, - t, - &flashErr, - timeout); - if (retval != ERROR_OK) - return retval; + u32 flashErr; + retval=runCode(info, + info->start_address+OFFSET_FLASH, + info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE, + buffer, + address+i, + t, + &flashErr, + timeout); + if (retval != ERROR_OK) + return retval; if (flashErr != 0x0) { LOG_ERROR("Flash prog failed with %d (%s)\n", flashErr, flash_errmsg(flashErr)); return ERROR_FAIL; } - } + } return ERROR_OK; } - int ecosflash_probe(struct flash_bank_s *bank) { return ERROR_OK; } - int ecosflash_register_commands(struct command_context_s *cmd_ctx) { register_command(cmd_ctx, NULL, "ecosflash", NULL, COMMAND_ANY, NULL); @@ -382,7 +373,7 @@ return ERROR_OK; } -/* +#if 0 static void command(flash_bank_t *bank, u8 cmd, u8 *cmd_buf) { ecosflash_flash_bank_t *info = bank->driver_priv; @@ -403,7 +394,7 @@ } } } -*/ +#endif u32 ecosflash_address(struct flash_bank_s *bank, u32 address) { @@ -421,7 +412,6 @@ return retval + bank->base; } - int ecosflash_erase(struct flash_bank_s *bank, int first, int last) { struct flash_bank_s *c=bank; @@ -434,7 +424,6 @@ return ERROR_OK; } - int ecosflash_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) { ecosflash_flash_bank_t *info = bank->driver_priv; @@ -442,7 +431,6 @@ return eCosBoard_flash(info, buffer, c->base+offset, count); } - int ecosflash_protect_check(struct flash_bank_s *bank) { return ERROR_OK; @@ -455,7 +443,6 @@ return ERROR_OK; } - u32 ecosflash_get_flash_status(flash_bank_t *bank) { return ERROR_OK; @@ -475,7 +462,3 @@ { return ERROR_OK; } - - - - Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/flash.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -466,7 +466,6 @@ j, p->sectors[j].offset, p->sectors[j].size, p->sectors[j].size>>10, erase_state); } - } return ERROR_OK; @@ -658,7 +657,6 @@ command_print(cmd_ctx, "auto erase enabled"); } - if (argc < 1) { return ERROR_COMMAND_SYNTAX_ERROR; @@ -743,7 +741,6 @@ if(count == 0) return ERROR_OK; - switch(cmd[4]) { case 'w': @@ -804,7 +801,6 @@ return retval; } - if(err == ERROR_OK) { float speed; Modified: trunk/src/flash/lpc2000.c =================================================================== --- trunk/src/flash/lpc2000.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/lpc2000.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -577,7 +577,7 @@ break; if (bytes_remaining >= thisrun_bytes) - { + { if ((retval = target_write_buffer(bank->target, download_area->address, thisrun_bytes, buffer + bytes_written)) != ERROR_OK) { retval = ERROR_FLASH_OPERATION_FAILED; Modified: trunk/src/flash/lpc288x.c =================================================================== --- trunk/src/flash/lpc288x.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/lpc288x.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -126,7 +126,6 @@ .info = lpc288x_info }; - int lpc288x_register_commands(struct command_context_s *cmd_ctx) { return ERROR_OK; @@ -204,7 +203,7 @@ int lpc288x_protect_check(struct flash_bank_s *bank) { - return ERROR_OK; + return ERROR_OK; } /* flash_bank LPC288x 0 0 0 0 <target#> <cclk> */ Modified: trunk/src/flash/lpc3180_nand_controller.c =================================================================== --- trunk/src/flash/lpc3180_nand_controller.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/lpc3180_nand_controller.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -69,7 +69,7 @@ int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device) { lpc3180_nand_controller_t *lpc3180_info; - + if (argc < 3) { LOG_WARNING("incomplete 'lpc3180' nand flash configuration"); @@ -126,7 +126,7 @@ if (bypass && !direct) /* bypass mode */ return fclkin / (2 * p); - + if (bypass & direct) /* direct bypass mode */ return fclkin; @@ -273,7 +273,7 @@ trhz = ((30 / cycle) + 1); trbwb = ((100 / cycle) + 1); tcea = ((45 / cycle) + 1); - + /* MLC_LOCK = 0xa25e (unlock protected registers) */ target_write_u32(target, 0x200b8044, 0xa25e); Modified: trunk/src/flash/mflash.c =================================================================== --- trunk/src/flash/mflash.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/mflash.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -80,7 +80,7 @@ target_t *target = mflash_bank->target; int ret; - // remove alternate function. + /* remove alternate function. */ mask = 0x3u << (gpio.num & 0xF)*2; addr = PXA270_GAFR0_L + (gpio.num >> 4) * 4; @@ -95,7 +95,7 @@ if ((ret = target_write_u32(target, addr, value)) != ERROR_OK) return ret; - // set direction to output + /* set direction to output */ mask = 0x1u << (gpio.num & 0x1F); addr = PXA270_GPDR0 + (gpio.num >> 5) * 4; @@ -261,75 +261,75 @@ duration_start_measure(&duration); - while (time) { + while (time) { - target_read_u8(target, mg_task_reg + MG_REG_STATUS, &status); + target_read_u8(target, mg_task_reg + MG_REG_STATUS, &status); - if (status & mg_io_rbit_status_busy) - { - if (wait == mg_io_wait_bsy) - return ERROR_OK; - } else { - switch(wait) - { - case mg_io_wait_not_bsy: - return ERROR_OK; - case mg_io_wait_rdy_noerr: - if (status & mg_io_rbit_status_ready) - return ERROR_OK; - break; - case mg_io_wait_drq_noerr: - if (status & mg_io_rbit_status_data_req) - return ERROR_OK; - break; - default: - break; - } + if (status & mg_io_rbit_status_busy) + { + if (wait == mg_io_wait_bsy) + return ERROR_OK; + } else { + switch(wait) + { + case mg_io_wait_not_bsy: + return ERROR_OK; + case mg_io_wait_rdy_noerr: + if (status & mg_io_rbit_status_ready) + return ERROR_OK; + break; + case mg_io_wait_drq_noerr: + if (status & mg_io_rbit_status_data_req) + return ERROR_OK; + break; + default: + break; + } - // Now we check the error condition! - if (status & mg_io_rbit_status_error) - { - target_read_u8(target, mg_task_reg + MG_REG_ERROR, &error); + /* Now we check the error condition! */ + if (status & mg_io_rbit_status_error) + { + target_read_u8(target, mg_task_reg + MG_REG_ERROR, &error); - if (error & mg_io_rbit_err_bad_sect_num) { - LOG_ERROR("sector not found"); - return ERROR_FAIL; - } - else if (error & (mg_io_rbit_err_bad_block | mg_io_rbit_err_uncorrectable)) { - LOG_ERROR("bad block"); - return ERROR_FAIL; - } else { - LOG_ERROR("disk operation fail"); - return ERROR_FAIL; - } - } + if (error & mg_io_rbit_err_bad_sect_num) { + LOG_ERROR("sector not found"); + return ERROR_FAIL; + } + else if (error & (mg_io_rbit_err_bad_block | mg_io_rbit_err_uncorrectable)) { + LOG_ERROR("bad block"); + return ERROR_FAIL; + } else { + LOG_ERROR("disk operation fail"); + return ERROR_FAIL; + } + } - switch (wait) - { - case mg_io_wait_rdy: - if (status & mg_io_rbit_status_ready) - return ERROR_OK; + switch (wait) + { + case mg_io_wait_rdy: + if (status & mg_io_rbit_status_ready) + return ERROR_OK; - case mg_io_wait_drq: - if (status & mg_io_rbit_status_data_req) - return ERROR_OK; + case mg_io_wait_drq: + if (status & mg_io_rbit_status_data_req) + return ERROR_OK; - default: - break; - } - } + default: + break; + } + } - duration_stop_measure(&duration, NULL); + duration_stop_measure(&duration, NULL); - t=duration.duration.tv_usec/1000; - t+=duration.duration.tv_sec*1000; + t=duration.duration.tv_usec/1000; + t+=duration.duration.tv_sec*1000; if (t > time) - break; - } + break; + } - LOG_ERROR("timeout occured"); - return ERROR_FAIL; + LOG_ERROR("timeout occured"); + return ERROR_FAIL; } static int mg_dsk_srst(u8 on) @@ -634,7 +634,6 @@ LOG_DEBUG("copies %u byte", end_addr - cur_addr); } - } free(sect_buff); @@ -671,7 +670,6 @@ } mg_mflash_write_sects(sect_buff, sect_num, 1); - } if (cur_addr < end_addr) { @@ -697,9 +695,7 @@ memcpy(sect_buff, buff_ptr, end_addr - cur_addr); LOG_DEBUG("copies %u byte", end_addr - cur_addr); mg_mflash_write_sects(sect_buff, sect_num, 1); - } - } free(sect_buff); @@ -711,7 +707,7 @@ { u32 address, buf_cnt; u8 *buffer; - // TODO : multi-bank support, large file support + /* TODO : multi-bank support, large file support */ fileio_t fileio; duration_t duration; char *duration_text; @@ -727,7 +723,6 @@ mg_mflash_probe(); } - if (fileio_open(&fileio, args[1], FILEIO_READ, FILEIO_BINARY) != ERROR_OK) { return ERROR_FAIL; } @@ -764,7 +759,7 @@ { u32 address, size_written, size; u8 *buffer; - // TODO : multi-bank support + /* TODO : multi-bank support */ fileio_t fileio; duration_t duration; char *duration_text; Modified: trunk/src/flash/mflash.h =================================================================== --- trunk/src/flash/mflash.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/mflash.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -39,79 +39,79 @@ typedef struct _mg_io_type_drv_info { - mg_io_uint16 general_configuration; // 00 - mg_io_uint16 number_of_cylinders; // 01 - mg_io_uint16 reserved1; // 02 - mg_io_uint16 number_of_heads; // 03 - mg_io_uint16 unformatted_bytes_per_track; // 04 - mg_io_uint16 unformatted_bytes_per_sector; // 05 - mg_io_uint16 sectors_per_track; // 06 - mg_io_uint8 vendor_unique1[6]; // 07/08/09 + mg_io_uint16 general_configuration; /* 00 */ + mg_io_uint16 number_of_cylinders; /* 01 */ + mg_io_uint16 reserved1; /* 02 */ + mg_io_uint16 number_of_heads; /* 03 */ + mg_io_uint16 unformatted_bytes_per_track; /* 04 */ + mg_io_uint16 unformatted_bytes_per_sector; /* 05 */ + mg_io_uint16 sectors_per_track; /* 06 */ + mg_io_uint8 vendor_unique1[6]; /* 07/08/09 */ - mg_io_uint8 serial_number[20]; // 10~19 + mg_io_uint8 serial_number[20]; /* 10~19 */ - mg_io_uint16 buffer_type; // 20 - mg_io_uint16 buffer_sector_size; // 21 - mg_io_uint16 number_of_ecc_bytes; // 22 + mg_io_uint16 buffer_type; /* 20 */ + mg_io_uint16 buffer_sector_size; /* 21 */ + mg_io_uint16 number_of_ecc_bytes; /* 22 */ - mg_io_uint8 firmware_revision[8]; // 23~26 - mg_io_uint8 model_number[40]; // 27 + mg_io_uint8 firmware_revision[8]; /* 23~26 */ + mg_io_uint8 model_number[40]; /* 27 */ - mg_io_uint8 maximum_block_transfer; // 47 low byte - mg_io_uint8 vendor_unique2; // 47 high byte - mg_io_uint16 dword_io; // 48 + mg_io_uint8 maximum_block_transfer; /* 47 low byte */ + mg_io_uint8 vendor_unique2; /* 47 high byte */ + mg_io_uint16 dword_io; /* 48 */ - mg_io_uint16 capabilities; // 49 - mg_io_uint16 reserved2; // 50 + mg_io_uint16 capabilities; /* 49 */ + mg_io_uint16 reserved2; /* 50 */ - mg_io_uint8 vendor_unique3; // 51 low byte - mg_io_uint8 pio_cycle_timing_mode; // 51 high byte - mg_io_uint8 vendor_unique4; // 52 low byte - mg_io_uint8 dma_cycle_timing_mode; // 52 high byte - mg_io_uint16 translation_fields_valid; // 53 (low bit) - mg_io_uint16 number_of_current_cylinders; // 54 - mg_io_uint16 number_of_current_heads; // 55 - mg_io_uint16 current_sectors_per_track; // 56 - mg_io_uint16 current_sector_capacity_lo; // 57 & 58 - mg_io_uint16 current_sector_capacity_hi; // 57 & 58 - mg_io_uint8 multi_sector_count; // 59 low - mg_io_uint8 multi_sector_setting_valid; // 59 high (low bit) + mg_io_uint8 vendor_unique3; /* 51 low byte */ + mg_io_uint8 pio_cycle_timing_mode; /* 51 high byte */ + mg_io_uint8 vendor_unique4; /* 52 low byte */ + mg_io_uint8 dma_cycle_timing_mode; /* 52 high byte */ + mg_io_uint16 translation_fields_valid; /* 53 (low bit) */ + mg_io_uint16 number_of_current_cylinders; /* 54 */ + mg_io_uint16 number_of_current_heads; /* 55 */ + mg_io_uint16 current_sectors_per_track; /* 56 */ + mg_io_uint16 current_sector_capacity_lo; /* 57 & 58 */ + mg_io_uint16 current_sector_capacity_hi; /* 57 & 58 */ + mg_io_uint8 multi_sector_count; /* 59 low */ + mg_io_uint8 multi_sector_setting_valid; /* 59 high (low bit) */ - mg_io_uint16 total_user_addressable_sectors_lo; // 60 & 61 - mg_io_uint16 total_user_addressable_sectors_hi; // 60 & 61 + mg_io_uint16 total_user_addressable_sectors_lo; /* 60 & 61 */ + mg_io_uint16 total_user_addressable_sectors_hi; /* 60 & 61 */ - mg_io_uint8 single_dma_modes_supported; // 62 low byte - mg_io_uint8 single_dma_transfer_active; // 62 high byte - mg_io_uint8 multi_dma_modes_supported; // 63 low byte - mg_io_uint8 multi_dma_transfer_active; // 63 high byte - mg_io_uint16 adv_pio_mode; - mg_io_uint16 min_dma_cyc; - mg_io_uint16 recommend_dma_cyc; - mg_io_uint16 min_pio_cyc_no_iordy; - mg_io_uint16 min_pio_cyc_with_iordy; - mg_io_uint8 reserved3[22]; - mg_io_uint16 major_ver_num; - mg_io_uint16 minor_ver_num; - mg_io_uint16 feature_cmd_set_suprt0; - mg_io_uint16 feature_cmd_set_suprt1; - mg_io_uint16 feature_cmd_set_suprt2; - mg_io_uint16 feature_cmd_set_en0; - mg_io_uint16 feature_cmd_set_en1; - mg_io_uint16 feature_cmd_set_en2; - mg_io_uint16 reserved4; - mg_io_uint16 req_time_for_security_er_done; - mg_io_uint16 req_time_for_enhan_security_er_done; - mg_io_uint16 adv_pwr_mgm_lvl_val; - mg_io_uint16 reserved5; - mg_io_uint16 re_of_hw_rst; - mg_io_uint8 reserved6[68]; - mg_io_uint16 security_stas; - mg_io_uint8 vendor_uniq_bytes[62]; - mg_io_uint16 cfa_pwr_mode; - mg_io_uint8 reserved7[186]; + mg_io_uint8 single_dma_modes_supported; /* 62 low byte */ + mg_io_uint8 single_dma_transfer_active; /* 62 high byte */ + mg_io_uint8 multi_dma_modes_supported; /* 63 low byte */ + mg_io_uint8 multi_dma_transfer_active; /* 63 high byte */ + mg_io_uint16 adv_pio_mode; + mg_io_uint16 min_dma_cyc; + mg_io_uint16 recommend_dma_cyc; + mg_io_uint16 min_pio_cyc_no_iordy; + mg_io_uint16 min_pio_cyc_with_iordy; + mg_io_uint8 reserved3[22]; + mg_io_uint16 major_ver_num; + mg_io_uint16 minor_ver_num; + mg_io_uint16 feature_cmd_set_suprt0; + mg_io_uint16 feature_cmd_set_suprt1; + mg_io_uint16 feature_cmd_set_suprt2; + mg_io_uint16 feature_cmd_set_en0; + mg_io_uint16 feature_cmd_set_en1; + mg_io_uint16 feature_cmd_set_en2; + mg_io_uint16 reserved4; + mg_io_uint16 req_time_for_security_er_done; + mg_io_uint16 req_time_for_enhan_security_er_done; + mg_io_uint16 adv_pwr_mgm_lvl_val; + mg_io_uint16 reserved5; + mg_io_uint16 re_of_hw_rst; + mg_io_uint8 reserved6[68]; + mg_io_uint16 security_stas; + mg_io_uint8 vendor_uniq_bytes[62]; + mg_io_uint16 cfa_pwr_mode; + mg_io_uint8 reserved7[186]; - mg_io_uint16 scts_per_secure_data_unit; - mg_io_uint16 integrity_word; + mg_io_uint16 scts_per_secure_data_unit; + mg_io_uint16 integrity_word; } mg_io_type_drv_info; @@ -140,105 +140,105 @@ extern int mflash_register_commands(struct command_context_s *cmd_ctx); extern int mflash_init_drivers(struct command_context_s *cmd_ctx); -#define MG_MFLASH_SECTOR_SIZE (0x200) //512Bytes = 2^9 -#define MG_MFLASH_SECTOR_SIZE_MASK (0x200-1) -#define MG_MFLASH_SECTOR_SIZE_SHIFT (9) +#define MG_MFLASH_SECTOR_SIZE (0x200) /* 512Bytes = 2^9 */ +#define MG_MFLASH_SECTOR_SIZE_MASK (0x200-1) +#define MG_MFLASH_SECTOR_SIZE_SHIFT (9) -#define MG_BUFFER_OFFSET 0x8000 +#define MG_BUFFER_OFFSET 0x8000 #define MG_REG_OFFSET 0xC000 -#define MG_REG_FEATURE 0x2 // write case -#define MG_REG_ERROR 0x2 // read case +#define MG_REG_FEATURE 0x2 /* write case */ +#define MG_REG_ERROR 0x2 /* read case */ #define MG_REG_SECT_CNT 0x4 #define MG_REG_SECT_NUM 0x6 #define MG_REG_CYL_LOW 0x8 #define MG_REG_CYL_HIGH 0xA #define MG_REG_DRV_HEAD 0xC -#define MG_REG_COMMAND 0xE // write case -#define MG_REG_STATUS 0xE // read case +#define MG_REG_COMMAND 0xE /* write case */ +#define MG_REG_STATUS 0xE /* read case */ #define MG_REG_DRV_CTRL 0x10 #define MG_REG_BURST_CTRL 0x12 -#define MG_OEM_DISK_WAIT_TIME_LONG 15000 // msec -#define MG_OEM_DISK_WAIT_TIME_NORMAL 3000 // msec -#define MG_OEM_DISK_WAIT_TIME_SHORT 1000 // msec +#define MG_OEM_DISK_WAIT_TIME_LONG 15000 /* msec */ +#define MG_OEM_DISK_WAIT_TIME_NORMAL 3000 /* msec */ +#define MG_OEM_DISK_WAIT_TIME_SHORT 1000 /* msec */ typedef enum _mg_io_type_wait{ - mg_io_wait_bsy = 1, - mg_io_wait_not_bsy = 2, - mg_io_wait_rdy = 3, - mg_io_wait_drq = 4, // wait for data request - mg_io_wait_drq_noerr = 5, // wait for DRQ but ignore the error status bit - mg_io_wait_rdy_noerr = 6 // wait for ready, but ignore error status bit + mg_io_wait_bsy = 1, + mg_io_wait_not_bsy = 2, + mg_io_wait_rdy = 3, + mg_io_wait_drq = 4, /* wait for data request */ + mg_io_wait_drq_noerr = 5, /* wait for DRQ but ignore the error status bit */ + mg_io_wait_rdy_noerr = 6 /* wait for ready, but ignore error status bit */ } mg_io_type_wait; -//= "Status Register" bit masks. +/*= "Status Register" bit masks. */ typedef enum _mg_io_type_rbit_status{ - mg_io_rbit_status_error = 0x01, // error bit in status register - mg_io_rbit_status_corrected_error = 0x04, // corrected error in status register - mg_io_rbit_status_data_req = 0x08, // data request bit in status register - mg_io_rbit_status_seek_done = 0x10, // DSC - Drive Seek Complete - mg_io_rbit_status_write_fault = 0x20, // DWF - Drive Write Fault - mg_io_rbit_status_ready = 0x40, - mg_io_rbit_status_busy = 0x80 + mg_io_rbit_status_error = 0x01, /* error bit in status register */ + mg_io_rbit_status_corrected_error = 0x04, /* corrected error in status register */ + mg_io_rbit_status_data_req = 0x08, /* data request bit in status register */ + mg_io_rbit_status_seek_done = 0x10, /* DSC - Drive Seek Complete */ + mg_io_rbit_status_write_fault = 0x20, /* DWF - Drive Write Fault */ + mg_io_rbit_status_ready = 0x40, + mg_io_rbit_status_busy = 0x80 } mg_io_type_rbit_status; -//= "Error Register" bit masks. +/*= "Error Register" bit masks. */ typedef enum _mg_io_type_rbit_error{ - mg_io_rbit_err_general = 0x01, - mg_io_rbit_err_aborted = 0x04, - mg_io_rbit_err_bad_sect_num = 0x10, - mg_io_rbit_err_uncorrectable = 0x40, - mg_io_rbit_err_bad_block = 0x80 + mg_io_rbit_err_general = 0x01, + mg_io_rbit_err_aborted = 0x04, + mg_io_rbit_err_bad_sect_num = 0x10, + mg_io_rbit_err_uncorrectable = 0x40, + mg_io_rbit_err_bad_block = 0x80 } mg_io_type_rbit_error; -//= "Device Control Register" bit. +/* = "Device Control Register" bit. */ typedef enum _mg_io_type_rbit_devc{ - mg_io_rbit_devc_intr = 0x02,// interrupt enable bit (1:disable, 0:enable) - mg_io_rbit_devc_srst = 0x04 // softwrae reset bit (1:assert, 0:de-assert) + mg_io_rbit_devc_intr = 0x02, /* interrupt enable bit (1:disable, 0:enable) */ + mg_io_rbit_devc_srst = 0x04 /* softwrae reset bit (1:assert, 0:de-assert) */ } mg_io_type_rbit_devc; -// "Drive Select/Head Register" values. +/* "Drive Select/Head Register" values. */ typedef enum _mg_io_type_rval_dev{ - mg_io_rval_dev_must_be_on = 0x80, // These 1 bits are always on - mg_io_rval_dev_drv_master = (0x00 | mg_io_rval_dev_must_be_on),// Master - mg_io_rval_dev_drv_slave0 = (0x10 | mg_io_rval_dev_must_be_on),// Slave0 - mg_io_rval_dev_drv_slave1 = (0x20 | mg_io_rval_dev_must_be_on),// Slave1 - mg_io_rval_dev_drv_slave2 = (0x30 | mg_io_rval_dev_must_be_on),// Slave2 - mg_io_rval_dev_lba_mode = (0x40 | mg_io_rval_dev_must_be_on) + mg_io_rval_dev_must_be_on = 0x80, /* These 1 bits are always on */ + mg_io_rval_dev_drv_master = (0x00 | mg_io_rval_dev_must_be_on), /* Master */ + mg_io_rval_dev_drv_slave0 = (0x10 | mg_io_rval_dev_must_be_on), /* Slave0 */ + mg_io_rval_dev_drv_slave1 = (0x20 | mg_io_rval_dev_must_be_on), /* Slave1 */ + mg_io_rval_dev_drv_slave2 = (0x30 | mg_io_rval_dev_must_be_on), /* Slave2 */ + mg_io_rval_dev_lba_mode = (0x40 | mg_io_rval_dev_must_be_on) } mg_io_type_rval_dev; typedef enum _mg_io_type_cmd { - mg_io_cmd_read =0x20, - mg_io_cmd_write =0x30, + mg_io_cmd_read =0x20, + mg_io_cmd_write =0x30, - mg_io_cmd_setmul =0xC6, - mg_io_cmd_readmul =0xC4, - mg_io_cmd_writemul =0xC5, + mg_io_cmd_setmul =0xC6, + mg_io_cmd_readmul =0xC4, + mg_io_cmd_writemul =0xC5, - mg_io_cmd_idle =0x97,//0xE3 - mg_io_cmd_idle_immediate =0x95,//0xE1 + mg_io_cmd_idle =0x97, /* 0xE3 */ + mg_io_cmd_idle_immediate =0x95, /* 0xE1 */ - mg_io_cmd_setsleep =0x99,//0xE6 - mg_io_cmd_stdby =0x96,//0xE2 - mg_io_cmd_stdby_immediate =0x94,//0xE0 + mg_io_cmd_setsleep =0x99, /* 0xE6 */ + mg_io_cmd_stdby =0x96, /* 0xE2 */ + mg_io_cmd_stdby_immediate =0x94, /* 0xE0 */ - mg_io_cmd_identify =0xEC, - mg_io_cmd_set_feature =0xEF, + mg_io_cmd_identify =0xEC, + mg_io_cmd_set_feature =0xEF, - mg_io_cmd_confirm_write =0x3C, - mg_io_cmd_confirm_read =0x40, - mg_io_cmd_wakeup =0xC3 + mg_io_cmd_confirm_write =0x3C, + mg_io_cmd_confirm_read =0x40, + mg_io_cmd_wakeup =0xC3 } mg_io_type_cmd; Modified: trunk/src/flash/nand.c =================================================================== --- trunk/src/flash/nand.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/nand.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -1524,4 +1524,3 @@ return ERROR_OK; } - Modified: trunk/src/flash/s3c24xx_regs_nand.h =================================================================== --- trunk/src/flash/s3c24xx_regs_nand.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/s3c24xx_regs_nand.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -85,11 +85,11 @@ #define S3C2440_NFCONT_SPARE_ECCLOCK (1<<6) #define S3C2440_NFCONT_MAIN_ECCLOCK (1<<5) #define S3C2440_NFCONT_INITECC (1<<4) -#define S3C2440_NFCONT_nFCE (1<<1) +#define S3C2440_NFCONT_nFCE (1<<1) #define S3C2440_NFCONT_ENABLE (1<<0) #define S3C2440_NFSTAT_READY (1<<0) -#define S3C2440_NFSTAT_nCE (1<<1) +#define S3C2440_NFSTAT_nCE (1<<1) #define S3C2440_NFSTAT_RnB_CHANGE (1<<2) #define S3C2440_NFSTAT_ILLEGAL_ACCESS (1<<3) @@ -114,13 +114,13 @@ #define S3C2412_NFSTAT_RnB_CHANGE (1<<4) #define S3C2412_NFSTAT_nFCE1 (1<<3) #define S3C2412_NFSTAT_nFCE0 (1<<2) -#define S3C2412_NFSTAT_Res1 (1<<1) +#define S3C2412_NFSTAT_Res1 (1<<1) #define S3C2412_NFSTAT_READY (1<<0) #define S3C2412_NFECCERR_SERRDATA(x) (((x) >> 21) & 0xf) -#define S3C2412_NFECCERR_SERRBIT(x) (((x) >> 18) & 0x7) +#define S3C2412_NFECCERR_SERRBIT(x) (((x) >> 18) & 0x7) #define S3C2412_NFECCERR_MERRDATA(x) (((x) >> 7) & 0x3ff) -#define S3C2412_NFECCERR_MERRBIT(x) (((x) >> 4) & 0x7) +#define S3C2412_NFECCERR_MERRBIT(x) (((x) >> 4) & 0x7) #define S3C2412_NFECCERR_SPARE_ERR(x) (((x) >> 2) & 0x3) #define S3C2412_NFECCERR_MAIN_ERR(x) (((x) >> 2) & 0x3) #define S3C2412_NFECCERR_NONE (0) Modified: trunk/src/flash/stellaris.h =================================================================== --- trunk/src/flash/stellaris.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/stellaris.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -83,7 +83,6 @@ #define AMASK 1 #define PMASK 2 - /* Flash Controller Command bits */ #define FMC_WRKEY (0xA442<<16) #define FMC_COMT (1<<3) Modified: trunk/src/flash/stm32x.h =================================================================== --- trunk/src/flash/stm32x.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/stm32x.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -100,4 +100,3 @@ } stm32x_mem_layout_t; #endif /* STM32X_H */ - Modified: trunk/src/flash/str7x.c =================================================================== --- trunk/src/flash/str7x.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/str7x.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -717,4 +717,3 @@ return ERROR_OK; } - Modified: trunk/src/flash/str7x.h =================================================================== --- trunk/src/flash/str7x.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/str7x.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -109,4 +109,3 @@ } str7x_mem_layout_t; #endif /* STR7X_H */ - Modified: trunk/src/flash/str9x.h =================================================================== --- trunk/src/flash/str9x.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/str9x.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -50,7 +50,7 @@ STR9X_BUSY = 11 }; -/* Flash registers */ +/* Flash registers */ #define FLASH_BBSR 0x54000000 /* Boot Bank Size Register */ #define FLASH_NBBSR 0x54000004 /* Non-Boot Bank Size Register */ @@ -61,4 +61,3 @@ #define FLASH_BCE5ADDR 0x54000020 /* BC Fifth Entry Target Address Register */ #endif /* STR9X_H */ - Modified: trunk/src/flash/tms470.c =================================================================== --- trunk/src/flash/tms470.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/flash/tms470.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -73,7 +73,7 @@ }; #define TMS470R1A256_NUM_SECTORS \ - (sizeof(TMS470R1A256_SECTORS)/sizeof(TMS470R1A256_SECTORS[0])) + (sizeof(TMS470R1A256_SECTORS)/sizeof(TMS470R1A256_SECTORS[0])) const flash_sector_t TMS470R1A288_BANK0_SECTORS[] = { {0x00000000, 0x00002000, -1, -1}, @@ -83,7 +83,7 @@ }; #define TMS470R1A288_BANK0_NUM_SECTORS \ - (sizeof(TMS470R1A288_BANK0_SECTORS)/sizeof(TMS470R1A288_BANK0_SECTORS[0])) + (sizeof(TMS470R1A288_BANK0_SECTORS)/sizeof(TMS470R1A288_BANK0_SECTORS[0])) const flash_sector_t TMS470R1A288_BANK1_SECTORS[] = { {0x00040000, 0x00010000, -1, -1}, @@ -93,43 +93,43 @@ }; #define TMS470R1A288_BANK1_NUM_SECTORS \ - (sizeof(TMS470R1A288_BANK1_SECTORS)/sizeof(TMS470R1A288_BANK1_SECTORS[0])) + (sizeof(TMS470R1A288_BANK1_SECTORS)/sizeof(TMS470R1A288_BANK1_SECTORS[0])) const flash_sector_t TMS470R1A384_BANK0_SECTORS[] = { - {0x00000000, 0x00002000, -1, -1}, - {0x00002000, 0x00002000, -1, -1}, - {0x00004000, 0x00004000, -1, -1}, - {0x00008000, 0x00004000, -1, -1}, - {0x0000C000, 0x00004000, -1, -1}, - {0x00010000, 0x00004000, -1, -1}, - {0x00014000, 0x00004000, -1, -1}, - {0x00018000, 0x00002000, -1, -1}, - {0x0001C000, 0x00002000, -1, -1}, - {0x0001E000, 0x00002000, -1, -1}, + {0x00000000, 0x00002000, -1, -1}, + {0x00002000, 0x00002000, -1, -1}, + {0x00004000, 0x00004000, -1, -1}, + {0x00008000, 0x00004000, -1, -1}, + {0x0000C000, 0x00004000, -1, -1}, + {0x00010000, 0x00004000, -1, -1}, + {0x00014000, 0x00004000, -1, -1}, + {0x00018000, 0x00002000, -1, -1}, + {0x0001C000, 0x00002000, -1, -1}, + {0x0001E000, 0x00002000, -1, -1}, }; #define TMS470R1A384_BANK0_NUM_SECTORS \ - (sizeof(TMS470R1A384_BANK0_SECTORS)/sizeof(TMS470R1A384_BANK0_SECTORS[0])) + (sizeof(TMS470R1A384_BANK0_SECTORS)/sizeof(TMS470R1A384_BANK0_SECTORS[0])) const flash_sector_t TMS470R1A384_BANK1_SECTORS[] = { - {0x00020000, 0x00008000, -1, -1}, - {0x00028000, 0x00008000, -1, -1}, - {0x00030000, 0x00008000, -1, -1}, - {0x00038000, 0x00008000, -1, -1}, + {0x00020000, 0x00008000, -1, -1}, + {0x00028000, 0x00008000, -1, -1}, + {0x00030000, 0x00008000, -1, -1}, + {0x00038000, 0x00008000, -1, -1}, }; #define TMS470R1A384_BANK1_NUM_SECTORS \ - (sizeof(TMS470R1A384_BANK1_SECTORS)/sizeof(TMS470R1A384_BANK1_SECTORS[0])) + (sizeof(TMS470R1A384_BANK1_SECTORS)/sizeof(TMS470R1A384_BANK1_SECTORS[0])) const flash_sector_t TMS470R1A384_BANK2_SECTORS[] = { - {0x00040000, 0x00008000, -1, -1}, - {0x00048000, 0x00008000, -1, -1}, - {0x00050000, 0x00008000, -1, -1}, - {0x00058000, 0x00008000, -1, -1}, + {0x00040000, 0x00008000, -1, -1}, + {0x00048000, 0x00008000, -1, -1}, + {0x00050000, 0x00008000, -1, -1}, + {0x00058000, 0x00008000, -1, -1}, }; #define TMS470R1A384_BANK2_NUM_SECTORS \ - (sizeof(TMS470R1A384_BANK2_SECTORS)/sizeof(TMS470R1A384_BANK2_SECTORS[0])) + (sizeof(TMS470R1A384_BANK2_SECTORS)/sizeof(TMS470R1A384_BANK2_SECTORS[0])) /* ---------------------------------------------------------------------- */ @@ -229,56 +229,56 @@ } break; - case 0x2d: - part_name = "TMS470R1A384"; + case 0x2d: + part_name = "TMS470R1A384"; - if ((bank->base >= 0x00000000) && (bank->base < 0x00020000)) - { - tms470_info->ordinal = 0; - bank->base = 0x00000000; - bank->size = 128 * 1024; - bank->num_sectors = TMS470R1A384_BANK0_NUM_SECTORS; - bank->sectors = malloc(sizeof(TMS470R1A384_BANK0_SECTORS)); - if (!bank->sectors) - { - return ERROR_FLASH_OPERATION_FAILED; - } - (void)memcpy(bank->sectors, TMS470R1A384_BANK0_SECTORS, sizeof(TMS470R1A384_BANK0_SECTORS)); - } - else if ((bank->base >= 0x00020000) && (bank->base < 0x00040000)) - { - tms470_info->ordinal = 1; - bank->base = 0x00020000; - bank->size = 128 * 1024; - bank->num_sectors = TMS470R1A384_BANK1_NUM_SECTORS; - bank->sectors = malloc(sizeof(TMS470R1A384_BANK1_SECTORS)); - if (!bank->sectors) - { - return ERROR_FLASH_OPERATION_FAILED; - } - (void)memcpy(bank->sectors, TMS470R1A384_BANK1_SECTORS, sizeof(TMS470R1A384_BANK1_SECTORS)); - } - else if ((bank->base >= 0x00040000) && (bank->base < 0x00060000)) - { - tms470_info->ordinal = 2; - bank->base = 0x00040000; - bank->size = 128 * 1024; - bank->num_sectors = TMS470R1A384_BANK2_NUM_SECTORS; - bank->sectors = malloc(sizeof(TMS470R1A384_BANK2_SECTORS)); - if (!bank->sectors) - { - return ERROR_FLASH_OPERATION_FAILED; - } - (void)memcpy(bank->sectors, TMS470R1A384_BANK2_SECTORS, sizeof(TMS470R1A384_BANK2_SECTORS)); - } - else - { - LOG_ERROR("No %s flash bank contains base address 0x%08x.", part_name, bank->base); - return ERROR_FLASH_OPERATION_FAILED; - } - break; + if ((bank->base >= 0x00000000) && (bank->base < 0x00020000)) + { + tms470_info->ordinal = 0; + bank->base = 0x00000000; + bank->size = 128 * 1024; + bank->num_sectors = TMS470R1A384_BANK0_NUM_SECTORS; + bank->sectors = malloc(sizeof(TMS470R1A384_BANK0_SECTORS)); + if (!bank->sectors) + { + return ERROR_FLASH_OPERATION_FAILED; + } + (void)memcpy(bank->sectors, TMS470R1A384_BANK0_SECTORS, sizeof(TMS470R1A384_BANK0_SECTORS)); + } + else if ((bank->base >= 0x00020000) && (bank->base < 0x00040000)) + { + tms470_info->ordinal = 1; + bank->base = 0x00020000; + bank->size = 128 * 1024; + bank->num_sectors = TMS470R1A384_BANK1_NUM_SECTORS; + bank->sectors = malloc(sizeof(TMS470R1A384_BANK1_SECTORS)); + if (!bank->sectors) + { + return ERROR_FLASH_OPERATION_FAILED; + } + (void)memcpy(bank->sectors, TMS470R1A384_BANK1_SECTORS, sizeof(TMS470R1A384_BANK1_SECTORS)); + } + else if ((bank->base >= 0x00040000) && (bank->base < 0x00060000)) + { + tms470_info->ordinal = 2; + bank->base = 0x00040000; + bank->size = 128 * 1024; + bank->num_sectors = TMS470R1A384_BANK2_NUM_SECTORS; + bank->sectors = malloc(sizeof(TMS470R1A384_BANK2_SECTORS)); + if (!bank->sectors) + { + return ERROR_FLASH_OPERATION_FAILED; + } + (void)memcpy(bank->sectors, TMS470R1A384_BANK2_SECTORS, sizeof(TMS470R1A384_BANK2_SECTORS)); + } + else + { + LOG_ERROR("No %s flash bank contains base address 0x%08x.", part_name, bank->base); + return ERROR_FLASH_OPERATION_FAILED; + } + break; - default: + default: LOG_WARNING("Could not identify part 0x%02x as a member of the TMS470 family.", part_number); return ERROR_FLASH_OPERATION_FAILED; } Modified: trunk/src/helper/bin2char.c =================================================================== --- trunk/src/helper/bin2char.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/bin2char.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -30,7 +30,7 @@ if (argc == 1) { fprintf(stderr, "bin2char <varname>\n"); fprintf(stderr, "read from standard input and write a char" - " array out to standard output\n"); + " array out to standard output\n"); exit(1); } Modified: trunk/src/helper/binarybuffer.c =================================================================== --- trunk/src/helper/binarybuffer.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/binarybuffer.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -210,7 +210,7 @@ else if (radix == 10) { factor = 2.40824; /* log(256) / log(10) = 2.40824 */ - } + } else if (radix == 8) { factor = 2.66667; /* log(256) / log(8) = 2.66667 */ @@ -222,20 +222,20 @@ str = calloc(str_len + 1, 1); for (i = b256_len - 1; i >= 0; i--) - { - tmp = buf[i]; - if ((i == (buf_len / 8)) && (buf_len % 8)) - tmp &= (0xff >> (8 - (buf_len % 8))); + { + tmp = buf[i]; + if ((i == (buf_len / 8)) && (buf_len % 8)) + tmp &= (0xff >> (8 - (buf_len % 8))); - for (j = str_len; j > 0; j--) - { - tmp += (u32)str[j-1] * 256; - str[j-1] = (u8)(tmp % radix); - tmp /= radix; - } - } - - for (j = 0; j < str_len; j++) + for (j = str_len; j > 0; j--) + { + tmp += (u32)str[j-1] * 256; + str[j-1] = (u8)(tmp % radix); + tmp /= radix; + } + } + + for (j = 0; j < str_len; j++) str[j] = DIGITS[(int)str[j]]; return str; @@ -295,23 +295,23 @@ for (i = 0; charbuf[i]; i++) { tmp = charbuf[i]; - if ((tmp >= '0') && (tmp <= '9')) - tmp = (tmp - '0'); - else if ((tmp >= 'a') && (tmp <= 'f')) - tmp = (tmp - 'a' + 10); - else if ((tmp >= 'A') && (tmp <= 'F')) - tmp = (tmp - 'A' + 10); - else continue; /* skip characters other than [0-9,a-f,A-F] */ + if ((tmp >= '0') && (tmp <= '9')) + tmp = (tmp - '0'); + else if ((tmp >= 'a') && (tmp <= 'f')) + tmp = (tmp - 'a' + 10); + else if ((tmp >= 'A') && (tmp <= 'F')) + tmp = (tmp - 'A' + 10); + else continue; /* skip characters other than [0-9,a-f,A-F] */ if (tmp >= radix) continue; /* skip digits invalid for the current radix */ for (j = 0; j < b256_len; j++) - { - tmp += (u32)b256_buf[j] * radix; - b256_buf[j] = (u8)(tmp & 0xFF); - tmp >>= 8; - } + { + tmp += (u32)b256_buf[j] * radix; + b256_buf[j] = (u8)(tmp & 0xFF); + tmp >>= 8; + } } Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/command.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -229,9 +229,9 @@ free((void *)override_name); /* accumulate help text in Tcl helptext list. */ - Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); - if (Jim_IsShared(helptext)) - helptext = Jim_DuplicateObj(interp, helptext); + Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); + if (Jim_IsShared(helptext)) + helptext = Jim_DuplicateObj(interp, helptext); Jim_Obj *cmd_entry=Jim_NewListObj(interp, NULL, 0); Jim_Obj *cmd_list=Jim_NewListObj(interp, NULL, 0); @@ -356,8 +356,8 @@ * The latter bit isn't precisely neat, but will do for now. */ LOG_USER_N("%s", string); - // We already printed it above - //command_output_text(context, string); + /* We already printed it above */ + /* command_output_text(context, string); */ free(string); } @@ -381,8 +381,8 @@ * The latter bit isn't precisely neat, but will do for now. */ LOG_USER_N("%s", string); - // We already printed it above - //command_output_text(context, string); + /* We already printed it above */ + /* command_output_text(context, string); */ free(string); } @@ -644,7 +644,6 @@ return NULL; } - static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 2) @@ -801,7 +800,7 @@ Jim_CreateCommand(interp, name, cmd, NULL, NULL); /* FIX!!! it would be prettier to invoke add_help_text... - accumulate help text in Tcl helptext list. */ + * accumulate help text in Tcl helptext list. */ Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); if (Jim_IsShared(helptext)) helptext = Jim_DuplicateObj(interp, helptext); @@ -816,7 +815,6 @@ Jim_ListAppendElement(interp, helptext, cmd_entry); } - /* return global variable long value or 0 upon failure */ long jim_global_long(const char *variable) { Modified: trunk/src/helper/configuration.c =================================================================== --- trunk/src/helper/configuration.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/configuration.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -91,7 +91,6 @@ return NULL; } - FILE *open_file_from_path (char *file, char *mode) { if (mode[0]!='r') Modified: trunk/src/helper/fileio.h =================================================================== --- trunk/src/helper/fileio.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/fileio.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -44,7 +44,6 @@ FILEIO_BINARY, }; - enum fileio_access { FILEIO_READ, /* open for reading, position at beginning */ @@ -71,7 +70,7 @@ extern int fileio_open(fileio_t *fileio, 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); - + #define ERROR_FILEIO_LOCATION_UNKNOWN (-1200) #define ERROR_FILEIO_NOT_FOUND (-1201) #define ERROR_FILEIO_OPERATION_FAILED (-1202) Modified: trunk/src/helper/log.c =================================================================== --- trunk/src/helper/log.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/log.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -413,7 +413,6 @@ } } - void busy_sleep(int ms) { long long then; Modified: trunk/src/helper/log.h =================================================================== --- trunk/src/helper/log.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/log.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -124,6 +124,6 @@ /* see "Error:" log entry for meaningful message to the user. The caller should * make no assumptions about what went wrong and try to handle the problem. */ -#define ERROR_FAIL (-4) +#define ERROR_FAIL (-4) #endif /* LOG_H */ Modified: trunk/src/helper/options.c =================================================================== --- trunk/src/helper/options.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/options.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -163,6 +163,5 @@ exit(-1); } - return ERROR_OK; } Modified: trunk/src/helper/replacements.c =================================================================== --- trunk/src/helper/replacements.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/replacements.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -82,19 +82,19 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) { - FILETIME ft; - LARGE_INTEGER li; - __int64 t; - static int tzflag; + FILETIME ft; + LARGE_INTEGER li; + __int64 t; + static int tzflag; if (tv) { GetSystemTimeAsFileTime(&ft); li.LowPart = ft.dwLowDateTime; li.HighPart = ft.dwHighDateTime; - t = li.QuadPart; /* In 100-nanosecond intervals */ - t -= EPOCHFILETIME; /* Offset to the Epoch time */ - t /= 10; /* In microseconds */ + t = li.QuadPart; /* In 100-nanosecond intervals */ + t -= EPOCHFILETIME; /* Offset to the Epoch time */ + t /= 10; /* In microseconds */ tv->tv_sec = (long)(t / 1000000); tv->tv_usec = (long)(t % 1000000); } Modified: trunk/src/helper/replacements.h =================================================================== --- trunk/src/helper/replacements.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/replacements.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -87,7 +87,7 @@ #ifdef _WIN32 struct timezone { - int tz_minuteswest; + int tz_minuteswest; int tz_dsttime; }; #endif @@ -181,27 +181,27 @@ static __inline int write_socket( int handle, const void *buffer, unsigned int count ) { #ifdef _WIN32 - return send(handle, buffer, count, 0); + return send(handle, buffer, count, 0); #else - return write(handle, buffer, count); + return write(handle, buffer, count); #endif } static __inline int read_socket( int handle, void *buffer, unsigned int count ) { #ifdef _WIN32 - return recv(handle, buffer, count, 0); + return recv(handle, buffer, count, 0); #else - return read(handle, buffer, count); + return read(handle, buffer, count); #endif } static __inline int close_socket(int sock) { #ifdef _WIN32 - return closesocket(sock); + return closesocket(sock); #else - return close(sock); + return close(sock); #endif } @@ -229,9 +229,9 @@ u32 e_shoff; /* Section header table file offset */ u32 e_flags; /* Processor-specific flags */ u16 e_ehsize; /* ELF header size in bytes */ - u16 e_phentsize; /* Program header table entry size */ + u16 e_phentsize; /* Program header table entry size */ u16 e_phnum; /* Program header table entry count */ - u16 e_shentsize; /* Section header table entry size */ + u16 e_shentsize; /* Section header table entry size */ u16 e_shnum; /* Section header table entry count */ u16 e_shstrndx; /* Section header string table index */ } Elf32_Ehdr; Modified: trunk/src/helper/tclapi.c =================================================================== --- trunk/src/helper/tclapi.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/tclapi.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -525,7 +525,6 @@ return JIM_OK; } - int tclapi_register_commands() { register_jim("ocd_mem2array", jim_mem2array, "read memory and return as a TCL array for script processing"); Modified: trunk/src/helper/types.h =================================================================== --- trunk/src/helper/types.h 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/helper/types.h 2008-12-13 12:44:39 UTC (rev 1238) @@ -43,10 +43,8 @@ typedef unsigned long long u64; #endif - typedef struct jtag_tap_s jtag_tap_t; - /* DANGER!!!! here be dragons! Note that the pointer in * memory might be unaligned. On some CPU's, i.e. ARM7, * the 2 lsb are ignored for 32 bit access, on others @@ -59,26 +57,25 @@ #define be_to_h_u16(x) ((u16)((x)[1] | (x)[0] << 8)) #define h_u32_to_le(buf, val) do {\ -(buf)[3] = ((val) & 0xff000000) >> 24;\ -(buf)[2] = ((val) & 0x00ff0000) >> 16;\ -(buf)[1] = ((val) & 0x0000ff00) >> 8;\ -(buf)[0] = ((val) & 0x000000ff);\ + (buf)[3] = ((val) & 0xff000000) >> 24;\ + (buf)[2] = ((val) & 0x00ff0000) >> 16;\ + (buf)[1] = ((val) & 0x0000ff00) >> 8;\ + (buf)[0] = ((val) & 0x000000ff);\ } while (0) #define h_u32_to_be(buf, val) do {\ -(buf)[0] = ((val) & 0xff000000) >> 24;\ -(buf)[1] = ((val) & 0x00ff0000) >> 16;\ -(buf)[2] = ((val) & 0x0000ff00) >> 8;\ -(buf)[3] = ((val) & 0x000000ff);\ + (buf)[0] = ((val) & 0xff000000) >> 24;\ + (buf)[1] = ((val) & 0x00ff0000) >> 16;\ + (buf)[2] = ((val) & 0x0000ff00) >> 8;\ + (buf)[3] = ((val) & 0x000000ff);\ } while (0) #define h_u16_to_le(buf, val) do {\ -(buf)[1] = ((val) & 0xff00) >> 8;\ -(buf)[0] = ((val) & 0x00ff) >> 0;\ + (buf)[1] = ((val) & 0xff00) >> 8;\ + (buf)[0] = ((val) & 0x00ff) >> 0;\ } while (0) #define h_u16_to_be(buf, val) do {\ -(buf)[0] = ((val) & 0xff00) >> 8;\ -(buf)[1] = ((val) & 0x00ff) >> 0;\ + (buf)[0] = ((val) & 0xff00) >> 8;\ + (buf)[1] = ((val) & 0x00ff) >> 0;\ } while (0) - #endif /* TYPES_H */ Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/jtag/bitbang.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -39,7 +39,6 @@ bitbang_interface_t *bitbang_interface; - /* DANGER!!!! clock absolutely *MUST* be 0 in idle or reset won't work! * * Set this to 1 and str912 reset halt will fail. @@ -316,4 +315,3 @@ return retval; } - Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/jtag/bitq.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -34,7 +34,6 @@ #include <stdlib.h> #include <unistd.h> - bitq_interface_t *bitq_interface; /* low level bit queue interface */ bitq_state_t bitq_in_state; /* state of input queue */ @@ -42,7 +41,6 @@ u8 *bitq_in_buffer; /* buffer dynamically reallocated as needed */ unsigned long bitq_in_bufsize=32; /* min. buffer size */ - /* * input queue processing does not use jtag_read_buffer() to avoid unnecessary overhead * also the buffer for incomming data is reallocated only if necessary @@ -129,8 +127,6 @@ } } - - void bitq_io(int tms, int tdi, int tdo_req) { bitq_interface->out(tms, tdi, tdo_req); @@ -138,7 +134,6 @@ if (bitq_interface->in_rdy()) bitq_in_proc(); } - void bitq_end_state(enum tap_state state) { if (state==-1) return; @@ -149,7 +144,6 @@ end_state = state; } - void bitq_state_move(enum tap_state new_state) { int i=0; @@ -170,7 +164,6 @@ cur_state = new_state; } - void bitq_path_move(pathmove_command_t *cmd) { int i; @@ -189,7 +182,6 @@ end_state = cur_state; } - void bitq_runtest(int num_cycles) { int i; @@ -205,7 +197,6 @@ if (cur_state != end_state) bitq_state_move(end_state); } - void bitq_scan_field(scan_field_t *field, int pause) { int bit_cnt; @@ -245,7 +236,6 @@ } } - void bitq_scan(scan_command_t *cmd) { int i; @@ -258,7 +248,6 @@ bitq_scan_field(&cmd->fields[i], 1); } - int bitq_execute_queue(void) { jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ @@ -356,7 +345,6 @@ return bitq_in_state.status; } - void bitq_cleanup(void) { if (bitq_in_buffer!=NULL) Modified: trunk/src/jtag/dummy.c =================================================================== --- trunk/src/jtag/dummy.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/jtag/dummy.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -26,7 +26,6 @@ #include "jtag.h" #include "bitbang.h" - int dummy_speed(int speed); int dummy_register_commands(struct command_context_s *cmd_ctx); int dummy_init(void); @@ -65,7 +64,6 @@ return 1; } - void dummy_write(int tck, int tms, int tdi) { } @@ -73,7 +71,6 @@ void dummy_reset(int trst, int srst) { } - int dummy_speed(int speed) { @@ -85,7 +82,6 @@ return ERROR_OK; } - int dummy_init(void) { bitbang_interface = &dummy_bitbang; @@ -98,8 +94,6 @@ return ERROR_OK; } - void dummy_led(int on) { } - Modified: trunk/src/jtag/ep93xx.c =================================================================== --- trunk/src/jtag/ep93xx.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/jtag/ep93xx.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -64,7 +64,7 @@ jtag_interface_t ep93xx_interface = { .name = "ep93xx", - + .execute_queue = bitbang_execute_queue, .speed = ep93xx_speed, @@ -126,7 +126,7 @@ int ep93xx_speed(int speed) { - + return ERROR_OK; } Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/jtag/gw16012.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -438,26 +438,26 @@ #if PARPORT_USE_GIVEIO == 1 int gw16012_get_giveio_access() { - HANDLE h; - OSVERSIONINFO version; + HANDLE h; + OSVERSIONINFO version; - version.dwOSVersionInfoSize = sizeof version; - if (!GetVersionEx( &version )) { - errno = EINVAL; - return -1; - } - if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; + version.dwOSVersionInfoSize = sizeof version; + if (!GetVersionEx( &version )) { + errno = EINVAL; + return -1; + } + if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) + return 0; - h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; - } + h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); + if (h == INVALID_HANDLE_VALUE) { + errno = ENODEV; + return -1; + } - CloseHandle( h ); + CloseHandle( h ); - return 0; + return 0; } #endif Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2008-12-13 07:05:38 UTC (rev 1237) +++ trunk/src/jtag/jtag.c 2008-12-13 12:44:39 UTC (rev 1238) @@ -250,8 +250,6 @@ jtag_interface_t *jtag_interface = NULL; int jtag_speed = 0; - - /* forward declarations */ void jtag_add_pathmove(int num_states, enum tap_state *path); void jtag_add_runtest(int num_cycles, enum tap_state endstate); @@ -279,14 +277,12 @@ int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - jtag_tap_t *jtag_AllTaps(void) { - return jtag_all_taps; + return jtag_all_taps; }; -int -jtag_NumTotalTaps(void) +int jtag_NumTotalTaps(void) { jtag_tap_t *t; int n; @@ -300,8 +296,7 @@ return n; } -int -jtag_NumEnabledTaps(void) +int jtag_NumEnabledTaps(void) { jtag_tap_t *t; int n; @@ -345,8 +340,7 @@ return t; } -jtag_tap_t * -jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *o ) +jtag_tap_t * jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *o ) { jtag_tap_t *t; const char *cp; @@ -365,8 +359,7 @@ } /* returns a pointer to the n-th device in the scan chain */ -jtag_tap_t * -jtag_TapByAbsPosition( int n ) +jtag_tap_t * jtag_TapByAbsPosition( int n ) { int orig_n; jtag_tap_t *t; @@ -377,11 +370,10 @@ while( t && (n > 0)) { n--; t = t->next_tap; - } + } return t; } - int jtag_register_event_callback(int (*callback)(enum jtag_event event, void *priv), void *priv) { jtag_event_callback_t **callbacks_p = &jtag_event_callbacks; @@ -463,7 +455,6 @@ return last_comand_pointer; } - void* cmd_queue_alloc(size_t size) { cmd_queue_page_t **p_page = &cmd_queue_pages; @@ -491,18 +482,17 @@ * */ union worse_case_align { - int i; - long l; - float f; - void *v; + int i; + long l; + float f; + void *v; }; #define ALIGN_SIZE (sizeof(union worse_case_align)) - // The alignment process. + /* The alignment process. */ size = (size + ALIGN_SIZE -1) & (~(ALIGN_SIZE-1)); - // Done... + /* Done... */ - if (*p_page) { while ((*p_page)->next) @@ -652,7 +642,6 @@ (*last_cmd)->cmd.scan->fields[nth_tap].out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); (*last_cmd)->cmd.scan->fields[nth_tap].out_mask = NULL; tap->bypass = 1; - } /* update device information */ @@ -1023,7 +1012,6 @@ jtag_prelude1(); - retval=interface_jtag_add_pathmove(num_states, path); cmd_queue_cur_state = path[num_states - 1]; if (retval!=ERROR_OK) @@ -1805,8 +1793,7 @@ return JIM_OK; } -static int -jim_newtap_cmd( Jim_GetOptInfo *goi ) +static int jim_newtap_cmd( Jim_GetOptInfo *goi ) { jtag_tap_t *pTap; jtag_tap_t **ppTap; @@ -1824,24 +1811,23 @@ ... [truncated message content] |
From: <kc...@ma...> - 2008-12-13 08:05:42
|
Author: kc8apf Date: 2008-12-13 08:05:38 +0100 (Sat, 13 Dec 2008) New Revision: 1237 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Add JTAG tap events for enable/disable Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2008-12-13 07:02:56 UTC (rev 1236) +++ trunk/src/jtag/jtag.c 2008-12-13 07:05:38 UTC (rev 1237) @@ -110,6 +110,13 @@ "JTAG controller reset (RESET or TRST)" }; +const Jim_Nvp nvp_jtag_tap_event[] = { + { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" }, + { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" }, + + { .name = NULL, .value = -1 } +}; + /* kludge!!!! these are just global variables that the * interface use internally. They really belong * inside the drivers, but we don't want to break @@ -1699,8 +1706,106 @@ return ERROR_OK; } +enum jtag_tap_cfg_param { + JCFG_EVENT +}; +static Jim_Nvp nvp_config_opts[] = { + { .name = "-event", .value = JCFG_EVENT }, + + { .name = NULL, .value = -1 } +}; + static int +jtag_tap_configure_cmd( Jim_GetOptInfo *goi, + jtag_tap_t * tap) +{ + Jim_Nvp *n; + Jim_Obj *o; + int e; + + /* parse config or cget options */ + while (goi->argc > 0) { + Jim_SetEmptyResult (goi->interp); + + e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n); + if (e != JIM_OK) { + Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0); + return e; + } + + switch (n->value) { + case JCFG_EVENT: + if (goi->argc == 0) { + Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "-event ?event-name? ..." ); + return JIM_ERR; + } + + e = Jim_GetOpt_Nvp( goi, nvp_jtag_tap_event, &n ); + if (e != JIM_OK) { + Jim_GetOpt_NvpUnknown(goi, nvp_jtag_tap_event, 1); + return e; + } + + if (goi->isconfigure) { + if (goi->argc != 1) { + Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?"); + return JIM_ERR; + } + } else { + if (goi->argc != 0) { + Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name?"); + return JIM_ERR; + } + } + + { + jtag_tap_event_action_t *jteap; + + jteap = tap->event_action; + /* replace existing? */ + while (jteap) { + if (jteap->event == n->value) { + break; + } + jteap = jteap->next; + } + + if (goi->isconfigure) { + if (jteap == NULL) { + /* create new */ + jteap = calloc(1, sizeof (*jteap)); + } + jteap->event = n->value; + Jim_GetOpt_Obj( goi, &o); + if (jteap->body) { + Jim_DecrRefCount(interp, jteap->body); + } + jteap->body = Jim_DuplicateObj(goi->interp, o); + Jim_IncrRefCount(jteap->body); + + /* add to head of event list */ + jteap->next = tap->event_action; + tap->event_action = jteap; + Jim_SetEmptyResult(goi->interp); + } else { + /* get */ + if (jteap == NULL) { + Jim_SetEmptyResult(goi->interp); + } else { + Jim_SetResult(goi->interp, Jim_DuplicateObj(goi->interp, jteap->body)); + } + } + } + /* loop for more */ + break; + } + } /* while (goi->argc) */ + + return JIM_OK; +} + +static int jim_newtap_cmd( Jim_GetOptInfo *goi ) { jtag_tap_t *pTap; @@ -1901,6 +2006,7 @@ Jim_GetOptInfo goi; int e; Jim_Nvp *n; + Jim_Obj *o; struct command_context_s *context; enum { @@ -1909,7 +2015,9 @@ JTAG_CMD_NEWTAP, JTAG_CMD_TAPENABLE, JTAG_CMD_TAPDISABLE, - JTAG_CMD_TAPISENABLED + JTAG_CMD_TAPISENABLED, + JTAG_CMD_CONFIGURE, + JTAG_CMD_CGET }; const Jim_Nvp jtag_cmds[] = { @@ -1919,6 +2027,8 @@ { .name = "tapisenabled" , .value = JTAG_CMD_TAPISENABLED }, { .name = "tapenable" , .value = JTAG_CMD_TAPENABLE }, { .name = "tapdisable" , .value = JTAG_CMD_TAPDISABLE }, + { .name = "configure" , .value = JTAG_CMD_CONFIGURE }, + { .name = "cget" , .value = JTAG_CMD_CGET }, { .name = NULL, .value = -1 }, }; @@ -1977,10 +2087,12 @@ // below break; case JTAG_CMD_TAPENABLE: + jtag_tap_handle_event( t, JTAG_TAP_EVENT_ENABLE); e = 1; t->enabled = e; break; case JTAG_CMD_TAPDISABLE: + jtag_tap_handle_event( t, JTAG_TAP_EVENT_DISABLE); e = 0; t->enabled = e; break; @@ -1988,6 +2100,46 @@ Jim_SetResult( goi.interp, Jim_NewIntObj( goi.interp, e ) ); return JIM_OK; } + break; + + case JTAG_CMD_CGET: + if( goi.argc < 2 ){ + Jim_WrongNumArgs( goi.interp, 0, NULL, "?tap-name? -option ..."); + return JIM_ERR; + } + + { + jtag_tap_t *t; + + Jim_GetOpt_Obj(&goi, &o); + t = jtag_TapByJimObj( goi.interp, o ); + if( t == NULL ){ + return JIM_ERR; + } + + goi.isconfigure = 0; + return jtag_tap_configure_cmd( &goi, t); + } + break; + + case JTAG_CMD_CONFIGURE: + if( goi.argc < 3 ){ + Jim_WrongNumArgs( goi.interp, 0, NULL, "?tap-name? -option ?VALUE? ..."); + return JIM_ERR; + } + + { + jtag_tap_t *t; + + Jim_GetOpt_Obj(&goi, &o); + t = jtag_TapByJimObj( goi.interp, o ); + if( t == NULL ){ + return JIM_ERR; + } + + goi.isconfigure = 1; + return jtag_tap_configure_cmd( &goi, t); + } } @@ -2763,3 +2915,34 @@ return jtag->srst_asserted(srst_asserted); } +void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e) +{ + jtag_tap_event_action_t * jteap; + int done; + + jteap = tap->event_action; + + done = 0; + while (jteap) { + if (jteap->event == e) { + done = 1; + LOG_DEBUG( "JTAG tap: %s event: %d (%s) action: %s\n", + tap->dotted_name, + e, + Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name, + Jim_GetString(jteap->body, NULL) ); + if (Jim_EvalObj(interp, jteap->body) != JIM_OK) { + Jim_PrintErrorMessage(interp); + } + } + + jteap = jteap->next; + } + + if (!done) { + LOG_DEBUG( "event %d %s - no action", + e, + Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name); + } +} + Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2008-12-13 07:02:56 UTC (rev 1236) +++ trunk/src/jtag/jtag.h 2008-12-13 07:05:38 UTC (rev 1237) @@ -158,6 +158,9 @@ extern jtag_command_t *jtag_command_queue; +// forward declaration +typedef struct jtag_tap_event_action_s jtag_tap_event_action_t; + // this is really: typedef jtag_tap_t // But - the typedef is done in "types.h" // due to "forward decloration reasons" @@ -178,6 +181,9 @@ u8 expected_ids_cnt;/* Number of expected identification codes */ u8 *cur_instr; /* current instruction */ int bypass; /* bypass register selected */ + + jtag_tap_event_action_t *event_action; + jtag_tap_t *next_tap; }; extern jtag_tap_t *jtag_AllTaps(void); @@ -271,8 +277,22 @@ JTAG_TRST_ASSERTED }; -extern char* jtag_event_strings[]; +extern char * jtag_event_strings[]; +enum jtag_tap_event +{ + JTAG_TAP_EVENT_ENABLE, + JTAG_TAP_EVENT_DISABLE +}; + +extern const Jim_Nvp nvp_jtag_tap_event[]; + +struct jtag_tap_event_action_s { + enum jtag_tap_event event; + Jim_Obj *body; + jtag_tap_event_action_t *next; +}; + extern int jtag_trst; extern int jtag_srst; @@ -462,6 +482,8 @@ extern int jtag_verify_capture_ir; +void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e); + /* error codes * JTAG subsystem uses codes between -100 and -199 */ |
From: <kc...@ma...> - 2008-12-13 08:04:06
|
Author: kc8apf Date: 2008-12-13 08:02:56 +0100 (Sat, 13 Dec 2008) New Revision: 1236 Added: branches/openocd_1_0_branch/src/target/target/samsung_s3c2410.cfg Removed: branches/openocd_1_0_branch/src/target/target/samsung_s2c2410.cfg Modified: branches/openocd_1_0_branch/README branches/openocd_1_0_branch/doc/openocd.texi branches/openocd_1_0_branch/src/flash/flash.c branches/openocd_1_0_branch/src/flash/str9xpec.c branches/openocd_1_0_branch/src/helper/command.c branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c branches/openocd_1_0_branch/src/jtag/bitbang.c branches/openocd_1_0_branch/src/jtag/bitq.c branches/openocd_1_0_branch/src/jtag/ft2232.c branches/openocd_1_0_branch/src/jtag/gw16012.c branches/openocd_1_0_branch/src/jtag/jlink.c branches/openocd_1_0_branch/src/jtag/jtag.c branches/openocd_1_0_branch/src/jtag/jtag.h branches/openocd_1_0_branch/src/jtag/usbprog.c branches/openocd_1_0_branch/src/jtag/zy1000.c branches/openocd_1_0_branch/src/pld/virtex2.c branches/openocd_1_0_branch/src/target/arm11.c branches/openocd_1_0_branch/src/target/arm11_dbgtap.c branches/openocd_1_0_branch/src/target/arm720t.c branches/openocd_1_0_branch/src/target/arm7_9_common.c branches/openocd_1_0_branch/src/target/arm7tdmi.c branches/openocd_1_0_branch/src/target/arm920t.c branches/openocd_1_0_branch/src/target/arm926ejs.c branches/openocd_1_0_branch/src/target/arm966e.c branches/openocd_1_0_branch/src/target/arm9tdmi.c branches/openocd_1_0_branch/src/target/board/hammer.cfg branches/openocd_1_0_branch/src/target/cortex_m3.c branches/openocd_1_0_branch/src/target/cortex_m3.h branches/openocd_1_0_branch/src/target/cortex_swjdp.c branches/openocd_1_0_branch/src/target/embeddedice.c branches/openocd_1_0_branch/src/target/etb.c branches/openocd_1_0_branch/src/target/etm.c branches/openocd_1_0_branch/src/target/feroceon.c branches/openocd_1_0_branch/src/target/mips_ejtag.c branches/openocd_1_0_branch/src/target/mips_m4k.c branches/openocd_1_0_branch/src/target/target/at91r40008.cfg branches/openocd_1_0_branch/src/target/target/at91sam9260.cfg branches/openocd_1_0_branch/src/target/target/at91sam9260minimal.cfg branches/openocd_1_0_branch/src/target/target/imote2.cfg branches/openocd_1_0_branch/src/target/target/is5114.cfg branches/openocd_1_0_branch/src/target/target/samsung_s3c6410.cfg branches/openocd_1_0_branch/src/target/xscale.c branches/openocd_1_0_branch/src/xsvf/xsvf.c Log: Merge r1217-r1235 Modified: branches/openocd_1_0_branch/README =================================================================== --- branches/openocd_1_0_branch/README 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/README 2008-12-13 07:02:56 UTC (rev 1236) @@ -1 +1,2 @@ openocd.texi is the authoritative source of OpenOCD documentation + Modified: branches/openocd_1_0_branch/doc/openocd.texi =================================================================== --- branches/openocd_1_0_branch/doc/openocd.texi 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/doc/openocd.texi 2008-12-13 07:02:56 UTC (rev 1236) @@ -286,7 +286,7 @@ @itemize @bullet @item @b{usbjtag} -@* Link Unknown [not easily verified] +@* Link @url{http://www.hs-augsburg.de/~hhoegl/proj/usbjtag/usbjtag.html} @item @b{jtagkey} @* See: @url{http://www.amontec.com/jtagkey.shtml} @item @b{oocdlink} @@ -304,7 +304,9 @@ @item @b{comstick} @* Link: @url{http://www.hitex.com/index.php?id=383} @item @b{stm32stick} -@* Link Unknown [not easily verified] +@* Link @url{http://www.hitex.com/stm32-stick} +@item @b{axm0432_jtag} +@* Axiom AXM-0432 Link @url{http://www.axman.com} @end itemize @section USB JLINK based @@ -370,7 +372,7 @@ @* Unknown. @item @b{Lattice} -@* From Lattice Semiconductor [link unknown] +@* ispDownload from Lattice Semiconductor @url{http://www.latticesemi.com/lit/docs/devtools/dlcable.pdf} @item @b{flashlink} @* From ST Microsystems, link: @@ -1177,6 +1179,8 @@ egnite Software turtelizer2 @item @b{oocdlink} OOCDLink +@item @b{axm0432_jtag} +Axiom AXM-0432 @end itemize @item @b{ft2232_vid_pid} <@var{vid}> <@var{pid}> @@ -1950,7 +1954,7 @@ @cindex flash protect_check @*Check protection state of sectors in flash bank <num>. @option{flash erase_sector} using the same syntax. -@subsection fash erase_sector +@subsection flash erase_sector @b{flash erase_sector} <@var{num}> <@var{first}> <@var{last}> @cindex flash erase_sector @anchor{flash erase_sector} @@ -2080,7 +2084,7 @@ @option{enable_turbo} <@var{num>.} Only use this driver for locking/unlocking the device or configuring the option bytes. -Use the standard str9 driver for programming. +Use the standard str9 driver for programming. @xref{STR9 specific commands}. @subsubsection stellaris (LM3Sxxx) options @cindex stellaris (LM3Sxxx) options @@ -2140,6 +2144,7 @@ @subsection STR9 specific commands @cindex STR9 specific commands +@anchor{STR9 specific commands} These are flash specific commands when using the str9xpec driver. @itemize @bullet @item @b{str9xpec enable_turbo} <@var{num}> @@ -2164,6 +2169,43 @@ @*write str9 option bytes. @end itemize +Note: Before using the str9xpec driver here is some background info to help +you better understand how the drivers works. Openocd has two flash drivers for +the str9. +@enumerate +@item +Standard driver @option{str9x} programmed via the str9 core. Normally used for +flash programming as it is faster than the @option{str9xpec} driver. +@item +Direct programming @option{str9xpec} using the flash controller, this is +ISC compilant (IEEE 1532) tap connected in series with the str9 core. The str9 +core does not need to be running to program using this flash driver. Typical use +for this driver is locking/unlocking the target and programming the option bytes. +@end enumerate + +Before we run any cmds using the @option{str9xpec} driver we must first disable +the str9 core. This example assumes the @option{str9xpec} driver has been +configured for flash bank 0. +@example +# assert srst, we do not want core running +# while accessing str9xpec flash driver +jtag_reset 0 1 +# turn off target polling +poll off +# disable str9 core +str9xpec enable_turbo 0 +# read option bytes +str9xpec options_read 0 +# re-enable str9 core +str9xpec disable_turbo 0 +poll on +reset halt +@end example +The above example will read the str9 option bytes. +When performing a unlock remember that you will not be able to halt the str9 - it +has been locked. Halting the core is not required for the @option{str9xpec} driver +as mentioned above, just issue the cmds above manually or from a telnet prompt. + @subsection STR9 configuration @cindex STR9 configuration @itemize @bullet Modified: branches/openocd_1_0_branch/src/flash/flash.c =================================================================== --- branches/openocd_1_0_branch/src/flash/flash.c 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/src/flash/flash.c 2008-12-13 07:02:56 UTC (rev 1236) @@ -144,7 +144,7 @@ { flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash_bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]"); + register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]"); return ERROR_OK; } Modified: branches/openocd_1_0_branch/src/flash/str9xpec.c =================================================================== --- branches/openocd_1_0_branch/src/flash/str9xpec.c 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/src/flash/str9xpec.c 2008-12-13 07:02:56 UTC (rev 1236) @@ -145,7 +145,7 @@ scan_field_t field; u8 status; - if (str9xpec_set_instr(tap, ISC_NOOP, TAP_PI) != ERROR_OK) + if (str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE) != ERROR_OK) return ISC_STATUS_ERROR; field.tap = tap; @@ -158,7 +158,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); LOG_DEBUG("status: 0x%2.2x", status); @@ -181,7 +181,7 @@ return ERROR_OK; /* enter isc mode */ - if (str9xpec_set_instr(tap, ISC_ENABLE, TAP_RTI) != ERROR_OK) + if (str9xpec_set_instr(tap, ISC_ENABLE, TAP_IDLE) != ERROR_OK) return ERROR_TARGET_INVALID; /* check ISC status */ @@ -207,7 +207,7 @@ if (!str9xpec_info->isc_enable) return ERROR_OK; - if (str9xpec_set_instr(tap, ISC_DISABLE, TAP_RTI) != ERROR_OK) + if (str9xpec_set_instr(tap, ISC_DISABLE, TAP_IDLE) != ERROR_OK) return ERROR_TARGET_INVALID; /* delay to handle aborts */ @@ -238,7 +238,7 @@ LOG_DEBUG("ISC_CONFIGURATION"); /* execute ISC_CONFIGURATION command */ - str9xpec_set_instr(tap, ISC_CONFIGURATION, TAP_PI); + str9xpec_set_instr(tap, ISC_CONFIGURATION, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -250,7 +250,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); status = str9xpec_isc_status(tap); @@ -349,10 +349,10 @@ armv4_5 = bank->target->arch_info; arm7_9 = armv4_5->arch_info; jtag_info = &arm7_9->jtag_info; - + str9xpec_info->tap = jtag_TapByAbsPosition( jtag_info->tap->abs_chain_position - 1); str9xpec_info->isc_enable = 0; - + str9xpec_build_block_list(bank); /* clear option byte register */ @@ -390,7 +390,7 @@ } /* execute ISC_BLANK_CHECK command */ - str9xpec_set_instr(tap, ISC_BLANK_CHECK, TAP_PI); + str9xpec_set_instr(tap, ISC_BLANK_CHECK, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -402,7 +402,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_add_sleep(40000); /* read blank check result */ @@ -416,7 +416,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_PI); + jtag_add_dr_scan(1, &field, TAP_IRPAUSE); jtag_execute_queue(); status = str9xpec_isc_status(tap); @@ -506,7 +506,7 @@ LOG_DEBUG("ISC_ERASE"); /* execute ISC_ERASE command */ - str9xpec_set_instr(tap, ISC_ERASE, TAP_PI); + str9xpec_set_instr(tap, ISC_ERASE, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -518,7 +518,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); jtag_add_sleep(10); @@ -569,9 +569,9 @@ str9xpec_set_address(bank, 0x80); /* execute ISC_PROGRAM command */ - str9xpec_set_instr(tap, ISC_PROGRAM_SECURITY, TAP_RTI); + str9xpec_set_instr(tap, ISC_PROGRAM_SECURITY, TAP_IDLE); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -658,7 +658,7 @@ tap = str9xpec_info->tap; /* set flash controller address */ - str9xpec_set_instr(tap, ISC_ADDRESS_SHIFT, TAP_PI); + str9xpec_set_instr(tap, ISC_ADDRESS_SHIFT, TAP_IRPAUSE); field.tap = tap; field.num_bits = 8; @@ -747,7 +747,7 @@ while (dwords_remaining > 0) { - str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI); + str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -759,12 +759,12 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); /* small delay before polling */ jtag_add_sleep(50); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -807,7 +807,7 @@ bytes_written++; } - str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI); + str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -819,12 +819,12 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); /* small delay before polling */ jtag_add_sleep(50); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -889,7 +889,7 @@ buffer = calloc(CEIL(32, 8), 1); - str9xpec_set_instr(tap, ISC_IDCODE, TAP_PI); + str9xpec_set_instr(tap, ISC_IDCODE, TAP_IRPAUSE); field.tap = tap; field.num_bits = 32; @@ -901,7 +901,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); idcode = buf_get_u32(buffer, 0, 32); @@ -1014,7 +1014,7 @@ str9xpec_set_address(bank, 0x50); /* execute ISC_PROGRAM command */ - str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI); + str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -1026,12 +1026,12 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); /* small delay before polling */ jtag_add_sleep(50); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -1303,13 +1303,13 @@ } /* enable turbo mode - TURBO-PROG-ENABLE */ - str9xpec_set_instr(tap2, 0xD, TAP_RTI); + str9xpec_set_instr(tap2, 0xD, TAP_IDLE); if ((retval = jtag_execute_queue()) != ERROR_OK) return retval; /* modify scan chain - str9 core has been removed */ tap1->enabled = 0; - + return ERROR_OK; } @@ -1337,11 +1337,11 @@ if (tap == NULL) return ERROR_FAIL; - - /* exit turbo mode via TLR */ - str9xpec_set_instr(tap, ISC_NOOP, TAP_TLR); + + /* exit turbo mode via RESET */ + str9xpec_set_instr(tap, ISC_NOOP, TAP_RESET); jtag_execute_queue(); - + /* restore previous scan chain */ if (tap->next_tap) { tap->next_tap->enabled = 1; Modified: branches/openocd_1_0_branch/src/helper/command.c =================================================================== --- branches/openocd_1_0_branch/src/helper/command.c 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/src/helper/command.c 2008-12-13 07:02:56 UTC (rev 1236) @@ -289,8 +289,10 @@ return ERROR_INVALID_ARGUMENTS; /* find command */ - for (c = context->commands; c; c = c->next) - { + c = context->commands; + + while(NULL != c) + { if (strcmp(name, c->name) == 0) { /* unlink command */ @@ -300,26 +302,32 @@ } else { + /* first element in command list */ context->commands = c->next; } - + /* unregister children */ - if (c->children) + while(NULL != c->children) { - for (c2 = c->children; c2; c2 = c2->next) - { - free(c2->name); - free(c2); - } + c2 = c->children; + c->children = c->children->next; + free(c2->name); + c2->name = NULL; + free(c2); + c2 = NULL; } - + /* delete command */ free(c->name); + c->name = NULL; free(c); + c = NULL; + return ERROR_OK; } - + /* remember the last command for unlinking */ p = c; + c = c->next; } return ERROR_OK; Modified: branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c =================================================================== --- branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/src/jtag/amt_jtagaccel.c 2008-12-13 07:02:56 UTC (rev 1236) @@ -100,22 +100,22 @@ */ u8 amt_jtagaccel_tap_move[6][6][2] = { - /* TLR RTI SD PD SI PI */ - {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* TLR */ - {{0x1f, 0x00}, {0x00, 0x00}, {0x85, 0x08}, {0x05, 0x00}, {0x8b, 0x08}, {0x0b, 0x00}}, /* RTI */ - {{0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* SD */ - {{0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* PD */ - {{0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00}}, /* SI */ - {{0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00}}, /* PI */ + /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ + {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* RESET */ + {{0x1f, 0x00}, {0x00, 0x00}, {0x85, 0x08}, {0x05, 0x00}, {0x8b, 0x08}, {0x0b, 0x00}}, /* IDLE */ + {{0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRSHIFT */ + {{0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRPAUSE */ + {{0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00}}, /* IRSHIFT */ + {{0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00}}, /* IRPAUSE */ }; -jtag_interface_t amt_jtagaccel_interface = +jtag_interface_t amt_jtagaccel_interface = { .name = "amt_jtagaccel", - + .execute_queue = amt_jtagaccel_execute_queue, - .speed = amt_jtagaccel_speed, + .speed = amt_jtagaccel_speed, .register_commands = amt_jtagaccel_register_commands, .init = amt_jtagaccel_init, .quit = amt_jtagaccel_quit, @@ -127,7 +127,7 @@ COMMAND_CONFIG, NULL); register_command(cmd_ctx, NULL, "rtck", amt_jtagaccel_handle_rtck_command, COMMAND_CONFIG, NULL); - + return ERROR_OK; } @@ -142,7 +142,7 @@ aw_control_rst |= 0x1; else if (srst == 0) aw_control_rst &= ~0x1; - + AMT_AW(aw_control_rst); } @@ -151,7 +151,7 @@ aw_control_baudrate &= 0xf0; aw_control_baudrate |= speed & 0x0f; AMT_AW(aw_control_baudrate); - + return ERROR_OK; } @@ -170,11 +170,11 @@ { int timeout = 4096; u8 ar_status; - + AMT_AR(ar_status); while (((ar_status) & 0x80) && (timeout-- > 0)) AMT_AR(ar_status); - + if (ar_status & 0x80) { LOG_ERROR("amt_jtagaccel timed out while waiting for end of scan, rtck was %s, last AR_STATUS: 0x%2.2x", (rtck_enabled) ? "enabled" : "disabled", ar_status); @@ -186,15 +186,15 @@ { u8 aw_scan_tms_5; u8 tms_scan[2]; - + tms_scan[0] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][0]; tms_scan[1] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][1]; - + aw_scan_tms_5 = 0x40 | (tms_scan[0] & 0x1f); AMT_AW(aw_scan_tms_5); if (jtag_speed > 3 || rtck_enabled) amt_wait_scan_busy(); - + if (tms_scan[0] & 0x80) { aw_scan_tms_5 = 0x40 | (tms_scan[1] & 0x1f); @@ -202,7 +202,7 @@ if (jtag_speed > 3 || rtck_enabled) amt_wait_scan_busy(); } - + cur_state = end_state; } @@ -213,27 +213,27 @@ u8 aw_scan_tms_1to4; enum tap_state saved_end_state = end_state; - - /* only do a state_move when we're not already in RTI */ - if (cur_state != TAP_RTI) + + /* only do a state_move when we're not already in IDLE */ + if (cur_state != TAP_IDLE) { - amt_jtagaccel_end_state(TAP_RTI); + amt_jtagaccel_end_state(TAP_IDLE); amt_jtagaccel_state_move(); } - + while (num_cycles - i >= 5) { aw_scan_tms_5 = 0x40; AMT_AW(aw_scan_tms_5); i += 5; } - + if (num_cycles - i > 0) { aw_scan_tms_1to4 = 0x80 | ((num_cycles - i - 1) & 0x3) << 4; AMT_AW(aw_scan_tms_1to4); } - + amt_jtagaccel_end_state(saved_end_state); if (cur_state != end_state) amt_jtagaccel_state_move(); @@ -251,9 +251,9 @@ u8 tms_scan[2]; if (ir_scan) - amt_jtagaccel_end_state(TAP_SI); + amt_jtagaccel_end_state(TAP_IRSHIFT); else - amt_jtagaccel_end_state(TAP_SD); + amt_jtagaccel_end_state(TAP_DRSHIFT); amt_jtagaccel_state_move(); amt_jtagaccel_end_state(saved_end_state); @@ -263,7 +263,7 @@ { aw_tdi_option = 0x30 | (((scan_size - 1) % 8) - 1); AMT_AW(aw_tdi_option); - + dw_tdi_scan = buf_get_u32(buffer, bit_count, (scan_size - 1) % 8) & 0xff; AMT_DW(dw_tdi_scan); if (jtag_speed > 3 || rtck_enabled) @@ -275,11 +275,11 @@ dr_tdo = dr_tdo >> (8 - ((scan_size - 1) % 8)); buf_set_u32(buffer, bit_count, (scan_size - 1) % 8, dr_tdo); } - + bit_count += (scan_size - 1) % 8; bits_left -= (scan_size - 1) % 8; } - + while (bits_left - 1 >= 8) { dw_tdi_scan = buf_get_u32(buffer, bit_count, 8) & 0xff; @@ -292,11 +292,11 @@ AMT_DR(dr_tdo); buf_set_u32(buffer, bit_count, 8, dr_tdo); } - + bit_count += 8; bits_left -= 8; } - + tms_scan[0] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][0]; tms_scan[1] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][1]; aw_tms_scan = 0x40 | (tms_scan[0] & 0x1f) | (buf_get_u32(buffer, bit_count, 1) << 5); @@ -310,7 +310,7 @@ dr_tdo = dr_tdo >> 7; buf_set_u32(buffer, bit_count, 1, dr_tdo); } - + if (tms_scan[0] & 0x80) { aw_tms_scan = 0x40 | (tms_scan[1] & 0x1f); @@ -328,12 +328,12 @@ enum scan_type type; u8 *buffer; int retval; - + /* return ERROR_OK, unless a jtag_read_buffer returns a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; - + while (cmd) { switch (cmd->type) @@ -351,7 +351,7 @@ #endif if (cmd->cmd.reset->trst == 1) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } amt_jtagaccel_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); break; @@ -397,7 +397,7 @@ } cmd = cmd->next; } - + return retval; } @@ -409,16 +409,16 @@ version.dwOSVersionInfoSize = sizeof version; if (!GetVersionEx( &version )) { - errno = EINVAL; - return -1; + errno = EINVAL; + return -1; } if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; + return 0; h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; + errno = ENODEV; + return -1; } CloseHandle( h ); @@ -437,7 +437,7 @@ u8 status_port; #endif u8 ar_status; - + #if PARPORT_USE_PPDEV == 1 if (device_handle > 0) { @@ -447,7 +447,7 @@ snprintf(buffer, 256, "/dev/parport%d", amt_jtagaccel_port); device_handle = open(buffer, O_RDWR); - + if (device_handle < 0) { LOG_ERROR("cannot open device. check it exists and that user read and write rights are set"); @@ -468,7 +468,7 @@ LOG_ERROR(" cannot set compatible mode to device"); return ERROR_JTAG_INIT_FAILED; } - + control_port = 0x00; i = ioctl(device_handle, PPWCONTROL, &control_port); @@ -484,57 +484,57 @@ #if PARPORT_USE_GIVEIO == 1 if (amt_jtagaccel_get_giveio_access() != 0) { -#else /* PARPORT_USE_GIVEIO */ +#else /* PARPORT_USE_GIVEIO */ if (ioperm(amt_jtagaccel_port, 5, 1) != 0) { #endif /* PARPORT_USE_GIVEIO */ LOG_ERROR("missing privileges for direct i/o"); return ERROR_JTAG_INIT_FAILED; } - + /* prepare epp port */ /* clear timeout */ status_port = inb(amt_jtagaccel_port + 1); outb(status_port | 0x1, amt_jtagaccel_port + 1); - + /* reset epp port */ outb(0x00, amt_jtagaccel_port + 2); outb(0x04, amt_jtagaccel_port + 2); #endif - + if (rtck_enabled) - { + { /* set RTCK enable bit */ aw_control_fsm |= 0x02; } - + /* enable JTAG port */ aw_control_fsm |= 0x04; AMT_AW(aw_control_fsm); - + amt_jtagaccel_speed(jtag_speed); - + if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) aw_control_rst &= ~0x8; else aw_control_rst |= 0x8; - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) aw_control_rst &= ~0x2; else aw_control_rst |= 0x2; - + amt_jtagaccel_reset(0, 0); - + /* read status register */ AMT_AR(ar_status); LOG_DEBUG("AR_STATUS: 0x%2.2x", ar_status); - + return ERROR_OK; } int amt_jtagaccel_quit(void) { - + return ERROR_OK; } @@ -568,6 +568,6 @@ rtck_enabled = 0; } } - + return ERROR_OK; } Modified: branches/openocd_1_0_branch/src/jtag/bitbang.c =================================================================== --- branches/openocd_1_0_branch/src/jtag/bitbang.c 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/src/jtag/bitbang.c 2008-12-13 07:02:56 UTC (rev 1236) @@ -41,24 +41,24 @@ /* DANGER!!!! clock absolutely *MUST* be 0 in idle or reset won't work! - * + * * Set this to 1 and str912 reset halt will fail. - * + * * If someone can submit a patch with an explanation it will be greatly * appreciated, but as far as I can tell () DCLK is generated upon - * clk=0 in TAP_RTI. Good luck deducing that from the ARM documentation! - * The ARM documentation uses the term "DCLK is asserted while in the TAP_RTI + * clk=0 in TAP_IDLE. Good luck deducing that from the ARM documentation! + * The ARM documentation uses the term "DCLK is asserted while in the TAP_IDLE * state". With hardware there is no such thing as *while* in a state. There * are only edges. So clk => 0 is in fact a very subtle state transition that - * happens *while* in the TAP_RTI state. "#&"#&"#&"#& - * + * happens *while* in the TAP_IDLE state. "#&"#&"#&"#& + * * For "reset halt" the last thing that happens before srst is asserted * is that the breakpoint is set up. If DCLK is not wiggled one last * time before the reset, then the breakpoint is not set up and * "reset halt" will fail to halt. - * + * */ -#define CLOCK_IDLE() 0 +#define CLOCK_IDLE() 0 int bitbang_execute_queue(void); @@ -76,10 +76,10 @@ } void bitbang_state_move(void) { - + int i=0, tms=0; u8 tms_scan = TAP_MOVE(cur_state, end_state); - + for (i = 0; i < 7; i++) { tms = (tms_scan >> i) & 1; @@ -87,7 +87,7 @@ bitbang_interface->write(1, tms, 0); } bitbang_interface->write(CLOCK_IDLE(), tms, 0); - + cur_state = end_state; } @@ -113,7 +113,7 @@ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); exit(-1); } - + bitbang_interface->write(0, tms, 0); bitbang_interface->write(1, tms, 0); @@ -121,7 +121,7 @@ state_count++; num_states--; } - + bitbang_interface->write(CLOCK_IDLE(), tms, 0); end_state = cur_state; @@ -130,16 +130,16 @@ void bitbang_runtest(int num_cycles) { int i; - + enum tap_state saved_end_state = end_state; - - /* only do a state_move when we're not already in RTI */ - if (cur_state != TAP_RTI) + + /* only do a state_move when we're not already in IDLE */ + if (cur_state != TAP_IDLE) { - bitbang_end_state(TAP_RTI); + bitbang_end_state(TAP_IDLE); bitbang_state_move(); } - + /* execute num_cycles */ for (i = 0; i < num_cycles; i++) { @@ -147,7 +147,7 @@ bitbang_interface->write(1, 0, 0); } bitbang_interface->write(CLOCK_IDLE(), 0, 0); - + /* finish in end_state */ bitbang_end_state(saved_end_state); if (cur_state != end_state) @@ -158,13 +158,13 @@ { enum tap_state saved_end_state = end_state; int bit_cnt; - - if (!((!ir_scan && (cur_state == TAP_SD)) || (ir_scan && (cur_state == TAP_SI)))) + + if (!((!ir_scan && (cur_state == TAP_DRSHIFT)) || (ir_scan && (cur_state == TAP_IRSHIFT)))) { if (ir_scan) - bitbang_end_state(TAP_SI); + bitbang_end_state(TAP_IRSHIFT); else - bitbang_end_state(TAP_SD); + bitbang_end_state(TAP_DRSHIFT); bitbang_state_move(); bitbang_end_state(saved_end_state); @@ -181,7 +181,7 @@ /* if we're just reading the scan, but don't care about the output * default to outputting 'low', this also makes valgrind traces more readable, * as it removes the dependency on an uninitialised value - */ + */ tdi=0; if ((type != SCAN_IN) && (buffer[bytec] & bcval)) tdi=1; @@ -192,7 +192,7 @@ val=bitbang_interface->read(); bitbang_interface->write(1, tms, tdi); - + if (type != SCAN_OUT) { if (val) @@ -201,21 +201,21 @@ buffer[bytec] &= ~bcval; } } - - /* TAP_SD & TAP_SI are illegal end states, so we always transition to the pause + + /* TAP_DRSHIFT & TAP_IRSHIFT are illegal end states, so we always transition to the pause * state which is a legal stable state from which statemove will work. - * - * Exit1 -> Pause + * + * Exit1 -> Pause */ bitbang_interface->write(0, 0, 0); bitbang_interface->write(1, 0, 0); bitbang_interface->write(CLOCK_IDLE(), 0, 0); - + if (ir_scan) - cur_state = TAP_PI; + cur_state = TAP_IRPAUSE; else - cur_state = TAP_PD; - + cur_state = TAP_DRPAUSE; + if (cur_state != end_state) bitbang_state_move(); } @@ -227,18 +227,18 @@ enum scan_type type; u8 *buffer; int retval; - + if (!bitbang_interface) { LOG_ERROR("BUG: Bitbang interface called, but not yet initialized"); exit(-1); } - + /* return ERROR_OK, unless a jtag_read_buffer returns a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; - + if(bitbang_interface->blink) bitbang_interface->blink(1); @@ -259,7 +259,7 @@ #endif if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } bitbang_interface->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); break; @@ -313,7 +313,7 @@ } if(bitbang_interface->blink) bitbang_interface->blink(0); - + return retval; } Modified: branches/openocd_1_0_branch/src/jtag/bitq.c =================================================================== --- branches/openocd_1_0_branch/src/jtag/bitq.c 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/src/jtag/bitq.c 2008-12-13 07:02:56 UTC (rev 1236) @@ -194,8 +194,8 @@ { int i; - /* only do a state_move when we're not already in RTI */ - if (cur_state != TAP_RTI) bitq_state_move(TAP_RTI); + /* only do a state_move when we're not already in IDLE */ + if (cur_state != TAP_IDLE) bitq_state_move(TAP_IDLE); /* execute num_cycles */ for (i = 0; i < num_cycles; i++) @@ -240,8 +240,8 @@ if (pause) { bitq_io(0,0,0); - if (cur_state==TAP_SI) cur_state=TAP_PI; - else if (cur_state==TAP_SD) cur_state=TAP_PD; + if (cur_state==TAP_IRSHIFT) cur_state=TAP_IRPAUSE; + else if (cur_state==TAP_DRSHIFT) cur_state=TAP_DRPAUSE; } } @@ -250,8 +250,8 @@ { int i; - if (cmd->ir_scan) bitq_state_move(TAP_SI); - else bitq_state_move(TAP_SD); + if (cmd->ir_scan) bitq_state_move(TAP_IRSHIFT); + else bitq_state_move(TAP_DRSHIFT); for (i=0; i < cmd->num_fields-1; i++) bitq_scan_field(&cmd->fields[i], 0); @@ -285,7 +285,7 @@ #endif if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } bitq_interface->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); if (bitq_interface->in_rdy()) bitq_in_proc(); Modified: branches/openocd_1_0_branch/src/jtag/ft2232.c =================================================================== --- branches/openocd_1_0_branch/src/jtag/ft2232.c 2008-12-13 06:59:24 UTC (rev 1235) +++ branches/openocd_1_0_branch/src/jtag/ft2232.c 2008-12-13 07:02:56 UTC (rev 1236) @@ -102,6 +102,7 @@ int turtle_init(void); int comstick_init(void); int stm32stick_init(void); +int axm0432_jtag_init(void); /* reset procedures for supported layouts */ void usbjtag_reset(int trst, int srst); @@ -111,6 +112,7 @@ void turtle_reset(int trst, int srst); void comstick_reset(int trst, int srst); void stm32stick_reset(int trst, int srst); +void axm0432_jtag_reset(int trst, int srst); /* blink procedures for layouts that support a blinking led */ void olimex_jtag_blink(void); @@ -129,6 +131,7 @@ {"turtelizer2", turtle_init, turtle_reset, turtle_jtag_blink}, {"comstick", comstick_init, comstick_reset, NULL}, {"stm32stick", stm32stick_init, stm32stick_reset, NULL}, + {"axm0432_jtag", axm0432_jtag_init, axm0432_jtag_reset, NULL}, {NULL, NULL, NULL}, }; @@ -154,13 +157,13 @@ #define BUFFER_ADD ft2232_buffer[ft2232_buffer_size++] #define BUFFER_READ ft2232_buffer[ft2232_read_pointer++] -jtag_interface_t ft2232_interface = +jtag_interface_t ft2232_interface = { .name = "ft2232", .execute_queue = ft2232_execute_queue, .speed = ft2232_speed, .speed_div = ft2232_speed_div, - .khz = ft2232_khz, + .khz = ft2232_khz, .register_commands = ft2232_register_commands, .init = ft2232_init, .quit = ft2232_quit, @@ -180,7 +183,7 @@ else { *bytes_written = dw_bytes_written; - return ERROR_OK; + return ERROR_OK; } #elif BUILD_FT2232_LIBFTDI == 1 int retval; @@ -193,7 +196,7 @@ else { *bytes_written = retval; - return ERROR_OK; + return ERROR_OK; } #endif } @@ -208,20 +211,20 @@ while ((*bytes_read < size) && timeout--) { - if ((status = FT_Read(ftdih, buf + *bytes_read, size - - *bytes_read, &dw_bytes_read)) != FT_OK) + if ((status = FT_Read(ftdih, buf + *bytes_read, size - + *bytes_read, &dw_bytes_read)) != FT_OK) { - *bytes_read = 0; + *bytes_read = 0; LOG_ERROR("FT_Read returned: %lu", status); return ERROR_JTAG_DEVICE_ERROR; } - *bytes_read += dw_bytes_read; + *bytes_read += dw_bytes_read; } #elif BUILD_FT2232_LIBFTDI == 1 int retval; int timeout = 100; *bytes_read = 0; - + while ((*bytes_read < size) && timeout--) { if ((retval = ftdi_read_data(&ftdic, buf + *bytes_read, size - *bytes_read)) < 0) @@ -239,7 +242,7 @@ LOG_ERROR("couldn't read the requested number of bytes from FT2232 device (%i < %i)", *bytes_read, size); return ERROR_JTAG_DEVICE_ERROR; } - + return ERROR_OK; } @@ -252,7 +255,7 @@ buf[0] = 0x86; /* command "set divisor" */ buf[1] = speed & 0xff; /* valueL (0=6MHz, 1=3MHz, 2=2.0MHz, ...*/ buf[2] = (speed >> 8) & 0xff; /* valueH */ - + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); if (((retval = ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { @@ -265,12 +268,12 @@ int ft2232_speed_div(int speed, int *khz) { - /* Take a look in the FT2232 manual, + /* Take a look in the FT2232 manual, * AN2232C-01 Command Processor for * MPSSE and MCU Host Bus. Chapter 3.8 */ - + *khz = 6000 / (1+speed); - + return ERROR_OK; } @@ -281,35 +284,35 @@ LOG_ERROR("RCLK not supported"); return ERROR_FAIL; } - /* Take a look in the FT2232 manual, + /* Take a look in the FT2232 manual, * AN2232C-01 Command Processor for * MPSSE and MCU Host Bus. Chapter 3.8 - * + * * We will calc here with a multiplier * of 10 for better rounding later. */ - + /* Calc speed, (6000 / khz) - 1 */ /* Use 65000 for better rounding */ *jtag_speed = (60000 / khz) - 10; - + /* Add 0.9 for rounding */ *jtag_speed += 9; - + /* Calc real speed */ *jtag_speed = *jtag_speed / 10; - + /* Check if speed is greater than 0 */ if (*jtag_speed < 0) { *jtag_speed = 0; } - + /* Check max value */ if (*jtag_speed > 0xFFFF) { *jtag_speed = 0xFFFF; } - + return ERROR_OK; } @@ -368,7 +371,7 @@ int i; char line[256]; char *line_p = line; - + for (i = 0; i < ft2232_buffer_size; i++) { line_p += snprintf(line_p, 256 - (line_p - line), "%2.2x ", ft2232_buffer[i]); @@ -378,7 +381,7 @@ line_p = line; } } - + if (line_p != line) LOG_DEBUG("%s", line); } @@ -392,7 +395,7 @@ int retval; u32 bytes_written; u32 bytes_read; - + #ifdef _DEBUG_USB_IO_ struct timeval start, inter, inter2, end; struct timeval d_inter, d_inter2, d_end; @@ -404,7 +407,7 @@ #endif #ifdef _DEBUG_USB_IO_ - gettimeofday(&start, NULL); + gettimeofday(&start, NULL); #endif if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) @@ -412,28 +415,28 @@ LOG_ERROR("couldn't write MPSSE commands to FT2232"); return retval; } - + #ifdef _DEBUG_USB_IO_ - gettimeofday(&inter, NULL); + gettimeofday(&inter, NULL); #endif - + if (ft2232_expect_read) { int timeout = 100; ft2232_buffer_size = 0; - + #ifdef _DEBUG_USB_IO_ - gettimeofday(&inter2, NULL); + gettimeofday(&inter2, NULL); #endif - + if ((retval = ft2232_read(ft2232_buffer, ft2232_expect_read, &bytes_read)) != ERROR_OK) { LOG_ERROR("couldn't read from FT2232"); return retval; } - + #ifdef _DEBUG_USB_IO_ - gettimeofday(&end, NULL); + gettimeofday(&end, NULL); timeval_subtract(&d_inter, &inter, &start); timeval_subtract(&d_inter2, &inter2, &start); @@ -441,14 +444,14 @@ LOG_INFO("inter: %i.%i, inter2: %i.%i end: %i.%i", d_inter.tv_sec, d_inter.tv_usec, d_inter2.tv_sec, d_inter2.tv_usec, d_end.tv_sec, d_end.tv_usec); #endif - - + + ft2232_buffer_size = bytes_read; - + if (ft2232_expect_read != ft2232_buffer_size) { LOG_ERROR("ft2232_expect_read (%i) != ft2232_buffer_size (%i) (%i retries)", ft2232_expect_read, ft2232_buffer_size, 100 - timeout); - ft2232_debug_dump_buffer(); + ft2232_debug_dump_buffer(); exit(-1); } @@ -461,12 +464,12 @@ ft2232_expect_read = 0; ft2232_read_pointer = 0; - + /* return ERROR_OK, unless a jtag_read_buffer returns a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; - + cmd = first; while (cmd != last) { @@ -489,7 +492,7 @@ } cmd = cmd->next; } - + ft2232_buffer_size = 0; return retval; @@ -505,7 +508,7 @@ while (num_states) { int bit_count = 0; - + int num_states_batch = num_states > 7 ? 7 : num_states; tms_byte = 0x0; @@ -513,7 +516,7 @@ BUFFER_ADD = 0x4b; /* number of states remaining */ BUFFER_ADD = num_states_batch - 1; - + while (num_states_batch--) { if (tap_transitions[cur_state].low == cmd->path[state_count]) @@ -530,10 +533,10 @@ state_count++; num_states--; } - + BUFFER_ADD = tms_byte; } - + end_state = cur_state; } @@ -544,7 +547,7 @@ int cur_byte = 0; int last_bit; - if (!((!ir_scan && (cur_state == TAP_SD)) || (ir_scan && (cur_state == TAP_SI)))) + if (!((!ir_scan && (cur_state == TAP_DRSHIFT)) || (ir_scan && (cur_state == TAP_IRSHIFT)))) { /* command "Clock Data to TMS/CS Pin (no Read)" */ BUFFER_ADD = 0x4b; @@ -553,17 +556,17 @@ /* TMS data bits */ if (ir_scan) { - BUFFER_ADD = TAP_MOVE(cur_state, TAP_SI); - cur_state = TAP_SI; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_IRSHIFT); + cur_state = TAP_IRSHIFT; } else { - BUFFER_ADD = TAP_MOVE(cur_state, TAP_SD); - cur_state = TAP_SD; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_DRSHIFT); + cur_state = TAP_DRSHIFT; } /* LOG_DEBUG("added TMS scan (no read)"); */ } - + /* add command for complete bytes */ while (num_bytes > 1) { @@ -605,7 +608,7 @@ bits_left -= 8 * (thisrun_bytes); } } - + /* the most signifcant bit is scanned during TAP movement */ if (type != SCAN_IN) last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1; @@ -638,8 +641,8 @@ BUFFER_ADD = buffer[cur_byte]; } - if ((ir_scan && (end_state == TAP_SI)) || - (!ir_scan && (end_state == TAP_SD))) + if ((ir_scan && (end_state == TAP_IRSHIFT)) || + (!ir_scan && (end_state == TAP_DRSHIFT))) { if (type == SCAN_IO) { @@ -695,24 +698,24 @@ u32 bytes_read; int retval; int thisrun_read = 0; - + if (cmd->ir_scan) { LOG_ERROR("BUG: large IR scans are not supported"); exit(-1); } - if (cur_state != TAP_SD) + if (cur_state != TAP_DRSHIFT) { /* command "Clock Data to TMS/CS Pin (no Read)" */ BUFFER_ADD = 0x4b; /* scan 7 bit */ BUFFER_ADD = 0x6; /* TMS data bits */ - BUFFER_ADD = TAP_MOVE(cur_state, TAP_SD); - cur_state = TAP_SD; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_DRSHIFT); + cur_state = TAP_DRSHIFT; } - + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); @@ -720,12 +723,12 @@ } LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written); ft2232_buffer_size = 0; - + /* add command for complete bytes */ while (num_bytes > 1) { int thisrun_bytes; - + if (type == SCAN_IO) { /* Clock Data Bytes In and Out LSB First */ @@ -771,7 +774,7 @@ } LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written); ft2232_buffer_size = 0; - + if (type != SCAN_OUT) { if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK) @@ -783,9 +786,9 @@ receive_pointer += bytes_read; } } - + thisrun_read = 0; - + /* the most signifcant bit is scanned during TAP movement */ if (type != SCAN_IN) last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1; @@ -816,12 +819,12 @@ BUFFER_ADD = bits_left - 2; if (type != SCAN_IN) BUFFER_ADD = buffer[cur_byte]; - + if (type != SCAN_OUT) thisrun_read += 2; } - if (end_state == TAP_SD) + if (end_state == TAP_DRSHIFT) { if (type == SCAN_IO) { @@ -863,10 +866,10 @@ BUFFER_ADD = TAP_MOVE(cur_state, end_state) | (last_bit << 7); cur_state = end_state; } - + if (type != SCAN_OUT) thisrun_read += 1; - + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); @@ -874,7 +877,7 @@ } LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written); ft2232_buffer_size = 0; - + if (type != SCAN_OUT) { if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK) @@ -885,7 +888,7 @@ LOG_DEBUG("thisrun_read: %i, bytes_read: %i", thisrun_read, bytes_read); receive_pointer += bytes_read; } - + return ERROR_OK; } @@ -893,10 +896,10 @@ { int predicted_size = 3; int num_bytes = (scan_size - 1) / 8; - - if (cur_state != TAP_SD) + + if (cur_state != TAP_DRSHIFT) predicted_size += 3; - + if (type == SCAN_IN) /* only from device to host */ { /* complete bytes */ @@ -918,7 +921,7 @@ int ft2232_predict_scan_in(int scan_size, enum scan_type type) { int predicted_size = 0; - + if (type != SCAN_OUT) { /* complete bytes */ @@ -928,7 +931,7 @@ /* last bit (from TMS scan) */ predicted_size += 1; } - + /* LOG_DEBUG("scan_size: %i, predicted_size: %i", scan_size, predicted_size); */ return predicted_size; @@ -965,7 +968,7 @@ else low_direction &= ~nSRSTnOE; /* switch to input pin (high-Z) */ } - + /* command "set data bits low byte" */ BUFFER_ADD = 0x80; BUFFER_ADD = low_output; @@ -1004,7 +1007,7 @@ else high_output |= nSRSTnOE; } - + /* command "set data bits high byte" */ BUFFER_ADD = 0x82; BUFFER_ADD = high_output; @@ -1045,6 +1048,34 @@ LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } +void axm0432_jtag_reset(int trst, int srst) +{ + if (trst == 1) + { + cur_state = TAP_RESET; + high_output &= ~nTRST; + } + else if (trst == 0) + { + high_output |= nTRST; + } + + if (srst == 1) + { + high_output &= ~nSRST; + } + else if (srst == 0) + { + high_output |= nSRST; + } + + /* command "set data bits low byte" */ + BUFFER_ADD = 0x82; + BUFFER_ADD = high_output; + BUFFER_ADD = high_direction; + LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); +} + void flyswatter_reset(int trst, int srst) { if (trst == 1) @@ -1075,7 +1106,7 @@ void turtle_reset(int trst, int srst) { trst = trst; - + if (srst == 1) { low_output |= nSRST; @@ -1084,7 +1115,7 @@ { low_output &= ~nSRST; } - + /* command "set data bits low byte" */ BUFFER_ADD = 0x80; BUFFER_ADD = low_output; @@ -1111,7 +1142,7 @@ { high_output |= nSRST; } - + /* command "set data bits high byte" */ BUFFER_ADD = 0x82; BUFFER_ADD = high_output; @@ -1138,12 +1169,12 @@ { low_output |= nSRST; } - + /* command "set data bits low byte" */ BUFFER_ADD = 0x80; BUFFER_ADD = low_output; BUFFER_ADD = low_direction; - + /* command "set data bits high byte" */ BUFFER_ADD = 0x82; BUFFER_ADD = high_output; @@ -1162,15 +1193,15 @@ int predicted_size = 0; int require_send = 0; int retval; - + /* return ERROR_OK, unless ft2232_send_and_recv reports a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; ft2232_buffer_size = 0; ft2232_expect_read = 0; - + /* blink, if the current layout has that feature */ if (layout->blink) layout->blink(); @@ -1196,24 +1227,24 @@ if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } layout->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); require_send = 1; - -#ifdef _DEBUG_JTAG_IO_ + +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("trst: %i, srst: %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst); #endif break; case JTAG_RUNTEST: /* only send the maximum buffer size that FT2232C can handle */ predicted_size = 0; - if (cur_state != TAP_RTI) + if (cur_state != TAP_IDLE) predicted_size += 3; predicted_size += 3 * CEIL(cmd->cmd.runtest->num_cycles, 7); - if ((cmd->cmd.runtest->end_state != -1) && (cmd->cmd.runtest->end_state != TAP_RTI)) + if ((cmd->cmd.runtest->end_state != -1) && (cmd->cmd.runtest->end_state != TAP_IDLE)) predicted_size += 3; - if ((cmd->cmd.runtest->end_state == -1) && (end_state != TAP_RTI)) + if ((cmd->cmd.runtest->end_state == -1) && (end_state != TAP_IDLE)) predicted_size += 3; if (ft2232_buffer_size + predicted_size + 1 > FT2232_BUFFER_SIZE) { @@ -1222,15 +1253,15 @@ require_send = 0; first_unsent = cmd; } - if (cur_state != TAP_RTI) + if (cur_state != TAP_IDLE) { /* command "Clock Data to TMS/CS Pin (no Read)" */ BUFFER_ADD = 0x4b; /* scan 7 bit */ BUFFER_ADD = 0x6; /* TMS data bits */ - BUFFER_ADD = TAP_MOVE(cur_state, TAP_RTI); - cur_state = TAP_RTI; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_IDLE); + cur_state = TAP_IDLE; require_send = 1; } i = cmd->cmd.runtest->num_cycles; @@ -1242,7 +1273,7 @@ BUFFER_ADD = (i > 7) ? 6 : (i - 1); /* TMS data bits */ BUFFER_ADD = 0x0; - cur_state = TAP_RTI; + cur_state = TAP_IDLE; i -= (i > 7) ? 7 : i; /* LOG_DEBUG("added TMS scan (no read)"); */ } @@ -1260,7 +1291,7 @@ /* LOG_DEBUG("added TMS scan (no read)"); */ } require_send = 1; -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("runtest: %i, end in %i", cmd->cmd.runtest->num_cycles, end_state); #endif break; @@ -1285,7 +1316,7 @@ /* LOG_DEBUG("added TMS scan (no read)"); */ cur_state = end_state; require_send = 1; -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("statemove: %i", end_state); #endif break; @@ -1301,7 +1332,7 @@ } ft2232_add_pathmove(cmd->cmd.pathmove); require_send = 1; -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); #endif break; @@ -1316,7 +1347,7 @@ if (first_unsent != cmd) if (ft2232_send_and_recv(first_unsent, cmd) != ERROR_OK) retval = ERROR_JTAG_QUEUE_FAILED; - + /* current command */ if (cmd->cmd.scan->end_state != -1) ft2232_end_state(cmd->cmd.scan->end_state); @@ -1343,7 +1374,7 @@ require_send = 1; if (buffer) free(buffer); -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("%s scan, %i bit, end in %i", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size, end_state); #endif break; @@ -1352,7 +1383,7 @@ retval = ERROR_JTAG_QUEUE_FAILED; first_unsent = cmd->next; jtag_sleep(cmd->cmd.sleep->us); -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("sleep %i usec", cmd->cmd.sleep->us); #endif break; @@ -1378,15 +1409,13 @@ char *openex_string = NULL; u8 latency_timer; - LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)", - ft2232_layout, vid, pid); + LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)",ft2232_layout, vid, pid); #if IS_WIN32 == 0 /* Add non-standard Vid/Pid to the linux driver */ if ((status = FT_SetVIDPID(vid, pid)) != FT_OK) { - LOG_WARNING("couldn't add %4.4x:%4.4x", - vid, pid); + LOG_WARNING("couldn't add %4.4x:%4.4x", vid, pid); } #endif @@ -1395,7 +1424,7 @@ LOG_WARNING("can't open by device description and serial number, giving precedence to serial"); ft2232_device_desc = NULL; } - + if (ft2232_device_desc) { openex_string = ft2232_device_desc; @@ -1410,17 +1439,16 @@ { LOG_ERROR("neither device description nor serial number specified"); LOG_ERROR("please add \"ft2232_device_desc <string>\" or \"ft2232_serial <string>\" to your .cfg file"); - - return ERROR_JTAG_INIT_FAILED; + + return ERROR_JTAG_INIT_FAILED; } if ((status = FT_OpenEx(openex_string, openex_flags, &ftdih)) != FT_OK) { DWORD num_devices; - + if (more) { - LOG_WARNING("unable to open ftdi device (trying more): %lu", - status); + LOG_WARNING("unable to open ftdi device (trying more): %lu", status); *try_more = 1; return ERROR_JTAG_INIT_FAILED; } @@ -1443,7 +1471,7 @@ for (i = 0; i < num_devices; i++) LOG_ERROR("%i: %s", i, desc_array[i]); } - + for (i = 0; i < num_devices; i++) free(desc_array[i]); free(desc_array); @@ -1460,7 +1488,7 @@ LOG_ERROR("unable to set latency timer: %lu", status); return ERROR_JTAG_INIT_FAILED; } - + if ((status = FT_GetLatencyTimer(ftdih, &latency_timer)) != FT_OK) { LOG_ERROR("unable to get latency timer: %lu", status); @@ -1470,7 +1498,7 @@ { LOG_DEBUG("current latency timer: %i", latency_timer); } - + if ((status = FT_SetTimeouts(ftdih, 5000, 5000)) != FT_OK) { LOG_ERROR("unable to set timeouts: %lu", status); @@ -1540,7 +1568,7 @@ LOG_ERROR("unable to set latency timer"); return ERROR_JTAG_INIT_FAILED; } - + if (ftdi_get_latency_timer(&ftdic, &latency_timer) < 0) { LOG_ERROR("unable to get latency timer"); @@ -1575,13 +1603,13 @@ u32 bytes_written; ft2232_layout_t *cur_layout = ft2232_layouts; int i; - + if ((ft2232_layout == NULL) || (ft2232_layout[0] == 0)) { ft2232_layout = "usbjtag"; LOG_WARNING("No ft2232 layout specified, using default 'usbjtag'"); } - + while (cur_layout->name) { if (strcmp(cur_layout->name, ft2232_layout) == 0) @@ -1597,7 +1625,7 @@ LOG_ERROR("No matching layout found for %s", ft2232_layout); return ERROR_JTAG_INIT_FAILED; } - + for (i = 0; 1; i++) { /* * "more indicates that there are more IDs to try, so we should @@ -1617,7 +1645,7 @@ #elif BUILD_FT2232_LIBFTDI == 1 retval = ft2232_init_libftdi(ft2232_vid[i], ft2232_pid[i], more, &try_more); -#endif +#endif if (retval >= 0) break; if (!more || !try_more) @@ -1643,7 +1671,7 @@ return ft2232_purge_ftd2xx(); #elif BUILD_FT2232_LIBFTDI == 1 return ft2232_purge_libftdi(); -#endif +#endif return ERROR_OK; } @@ -1652,10 +1680,10 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x0b; - + if (strcmp(ft2232_layout, "usbjtag") == 0) { nTRST = 0x10; @@ -1682,9 +1710,9 @@ else { LOG_ERROR("BUG: usbjtag_init called for unknown layout '%s'", ft2232_layout); - return ERROR_JTAG_INIT_FAILED; + return ERROR_JTAG_INIT_FAILED; } - + if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) { low_direction &= ~nTRSTnOE; /* nTRST input */ @@ -1695,7 +1723,7 @@ low_direction |= nTRSTnOE; /* nTRST output */ low_output |= nTRST; /* nTRST = 1 */ } - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) { low_direction |= nSRSTnOE; /* nSRST output */ @@ -1706,42 +1734,111 @@ low_direction &= ~nSRSTnOE; /* nSRST input */ low_output &= ~nSRST; /* nSRST = 0 */ } - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, xRST high) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout"); return ERROR_JTAG_INIT_FAILED; } return ERROR_OK; } +int axm0432_jtag_init(void) +{ + u8 buf[3]; + u32 bytes_written; + + low_output = 0x08; + low_direction = 0x2b; + + /* initialize low byte for jtag */ + buf[0] = 0x80; /* command "set data bits low byte" */ + buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ + buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); + + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) + { + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + return ERROR_JTAG_INIT_FAILED; + } + + if (strcmp(layout->name, "axm0432_jtag") == 0) + { + nTRST = 0x08; + nTRSTnOE = 0x0; /* No output enable for TRST*/ + nSRST = 0x04; + nSRSTnOE = 0x0; /* No output enable for SRST*/ + } + else + { + LOG_ERROR("BUG: axm0432_jtag_init called for non axm0432 layout"); + exit(-1); + } + + high_output = 0x0; + high_direction = 0x0c; + + if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) + { + LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag"); + } + else + { + high_output |= nTRST; + } + + if (jtag_reset_config & RESET_SRST_PUSH_PULL) + { + LOG_ERROR("can't set nSRST to push-pull on the Dicarlo jtag"); + } + else + { + high_output |= nSRST; + } + + /* initialize high port */ + buf[0] = 0x82; /* command "set data bits high byte" */ + buf[1] = high_output; /* value */ + buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); + + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) + { + LOG_ERROR("couldn't initialize FT2232 with 'Dicarlo' layout"); + return ERROR_JTAG_INIT_FAILED; + } + + return ERROR_OK; +} + int jtagkey_init(void) { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x1b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + if (strcmp(layout->name, "jtagkey") == 0) { nTRST = 0x01; @@ -1762,7 +1859,7 @@ LOG_ERROR("BUG: jtagkey_init called for non jtagkey layout"); exit(-1); } - + high_output = 0x0; high_direction = 0x0f; @@ -1776,7 +1873,7 @@ high_output &= ~nTRSTnOE; high_output |= nTRST; } - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) { high_output &= ~nSRSTnOE; @@ -1787,19 +1884,19 @@ high_output |= nSRSTnOE; high_output &= ~nSRST; } - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; /* value */ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -1807,22 +1904,22 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x1b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + nTRST = 0x01; nTRSTnOE = 0x4; nSRST = 0x02; @@ -1841,7 +1938,7 @@ high_output &= ~nTRSTnOE; high_output |= nTRST; } - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) { LOG_ERROR("can't set nSRST to push-pull on the Olimex ARM-USB-OCD"); @@ -1850,22 +1947,22 @@ { high_output &= ~nSRST; } - + /* turn red LED on */ high_output |= 0x08; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; /* value */ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -1873,22 +1970,22 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x18; low_direction = 0xfb; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE[12]=out, n[ST]srst=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); return ERROR_JTAG_INIT_FAILED; } - + nTRST = 0x10; nTRSTnOE = 0x0; /* not output enable for nTRST */ nSRST = 0x20; @@ -1899,19 +1996,19 @@ /* turn red LED1 on, LED2 off */ high_output |= 0x08; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; /* value */ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -1919,39 +2016,39 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x5b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); return ERROR_JTAG_INIT_FAILED; } - + nSRST = 0x40; - + high_output = 0x00; high_direction = 0x0C; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (by... [truncated message content] |
From: <kc...@ma...> - 2008-12-13 07:59:37
|
Author: kc8apf Date: 2008-12-13 07:59:24 +0100 (Sat, 13 Dec 2008) New Revision: 1235 Modified: trunk/src/flash/str9xpec.c trunk/src/jtag/amt_jtagaccel.c trunk/src/jtag/bitbang.c trunk/src/jtag/bitq.c trunk/src/jtag/gw16012.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h trunk/src/jtag/usbprog.c trunk/src/jtag/zy1000.c trunk/src/target/arm11_dbgtap.c Log: Clean up references to old tap_state names Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/flash/str9xpec.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -1338,7 +1338,7 @@ if (tap == NULL) return ERROR_FAIL; - /* exit turbo mode via TLR */ + /* exit turbo mode via RESET */ str9xpec_set_instr(tap, ISC_NOOP, TAP_RESET); jtag_execute_queue(); Modified: trunk/src/jtag/amt_jtagaccel.c =================================================================== --- trunk/src/jtag/amt_jtagaccel.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/amt_jtagaccel.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -100,13 +100,13 @@ */ u8 amt_jtagaccel_tap_move[6][6][2] = { - /* TLR RTI SD PD SI PI */ - {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* TLR */ - {{0x1f, 0x00}, {0x00, 0x00}, {0x85, 0x08}, {0x05, 0x00}, {0x8b, 0x08}, {0x0b, 0x00}}, /* RTI */ - {{0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* SD */ - {{0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* PD */ - {{0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00}}, /* SI */ - {{0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00}}, /* PI */ + /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ + {{0x1f, 0x00}, {0x0f, 0x00}, {0x8a, 0x04}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00}}, /* RESET */ + {{0x1f, 0x00}, {0x00, 0x00}, {0x85, 0x08}, {0x05, 0x00}, {0x8b, 0x08}, {0x0b, 0x00}}, /* IDLE */ + {{0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRSHIFT */ + {{0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01}}, /* DRPAUSE */ + {{0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00}}, /* IRSHIFT */ + {{0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00}}, /* IRPAUSE */ }; jtag_interface_t amt_jtagaccel_interface = @@ -214,7 +214,7 @@ enum tap_state saved_end_state = end_state; - /* only do a state_move when we're not already in RTI */ + /* only do a state_move when we're not already in IDLE */ if (cur_state != TAP_IDLE) { amt_jtagaccel_end_state(TAP_IDLE); Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/bitbang.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -133,7 +133,7 @@ enum tap_state saved_end_state = end_state; - /* only do a state_move when we're not already in RTI */ + /* only do a state_move when we're not already in IDLE */ if (cur_state != TAP_IDLE) { bitbang_end_state(TAP_IDLE); Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/bitq.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -194,7 +194,7 @@ { int i; - /* only do a state_move when we're not already in RTI */ + /* only do a state_move when we're not already in IDLE */ if (cur_state != TAP_IDLE) bitq_state_move(TAP_IDLE); /* execute num_cycles */ Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/gw16012.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -257,7 +257,7 @@ enum tap_state saved_end_state = end_state; int i; - /* only do a state_move when we're not already in RTI */ + /* only do a state_move when we're not already in IDLE */ if (cur_state != TAP_IDLE) { gw16012_end_state(TAP_IDLE); Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/jlink.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -392,7 +392,7 @@ enum tap_state saved_end_state = end_state; - /* only do a state_move when we're not already in RTI */ + /* only do a state_move when we're not already in IDLE */ if (cur_state != TAP_IDLE) { jlink_end_state(TAP_IDLE); Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/jtag.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -67,17 +67,17 @@ * 4: Shift-IR * 5: Pause-IR * - * SD->SD and SI->SI have to be caught in interface specific code + * DRSHIFT->DRSHIFT and IRSHIFT->IRSHIFT have to be caught in interface specific code */ u8 tap_move[6][6] = { -/* TLR RTI SD PD SI PI */ - {0x7f, 0x00, 0x17, 0x0a, 0x1b, 0x16}, /* TLR */ - {0x7f, 0x00, 0x25, 0x05, 0x2b, 0x0b}, /* RTI */ - {0x7f, 0x31, 0x00, 0x01, 0x0f, 0x2f}, /* SD */ - {0x7f, 0x30, 0x20, 0x17, 0x1e, 0x2f}, /* PD */ - {0x7f, 0x31, 0x07, 0x17, 0x00, 0x01}, /* SI */ - {0x7f, 0x30, 0x1c, 0x17, 0x20, 0x2f} /* PI */ +/* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ + { 0x7f, 0x00, 0x17, 0x0a, 0x1b, 0x16}, /* RESET */ + { 0x7f, 0x00, 0x25, 0x05, 0x2b, 0x0b}, /* IDLE */ + { 0x7f, 0x31, 0x00, 0x01, 0x0f, 0x2f}, /* DRSHIFT */ + { 0x7f, 0x30, 0x20, 0x17, 0x1e, 0x2f}, /* DRPAUSE */ + { 0x7f, 0x31, 0x07, 0x17, 0x00, 0x01}, /* IRSHIFT */ + { 0x7f, 0x30, 0x1c, 0x17, 0x20, 0x2f} /* IRPAUSE */ }; int tap_move_map[16] = { @@ -87,27 +87,27 @@ tap_transition_t tap_transitions[16] = { - {TAP_RESET, TAP_IDLE}, /* TLR */ - {TAP_IRSELECT, TAP_DRCAPTURE}, /* SDS */ - {TAP_DREXIT1, TAP_DRSHIFT}, /* CD */ - {TAP_DREXIT1, TAP_DRSHIFT}, /* SD */ - {TAP_DRUPDATE, TAP_DRPAUSE}, /* E1D */ - {TAP_DREXIT2, TAP_DRPAUSE}, /* PD */ - {TAP_DRUPDATE, TAP_DRSHIFT}, /* E2D */ - {TAP_DRSELECT, TAP_IDLE}, /* UD */ - {TAP_DRSELECT, TAP_IDLE}, /* RTI */ - {TAP_RESET, TAP_IRCAPTURE}, /* SIS */ - {TAP_IREXIT1, TAP_IRSHIFT}, /* CI */ - {TAP_IREXIT1, TAP_IRSHIFT}, /* SI */ - {TAP_IRUPDATE, TAP_IRPAUSE}, /* E1I */ - {TAP_IREXIT2, TAP_IRPAUSE}, /* PI */ - {TAP_IRUPDATE, TAP_IRSHIFT}, /* E2I */ - {TAP_DRSELECT, TAP_IDLE} /* UI */ + {TAP_RESET, TAP_IDLE}, /* RESET */ + {TAP_IRSELECT, TAP_DRCAPTURE}, /* DRSELECT */ + {TAP_DREXIT1, TAP_DRSHIFT}, /* DRCAPTURE */ + {TAP_DREXIT1, TAP_DRSHIFT}, /* DRSHIFT */ + {TAP_DRUPDATE, TAP_DRPAUSE}, /* DREXIT1 */ + {TAP_DREXIT2, TAP_DRPAUSE}, /* DRPAUSE */ + {TAP_DRUPDATE, TAP_DRSHIFT}, /* DREXIT2 */ + {TAP_DRSELECT, TAP_IDLE}, /* DRUPDATE */ + {TAP_DRSELECT, TAP_IDLE}, /* IDLE */ + {TAP_RESET, TAP_IRCAPTURE}, /* IRSELECT */ + {TAP_IREXIT1, TAP_IRSHIFT}, /* IRCAPTURE */ + {TAP_IREXIT1, TAP_IRSHIFT}, /* IRSHIFT */ + {TAP_IRUPDATE, TAP_IRPAUSE}, /* IREXIT1 */ + {TAP_IREXIT2, TAP_IRPAUSE}, /* IRPAUSE */ + {TAP_IRUPDATE, TAP_IRSHIFT}, /* IREXIT2 */ + {TAP_DRSELECT, TAP_IDLE} /* IRUPDATE */ }; char* jtag_event_strings[] = { - "JTAG controller reset (TLR or TRST)" + "JTAG controller reset (RESET or TRST)" }; /* kludge!!!! these are just global variables that the @@ -1153,7 +1153,7 @@ if (trst_with_tlr) { - LOG_DEBUG("JTAG reset with TLR instead of TRST"); + LOG_DEBUG("JTAG reset with RESET instead of TRST"); jtag_add_end_state(TAP_RESET); jtag_add_tlr(); jtag_call_event_callbacks(JTAG_TRST_ASSERTED); @@ -1198,7 +1198,7 @@ cmd_queue_end_state = state; if ((cmd_queue_end_state == TAP_DRSHIFT)||(cmd_queue_end_state == TAP_IRSHIFT)) { - LOG_ERROR("BUG: TAP_DRSHIFT/SI can't be end state. Calling code should use a larger scan field"); + LOG_ERROR("BUG: TAP_DRSHIFT/IRSHIFT can't be end state. Calling code should use a larger scan field"); } } @@ -2096,11 +2096,11 @@ if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK) return retval; - LOG_DEBUG("Trying to bring the JTAG controller to life by asserting TRST / TLR"); + LOG_DEBUG("Trying to bring the JTAG controller to life by asserting TRST / RESET"); /* Reset can happen after a power cycle. * - * Ideally we would only assert TRST or run TLR before the target reset. + * Ideally we would only assert TRST or run RESET before the target reset. * * However w/srst_pulls_trst, trst is asserted together with the target * reset whether we want it or not. @@ -2113,7 +2113,7 @@ * NB! order matters!!!! srst *can* disconnect JTAG circuitry * */ - jtag_add_reset(1, 0); /* TLR or TRST */ + jtag_add_reset(1, 0); /* RESET or TRST */ if (jtag_reset_config & RESET_HAS_SRST) { jtag_add_reset(1, 1); Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/jtag.h 2008-12-13 06:59:24 UTC (rev 1235) @@ -310,7 +310,7 @@ * upon subsequent invocations */ extern int jtag_interface_init(struct command_context_s *cmd_ctx); -/* initialize JTAG chain using only a TLR reset. If init fails, +/* initialize JTAG chain using only a RESET reset. If init fails, * try reset + init. */ extern int jtag_init(struct command_context_s *cmd_ctx); @@ -320,7 +320,7 @@ /* JTAG interface, can be implemented with a software or hardware fifo * - * TAP_DRSHIFT and TAP_IRSHIFT are illegal end states. TAP_DRSHIFT/SI as end states + * TAP_DRSHIFT and TAP_IRSHIFT are illegal end states. TAP_DRSHIFT/IRSHIFT as end states * can be emulated by using a larger scan. * * Code that is relatively insensitive to the path(as long Modified: trunk/src/jtag/usbprog.c =================================================================== --- trunk/src/jtag/usbprog.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/usbprog.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -298,7 +298,7 @@ { int i; - /* only do a state_move when we're not already in RTI */ + /* only do a state_move when we're not already in IDLE */ if (cur_state != TAP_IDLE) { usbprog_end_state(TAP_IDLE); Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/jtag/zy1000.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -176,7 +176,7 @@ if (trst||(srst&&(jtag_reset_config & RESET_SRST_PULLS_TRST))) { waitIdle(); - /* we're now in the TLR state until trst is deasserted */ + /* we're now in the RESET state until trst is deasserted */ ZY1000_POKE(ZY1000_JTAG_BASE+0x20, TAP_RESET); } else { Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2008-12-13 06:29:47 UTC (rev 1234) +++ trunk/src/target/arm11_dbgtap.c 2008-12-13 06:59:24 UTC (rev 1235) @@ -340,10 +340,10 @@ * Put arm11_run_instr_data_prepare() and arm11_run_instr_data_finish() * around a block of arm11_run_instr_... calls. * - * Any RTI can lead to an instruction execution when + * Any IDLE can lead to an instruction execution when * scan chains 4 or 5 are selected and the IR holds * INTEST or EXTEST. So we must disable that before - * any following activities lead to an RTI. + * any following activities lead to an IDLE. * * \param arm11 Target state variable. * @@ -471,7 +471,7 @@ * the core but still shorter than any manually inducible delays. * */ -enum tap_state arm11_MOVE_PD_RTI_PD_with_delay[] = +enum tap_state arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay[] = { TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT }; @@ -518,8 +518,8 @@ if (count) { jtag_add_dr_scan(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); - jtag_add_pathmove(asizeof(arm11_MOVE_PD_RTI_PD_with_delay), - arm11_MOVE_PD_RTI_PD_with_delay); + jtag_add_pathmove(asizeof(arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay), + arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay); } else { |
From: <kc...@ma...> - 2008-12-13 07:29:51
|
Author: kc8apf Date: 2008-12-13 07:29:47 +0100 (Sat, 13 Dec 2008) New Revision: 1234 Removed: branches/cortex-m3/ branches/mips/ branches/xscale-ixp-be/ branches/xscale/ Log: Remove obsolete branches |
From: <kc...@ma...> - 2008-12-13 07:28:28
|
Author: kc8apf Date: 2008-12-13 07:28:23 +0100 (Sat, 13 Dec 2008) New Revision: 1233 Added: branches/ tags/ Removed: openocd/ Log: Back to openocd being the top-level project Copied: branches (from rev 1231, openocd/branches) Copied: tags (from rev 1231, openocd/tags) |
From: <kc...@ma...> - 2008-12-13 07:26:14
|
Author: kc8apf Date: 2008-12-13 07:25:50 +0100 (Sat, 13 Dec 2008) New Revision: 1232 Modified: trunk/src/flash/str9xpec.c trunk/src/jtag/amt_jtagaccel.c trunk/src/jtag/bitbang.c trunk/src/jtag/bitq.c trunk/src/jtag/ft2232.c trunk/src/jtag/gw16012.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h trunk/src/jtag/usbprog.c trunk/src/jtag/zy1000.c trunk/src/pld/virtex2.c trunk/src/target/arm11.c trunk/src/target/arm11_dbgtap.c trunk/src/target/arm720t.c trunk/src/target/arm7_9_common.c trunk/src/target/arm7tdmi.c trunk/src/target/arm920t.c trunk/src/target/arm926ejs.c trunk/src/target/arm966e.c trunk/src/target/arm9tdmi.c trunk/src/target/cortex_swjdp.c trunk/src/target/embeddedice.c trunk/src/target/etb.c trunk/src/target/etm.c trunk/src/target/feroceon.c trunk/src/target/mips_ejtag.c trunk/src/target/mips_m4k.c trunk/src/target/xscale.c trunk/src/xsvf/xsvf.c Log: Change tap_state naming to be consistent with SVF documentation. Courtesy of Dick Hollenbeck <di...@so...> Modified: trunk/src/flash/str9xpec.c =================================================================== --- trunk/src/flash/str9xpec.c 2008-12-12 22:14:21 UTC (rev 1231) +++ trunk/src/flash/str9xpec.c 2008-12-13 06:25:50 UTC (rev 1232) @@ -145,7 +145,7 @@ scan_field_t field; u8 status; - if (str9xpec_set_instr(tap, ISC_NOOP, TAP_PI) != ERROR_OK) + if (str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE) != ERROR_OK) return ISC_STATUS_ERROR; field.tap = tap; @@ -158,7 +158,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); LOG_DEBUG("status: 0x%2.2x", status); @@ -181,7 +181,7 @@ return ERROR_OK; /* enter isc mode */ - if (str9xpec_set_instr(tap, ISC_ENABLE, TAP_RTI) != ERROR_OK) + if (str9xpec_set_instr(tap, ISC_ENABLE, TAP_IDLE) != ERROR_OK) return ERROR_TARGET_INVALID; /* check ISC status */ @@ -207,7 +207,7 @@ if (!str9xpec_info->isc_enable) return ERROR_OK; - if (str9xpec_set_instr(tap, ISC_DISABLE, TAP_RTI) != ERROR_OK) + if (str9xpec_set_instr(tap, ISC_DISABLE, TAP_IDLE) != ERROR_OK) return ERROR_TARGET_INVALID; /* delay to handle aborts */ @@ -238,7 +238,7 @@ LOG_DEBUG("ISC_CONFIGURATION"); /* execute ISC_CONFIGURATION command */ - str9xpec_set_instr(tap, ISC_CONFIGURATION, TAP_PI); + str9xpec_set_instr(tap, ISC_CONFIGURATION, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -250,7 +250,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); status = str9xpec_isc_status(tap); @@ -349,10 +349,10 @@ armv4_5 = bank->target->arch_info; arm7_9 = armv4_5->arch_info; jtag_info = &arm7_9->jtag_info; - + str9xpec_info->tap = jtag_TapByAbsPosition( jtag_info->tap->abs_chain_position - 1); str9xpec_info->isc_enable = 0; - + str9xpec_build_block_list(bank); /* clear option byte register */ @@ -390,7 +390,7 @@ } /* execute ISC_BLANK_CHECK command */ - str9xpec_set_instr(tap, ISC_BLANK_CHECK, TAP_PI); + str9xpec_set_instr(tap, ISC_BLANK_CHECK, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -402,7 +402,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_add_sleep(40000); /* read blank check result */ @@ -416,7 +416,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_PI); + jtag_add_dr_scan(1, &field, TAP_IRPAUSE); jtag_execute_queue(); status = str9xpec_isc_status(tap); @@ -506,7 +506,7 @@ LOG_DEBUG("ISC_ERASE"); /* execute ISC_ERASE command */ - str9xpec_set_instr(tap, ISC_ERASE, TAP_PI); + str9xpec_set_instr(tap, ISC_ERASE, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -518,7 +518,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); jtag_add_sleep(10); @@ -569,9 +569,9 @@ str9xpec_set_address(bank, 0x80); /* execute ISC_PROGRAM command */ - str9xpec_set_instr(tap, ISC_PROGRAM_SECURITY, TAP_RTI); + str9xpec_set_instr(tap, ISC_PROGRAM_SECURITY, TAP_IDLE); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -658,7 +658,7 @@ tap = str9xpec_info->tap; /* set flash controller address */ - str9xpec_set_instr(tap, ISC_ADDRESS_SHIFT, TAP_PI); + str9xpec_set_instr(tap, ISC_ADDRESS_SHIFT, TAP_IRPAUSE); field.tap = tap; field.num_bits = 8; @@ -747,7 +747,7 @@ while (dwords_remaining > 0) { - str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI); + str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -759,12 +759,12 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); /* small delay before polling */ jtag_add_sleep(50); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -807,7 +807,7 @@ bytes_written++; } - str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI); + str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -819,12 +819,12 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); /* small delay before polling */ jtag_add_sleep(50); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -889,7 +889,7 @@ buffer = calloc(CEIL(32, 8), 1); - str9xpec_set_instr(tap, ISC_IDCODE, TAP_PI); + str9xpec_set_instr(tap, ISC_IDCODE, TAP_IRPAUSE); field.tap = tap; field.num_bits = 32; @@ -901,7 +901,7 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); jtag_execute_queue(); idcode = buf_get_u32(buffer, 0, 32); @@ -1014,7 +1014,7 @@ str9xpec_set_address(bank, 0x50); /* execute ISC_PROGRAM command */ - str9xpec_set_instr(tap, ISC_PROGRAM, TAP_PI); + str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE); field.tap = tap; field.num_bits = 64; @@ -1026,12 +1026,12 @@ field.in_handler = NULL; field.in_handler_priv = NULL; - jtag_add_dr_scan(1, &field, TAP_RTI); + jtag_add_dr_scan(1, &field, TAP_IDLE); /* small delay before polling */ jtag_add_sleep(50); - str9xpec_set_instr(tap, ISC_NOOP, TAP_PI); + str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE); do { field.tap = tap; @@ -1303,13 +1303,13 @@ } /* enable turbo mode - TURBO-PROG-ENABLE */ - str9xpec_set_instr(tap2, 0xD, TAP_RTI); + str9xpec_set_instr(tap2, 0xD, TAP_IDLE); if ((retval = jtag_execute_queue()) != ERROR_OK) return retval; /* modify scan chain - str9 core has been removed */ tap1->enabled = 0; - + return ERROR_OK; } @@ -1337,11 +1337,11 @@ if (tap == NULL) return ERROR_FAIL; - + /* exit turbo mode via TLR */ - str9xpec_set_instr(tap, ISC_NOOP, TAP_TLR); + str9xpec_set_instr(tap, ISC_NOOP, TAP_RESET); jtag_execute_queue(); - + /* restore previous scan chain */ if (tap->next_tap) { tap->next_tap->enabled = 1; Modified: trunk/src/jtag/amt_jtagaccel.c =================================================================== --- trunk/src/jtag/amt_jtagaccel.c 2008-12-12 22:14:21 UTC (rev 1231) +++ trunk/src/jtag/amt_jtagaccel.c 2008-12-13 06:25:50 UTC (rev 1232) @@ -109,13 +109,13 @@ {{0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00}}, /* PI */ }; -jtag_interface_t amt_jtagaccel_interface = +jtag_interface_t amt_jtagaccel_interface = { .name = "amt_jtagaccel", - + .execute_queue = amt_jtagaccel_execute_queue, - .speed = amt_jtagaccel_speed, + .speed = amt_jtagaccel_speed, .register_commands = amt_jtagaccel_register_commands, .init = amt_jtagaccel_init, .quit = amt_jtagaccel_quit, @@ -127,7 +127,7 @@ COMMAND_CONFIG, NULL); register_command(cmd_ctx, NULL, "rtck", amt_jtagaccel_handle_rtck_command, COMMAND_CONFIG, NULL); - + return ERROR_OK; } @@ -142,7 +142,7 @@ aw_control_rst |= 0x1; else if (srst == 0) aw_control_rst &= ~0x1; - + AMT_AW(aw_control_rst); } @@ -151,7 +151,7 @@ aw_control_baudrate &= 0xf0; aw_control_baudrate |= speed & 0x0f; AMT_AW(aw_control_baudrate); - + return ERROR_OK; } @@ -170,11 +170,11 @@ { int timeout = 4096; u8 ar_status; - + AMT_AR(ar_status); while (((ar_status) & 0x80) && (timeout-- > 0)) AMT_AR(ar_status); - + if (ar_status & 0x80) { LOG_ERROR("amt_jtagaccel timed out while waiting for end of scan, rtck was %s, last AR_STATUS: 0x%2.2x", (rtck_enabled) ? "enabled" : "disabled", ar_status); @@ -186,15 +186,15 @@ { u8 aw_scan_tms_5; u8 tms_scan[2]; - + tms_scan[0] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][0]; tms_scan[1] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][1]; - + aw_scan_tms_5 = 0x40 | (tms_scan[0] & 0x1f); AMT_AW(aw_scan_tms_5); if (jtag_speed > 3 || rtck_enabled) amt_wait_scan_busy(); - + if (tms_scan[0] & 0x80) { aw_scan_tms_5 = 0x40 | (tms_scan[1] & 0x1f); @@ -202,7 +202,7 @@ if (jtag_speed > 3 || rtck_enabled) amt_wait_scan_busy(); } - + cur_state = end_state; } @@ -213,27 +213,27 @@ u8 aw_scan_tms_1to4; enum tap_state saved_end_state = end_state; - + /* only do a state_move when we're not already in RTI */ - if (cur_state != TAP_RTI) + if (cur_state != TAP_IDLE) { - amt_jtagaccel_end_state(TAP_RTI); + amt_jtagaccel_end_state(TAP_IDLE); amt_jtagaccel_state_move(); } - + while (num_cycles - i >= 5) { aw_scan_tms_5 = 0x40; AMT_AW(aw_scan_tms_5); i += 5; } - + if (num_cycles - i > 0) { aw_scan_tms_1to4 = 0x80 | ((num_cycles - i - 1) & 0x3) << 4; AMT_AW(aw_scan_tms_1to4); } - + amt_jtagaccel_end_state(saved_end_state); if (cur_state != end_state) amt_jtagaccel_state_move(); @@ -251,9 +251,9 @@ u8 tms_scan[2]; if (ir_scan) - amt_jtagaccel_end_state(TAP_SI); + amt_jtagaccel_end_state(TAP_IRSHIFT); else - amt_jtagaccel_end_state(TAP_SD); + amt_jtagaccel_end_state(TAP_DRSHIFT); amt_jtagaccel_state_move(); amt_jtagaccel_end_state(saved_end_state); @@ -263,7 +263,7 @@ { aw_tdi_option = 0x30 | (((scan_size - 1) % 8) - 1); AMT_AW(aw_tdi_option); - + dw_tdi_scan = buf_get_u32(buffer, bit_count, (scan_size - 1) % 8) & 0xff; AMT_DW(dw_tdi_scan); if (jtag_speed > 3 || rtck_enabled) @@ -275,11 +275,11 @@ dr_tdo = dr_tdo >> (8 - ((scan_size - 1) % 8)); buf_set_u32(buffer, bit_count, (scan_size - 1) % 8, dr_tdo); } - + bit_count += (scan_size - 1) % 8; bits_left -= (scan_size - 1) % 8; } - + while (bits_left - 1 >= 8) { dw_tdi_scan = buf_get_u32(buffer, bit_count, 8) & 0xff; @@ -292,11 +292,11 @@ AMT_DR(dr_tdo); buf_set_u32(buffer, bit_count, 8, dr_tdo); } - + bit_count += 8; bits_left -= 8; } - + tms_scan[0] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][0]; tms_scan[1] = amt_jtagaccel_tap_move[tap_move_map[cur_state]][tap_move_map[end_state]][1]; aw_tms_scan = 0x40 | (tms_scan[0] & 0x1f) | (buf_get_u32(buffer, bit_count, 1) << 5); @@ -310,7 +310,7 @@ dr_tdo = dr_tdo >> 7; buf_set_u32(buffer, bit_count, 1, dr_tdo); } - + if (tms_scan[0] & 0x80) { aw_tms_scan = 0x40 | (tms_scan[1] & 0x1f); @@ -328,12 +328,12 @@ enum scan_type type; u8 *buffer; int retval; - + /* return ERROR_OK, unless a jtag_read_buffer returns a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; - + while (cmd) { switch (cmd->type) @@ -351,7 +351,7 @@ #endif if (cmd->cmd.reset->trst == 1) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } amt_jtagaccel_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); break; @@ -397,7 +397,7 @@ } cmd = cmd->next; } - + return retval; } @@ -409,16 +409,16 @@ version.dwOSVersionInfoSize = sizeof version; if (!GetVersionEx( &version )) { - errno = EINVAL; - return -1; + errno = EINVAL; + return -1; } if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; + return 0; h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; + errno = ENODEV; + return -1; } CloseHandle( h ); @@ -437,7 +437,7 @@ u8 status_port; #endif u8 ar_status; - + #if PARPORT_USE_PPDEV == 1 if (device_handle > 0) { @@ -447,7 +447,7 @@ snprintf(buffer, 256, "/dev/parport%d", amt_jtagaccel_port); device_handle = open(buffer, O_RDWR); - + if (device_handle < 0) { LOG_ERROR("cannot open device. check it exists and that user read and write rights are set"); @@ -468,7 +468,7 @@ LOG_ERROR(" cannot set compatible mode to device"); return ERROR_JTAG_INIT_FAILED; } - + control_port = 0x00; i = ioctl(device_handle, PPWCONTROL, &control_port); @@ -484,57 +484,57 @@ #if PARPORT_USE_GIVEIO == 1 if (amt_jtagaccel_get_giveio_access() != 0) { -#else /* PARPORT_USE_GIVEIO */ +#else /* PARPORT_USE_GIVEIO */ if (ioperm(amt_jtagaccel_port, 5, 1) != 0) { #endif /* PARPORT_USE_GIVEIO */ LOG_ERROR("missing privileges for direct i/o"); return ERROR_JTAG_INIT_FAILED; } - + /* prepare epp port */ /* clear timeout */ status_port = inb(amt_jtagaccel_port + 1); outb(status_port | 0x1, amt_jtagaccel_port + 1); - + /* reset epp port */ outb(0x00, amt_jtagaccel_port + 2); outb(0x04, amt_jtagaccel_port + 2); #endif - + if (rtck_enabled) - { + { /* set RTCK enable bit */ aw_control_fsm |= 0x02; } - + /* enable JTAG port */ aw_control_fsm |= 0x04; AMT_AW(aw_control_fsm); - + amt_jtagaccel_speed(jtag_speed); - + if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) aw_control_rst &= ~0x8; else aw_control_rst |= 0x8; - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) aw_control_rst &= ~0x2; else aw_control_rst |= 0x2; - + amt_jtagaccel_reset(0, 0); - + /* read status register */ AMT_AR(ar_status); LOG_DEBUG("AR_STATUS: 0x%2.2x", ar_status); - + return ERROR_OK; } int amt_jtagaccel_quit(void) { - + return ERROR_OK; } @@ -568,6 +568,6 @@ rtck_enabled = 0; } } - + return ERROR_OK; } Modified: trunk/src/jtag/bitbang.c =================================================================== --- trunk/src/jtag/bitbang.c 2008-12-12 22:14:21 UTC (rev 1231) +++ trunk/src/jtag/bitbang.c 2008-12-13 06:25:50 UTC (rev 1232) @@ -41,24 +41,24 @@ /* DANGER!!!! clock absolutely *MUST* be 0 in idle or reset won't work! - * + * * Set this to 1 and str912 reset halt will fail. - * + * * If someone can submit a patch with an explanation it will be greatly * appreciated, but as far as I can tell () DCLK is generated upon - * clk=0 in TAP_RTI. Good luck deducing that from the ARM documentation! - * The ARM documentation uses the term "DCLK is asserted while in the TAP_RTI + * clk=0 in TAP_IDLE. Good luck deducing that from the ARM documentation! + * The ARM documentation uses the term "DCLK is asserted while in the TAP_IDLE * state". With hardware there is no such thing as *while* in a state. There * are only edges. So clk => 0 is in fact a very subtle state transition that - * happens *while* in the TAP_RTI state. "#&"#&"#&"#& - * + * happens *while* in the TAP_IDLE state. "#&"#&"#&"#& + * * For "reset halt" the last thing that happens before srst is asserted * is that the breakpoint is set up. If DCLK is not wiggled one last * time before the reset, then the breakpoint is not set up and * "reset halt" will fail to halt. - * + * */ -#define CLOCK_IDLE() 0 +#define CLOCK_IDLE() 0 int bitbang_execute_queue(void); @@ -76,10 +76,10 @@ } void bitbang_state_move(void) { - + int i=0, tms=0; u8 tms_scan = TAP_MOVE(cur_state, end_state); - + for (i = 0; i < 7; i++) { tms = (tms_scan >> i) & 1; @@ -87,7 +87,7 @@ bitbang_interface->write(1, tms, 0); } bitbang_interface->write(CLOCK_IDLE(), tms, 0); - + cur_state = end_state; } @@ -113,7 +113,7 @@ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); exit(-1); } - + bitbang_interface->write(0, tms, 0); bitbang_interface->write(1, tms, 0); @@ -121,7 +121,7 @@ state_count++; num_states--; } - + bitbang_interface->write(CLOCK_IDLE(), tms, 0); end_state = cur_state; @@ -130,16 +130,16 @@ void bitbang_runtest(int num_cycles) { int i; - + enum tap_state saved_end_state = end_state; - + /* only do a state_move when we're not already in RTI */ - if (cur_state != TAP_RTI) + if (cur_state != TAP_IDLE) { - bitbang_end_state(TAP_RTI); + bitbang_end_state(TAP_IDLE); bitbang_state_move(); } - + /* execute num_cycles */ for (i = 0; i < num_cycles; i++) { @@ -147,7 +147,7 @@ bitbang_interface->write(1, 0, 0); } bitbang_interface->write(CLOCK_IDLE(), 0, 0); - + /* finish in end_state */ bitbang_end_state(saved_end_state); if (cur_state != end_state) @@ -158,13 +158,13 @@ { enum tap_state saved_end_state = end_state; int bit_cnt; - - if (!((!ir_scan && (cur_state == TAP_SD)) || (ir_scan && (cur_state == TAP_SI)))) + + if (!((!ir_scan && (cur_state == TAP_DRSHIFT)) || (ir_scan && (cur_state == TAP_IRSHIFT)))) { if (ir_scan) - bitbang_end_state(TAP_SI); + bitbang_end_state(TAP_IRSHIFT); else - bitbang_end_state(TAP_SD); + bitbang_end_state(TAP_DRSHIFT); bitbang_state_move(); bitbang_end_state(saved_end_state); @@ -181,7 +181,7 @@ /* if we're just reading the scan, but don't care about the output * default to outputting 'low', this also makes valgrind traces more readable, * as it removes the dependency on an uninitialised value - */ + */ tdi=0; if ((type != SCAN_IN) && (buffer[bytec] & bcval)) tdi=1; @@ -192,7 +192,7 @@ val=bitbang_interface->read(); bitbang_interface->write(1, tms, tdi); - + if (type != SCAN_OUT) { if (val) @@ -201,21 +201,21 @@ buffer[bytec] &= ~bcval; } } - - /* TAP_SD & TAP_SI are illegal end states, so we always transition to the pause + + /* TAP_DRSHIFT & TAP_IRSHIFT are illegal end states, so we always transition to the pause * state which is a legal stable state from which statemove will work. - * - * Exit1 -> Pause + * + * Exit1 -> Pause */ bitbang_interface->write(0, 0, 0); bitbang_interface->write(1, 0, 0); bitbang_interface->write(CLOCK_IDLE(), 0, 0); - + if (ir_scan) - cur_state = TAP_PI; + cur_state = TAP_IRPAUSE; else - cur_state = TAP_PD; - + cur_state = TAP_DRPAUSE; + if (cur_state != end_state) bitbang_state_move(); } @@ -227,18 +227,18 @@ enum scan_type type; u8 *buffer; int retval; - + if (!bitbang_interface) { LOG_ERROR("BUG: Bitbang interface called, but not yet initialized"); exit(-1); } - + /* return ERROR_OK, unless a jtag_read_buffer returns a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; - + if(bitbang_interface->blink) bitbang_interface->blink(1); @@ -259,7 +259,7 @@ #endif if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } bitbang_interface->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); break; @@ -313,7 +313,7 @@ } if(bitbang_interface->blink) bitbang_interface->blink(0); - + return retval; } Modified: trunk/src/jtag/bitq.c =================================================================== --- trunk/src/jtag/bitq.c 2008-12-12 22:14:21 UTC (rev 1231) +++ trunk/src/jtag/bitq.c 2008-12-13 06:25:50 UTC (rev 1232) @@ -195,7 +195,7 @@ int i; /* only do a state_move when we're not already in RTI */ - if (cur_state != TAP_RTI) bitq_state_move(TAP_RTI); + if (cur_state != TAP_IDLE) bitq_state_move(TAP_IDLE); /* execute num_cycles */ for (i = 0; i < num_cycles; i++) @@ -240,8 +240,8 @@ if (pause) { bitq_io(0,0,0); - if (cur_state==TAP_SI) cur_state=TAP_PI; - else if (cur_state==TAP_SD) cur_state=TAP_PD; + if (cur_state==TAP_IRSHIFT) cur_state=TAP_IRPAUSE; + else if (cur_state==TAP_DRSHIFT) cur_state=TAP_DRPAUSE; } } @@ -250,8 +250,8 @@ { int i; - if (cmd->ir_scan) bitq_state_move(TAP_SI); - else bitq_state_move(TAP_SD); + if (cmd->ir_scan) bitq_state_move(TAP_IRSHIFT); + else bitq_state_move(TAP_DRSHIFT); for (i=0; i < cmd->num_fields-1; i++) bitq_scan_field(&cmd->fields[i], 0); @@ -285,7 +285,7 @@ #endif if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } bitq_interface->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); if (bitq_interface->in_rdy()) bitq_in_proc(); Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2008-12-12 22:14:21 UTC (rev 1231) +++ trunk/src/jtag/ft2232.c 2008-12-13 06:25:50 UTC (rev 1232) @@ -157,13 +157,13 @@ #define BUFFER_ADD ft2232_buffer[ft2232_buffer_size++] #define BUFFER_READ ft2232_buffer[ft2232_read_pointer++] -jtag_interface_t ft2232_interface = +jtag_interface_t ft2232_interface = { .name = "ft2232", .execute_queue = ft2232_execute_queue, .speed = ft2232_speed, .speed_div = ft2232_speed_div, - .khz = ft2232_khz, + .khz = ft2232_khz, .register_commands = ft2232_register_commands, .init = ft2232_init, .quit = ft2232_quit, @@ -183,7 +183,7 @@ else { *bytes_written = dw_bytes_written; - return ERROR_OK; + return ERROR_OK; } #elif BUILD_FT2232_LIBFTDI == 1 int retval; @@ -196,7 +196,7 @@ else { *bytes_written = retval; - return ERROR_OK; + return ERROR_OK; } #endif } @@ -211,20 +211,20 @@ while ((*bytes_read < size) && timeout--) { - if ((status = FT_Read(ftdih, buf + *bytes_read, size - - *bytes_read, &dw_bytes_read)) != FT_OK) + if ((status = FT_Read(ftdih, buf + *bytes_read, size - + *bytes_read, &dw_bytes_read)) != FT_OK) { - *bytes_read = 0; + *bytes_read = 0; LOG_ERROR("FT_Read returned: %lu", status); return ERROR_JTAG_DEVICE_ERROR; } - *bytes_read += dw_bytes_read; + *bytes_read += dw_bytes_read; } #elif BUILD_FT2232_LIBFTDI == 1 int retval; int timeout = 100; *bytes_read = 0; - + while ((*bytes_read < size) && timeout--) { if ((retval = ftdi_read_data(&ftdic, buf + *bytes_read, size - *bytes_read)) < 0) @@ -242,7 +242,7 @@ LOG_ERROR("couldn't read the requested number of bytes from FT2232 device (%i < %i)", *bytes_read, size); return ERROR_JTAG_DEVICE_ERROR; } - + return ERROR_OK; } @@ -255,7 +255,7 @@ buf[0] = 0x86; /* command "set divisor" */ buf[1] = speed & 0xff; /* valueL (0=6MHz, 1=3MHz, 2=2.0MHz, ...*/ buf[2] = (speed >> 8) & 0xff; /* valueH */ - + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); if (((retval = ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { @@ -268,12 +268,12 @@ int ft2232_speed_div(int speed, int *khz) { - /* Take a look in the FT2232 manual, + /* Take a look in the FT2232 manual, * AN2232C-01 Command Processor for * MPSSE and MCU Host Bus. Chapter 3.8 */ - + *khz = 6000 / (1+speed); - + return ERROR_OK; } @@ -284,35 +284,35 @@ LOG_ERROR("RCLK not supported"); return ERROR_FAIL; } - /* Take a look in the FT2232 manual, + /* Take a look in the FT2232 manual, * AN2232C-01 Command Processor for * MPSSE and MCU Host Bus. Chapter 3.8 - * + * * We will calc here with a multiplier * of 10 for better rounding later. */ - + /* Calc speed, (6000 / khz) - 1 */ /* Use 65000 for better rounding */ *jtag_speed = (60000 / khz) - 10; - + /* Add 0.9 for rounding */ *jtag_speed += 9; - + /* Calc real speed */ *jtag_speed = *jtag_speed / 10; - + /* Check if speed is greater than 0 */ if (*jtag_speed < 0) { *jtag_speed = 0; } - + /* Check max value */ if (*jtag_speed > 0xFFFF) { *jtag_speed = 0xFFFF; } - + return ERROR_OK; } @@ -371,7 +371,7 @@ int i; char line[256]; char *line_p = line; - + for (i = 0; i < ft2232_buffer_size; i++) { line_p += snprintf(line_p, 256 - (line_p - line), "%2.2x ", ft2232_buffer[i]); @@ -381,7 +381,7 @@ line_p = line; } } - + if (line_p != line) LOG_DEBUG("%s", line); } @@ -395,7 +395,7 @@ int retval; u32 bytes_written; u32 bytes_read; - + #ifdef _DEBUG_USB_IO_ struct timeval start, inter, inter2, end; struct timeval d_inter, d_inter2, d_end; @@ -407,7 +407,7 @@ #endif #ifdef _DEBUG_USB_IO_ - gettimeofday(&start, NULL); + gettimeofday(&start, NULL); #endif if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) @@ -415,28 +415,28 @@ LOG_ERROR("couldn't write MPSSE commands to FT2232"); return retval; } - + #ifdef _DEBUG_USB_IO_ - gettimeofday(&inter, NULL); + gettimeofday(&inter, NULL); #endif - + if (ft2232_expect_read) { int timeout = 100; ft2232_buffer_size = 0; - + #ifdef _DEBUG_USB_IO_ - gettimeofday(&inter2, NULL); + gettimeofday(&inter2, NULL); #endif - + if ((retval = ft2232_read(ft2232_buffer, ft2232_expect_read, &bytes_read)) != ERROR_OK) { LOG_ERROR("couldn't read from FT2232"); return retval; } - + #ifdef _DEBUG_USB_IO_ - gettimeofday(&end, NULL); + gettimeofday(&end, NULL); timeval_subtract(&d_inter, &inter, &start); timeval_subtract(&d_inter2, &inter2, &start); @@ -444,14 +444,14 @@ LOG_INFO("inter: %i.%i, inter2: %i.%i end: %i.%i", d_inter.tv_sec, d_inter.tv_usec, d_inter2.tv_sec, d_inter2.tv_usec, d_end.tv_sec, d_end.tv_usec); #endif - - + + ft2232_buffer_size = bytes_read; - + if (ft2232_expect_read != ft2232_buffer_size) { LOG_ERROR("ft2232_expect_read (%i) != ft2232_buffer_size (%i) (%i retries)", ft2232_expect_read, ft2232_buffer_size, 100 - timeout); - ft2232_debug_dump_buffer(); + ft2232_debug_dump_buffer(); exit(-1); } @@ -464,12 +464,12 @@ ft2232_expect_read = 0; ft2232_read_pointer = 0; - + /* return ERROR_OK, unless a jtag_read_buffer returns a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; - + cmd = first; while (cmd != last) { @@ -492,7 +492,7 @@ } cmd = cmd->next; } - + ft2232_buffer_size = 0; return retval; @@ -508,7 +508,7 @@ while (num_states) { int bit_count = 0; - + int num_states_batch = num_states > 7 ? 7 : num_states; tms_byte = 0x0; @@ -516,7 +516,7 @@ BUFFER_ADD = 0x4b; /* number of states remaining */ BUFFER_ADD = num_states_batch - 1; - + while (num_states_batch--) { if (tap_transitions[cur_state].low == cmd->path[state_count]) @@ -533,10 +533,10 @@ state_count++; num_states--; } - + BUFFER_ADD = tms_byte; } - + end_state = cur_state; } @@ -547,7 +547,7 @@ int cur_byte = 0; int last_bit; - if (!((!ir_scan && (cur_state == TAP_SD)) || (ir_scan && (cur_state == TAP_SI)))) + if (!((!ir_scan && (cur_state == TAP_DRSHIFT)) || (ir_scan && (cur_state == TAP_IRSHIFT)))) { /* command "Clock Data to TMS/CS Pin (no Read)" */ BUFFER_ADD = 0x4b; @@ -556,17 +556,17 @@ /* TMS data bits */ if (ir_scan) { - BUFFER_ADD = TAP_MOVE(cur_state, TAP_SI); - cur_state = TAP_SI; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_IRSHIFT); + cur_state = TAP_IRSHIFT; } else { - BUFFER_ADD = TAP_MOVE(cur_state, TAP_SD); - cur_state = TAP_SD; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_DRSHIFT); + cur_state = TAP_DRSHIFT; } /* LOG_DEBUG("added TMS scan (no read)"); */ } - + /* add command for complete bytes */ while (num_bytes > 1) { @@ -608,7 +608,7 @@ bits_left -= 8 * (thisrun_bytes); } } - + /* the most signifcant bit is scanned during TAP movement */ if (type != SCAN_IN) last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1; @@ -641,8 +641,8 @@ BUFFER_ADD = buffer[cur_byte]; } - if ((ir_scan && (end_state == TAP_SI)) || - (!ir_scan && (end_state == TAP_SD))) + if ((ir_scan && (end_state == TAP_IRSHIFT)) || + (!ir_scan && (end_state == TAP_DRSHIFT))) { if (type == SCAN_IO) { @@ -698,24 +698,24 @@ u32 bytes_read; int retval; int thisrun_read = 0; - + if (cmd->ir_scan) { LOG_ERROR("BUG: large IR scans are not supported"); exit(-1); } - if (cur_state != TAP_SD) + if (cur_state != TAP_DRSHIFT) { /* command "Clock Data to TMS/CS Pin (no Read)" */ BUFFER_ADD = 0x4b; /* scan 7 bit */ BUFFER_ADD = 0x6; /* TMS data bits */ - BUFFER_ADD = TAP_MOVE(cur_state, TAP_SD); - cur_state = TAP_SD; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_DRSHIFT); + cur_state = TAP_DRSHIFT; } - + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); @@ -723,12 +723,12 @@ } LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written); ft2232_buffer_size = 0; - + /* add command for complete bytes */ while (num_bytes > 1) { int thisrun_bytes; - + if (type == SCAN_IO) { /* Clock Data Bytes In and Out LSB First */ @@ -774,7 +774,7 @@ } LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written); ft2232_buffer_size = 0; - + if (type != SCAN_OUT) { if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK) @@ -786,9 +786,9 @@ receive_pointer += bytes_read; } } - + thisrun_read = 0; - + /* the most signifcant bit is scanned during TAP movement */ if (type != SCAN_IN) last_bit = (buffer[cur_byte] >> (bits_left - 1)) & 0x1; @@ -819,12 +819,12 @@ BUFFER_ADD = bits_left - 2; if (type != SCAN_IN) BUFFER_ADD = buffer[cur_byte]; - + if (type != SCAN_OUT) thisrun_read += 2; } - if (end_state == TAP_SD) + if (end_state == TAP_DRSHIFT) { if (type == SCAN_IO) { @@ -866,10 +866,10 @@ BUFFER_ADD = TAP_MOVE(cur_state, end_state) | (last_bit << 7); cur_state = end_state; } - + if (type != SCAN_OUT) thisrun_read += 1; - + if ((retval = ft2232_write(ft2232_buffer, ft2232_buffer_size, &bytes_written)) != ERROR_OK) { LOG_ERROR("couldn't write MPSSE commands to FT2232"); @@ -877,7 +877,7 @@ } LOG_DEBUG("ft2232_buffer_size: %i, bytes_written: %i", ft2232_buffer_size, bytes_written); ft2232_buffer_size = 0; - + if (type != SCAN_OUT) { if ((retval = ft2232_read(receive_pointer, thisrun_read, &bytes_read)) != ERROR_OK) @@ -888,7 +888,7 @@ LOG_DEBUG("thisrun_read: %i, bytes_read: %i", thisrun_read, bytes_read); receive_pointer += bytes_read; } - + return ERROR_OK; } @@ -896,10 +896,10 @@ { int predicted_size = 3; int num_bytes = (scan_size - 1) / 8; - - if (cur_state != TAP_SD) + + if (cur_state != TAP_DRSHIFT) predicted_size += 3; - + if (type == SCAN_IN) /* only from device to host */ { /* complete bytes */ @@ -921,7 +921,7 @@ int ft2232_predict_scan_in(int scan_size, enum scan_type type) { int predicted_size = 0; - + if (type != SCAN_OUT) { /* complete bytes */ @@ -931,7 +931,7 @@ /* last bit (from TMS scan) */ predicted_size += 1; } - + /* LOG_DEBUG("scan_size: %i, predicted_size: %i", scan_size, predicted_size); */ return predicted_size; @@ -968,7 +968,7 @@ else low_direction &= ~nSRSTnOE; /* switch to input pin (high-Z) */ } - + /* command "set data bits low byte" */ BUFFER_ADD = 0x80; BUFFER_ADD = low_output; @@ -1007,7 +1007,7 @@ else high_output |= nSRSTnOE; } - + /* command "set data bits high byte" */ BUFFER_ADD = 0x82; BUFFER_ADD = high_output; @@ -1052,7 +1052,7 @@ { if (trst == 1) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; high_output &= ~nTRST; } else if (trst == 0) @@ -1106,7 +1106,7 @@ void turtle_reset(int trst, int srst) { trst = trst; - + if (srst == 1) { low_output |= nSRST; @@ -1115,7 +1115,7 @@ { low_output &= ~nSRST; } - + /* command "set data bits low byte" */ BUFFER_ADD = 0x80; BUFFER_ADD = low_output; @@ -1142,7 +1142,7 @@ { high_output |= nSRST; } - + /* command "set data bits high byte" */ BUFFER_ADD = 0x82; BUFFER_ADD = high_output; @@ -1169,12 +1169,12 @@ { low_output |= nSRST; } - + /* command "set data bits low byte" */ BUFFER_ADD = 0x80; BUFFER_ADD = low_output; BUFFER_ADD = low_direction; - + /* command "set data bits high byte" */ BUFFER_ADD = 0x82; BUFFER_ADD = high_output; @@ -1193,15 +1193,15 @@ int predicted_size = 0; int require_send = 0; int retval; - + /* return ERROR_OK, unless ft2232_send_and_recv reports a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; ft2232_buffer_size = 0; ft2232_expect_read = 0; - + /* blink, if the current layout has that feature */ if (layout->blink) layout->blink(); @@ -1227,24 +1227,24 @@ if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } layout->reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); require_send = 1; - -#ifdef _DEBUG_JTAG_IO_ + +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("trst: %i, srst: %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst); #endif break; case JTAG_RUNTEST: /* only send the maximum buffer size that FT2232C can handle */ predicted_size = 0; - if (cur_state != TAP_RTI) + if (cur_state != TAP_IDLE) predicted_size += 3; predicted_size += 3 * CEIL(cmd->cmd.runtest->num_cycles, 7); - if ((cmd->cmd.runtest->end_state != -1) && (cmd->cmd.runtest->end_state != TAP_RTI)) + if ((cmd->cmd.runtest->end_state != -1) && (cmd->cmd.runtest->end_state != TAP_IDLE)) predicted_size += 3; - if ((cmd->cmd.runtest->end_state == -1) && (end_state != TAP_RTI)) + if ((cmd->cmd.runtest->end_state == -1) && (end_state != TAP_IDLE)) predicted_size += 3; if (ft2232_buffer_size + predicted_size + 1 > FT2232_BUFFER_SIZE) { @@ -1253,15 +1253,15 @@ require_send = 0; first_unsent = cmd; } - if (cur_state != TAP_RTI) + if (cur_state != TAP_IDLE) { /* command "Clock Data to TMS/CS Pin (no Read)" */ BUFFER_ADD = 0x4b; /* scan 7 bit */ BUFFER_ADD = 0x6; /* TMS data bits */ - BUFFER_ADD = TAP_MOVE(cur_state, TAP_RTI); - cur_state = TAP_RTI; + BUFFER_ADD = TAP_MOVE(cur_state, TAP_IDLE); + cur_state = TAP_IDLE; require_send = 1; } i = cmd->cmd.runtest->num_cycles; @@ -1273,7 +1273,7 @@ BUFFER_ADD = (i > 7) ? 6 : (i - 1); /* TMS data bits */ BUFFER_ADD = 0x0; - cur_state = TAP_RTI; + cur_state = TAP_IDLE; i -= (i > 7) ? 7 : i; /* LOG_DEBUG("added TMS scan (no read)"); */ } @@ -1291,7 +1291,7 @@ /* LOG_DEBUG("added TMS scan (no read)"); */ } require_send = 1; -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("runtest: %i, end in %i", cmd->cmd.runtest->num_cycles, end_state); #endif break; @@ -1316,7 +1316,7 @@ /* LOG_DEBUG("added TMS scan (no read)"); */ cur_state = end_state; require_send = 1; -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("statemove: %i", end_state); #endif break; @@ -1332,7 +1332,7 @@ } ft2232_add_pathmove(cmd->cmd.pathmove); require_send = 1; -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); #endif break; @@ -1347,7 +1347,7 @@ if (first_unsent != cmd) if (ft2232_send_and_recv(first_unsent, cmd) != ERROR_OK) retval = ERROR_JTAG_QUEUE_FAILED; - + /* current command */ if (cmd->cmd.scan->end_state != -1) ft2232_end_state(cmd->cmd.scan->end_state); @@ -1374,7 +1374,7 @@ require_send = 1; if (buffer) free(buffer); -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("%s scan, %i bit, end in %i", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size, end_state); #endif break; @@ -1383,7 +1383,7 @@ retval = ERROR_JTAG_QUEUE_FAILED; first_unsent = cmd->next; jtag_sleep(cmd->cmd.sleep->us); -#ifdef _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("sleep %i usec", cmd->cmd.sleep->us); #endif break; @@ -1424,7 +1424,7 @@ LOG_WARNING("can't open by device description and serial number, giving precedence to serial"); ft2232_device_desc = NULL; } - + if (ft2232_device_desc) { openex_string = ft2232_device_desc; @@ -1439,14 +1439,14 @@ { LOG_ERROR("neither device description nor serial number specified"); LOG_ERROR("please add \"ft2232_device_desc <string>\" or \"ft2232_serial <string>\" to your .cfg file"); - - return ERROR_JTAG_INIT_FAILED; + + return ERROR_JTAG_INIT_FAILED; } if ((status = FT_OpenEx(openex_string, openex_flags, &ftdih)) != FT_OK) { DWORD num_devices; - + if (more) { LOG_WARNING("unable to open ftdi device (trying more): %lu", status); *try_more = 1; @@ -1471,7 +1471,7 @@ for (i = 0; i < num_devices; i++) LOG_ERROR("%i: %s", i, desc_array[i]); } - + for (i = 0; i < num_devices; i++) free(desc_array[i]); free(desc_array); @@ -1488,7 +1488,7 @@ LOG_ERROR("unable to set latency timer: %lu", status); return ERROR_JTAG_INIT_FAILED; } - + if ((status = FT_GetLatencyTimer(ftdih, &latency_timer)) != FT_OK) { LOG_ERROR("unable to get latency timer: %lu", status); @@ -1498,7 +1498,7 @@ { LOG_DEBUG("current latency timer: %i", latency_timer); } - + if ((status = FT_SetTimeouts(ftdih, 5000, 5000)) != FT_OK) { LOG_ERROR("unable to set timeouts: %lu", status); @@ -1568,7 +1568,7 @@ LOG_ERROR("unable to set latency timer"); return ERROR_JTAG_INIT_FAILED; } - + if (ftdi_get_latency_timer(&ftdic, &latency_timer) < 0) { LOG_ERROR("unable to get latency timer"); @@ -1603,13 +1603,13 @@ u32 bytes_written; ft2232_layout_t *cur_layout = ft2232_layouts; int i; - + if ((ft2232_layout == NULL) || (ft2232_layout[0] == 0)) { ft2232_layout = "usbjtag"; LOG_WARNING("No ft2232 layout specified, using default 'usbjtag'"); } - + while (cur_layout->name) { if (strcmp(cur_layout->name, ft2232_layout) == 0) @@ -1625,7 +1625,7 @@ LOG_ERROR("No matching layout found for %s", ft2232_layout); return ERROR_JTAG_INIT_FAILED; } - + for (i = 0; 1; i++) { /* * "more indicates that there are more IDs to try, so we should @@ -1645,7 +1645,7 @@ #elif BUILD_FT2232_LIBFTDI == 1 retval = ft2232_init_libftdi(ft2232_vid[i], ft2232_pid[i], more, &try_more); -#endif +#endif if (retval >= 0) break; if (!more || !try_more) @@ -1671,7 +1671,7 @@ return ft2232_purge_ftd2xx(); #elif BUILD_FT2232_LIBFTDI == 1 return ft2232_purge_libftdi(); -#endif +#endif return ERROR_OK; } @@ -1680,10 +1680,10 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x0b; - + if (strcmp(ft2232_layout, "usbjtag") == 0) { nTRST = 0x10; @@ -1710,9 +1710,9 @@ else { LOG_ERROR("BUG: usbjtag_init called for unknown layout '%s'", ft2232_layout); - return ERROR_JTAG_INIT_FAILED; + return ERROR_JTAG_INIT_FAILED; } - + if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) { low_direction &= ~nTRSTnOE; /* nTRST input */ @@ -1723,7 +1723,7 @@ low_direction |= nTRSTnOE; /* nTRST output */ low_output |= nTRST; /* nTRST = 1 */ } - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) { low_direction |= nSRSTnOE; /* nSRST output */ @@ -1734,16 +1734,16 @@ low_direction &= ~nSRSTnOE; /* nSRST input */ low_output &= ~nSRST; /* nSRST = 0 */ } - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, xRST high) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'USBJTAG' layout"); return ERROR_JTAG_INIT_FAILED; } @@ -1754,19 +1754,19 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x2b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } @@ -1775,14 +1775,14 @@ nTRST = 0x08; nTRSTnOE = 0x0; /* No output enable for TRST*/ nSRST = 0x04; - nSRSTnOE = 0x0; /* No output enable for SRST*/ + nSRSTnOE = 0x0; /* No output enable for SRST*/ } else { LOG_ERROR("BUG: axm0432_jtag_init called for non axm0432 layout"); exit(-1); } - + high_output = 0x0; high_direction = 0x0c; @@ -1803,19 +1803,19 @@ { high_output |= nSRST; } - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; /* value */ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'Dicarlo' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'Dicarlo' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -1823,22 +1823,22 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x1b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + if (strcmp(layout->name, "jtagkey") == 0) { nTRST = 0x01; @@ -1859,7 +1859,7 @@ LOG_ERROR("BUG: jtagkey_init called for non jtagkey layout"); exit(-1); } - + high_output = 0x0; high_direction = 0x0f; @@ -1873,7 +1873,7 @@ high_output &= ~nTRSTnOE; high_output |= nTRST; } - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) { high_output &= ~nSRSTnOE; @@ -1884,19 +1884,19 @@ high_output |= nSRSTnOE; high_output &= ~nSRST; } - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; /* value */ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -1904,22 +1904,22 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x1b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + nTRST = 0x01; nTRSTnOE = 0x4; nSRST = 0x02; @@ -1938,7 +1938,7 @@ high_output &= ~nTRSTnOE; high_output |= nTRST; } - + if (jtag_reset_config & RESET_SRST_PUSH_PULL) { LOG_ERROR("can't set nSRST to push-pull on the Olimex ARM-USB-OCD"); @@ -1947,22 +1947,22 @@ { high_output &= ~nSRST; } - + /* turn red LED on */ high_output |= 0x08; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; /* value */ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -1970,22 +1970,22 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x18; low_direction = 0xfb; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE[12]=out, n[ST]srst=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); return ERROR_JTAG_INIT_FAILED; } - + nTRST = 0x10; nTRSTnOE = 0x0; /* not output enable for nTRST */ nSRST = 0x20; @@ -1996,19 +1996,19 @@ /* turn red LED1 on, LED2 off */ high_output |= 0x08; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; /* value */ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'flyswatter' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -2016,39 +2016,39 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x5b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); return ERROR_JTAG_INIT_FAILED; } - + nSRST = 0x40; - + high_output = 0x00; high_direction = 0x0C; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'turtelizer2' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -2056,42 +2056,42 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x08; low_direction = 0x0b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout"); return ERROR_JTAG_INIT_FAILED; } - + nTRST = 0x01; nTRSTnOE = 0x00; /* no output enable for nTRST */ nSRST = 0x02; nSRSTnOE = 0x00; /* no output enable for nSRST */ - + high_output = 0x03; high_direction = 0x03; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'comstick' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -2099,42 +2099,42 @@ { u8 buf[3]; u32 bytes_written; - + low_output = 0x88; low_direction = 0x8b; - + /* initialize low byte for jtag */ buf[0] = 0x80; /* command "set data bits low byte" */ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout"); return ERROR_JTAG_INIT_FAILED; } - + nTRST = 0x01; nTRSTnOE = 0x00; /* no output enable for nTRST */ nSRST = 0x80; nSRSTnOE = 0x00; /* no output enable for nSRST */ - + high_output = 0x01; high_direction = 0x03; - + /* initialize high port */ buf[0] = 0x82; /* command "set data bits high byte" */ buf[1] = high_output; buf[2] = high_direction; LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); - + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) { - LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout"); + LOG_ERROR("couldn't initialize FT2232 with 'stm32stick' layout"); return ERROR_JTAG_INIT_FAILED; } - + return ERROR_OK; } @@ -2153,7 +2153,7 @@ /* set port pin low */ high_output |= 0x08; } - + BUFFER_ADD = 0x82; BUFFER_ADD = high_output; BUFFER_ADD = high_direction; @@ -2161,7 +2161,7 @@ void turtle_jtag_blink(void) { - /* + /* * Turtelizer2 has two LEDs connected to ACBUS2 and ACBUS3 */ if (high_output & 0x08) @@ -2172,7 +2172,7 @@ { high_output = 0x08; } - + BUFFER_ADD = 0x82; BUFFER_ADD = high_output; BUFFER_ADD = high_direction; @@ -2186,9 +2186,9 @@ status = FT_Close(ftdih); #elif BUILD_FT2232_LIBFTDI == 1 ftdi_disable_bitbang(&ftdic); - + ftdi_usb_close(&ftdic); - + ftdi_deinit(&ftdic); #endif @@ -2208,7 +2208,7 @@ { LOG_ERROR("expected exactly one argument to ft2232_device_desc <description>"); } - + return ERROR_OK; } @@ -2222,7 +2222,7 @@ { LOG_ERROR("expected exactly one argument to ft2232_serial <serial-number>"); } - + return ERROR_OK; } @@ -2276,6 +2276,6 @@ { LOG_ERROR("expected exactly one argument to ft2232_latency <ms>"); } - + return ERROR_OK; } Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2008-12-12 22:14:21 UTC (rev 1231) +++ trunk/src/jtag/gw16012.c 2008-12-13 06:25:50 UTC (rev 1232) @@ -97,13 +97,13 @@ int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -jtag_interface_t gw16012_interface = +jtag_interface_t gw16012_interface = { .name = "gw16012", - + .execute_queue = gw16012_execute_queue, - .speed = gw16012_speed, + .speed = gw16012_speed, .register_commands = gw16012_register_commands, .init = gw16012_init, .quit = gw16012_quit, @@ -113,7 +113,7 @@ { register_command(cmd_ctx, NULL, "parport_port", gw16012_handle_parport_port_command, COMMAND_CONFIG, NULL); - + return ERROR_OK; } @@ -125,7 +125,7 @@ #ifdef _DEBUG_GW16012_IO_ LOG_DEBUG("%2.2x", value); #endif - + #if PARPORT_USE_PPDEV == 1 ioctl(device_handle, PPWDATA, &value); #else @@ -134,7 +134,7 @@ #else outb(value, gw16012_port); #endif - #endif + #endif } void gw16012_control(u8 value) @@ -209,15 +209,15 @@ { int i=0, tms=0; u8 tms_scan = TAP_MOVE(cur_state, end_state); - + gw16012_control(0x0); /* single-bit mode */ - + for (i = 0; i < 7; i++) { tms = (tms_scan >> i) & 1; gw16012_data(tms << 1); /* output next TMS bit */ } - + cur_state = end_state; } @@ -243,12 +243,12 @@ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]); exit(-1); } - + cur_state = cmd->path[state_count]; state_count++; num_states--; } - + end_state = cur_state; } @@ -256,20 +256,20 @@ { enum tap_state saved_end_state = end_state; int i; - + /* only do a state_move when we're not already in RTI */ - if (cur_state != TAP_RTI) + if (cur_state != TAP_IDLE) { - gw16012_end_state(TAP_RTI); + gw16012_end_state(TAP_IDLE); gw16012_state_move(); } - + for (i = 0; i < num_cycles; i++) { gw16012_control(0x0); /* single-bit mode */ gw16012_data(0x0); /* TMS cycle with TMS low */ } - + gw16012_end_state(saved_end_state); if (cur_state != end_state) gw16012_state_move(); @@ -283,12 +283,12 @@ u8 scan_out, scan_in; /* only if we're not already in the correct Shift state */ - if (!((!ir_scan && (cur_state == TAP_SD)) || (ir_scan && (cur_state == TAP_SI)))) + if (!((!ir_scan && (cur_state == TAP_DRSHIFT)) || (ir_scan && (cur_state == TAP_IRSHIFT)))) { if (ir_scan) - gw16012_end_state(TAP_SI); + gw16012_end_state(TAP_IRSHIFT); else - gw16012_end_state(TAP_SD); + gw16012_end_state(TAP_DRSHIFT); gw16012_state_move(); gw16012_end_state(saved_end_state); @@ -302,20 +302,20 @@ bit_count += 7; bits_left -= 7; } - + gw16012_control(0x0); /* single-bit mode */ while (bits_left-- > 0) { u8 tms = 0; - + scan_out = buf_get_u32(buffer, bit_count, 1); - + if (bits_left == 0) /* last bit */ { - if ((ir_scan && (end_state == TAP_SI)) - || (!ir_scan && (end_state == TAP_SD))) + if ((ir_scan && (end_state == TAP_IRSHIFT)) + || (!ir_scan && (end_state == TAP_DRSHIFT))) { - tms = 0; + tms = 0; } else { @@ -329,20 +329,20 @@ { gw16012_input(&scan_in); buf_set_u32(buffer, bit_count, 1, ((scan_in & 0x08) >> 3)); - } + } bit_count++; } - if (!((ir_scan && (end_state == TAP_SI)) || - (!ir_scan && (end_state == TAP_SD)))) + if (!((ir_scan && (end_state == TAP_IRSHIFT)) || + (!ir_scan && (end_state == TAP_DRSHIFT)))) { gw16012_data(0x0); if (ir_scan) - cur_state = TAP_PI; + cur_state = TAP_IRPAUSE; else - cur_state = TAP_PD; - + cur_state = TAP_DRPAUSE; + if (cur_state != end_state) gw16012_state_move(); } @@ -355,12 +355,12 @@ enum scan_type type; u8 *buffer; int retval; - + /* return ERROR_OK, unless a jtag_read_buffer returns a failed check * that wasn't handled by a caller-provided error handler - */ + */ retval = ERROR_OK; - + while (cmd) { switch (cmd->type) @@ -378,7 +378,7 @@ #endif if (cmd->cmd.reset->trst == 1) { - cur_state = TAP_TLR; + cur_state = TAP_RESET; } gw16012_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); break; @@ -410,7 +410,7 @@ scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); type = jtag_scan_type(cmd->cmd.scan); #ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("%s scan (%i) %i bit end in %i", (cmd->cmd.scan->ir_scan) ? "ir" : "dr", + LOG_DEBUG("%s scan (%i) %i bit end in %i", (cmd->cmd.scan->ir_scan) ? "ir" : "dr", type, scan_size, cmd->cmd.scan->end_state); #endif gw16012_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size); @@ -431,7 +431,7 @@ } cmd = cmd->next; } - + return retval; } @@ -443,16 +443,16 @@ version.dwOSVersionInfoSize = sizeof version; if (!GetVersionEx( &version )) { - errno = EINVAL; - return -1; + errno = EINVAL; + return -1; } if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; + return 0; h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; + errno = ENODEV; + return -1; } CloseHandle( h ); @@ -468,7 +468,7 @@ int i = 0; #endif u8 status_port; - + #if PARPORT_USE_PPDEV == 1 if (device_handle>0) { @@ -486,7 +486,7 @@ snprintf(buffer, 256, "/dev/parport%d", gw16012_port); device_handle = open(buffer, O_WRONLY); -#endif +#endif if (device_handle<0) { LOG_ERROR("cannot open device. check it exists and that user read and write rights are set"); @@ -525,7 +525,7 @@ gw16012_port = 0x378; LOG_WARNING("No gw16012 port specified, using default '0x378' (LPT1)"); } - + LOG_DEBUG("requesting privileges for parallel port 0x%lx...", (long unsigned)(gw16012_port) ); #if PARPORT_USE_GIVEIO == 1 if (gw16012_get_giveio_access() != 0) @@ -545,19 +545,19 @@ outb(0x0, gw16012_port + 2); #endif #endif /* PARPORT_USE_PPDEV */ - + gw16012_input(&status_port); gw16012_msb = (status_port & 0x80) ^ 0x80; - + gw16012_speed(jtag_speed); gw16012_reset(0, 0); - + return ERROR_OK; } int gw16012_quit(void) { - + return ERROR_OK; } Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2008-12-12 22:14:21 UTC (rev 1231) +++ trunk/src/jtag/jlink.c 2008-12-13 06:25:50 UTC (rev 1232) @@ -146,92 +146,92 @@ int scan_size; enum scan_type type; u8 *buffer; - + while (cmd != NULL) { switch (cmd->type) { case JTAG_END_STATE: DEBUG_JTAG_IO("end_state: %i", cmd->cmd.end_state->end_state); - + if (cmd->cmd.end_state->end_state != -1) { jlink_end_state(cmd->cmd.end_state->end_state); } break; - + case JTAG_RUNTEST: DEBUG_JTAG_IO( "runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \ cmd->cmd.runtest->end_state); - + if (cmd->cmd.runtest->end_state != -1) { jlink_end_state(cmd->cmd.runtest->end_state); } jlink_runtest(cmd->cmd.runtest->num_cycles); break; - + case JTAG_STATEMOVE: DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state); - + if (cmd->cmd.statemove->end_state != -1) { jlink_end_state(cmd->cmd.statemove->end_state); } jlink_state_move(); break; - + case JTAG_PATHMOVE: DEBUG_JTAG_IO("pathmove: %i states, end in %i", \ cmd->cmd.pathmove->num_states, \ cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); - + jlink_path_move(cmd->cmd.pathmove->num_... [truncated message content] |
From: ntfreak at B. <nt...@ma...> - 2008-12-12 23:14:22
|
Author: ntfreak Date: 2008-12-12 23:14:21 +0100 (Fri, 12 Dec 2008) New Revision: 1231 Modified: trunk/src/target/cortex_m3.c trunk/src/target/cortex_m3.h Log: - check cortex_m3 FPB is enabled when setting hardware breakpoint - Thanks Igor Skochinsky Modified: trunk/src/target/cortex_m3.c =================================================================== --- trunk/src/target/cortex_m3.c 2008-12-12 18:33:19 UTC (rev 1230) +++ trunk/src/target/cortex_m3.c 2008-12-12 22:14:21 UTC (rev 1231) @@ -225,6 +225,7 @@ /* Enable FPB */ target_write_u32(target, FP_CTRL, 3); + cortex_m3->fpb_enabled = 1; /* Restore FPB registers */ for (i = 0; i < cortex_m3->fp_num_code + cortex_m3->fp_num_lit; i++) @@ -869,6 +870,11 @@ comparator_list[fp_num].fpcr_value = (breakpoint->address & 0x1FFFFFFC) | hilo | 1; target_write_u32(target, comparator_list[fp_num].fpcr_address, comparator_list[fp_num].fpcr_value); LOG_DEBUG("fpc_num %i fpcr_value 0x%x", fp_num, comparator_list[fp_num].fpcr_value); + if (!cortex_m3->fpb_enabled) + { + LOG_DEBUG("FPB wasn't enabled, do it now"); + target_write_u32(target, FP_CTRL, 3); + } } else if (breakpoint->type == BKPT_SOFT) { @@ -1401,10 +1407,11 @@ /* Setup FPB */ target_read_u32(target, FP_CTRL, &fpcr); cortex_m3->auto_bp_type = 1; - cortex_m3->fp_num_code = (fpcr >> 4) & 0xF; + cortex_m3->fp_num_code = (fpcr >> 8) & 0x70 | (fpcr >> 4) & 0xF; /* bits [14:12] and [7:4] */ cortex_m3->fp_num_lit = (fpcr >> 8) & 0xF; cortex_m3->fp_code_available = cortex_m3->fp_num_code; cortex_m3->fp_comparator_list = calloc(cortex_m3->fp_num_code + cortex_m3->fp_num_lit, sizeof(cortex_m3_fp_comparator_t)); + cortex_m3->fpb_enabled = fpcr & 1; for (i = 0; i < cortex_m3->fp_num_code + cortex_m3->fp_num_lit; i++) { cortex_m3->fp_comparator_list[i].type = (i < cortex_m3->fp_num_code) ? FPCR_CODE : FPCR_LITERAL; Modified: trunk/src/target/cortex_m3.h =================================================================== --- trunk/src/target/cortex_m3.h 2008-12-12 18:33:19 UTC (rev 1230) +++ trunk/src/target/cortex_m3.h 2008-12-12 22:14:21 UTC (rev 1231) @@ -145,14 +145,15 @@ u32 nvic_dfsr; /* Debug Fault Status Register - shows reason for debug halt */ u32 nvic_icsr; /* Interrupt Control State Register - shows active and pending IRQ */ - /* Flash Patch and Breakpoint */ + /* Flash Patch and Breakpoint (FPB) */ int fp_num_lit; int fp_num_code; int fp_code_available; + int fpb_enabled; int auto_bp_type; cortex_m3_fp_comparator_t *fp_comparator_list; - /* DWT */ + /* Data Watchpoint and Trace (DWT) */ int dwt_num_comp; int dwt_comp_available; cortex_m3_dwt_comparator_t *dwt_comparator_list; |
From: <oh...@ma...> - 2008-12-12 19:33:31
|
Author: oharboe Date: 2008-12-12 19:33:19 +0100 (Fri, 12 Dec 2008) New Revision: 1230 Added: zy1000/tags/ Log: layout fix |
From: <kc...@ma...> - 2008-12-12 01:21:11
|
Author: kc8apf Date: 2008-12-12 01:21:07 +0100 (Fri, 12 Dec 2008) New Revision: 1229 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Allow -expected-id to be specified multiple times when creating a jtag tap Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2008-12-11 23:36:51 UTC (rev 1228) +++ trunk/src/jtag/jtag.c 2008-12-12 00:21:07 UTC (rev 1229) @@ -1574,20 +1574,36 @@ if (tap) { tap->idcode = idcode; - if( tap->expected_id ){ - if( tap->idcode != tap->expected_id ){ - LOG_ERROR("ERROR: Tap: %s - Expected id: 0x%08x, Got: 0x%08x", + + if (tap->expected_ids_cnt > 0) { + /* Loop over the expected identification codes and test for a match */ + u8 ii; + for (ii = 0; ii < tap->expected_ids_cnt; ii++) { + if( tap->idcode == tap->expected_ids[ii] ){ + break; + } + } + + /* If none of the expected ids matched, log an error */ + if (ii == tap->expected_ids_cnt) { + LOG_ERROR("JTAG tap: %s got: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)", tap->dotted_name, - tap->expected_id, - idcode ); - LOG_ERROR("ERROR: expected: mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x", - EXTRACT_MFG( tap->expected_id ), - EXTRACT_PART( tap->expected_id ), - EXTRACT_VER( tap->expected_id ) ); - LOG_ERROR("ERROR: got: mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x", + idcode, EXTRACT_MFG( tap->idcode ), EXTRACT_PART( tap->idcode ), EXTRACT_VER( tap->idcode ) ); + for (ii = 0; ii < tap->expected_ids_cnt; ii++) { + LOG_ERROR("JTAG tap: %s expected %hhu of %hhu: 0x%08x (mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)", + tap->dotted_name, + ii + 1, + tap->expected_ids_cnt, + tap->expected_ids[ii], + EXTRACT_MFG( tap->expected_ids[ii] ), + EXTRACT_PART( tap->expected_ids[ii] ), + EXTRACT_VER( tap->expected_ids[ii] ) ); + } + + return ERROR_JTAG_INIT_FAILED; } else { LOG_INFO("JTAG Tap/device matched"); } @@ -1767,9 +1783,30 @@ pTap->enabled = 0; break; case NTAP_OPT_EXPECTED_ID: + { + u32 *new_expected_ids; + e = Jim_GetOpt_Wide( goi, &w ); - pTap->expected_id = w; + if( e != JIM_OK) { + Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name); + return e; + } + + new_expected_ids = malloc(sizeof(u32) * (pTap->expected_ids_cnt + 1)); + if (new_expected_ids == NULL) { + Jim_SetResult_sprintf( goi->interp, "no memory"); + return JIM_ERR; + } + + memcpy(new_expected_ids, pTap->expected_ids, sizeof(u32) * pTap->expected_ids_cnt); + + new_expected_ids[pTap->expected_ids_cnt] = w; + + free(pTap->expected_ids); + pTap->expected_ids = new_expected_ids; + pTap->expected_ids_cnt++; break; + } case NTAP_OPT_IRLEN: case NTAP_OPT_IRMASK: case NTAP_OPT_IRCAPTURE: @@ -1809,6 +1846,7 @@ pTap->dotted_name); // fixme: Tell user what is missing :-( // no memory leaks pelase + free(((void *)(pTap->expected_ids))); free(((void *)(pTap->chip))); free(((void *)(pTap->tapname))); free(((void *)(pTap->dotted_name))); @@ -2270,21 +2308,28 @@ command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------"); while( tap ){ - u32 expected, expected_mask, cur_instr; + u32 expected, expected_mask, cur_instr, ii; expected = buf_get_u32(tap->expected, 0, tap->ir_length); expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length); cur_instr = buf_get_u32(tap->cur_instr, 0, tap->ir_length); + command_print(cmd_ctx, "%2d | %-18s | %c | 0x%08x | 0x%08x | 0x%02x | 0x%02x | 0x%02x | 0x%02x", tap->abs_chain_position, tap->dotted_name, tap->enabled ? 'Y' : 'n', tap->idcode, - tap->expected_id, + (tap->expected_ids_cnt > 0 ? tap->expected_ids[0] : 0), tap->ir_length, expected, expected_mask, cur_instr); + + for (ii = 1; ii < tap->expected_ids_cnt; ii++) { + command_print(cmd_ctx, " | | | | 0x%08x | | | | ", + tap->expected_ids[ii]); + } + tap = tap->next_tap; } Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2008-12-11 23:36:51 UTC (rev 1228) +++ trunk/src/jtag/jtag.h 2008-12-12 00:21:07 UTC (rev 1229) @@ -179,7 +179,8 @@ u32 ir_capture_mask; u8 *expected_mask; /* Capture-IR expected mask */ u32 idcode; /* device identification code */ - u32 expected_id; + u32 *expected_ids; /* Array of expected identification codes */ + u8 expected_ids_cnt;/* Number of expected identification codes */ u8 *cur_instr; /* current instruction */ int bypass; /* bypass register selected */ jtag_tap_t *next_tap; |
From: ntfreak at B. <nt...@ma...> - 2008-12-12 00:36:53
|
Author: ntfreak Date: 2008-12-12 00:36:51 +0100 (Fri, 12 Dec 2008) New Revision: 1228 Modified: trunk/doc/openocd.texi Log: - incorrect url in last commit for usbjtag - added missing ft2232 option for interface axm0432_jtag Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2008-12-11 23:22:16 UTC (rev 1227) +++ trunk/doc/openocd.texi 2008-12-11 23:36:51 UTC (rev 1228) @@ -286,7 +286,7 @@ @itemize @bullet @item @b{usbjtag} -@* Link @url{www.ixo.de/info/usb_jtag} +@* Link @url{http://www.hs-augsburg.de/~hhoegl/proj/usbjtag/usbjtag.html} @item @b{jtagkey} @* See: @url{http://www.amontec.com/jtagkey.shtml} @item @b{oocdlink} @@ -1179,6 +1179,8 @@ egnite Software turtelizer2 @item @b{oocdlink} OOCDLink +@item @b{axm0432_jtag} +Axiom AXM-0432 @end itemize @item @b{ft2232_vid_pid} <@var{vid}> <@var{pid}> |
From: ntfreak at B. <nt...@ma...> - 2008-12-12 00:22:17
|
Author: ntfreak Date: 2008-12-12 00:22:16 +0100 (Fri, 12 Dec 2008) New Revision: 1227 Modified: trunk/doc/openocd.texi trunk/src/jtag/ft2232.c Log: - added Axiom AXM-0432 to texi - updated missing jtag dongle url's in texi - reformat and remove whitespace from last commit Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2008-12-11 19:03:17 UTC (rev 1226) +++ trunk/doc/openocd.texi 2008-12-11 23:22:16 UTC (rev 1227) @@ -286,7 +286,7 @@ @itemize @bullet @item @b{usbjtag} -@* Link Unknown [not easily verified] +@* Link @url{www.ixo.de/info/usb_jtag} @item @b{jtagkey} @* See: @url{http://www.amontec.com/jtagkey.shtml} @item @b{oocdlink} @@ -304,7 +304,9 @@ @item @b{comstick} @* Link: @url{http://www.hitex.com/index.php?id=383} @item @b{stm32stick} -@* Link Unknown [not easily verified] +@* Link @url{http://www.hitex.com/stm32-stick} +@item @b{axm0432_jtag} +@* Axiom AXM-0432 Link @url{http://www.axman.com} @end itemize @section USB JLINK based @@ -370,7 +372,7 @@ @* Unknown. @item @b{Lattice} -@* From Lattice Semiconductor [link unknown] +@* ispDownload from Lattice Semiconductor @url{http://www.latticesemi.com/lit/docs/devtools/dlcable.pdf} @item @b{flashlink} @* From ST Microsystems, link: Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2008-12-11 19:03:17 UTC (rev 1226) +++ trunk/src/jtag/ft2232.c 2008-12-11 23:22:16 UTC (rev 1227) @@ -114,7 +114,6 @@ void stm32stick_reset(int trst, int srst); void axm0432_jtag_reset(int trst, int srst); - /* blink procedures for layouts that support a blinking led */ void olimex_jtag_blink(void); void turtle_jtag_blink(void); @@ -1049,7 +1048,6 @@ LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } - void axm0432_jtag_reset(int trst, int srst) { if (trst == 1) @@ -1062,25 +1060,22 @@ high_output |= nTRST; } - if (srst == 1) - { - high_output &= ~nSRST; - } - else if (srst == 0) - { - high_output |= nSRST; - } + if (srst == 1) + { + high_output &= ~nSRST; + } + else if (srst == 0) + { + high_output |= nSRST; + } - /* command "set data bits low byte" */ - BUFFER_ADD = 0x82; - BUFFER_ADD = high_output; - BUFFER_ADD = high_direction; - LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); + /* command "set data bits low byte" */ + BUFFER_ADD = 0x82; + BUFFER_ADD = high_output; + BUFFER_ADD = high_direction; + LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } - - - void flyswatter_reset(int trst, int srst) { if (trst == 1) @@ -1414,15 +1409,13 @@ char *openex_string = NULL; u8 latency_timer; - LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)", - ft2232_layout, vid, pid); + LOG_DEBUG("'ft2232' interface using FTD2XX with '%s' layout (%4.4x:%4.4x)",ft2232_layout, vid, pid); #if IS_WIN32 == 0 /* Add non-standard Vid/Pid to the linux driver */ if ((status = FT_SetVIDPID(vid, pid)) != FT_OK) { - LOG_WARNING("couldn't add %4.4x:%4.4x", - vid, pid); + LOG_WARNING("couldn't add %4.4x:%4.4x", vid, pid); } #endif @@ -1455,8 +1448,7 @@ DWORD num_devices; if (more) { - LOG_WARNING("unable to open ftdi device (trying more): %lu", - status); + LOG_WARNING("unable to open ftdi device (trying more): %lu", status); *try_more = 1; return ERROR_JTAG_INIT_FAILED; } @@ -1758,13 +1750,10 @@ return ERROR_OK; } - int axm0432_jtag_init(void) { u8 buf[3]; - u8 buf_read[1]; u32 bytes_written; - u32 bytes_read; low_output = 0x08; low_direction = 0x2b; @@ -1781,7 +1770,6 @@ return ERROR_JTAG_INIT_FAILED; } - if (strcmp(layout->name, "axm0432_jtag") == 0) { nTRST = 0x08; @@ -1798,16 +1786,16 @@ high_output = 0x0; high_direction = 0x0c; - if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) + if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) { - LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag"); - } + LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag"); + } else { high_output |= nTRST; } - if (jtag_reset_config & RESET_SRST_PUSH_PULL) + if (jtag_reset_config & RESET_SRST_PUSH_PULL) { LOG_ERROR("can't set nSRST to push-pull on the Dicarlo jtag"); } @@ -1831,9 +1819,6 @@ return ERROR_OK; } - - - int jtagkey_init(void) { u8 buf[3]; @@ -2048,7 +2033,7 @@ } nSRST = 0x40; - + high_output = 0x00; high_direction = 0x0C; @@ -2091,7 +2076,7 @@ nTRSTnOE = 0x00; /* no output enable for nTRST */ nSRST = 0x02; nSRSTnOE = 0x00; /* no output enable for nSRST */ - + high_output = 0x03; high_direction = 0x03; @@ -2134,7 +2119,7 @@ nTRSTnOE = 0x00; /* no output enable for nTRST */ nSRST = 0x80; nSRSTnOE = 0x00; /* no output enable for nSRST */ - + high_output = 0x01; high_direction = 0x03; |
From: <kc...@ma...> - 2008-12-11 20:03:19
|
Author: kc8apf Date: 2008-12-11 20:03:17 +0100 (Thu, 11 Dec 2008) New Revision: 1226 Modified: trunk/src/jtag/ft2232.c Log: AXM0432 layout for FDTI provided by Alan Carvalho de Assis (Freescale) Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2008-12-11 15:53:45 UTC (rev 1225) +++ trunk/src/jtag/ft2232.c 2008-12-11 19:03:17 UTC (rev 1226) @@ -102,6 +102,7 @@ int turtle_init(void); int comstick_init(void); int stm32stick_init(void); +int axm0432_jtag_init(void); /* reset procedures for supported layouts */ void usbjtag_reset(int trst, int srst); @@ -111,7 +112,9 @@ void turtle_reset(int trst, int srst); void comstick_reset(int trst, int srst); void stm32stick_reset(int trst, int srst); +void axm0432_jtag_reset(int trst, int srst); + /* blink procedures for layouts that support a blinking led */ void olimex_jtag_blink(void); void turtle_jtag_blink(void); @@ -129,6 +132,7 @@ {"turtelizer2", turtle_init, turtle_reset, turtle_jtag_blink}, {"comstick", comstick_init, comstick_reset, NULL}, {"stm32stick", stm32stick_init, stm32stick_reset, NULL}, + {"axm0432_jtag", axm0432_jtag_init, axm0432_jtag_reset, NULL}, {NULL, NULL, NULL}, }; @@ -1045,6 +1049,38 @@ LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); } + +void axm0432_jtag_reset(int trst, int srst) +{ + if (trst == 1) + { + cur_state = TAP_TLR; + high_output &= ~nTRST; + } + else if (trst == 0) + { + high_output |= nTRST; + } + + if (srst == 1) + { + high_output &= ~nSRST; + } + else if (srst == 0) + { + high_output |= nSRST; + } + + /* command "set data bits low byte" */ + BUFFER_ADD = 0x82; + BUFFER_ADD = high_output; + BUFFER_ADD = high_direction; + LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction); +} + + + + void flyswatter_reset(int trst, int srst) { if (trst == 1) @@ -1722,6 +1758,82 @@ return ERROR_OK; } + +int axm0432_jtag_init(void) +{ + u8 buf[3]; + u8 buf_read[1]; + u32 bytes_written; + u32 bytes_read; + + low_output = 0x08; + low_direction = 0x2b; + + /* initialize low byte for jtag */ + buf[0] = 0x80; /* command "set data bits low byte" */ + buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */ + buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */ + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); + + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) + { + LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey' layout"); + return ERROR_JTAG_INIT_FAILED; + } + + + if (strcmp(layout->name, "axm0432_jtag") == 0) + { + nTRST = 0x08; + nTRSTnOE = 0x0; /* No output enable for TRST*/ + nSRST = 0x04; + nSRSTnOE = 0x0; /* No output enable for SRST*/ + } + else + { + LOG_ERROR("BUG: axm0432_jtag_init called for non axm0432 layout"); + exit(-1); + } + + high_output = 0x0; + high_direction = 0x0c; + + if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) + { + LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag"); + } + else + { + high_output |= nTRST; + } + + if (jtag_reset_config & RESET_SRST_PUSH_PULL) + { + LOG_ERROR("can't set nSRST to push-pull on the Dicarlo jtag"); + } + else + { + high_output |= nSRST; + } + + /* initialize high port */ + buf[0] = 0x82; /* command "set data bits high byte" */ + buf[1] = high_output; /* value */ + buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); + + if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3)) + { + LOG_ERROR("couldn't initialize FT2232 with 'Dicarlo' layout"); + return ERROR_JTAG_INIT_FAILED; + } + + return ERROR_OK; +} + + + + int jtagkey_init(void) { u8 buf[3]; |
From: ntfreak at B. <nt...@ma...> - 2008-12-11 16:53:46
|
Author: ntfreak Date: 2008-12-11 16:53:45 +0100 (Thu, 11 Dec 2008) New Revision: 1225 Modified: trunk/doc/openocd.texi trunk/src/flash/flash.c Log: - typo with flash bank help command - typo with flash erase_sector in texi Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2008-12-10 17:47:16 UTC (rev 1224) +++ trunk/doc/openocd.texi 2008-12-11 15:53:45 UTC (rev 1225) @@ -1950,7 +1950,7 @@ @cindex flash protect_check @*Check protection state of sectors in flash bank <num>. @option{flash erase_sector} using the same syntax. -@subsection fash erase_sector +@subsection flash erase_sector @b{flash erase_sector} <@var{num}> <@var{first}> <@var{last}> @cindex flash erase_sector @anchor{flash erase_sector} Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2008-12-10 17:47:16 UTC (rev 1224) +++ trunk/src/flash/flash.c 2008-12-11 15:53:45 UTC (rev 1225) @@ -144,7 +144,7 @@ { flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash_bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]"); + register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]"); return ERROR_OK; } |
From: ntfreak at B. <nt...@ma...> - 2008-12-10 18:47:49
|
Author: ntfreak Date: 2008-12-10 18:47:16 +0100 (Wed, 10 Dec 2008) New Revision: 1224 Modified: trunk/src/helper/command.c Log: - fix illegal memory access in unregister_command function Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2008-12-10 11:44:45 UTC (rev 1223) +++ trunk/src/helper/command.c 2008-12-10 17:47:16 UTC (rev 1224) @@ -289,8 +289,10 @@ return ERROR_INVALID_ARGUMENTS; /* find command */ - for (c = context->commands; c; c = c->next) - { + c = context->commands; + + while(NULL != c) + { if (strcmp(name, c->name) == 0) { /* unlink command */ @@ -300,26 +302,32 @@ } else { + /* first element in command list */ context->commands = c->next; } - + /* unregister children */ - if (c->children) + while(NULL != c->children) { - for (c2 = c->children; c2; c2 = c2->next) - { - free(c2->name); - free(c2); - } + c2 = c->children; + c->children = c->children->next; + free(c2->name); + c2->name = NULL; + free(c2); + c2 = NULL; } - + /* delete command */ free(c->name); + c->name = NULL; free(c); + c = NULL; + return ERROR_OK; } - + /* remember the last command for unlinking */ p = c; + c = c->next; } return ERROR_OK; |
From: <du...@ma...> - 2008-12-10 12:44:57
|
Author: duane Date: 2008-12-10 12:44:45 +0100 (Wed, 10 Dec 2008) New Revision: 1223 Modified: trunk/src/target/target/imote2.cfg trunk/src/target/target/is5114.cfg trunk/src/target/target/samsung_s3c6410.cfg Log: More fixes thanks to Kees Jongenburger Modified: trunk/src/target/target/imote2.cfg =================================================================== --- trunk/src/target/target/imote2.cfg 2008-12-10 01:18:10 UTC (rev 1222) +++ trunk/src/target/target/imote2.cfg 2008-12-10 11:44:45 UTC (rev 1223) @@ -35,7 +35,7 @@ jtag newtap $_CHIPNAME cpu -irlen 7 -ircapture 0x1 -irmask 0x7f -expected-id $_CPUTAPID set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME xscale -endian $_ENDIAN -chain-position $_TARGETNAME -varient pxa27x +target create $_TARGETNAME xscale -endian $_ENDIAN -chain-position $_TARGETNAME -variant pxa27x $_TARGETNAME configure -work-area-virt 0x0x5c000000 -work-area-phys 0x0x5c000000 -work-area-size 0x10000 -work-area-backup 1 # maps to PXA internal RAM. If you are using a PXA255 # you must initialize SDRAM or leave this option off Modified: trunk/src/target/target/is5114.cfg =================================================================== --- trunk/src/target/target/is5114.cfg 2008-12-10 01:18:10 UTC (rev 1222) +++ trunk/src/target/target/is5114.cfg 2008-12-10 11:44:45 UTC (rev 1223) @@ -39,7 +39,7 @@ #arm946e-s and set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME arm966e -endian $_ENDIAN -chain-position $_TARGETNAME -varient arm966e +target create $_TARGETNAME arm966e -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm966e $_TARGETNAME configure -event reset-start { jtag_rclk 16 } $_TARGETNAME configure -event reset-init { Modified: trunk/src/target/target/samsung_s3c6410.cfg =================================================================== --- trunk/src/target/target/samsung_s3c6410.cfg 2008-12-10 01:18:10 UTC (rev 1222) +++ trunk/src/target/target/samsung_s3c6410.cfg 2008-12-10 11:44:45 UTC (rev 1223) @@ -23,14 +23,14 @@ set _BSTAPID $BSTAPID } else { # force an error till we get a good number - set _BSTAPID 0xffffffff + set _BSTAPID 0x2b900f0f } if { [info exists CPUTAPID ] } { set _CPUTAPID $CPUTAPID } else { # force an error till we get a good number - set _CPUTAPID 0xffffffff + set _CPUTAPID 0x07b76f0f } #jtag scan chain @@ -40,7 +40,7 @@ jtag newtap $_CHIPNAME cpu -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPUTAPID set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME arm11 -endian $_ENDIAN -chain-position $_TARGETNAME -varient arm1176 +target create $_TARGETNAME arm11 -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm1176 jtag_nsrst_delay 500 jtag_ntrst_delay 500 |
From: <du...@ma...> - 2008-12-10 02:19:41
|
Author: duane Date: 2008-12-10 02:18:10 +0100 (Wed, 10 Dec 2008) New Revision: 1222 Added: trunk/src/target/target/samsung_s3c2410.cfg Removed: trunk/src/target/target/samsung_s2c2410.cfg Log: Fix from Kees Jongenburger (Part Duex) Deleted: trunk/src/target/target/samsung_s2c2410.cfg =================================================================== --- trunk/src/target/target/samsung_s2c2410.cfg 2008-12-10 01:15:27 UTC (rev 1221) +++ trunk/src/target/target/samsung_s2c2410.cfg 2008-12-10 01:18:10 UTC (rev 1222) @@ -1,35 +0,0 @@ -# Found on the 'TinCanTools' Hammer board. - -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME s3c2410 -} - -if { [info exists ENDIAN] } { - set _ENDIAN $ENDIAN -} else { - # This config file was defaulting to big endian.. - set _ENDIAN little -} - -if { [info exists CPUTAPID] } { - set _CPUTAPID $CPUTAPID -} else { - set _CPUTAPID 0xffffffff -} - -#use combined on interfaces or targets that cannot set TRST/SRST separately -reset_config trst_and_srst - -#jtag scan chain -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID - -set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME arm920t -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm920t - -$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x30800000 -work-area-size 0x20000 -work-area-backup 0 - -# speed up memory downloads -arm7_9 fast_memory_access enable -arm7_9 dcc_downloads enable Copied: trunk/src/target/target/samsung_s3c2410.cfg (from rev 1220, trunk/src/target/target/samsung_s2c2410.cfg) Property changes on: trunk/src/target/target/samsung_s3c2410.cfg ___________________________________________________________________ Name: svn:mergeinfo + Name: svn:eol-style + native |
From: <du...@ma...> - 2008-12-10 02:17:09
|
Author: duane Date: 2008-12-10 02:15:27 +0100 (Wed, 10 Dec 2008) New Revision: 1221 Modified: trunk/src/target/board/hammer.cfg Log: Fix from Kees Jongenburger Modified: trunk/src/target/board/hammer.cfg =================================================================== --- trunk/src/target/board/hammer.cfg 2008-12-08 11:23:04 UTC (rev 1220) +++ trunk/src/target/board/hammer.cfg 2008-12-10 01:15:27 UTC (rev 1221) @@ -1,7 +1,7 @@ # Target Configuration for the TinCanTools S3C2410 Based Hammer Module # http://www.tincantools.com -source [target/samsung_s3c2410.cfg] +source [find target/samsung_s3c2410.cfg] $_TARGETNAME configure -event reset-init { # Reset Script for the TinCanTools S3C2410 Based Hammer Module |
From: <du...@ma...> - 2008-12-08 12:23:07
|
Author: duane Date: 2008-12-08 12:23:04 +0100 (Mon, 08 Dec 2008) New Revision: 1220 Modified: trunk/src/target/target/at91r40008.cfg trunk/src/target/target/at91sam9260.cfg trunk/src/target/target/at91sam9260minimal.cfg Log: Typos in config files found by Sergey Lapin Modified: trunk/src/target/target/at91r40008.cfg =================================================================== --- trunk/src/target/target/at91r40008.cfg 2008-12-06 13:13:02 UTC (rev 1219) +++ trunk/src/target/target/at91r40008.cfg 2008-12-08 11:23:04 UTC (rev 1220) @@ -29,7 +29,7 @@ #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE) jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGENAME -variant arm7tdmi +target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi $_TARGETNAME configure -event gdb-flash-erase-start { Modified: trunk/src/target/target/at91sam9260.cfg =================================================================== --- trunk/src/target/target/at91sam9260.cfg 2008-12-06 13:13:02 UTC (rev 1219) +++ trunk/src/target/target/at91sam9260.cfg 2008-12-08 11:23:04 UTC (rev 1220) @@ -9,7 +9,7 @@ # Target configuration ###################### -$_TARGET_NAME configure -event reset-init { +$_TARGETNAME configure -event reset-init { # at reset chip runs at 32khz jtag_khz 8 mww 0xfffffd08 0xa5000501 # RSTC_MR : enable user reset Modified: trunk/src/target/target/at91sam9260minimal.cfg =================================================================== --- trunk/src/target/target/at91sam9260minimal.cfg 2008-12-06 13:13:02 UTC (rev 1219) +++ trunk/src/target/target/at91sam9260minimal.cfg 2008-12-08 11:23:04 UTC (rev 1220) @@ -18,7 +18,7 @@ set _CPUTAPID $CPUTAPID } else { # force an error till we get a good number - set _CPUTAPID 0xffffffff + set _CPUTAPID 0x0792603f } reset_config trst_and_srst @@ -37,6 +37,6 @@ target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm926ejs # Internal sram1 memory -$_TARGET_NAME configure -work-area-virt 0 -work-area-phys 0x00300000 -work-area-size 0x1000 -work-area-backup 1 +$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00300000 -work-area-size 0x1000 -work-area-backup 1 |
From: <du...@ma...> - 2008-12-06 14:13:05
|
Author: duane Date: 2008-12-06 14:13:02 +0100 (Sat, 06 Dec 2008) New Revision: 1219 Modified: trunk/README Log: Test of commit email from duane Modified: trunk/README =================================================================== --- trunk/README 2008-12-06 10:48:46 UTC (rev 1218) +++ trunk/README 2008-12-06 13:13:02 UTC (rev 1219) @@ -1 +1,2 @@ openocd.texi is the authoritative source of OpenOCD documentation + |
From: ntfreak at B. <nt...@ma...> - 2008-12-06 11:48:50
|
Author: ntfreak Date: 2008-12-06 11:48:46 +0100 (Sat, 06 Dec 2008) New Revision: 1218 Modified: trunk/doc/openocd.texi Log: - update texi to describe str9xpec driver flow Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2008-12-05 20:26:07 UTC (rev 1217) +++ trunk/doc/openocd.texi 2008-12-06 10:48:46 UTC (rev 1218) @@ -2080,7 +2080,7 @@ @option{enable_turbo} <@var{num>.} Only use this driver for locking/unlocking the device or configuring the option bytes. -Use the standard str9 driver for programming. +Use the standard str9 driver for programming. @xref{STR9 specific commands}. @subsubsection stellaris (LM3Sxxx) options @cindex stellaris (LM3Sxxx) options @@ -2140,6 +2140,7 @@ @subsection STR9 specific commands @cindex STR9 specific commands +@anchor{STR9 specific commands} These are flash specific commands when using the str9xpec driver. @itemize @bullet @item @b{str9xpec enable_turbo} <@var{num}> @@ -2164,6 +2165,43 @@ @*write str9 option bytes. @end itemize +Note: Before using the str9xpec driver here is some background info to help +you better understand how the drivers works. Openocd has two flash drivers for +the str9. +@enumerate +@item +Standard driver @option{str9x} programmed via the str9 core. Normally used for +flash programming as it is faster than the @option{str9xpec} driver. +@item +Direct programming @option{str9xpec} using the flash controller, this is +ISC compilant (IEEE 1532) tap connected in series with the str9 core. The str9 +core does not need to be running to program using this flash driver. Typical use +for this driver is locking/unlocking the target and programming the option bytes. +@end enumerate + +Before we run any cmds using the @option{str9xpec} driver we must first disable +the str9 core. This example assumes the @option{str9xpec} driver has been +configured for flash bank 0. +@example +# assert srst, we do not want core running +# while accessing str9xpec flash driver +jtag_reset 0 1 +# turn off target polling +poll off +# disable str9 core +str9xpec enable_turbo 0 +# read option bytes +str9xpec options_read 0 +# re-enable str9 core +str9xpec disable_turbo 0 +poll on +reset halt +@end example +The above example will read the str9 option bytes. +When performing a unlock remember that you will not be able to halt the str9 - it +has been locked. Halting the core is not required for the @option{str9xpec} driver +as mentioned above, just issue the cmds above manually or from a telnet prompt. + @subsection STR9 configuration @cindex STR9 configuration @itemize @bullet |