diff --git a/fet.c b/fet.c index dfc7913..10debe5 100644 --- a/fet.c +++ b/fet.c @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * Various constants and tables come from fet430uif, written by Robert + * Various constants and tables come from uif430, written by Robert * Kavaler (kavaler@diva.com). This is available under the same license * as this program, from www.relavak.com. */ @@ -36,7 +36,7 @@ static int fet_is_rf2500; /********************************************************************** * FET command codes. * - * These come from fet430uif by Robert Kavaler (kavaler@diva.com). + * These come from uif430 by Robert Kavaler (kavaler@diva.com). * www.relavak.com */ @@ -194,7 +194,7 @@ static struct { #define PTYPE_NAK 5 #define PTYPE_FLASH_ACK 6 -/* This table is taken from fet430uif */ +/* This table is taken from uif430 */ static const char *error_strings[] = { "No error", // 0 @@ -489,7 +489,7 @@ static int xfer(int command_code, const char *data, int datalen, static int fet_version; -/* Reply data taken from fet430uif */ +/* Reply data taken from uif430 */ #define ID_REPLY_LEN 18 static const struct { diff --git a/main.c b/main.c index 510f7c8..a264d9b 100644 --- a/main.c +++ b/main.c @@ -597,11 +597,14 @@ static void reader_loop(void) static void usage(const char *progname) { - fprintf(stderr, "Usage: %s [-u device] [command ...]\n" + fprintf(stderr, "Usage: %s [-u device] [-j] [command ...]\n" "\n" -"By default, the first RF2500 device on the USB bus is opened. If -u is\n" -"given, then a UIF device attached to the specified serial port is\n" -"opened.\n" +" -u device\n" +" Open the given tty device (MSP430 UIF compatible devices).\n" +" -j\n" +" Use JTAG, rather than spy-bi-wire (UIF devices only).\n" +"\n" +"By default, the first RF2500 device on the USB bus is opened.\n" "\n" "If commands are given, they will be executed. Otherwise, an interactive\n" "command reader is started.\n", @@ -613,6 +616,7 @@ int main(int argc, char **argv) const char *uif_device = NULL; int opt; int result; + int want_jtag = 0; puts( "MSPDebug version 0.2 - debugging tool for the eZ430\n" @@ -620,12 +624,16 @@ int main(int argc, char **argv) "This is free software; see the source for copying conditions. There is NO\n" "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); - while ((opt = getopt(argc, argv, "u:")) >= 0) + while ((opt = getopt(argc, argv, "u:j")) >= 0) switch (opt) { case 'u': uif_device = optarg; break; + case 'j': + want_jtag = 1; + break; + default: usage(argv[0]); return -1; @@ -633,7 +641,7 @@ int main(int argc, char **argv) /* Open the appropriate device */ if (uif_device) - result = uif_open(uif_device); + result = uif_open(uif_device, want_jtag); else result = rf2500_open(); diff --git a/uif.c b/uif.c index 73186b6..f52ee44 100644 --- a/uif.c +++ b/uif.c @@ -94,7 +94,7 @@ static const struct fet_transport serial_transport = { .close = serial_close }; -int uif_open(const char *device) +int uif_open(const char *device, int want_jtag) { struct termios attr; @@ -116,7 +116,8 @@ int uif_open(const char *device) return -1; } - if (fet_open(&serial_transport, FET_PROTO_SPYBIWIRE, 3000) < 0) { + if (fet_open(&serial_transport, want_jtag ? 0 : FET_PROTO_SPYBIWIRE, + 3000) < 0) { close(serial_fd); return -1; } diff --git a/uif.h b/uif.h index e143b4b..28d6963 100644 --- a/uif.h +++ b/uif.h @@ -23,6 +23,6 @@ * a kernel-supported serial interface. The argument given should be the * filename of the relevant tty device. */ -int uif_open(const char *device); +int uif_open(const char *device, int want_jtag); #endif