jtag/drivers/ftdi: add option to declare signal aliases 81/2181/3
authorPaul Fertser <fercerpav@gmail.com>
Fri, 20 Jun 2014 08:47:24 +0000 (12:47 +0400)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sat, 28 Jun 2014 09:36:02 +0000 (09:36 +0000)
This adds -alias|-nalias options to ftdi_layout_signal command that
allow to declare a new signal based on an already defined one.

Change-Id: I552578ebcd12ae21957a1c0d3b7e878adeff6df0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2181
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
doc/openocd.texi
src/jtag/drivers/ftdi.c

index fa8f1c550d7845970cac73ce581a9523fece13f0..e51de4de9108a01607e48faa8b6f5211c212eb00 100644 (file)
@@ -2767,7 +2767,7 @@ minimal impact on the target system. Avoid floating inputs, conflicting outputs
 and initially asserted reset signals.
 @end deffn
 
 and initially asserted reset signals.
 @end deffn
 
-@deffn {Config Command} {ftdi_layout_signal} name [@option{-data}|@option{-ndata} data_mask] [@option{-oe}|@option{-noe} oe_mask]
+@deffn {Config Command} {ftdi_layout_signal} name [@option{-data}|@option{-ndata} data_mask] [@option{-oe}|@option{-noe} oe_mask] [@option{-alias}|@option{-nalias} name]
 Creates a signal with the specified @var{name}, controlled by one or more FTDI
 GPIO pins via a range of possible buffer connections. The masks are FTDI GPIO
 register bitmasks to tell the driver the connection and type of the output
 Creates a signal with the specified @var{name}, controlled by one or more FTDI
 GPIO pins via a range of possible buffer connections. The masks are FTDI GPIO
 register bitmasks to tell the driver the connection and type of the output
@@ -2790,6 +2790,10 @@ target without any buffer. The FTDI pin is then switched between output and
 input as necessary to provide the full set of low, high and Hi-Z
 characteristics. In all other cases, the pins specified in a signal definition
 are always driven by the FTDI.
 input as necessary to provide the full set of low, high and Hi-Z
 characteristics. In all other cases, the pins specified in a signal definition
 are always driven by the FTDI.
+
+If @option{-alias} or @option{-nalias} is used, the signal is created
+identical (or with data inverted) to an already specified signal
+@var{name}.
 @end deffn
 
 @deffn {Command} {ftdi_set_signal} name @option{0}|@option{1}|@option{z}
 @end deffn
 
 @deffn {Command} {ftdi_set_signal} name @option{0}|@option{1}|@option{z}
index be02d20907e84f6e6dcf1e575c8b5f91544750bb..9d3444738930fb5065cdeddd2bbad935e1fdfddc 100644 (file)
@@ -740,6 +740,19 @@ COMMAND_HANDLER(ftdi_handle_layout_signal_command)
                } else if (strcmp("-noe", CMD_ARGV[i]) == 0) {
                        invert_oe = true;
                        COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], oe_mask);
                } else if (strcmp("-noe", CMD_ARGV[i]) == 0) {
                        invert_oe = true;
                        COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], oe_mask);
+               } else if (!strcmp("-alias", CMD_ARGV[i]) ||
+                          !strcmp("-nalias", CMD_ARGV[i])) {
+                       if (!strcmp("-nalias", CMD_ARGV[i]))
+                               invert_data = true;
+                       struct signal *sig = find_signal_by_name(CMD_ARGV[i + 1]);
+                       if (!sig) {
+                               LOG_ERROR("signal %s is not defined", CMD_ARGV[i + 1]);
+                               return ERROR_FAIL;
+                       }
+                       data_mask = sig->data_mask;
+                       oe_mask = sig->oe_mask;
+                       invert_oe = sig->invert_oe;
+                       invert_data ^= sig->invert_data;
                } else {
                        LOG_ERROR("unknown option '%s'", CMD_ARGV[i]);
                        return ERROR_COMMAND_SYNTAX_ERROR;
                } else {
                        LOG_ERROR("unknown option '%s'", CMD_ARGV[i]);
                        return ERROR_COMMAND_SYNTAX_ERROR;
@@ -869,7 +882,7 @@ static const struct command_registration ftdi_command_handlers[] = {
                .mode = COMMAND_ANY,
                .help = "define a signal controlled by one or more FTDI GPIO as data "
                        "and/or output enable",
                .mode = COMMAND_ANY,
                .help = "define a signal controlled by one or more FTDI GPIO as data "
                        "and/or output enable",
-               .usage = "name [-data mask|-ndata mask] [-oe mask|-noe mask]",
+               .usage = "name [-data mask|-ndata mask] [-oe mask|-noe mask] [-alias|-nalias name]",
        },
        {
                .name = "ftdi_set_signal",
        },
        {
                .name = "ftdi_set_signal",

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)