olimex: fix V2 tty access, and introduce olimex-v1 driver.

The olimex-v1 driver must be used when accessing a V1 device via the
tty interface.
This commit is contained in:
Daniel Beer 2011-12-26 11:22:04 +13:00
parent f501ab0843
commit 711ffbfd1a
6 changed files with 48 additions and 1 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -24,6 +24,7 @@
typedef enum {
UIF_TYPE_FET,
UIF_TYPE_OLIMEX,
UIF_TYPE_OLIMEX_V1,
UIF_TYPE_OLIMEX_ISO
} uif_type_t;

View File

@ -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"

View File

@ -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,