fet: reset on close, rather than init.

This commit is contained in:
Daniel Beer 2010-10-12 11:00:09 +13:00
parent 09813e3129
commit 32f45d72de
4 changed files with 2 additions and 22 deletions

11
fet.c
View File

@ -698,8 +698,8 @@ static void fet_destroy(device_t dev_base)
{
struct fet_device *dev = (struct fet_device *)dev_base;
if (xfer(dev, C_RUN, NULL, 0, 2, FET_RUN_FREE, 1) < 0)
printc_err("fet: failed to restart CPU\n");
if (xfer(dev, C_RESET, NULL, 0, 3, FET_RESET_ALL, 1, 1) < 0)
printc_err("fet: final reset failed\n");
if (xfer(dev, C_CLOSE, NULL, 0, 1, 0) < 0)
printc_err("fet: close command failed\n");
@ -950,13 +950,6 @@ device_t fet_open(transport_t transport, int proto_flags, int vcc_mv,
if (do_configure(dev) < 0)
goto fail;
/* Reset first, if requested */
if (!(proto_flags & FET_PROTO_NORESET)) {
printc_dbg("Sending initial reset...\n");
if (xfer(dev, C_RESET, NULL, 0, 3, FET_RESET_ALL, 0, 0) < 0)
printc_err("warning: fet: initial reset failed\n");
}
/* set VCC */
if (xfer(dev, C_VCC, NULL, 0, 1, vcc_mv) < 0)
printc_err("warning: fet: set VCC failed\n");

1
fet.h
View File

@ -26,7 +26,6 @@
#define FET_PROTO_SPYBIWIRE 0x01
#define FET_PROTO_RF2500 0x02
#define FET_PROTO_OLIMEX 0x04
#define FET_PROTO_NORESET 0x08
device_t fet_open(transport_t transport, int proto_flags, int vcc_mv,
const char *force_id);

10
main.c
View File

@ -125,7 +125,6 @@ struct cmdline_args {
const char *usb_device;
const char *fet_force_id;
int want_jtag;
int no_reset;
int no_rc;
int vcc_mv;
int long_password;
@ -144,8 +143,6 @@ static device_t driver_open_fet(const struct cmdline_args *args,
if (!args->want_jtag)
flags |= FET_PROTO_SPYBIWIRE;
if (args->no_reset)
flags |= FET_PROTO_NORESET;
dev = fet_open(trans, flags, args->vcc_mv, args->fet_force_id);
if (!dev) {
@ -292,8 +289,6 @@ static void usage(const char *progname)
" Set the supply voltage, in millivolts.\n"
" -n\n"
" Do not read ~/.mspdebug on startup.\n"
" --no-reset\n"
" Do not reset the device on startup.\n"
" --long-password\n"
" Send 32-byte IVT as BSL password (flash-bsl only)\n"
" --help\n"
@ -379,7 +374,6 @@ static int parse_cmdline_args(int argc, char **argv,
{"fet-force-id", 1, 0, 'F'},
{"usb-list", 0, 0, 'I'},
{"version", 0, 0, 'V'},
{"no-reset", 0, 0, 'R'},
{"long-password", 0, 0, 'P'},
{NULL, 0, 0, 0}
};
@ -439,10 +433,6 @@ static int parse_cmdline_args(int argc, char **argv,
args->no_rc = 1;
break;
case 'R':
args->no_reset = 1;
break;
case 'P':
args->long_password = 1;
break;

View File

@ -47,8 +47,6 @@ Specify a particular USB device to connect to. Without this option,
the first device of the appropriate type is opened.
.IP "\-n"
Do not process the startup file (~/.mspdebug).
.IP "\--no-reset"
Do not reset the device on startup.
.IP "\--long-password"
When using the flash-bsl driver, send a 32-byte BSL password instead
of the standard 16-byte password.