diff --git a/drivers/fet.c b/drivers/fet.c index 235827a..e036e1c 100644 --- a/drivers/fet.c +++ b/drivers/fet.c @@ -1109,6 +1109,38 @@ const struct device_class device_olimex = { .poll = fet_poll }; +static device_t fet_open_olimex_v1(const struct device_args *args) +{ + transport_t trans; + + if (args->flags & DEVICE_FLAG_TTY) + trans = uif_open(args->path, UIF_TYPE_OLIMEX_V1); + else + trans = olimex_open(args->path, args->requested_serial); + + if (!trans) + return NULL; + + return fet_open(args, FET_PROTO_NOLEAD_SEND | FET_PROTO_EXTRA_RECV | + FET_PROTO_IDENTIFY_NEW, + trans, &device_olimex_v1); +} + +const struct device_class device_olimex_v1 = { + .name = "olimex-v1", + .help = +"Olimex MSP-JTAG-TINY (V1).", + .open = fet_open_olimex_v1, + .destroy = fet_destroy, + .readmem = fet_readmem, + .writemem = fet_writemem, + .erase = fet_erase, + .getregs = fet_getregs, + .setregs = fet_setregs, + .ctl = fet_ctl, + .poll = fet_poll +}; + static device_t fet_open_olimex_iso(const struct device_args *args) { transport_t trans; diff --git a/drivers/fet.h b/drivers/fet.h index db702f0..636696c 100644 --- a/drivers/fet.h +++ b/drivers/fet.h @@ -23,6 +23,7 @@ extern const struct device_class device_rf2500; extern const struct device_class device_olimex; +extern const struct device_class device_olimex_v1; extern const struct device_class device_olimex_iso; extern const struct device_class device_uif; diff --git a/drivers/uif.c b/drivers/uif.c index ffa0e17..2799c55 100644 --- a/drivers/uif.c +++ b/drivers/uif.c @@ -131,7 +131,15 @@ transport_t uif_open(const char *device, uif_type_t type) break; case UIF_TYPE_OLIMEX: - printc("Trying to open Olimex on %s...\n", device); + printc("Trying to open Olimex (V2) on %s...\n", device); + tr->serial_fd = sport_open(device, B115200, 0); + if (sport_set_modem(tr->serial_fd, 0) < 0) + pr_error("warning: uif: failed to set " + "modem control lines"); + break; + + case UIF_TYPE_OLIMEX_V1: + printc("Trying to open Olimex (V1) on %s...\n", device); tr->serial_fd = sport_open(device, B500000, 0); break; diff --git a/drivers/uif.h b/drivers/uif.h index 9ada015..9e670f8 100644 --- a/drivers/uif.h +++ b/drivers/uif.h @@ -24,6 +24,7 @@ typedef enum { UIF_TYPE_FET, UIF_TYPE_OLIMEX, + UIF_TYPE_OLIMEX_V1, UIF_TYPE_OLIMEX_ISO } uif_type_t; diff --git a/mspdebug.man b/mspdebug.man index a8e6233..0b28f1c 100644 --- a/mspdebug.man +++ b/mspdebug.man @@ -90,6 +90,10 @@ connection is supported. .IP "\fBolimex\fR" Connect to an Olimex MSP-JTAG-TINY device. Both USB and tty access are supported. +.IP "\fBolimex-v1\fR" +Connect to an Olimex MSP-JTAG-TINY (V1) device. Both USB and tty access are +supported. This driver must be used instead of \fBolimex\fR if connecting +to a V1 device via a tty interface. .IP "\fBolimex-iso\fR" Connect to an Olimex MSP-JTAG-ISO device. Only tty access is supported. .IP "\fBsim\fR" diff --git a/ui/main.c b/ui/main.c index 3ca7160..eafe71d 100644 --- a/ui/main.c +++ b/ui/main.c @@ -61,6 +61,7 @@ struct cmdline_args { static const struct device_class *const driver_table[] = { &device_rf2500, &device_olimex, + &device_olimex_v1, &device_olimex_iso, &device_sim, &device_uif,