JTAG/drivers: amt_jtagaccel fixes + cleanup
authorDavid Brownell <dbrownell@users.sourceforge.net>
Sun, 3 Jan 2010 20:59:51 +0000 (12:59 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Sun, 3 Jan 2010 20:59:51 +0000 (12:59 -0800)
Build fixes:  it failed abysmally with PPDEV enabled.  Swapped
a build-time error with a FIXME comment in the affected macros.

Cleanup: remove "&" before function pointers, and excess indent,
for the interface struct declaration.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/jtag/drivers/amt_jtagaccel.c

index 8ba15838462ecb9cf4043168653b14bf9051f57a..de7cdcb6ab5af120860e77cca8d253235b93b6e5 100644 (file)
@@ -55,13 +55,41 @@ static int rtck_enabled = 0;
 #if PARPORT_USE_PPDEV == 1
 static int device_handle;
 
-static int addr_mode = IEEE1284_MODE_EPP | IEEE1284_ADDR ;
-#define AMT_AW(val)    do { ioctl(device_handle, PPSETMODE, &addr_mode); write(device_handle, &val, 1); } while (0)
-#define AMT_AR(val)    do { ioctl(device_handle, PPSETMODE, &addr_mode); read(device_handle, &val, 1); } while (0)
-
-static int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA ;
-#define AMT_DW(val)    do { ioctl(device_handle, PPSETMODE, &data_mode); write(device_handle, &val, 1); } while (0)
-#define AMT_DR(val)    do { ioctl(device_handle, PPSETMODE, &data_mode); read(device_handle, &val, 1); } while (0)
+static const int addr_mode = IEEE1284_MODE_EPP | IEEE1284_ADDR;
+
+/* FIXME do something sane when these ioctl/read/write calls fail. */
+
+#define AMT_AW(val) \
+       do { \
+               int __retval; \
+               \
+               __retval = ioctl(device_handle, PPSETMODE, &addr_mode); \
+               __retval = write(device_handle, &val, 1); \
+       } while (0)
+#define AMT_AR(val) \
+       do { \
+               int __retval; \
+               \
+               __retval = ioctl(device_handle, PPSETMODE, &addr_mode); \
+               __retval = read(device_handle, &val, 1); \
+       } while (0)
+
+static const int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA;
+
+#define AMT_DW(val) \
+       do { \
+               int __retval; \
+               \
+               __retval = ioctl(device_handle, PPSETMODE, &data_mode); \
+               __retval = write(device_handle, &val, 1); \
+       } while (0)
+#define AMT_DR(val) \
+       do { \
+               int __retval; \
+               \
+               __retval = ioctl(device_handle, PPSETMODE, &data_mode); \
+               __retval = read(device_handle, &val, 1); \
+       } while (0)
 
 #else
 
@@ -559,10 +587,11 @@ static const struct command_registration amtjtagaccel_command_handlers[] = {
 };
 
 struct jtag_interface amt_jtagaccel_interface = {
-               .name = "amt_jtagaccel",
-               .commands = amtjtagaccel_command_handlers,
-               .init = &amt_jtagaccel_init,
-               .quit = &amt_jtagaccel_quit,
-               .speed = &amt_jtagaccel_speed,
-               .execute_queue = &amt_jtagaccel_execute_queue,
-       };
+       .name = "amt_jtagaccel",
+       .commands = amtjtagaccel_command_handlers,
+
+       .init = amt_jtagaccel_init,
+       .quit = amt_jtagaccel_quit,
+       .speed = amt_jtagaccel_speed,
+       .execute_queue = amt_jtagaccel_execute_queue,
+};

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)