fet: reset on close, rather than init.
This commit is contained in:
parent
09813e3129
commit
32f45d72de
11
fet.c
11
fet.c
|
@ -698,8 +698,8 @@ static void fet_destroy(device_t dev_base)
|
||||||
{
|
{
|
||||||
struct fet_device *dev = (struct fet_device *)dev_base;
|
struct fet_device *dev = (struct fet_device *)dev_base;
|
||||||
|
|
||||||
if (xfer(dev, C_RUN, NULL, 0, 2, FET_RUN_FREE, 1) < 0)
|
if (xfer(dev, C_RESET, NULL, 0, 3, FET_RESET_ALL, 1, 1) < 0)
|
||||||
printc_err("fet: failed to restart CPU\n");
|
printc_err("fet: final reset failed\n");
|
||||||
|
|
||||||
if (xfer(dev, C_CLOSE, NULL, 0, 1, 0) < 0)
|
if (xfer(dev, C_CLOSE, NULL, 0, 1, 0) < 0)
|
||||||
printc_err("fet: close command failed\n");
|
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)
|
if (do_configure(dev) < 0)
|
||||||
goto fail;
|
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 */
|
/* set VCC */
|
||||||
if (xfer(dev, C_VCC, NULL, 0, 1, vcc_mv) < 0)
|
if (xfer(dev, C_VCC, NULL, 0, 1, vcc_mv) < 0)
|
||||||
printc_err("warning: fet: set VCC failed\n");
|
printc_err("warning: fet: set VCC failed\n");
|
||||||
|
|
1
fet.h
1
fet.h
|
@ -26,7 +26,6 @@
|
||||||
#define FET_PROTO_SPYBIWIRE 0x01
|
#define FET_PROTO_SPYBIWIRE 0x01
|
||||||
#define FET_PROTO_RF2500 0x02
|
#define FET_PROTO_RF2500 0x02
|
||||||
#define FET_PROTO_OLIMEX 0x04
|
#define FET_PROTO_OLIMEX 0x04
|
||||||
#define FET_PROTO_NORESET 0x08
|
|
||||||
|
|
||||||
device_t fet_open(transport_t transport, int proto_flags, int vcc_mv,
|
device_t fet_open(transport_t transport, int proto_flags, int vcc_mv,
|
||||||
const char *force_id);
|
const char *force_id);
|
||||||
|
|
10
main.c
10
main.c
|
@ -125,7 +125,6 @@ struct cmdline_args {
|
||||||
const char *usb_device;
|
const char *usb_device;
|
||||||
const char *fet_force_id;
|
const char *fet_force_id;
|
||||||
int want_jtag;
|
int want_jtag;
|
||||||
int no_reset;
|
|
||||||
int no_rc;
|
int no_rc;
|
||||||
int vcc_mv;
|
int vcc_mv;
|
||||||
int long_password;
|
int long_password;
|
||||||
|
@ -144,8 +143,6 @@ static device_t driver_open_fet(const struct cmdline_args *args,
|
||||||
|
|
||||||
if (!args->want_jtag)
|
if (!args->want_jtag)
|
||||||
flags |= FET_PROTO_SPYBIWIRE;
|
flags |= FET_PROTO_SPYBIWIRE;
|
||||||
if (args->no_reset)
|
|
||||||
flags |= FET_PROTO_NORESET;
|
|
||||||
|
|
||||||
dev = fet_open(trans, flags, args->vcc_mv, args->fet_force_id);
|
dev = fet_open(trans, flags, args->vcc_mv, args->fet_force_id);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
|
@ -292,8 +289,6 @@ static void usage(const char *progname)
|
||||||
" Set the supply voltage, in millivolts.\n"
|
" Set the supply voltage, in millivolts.\n"
|
||||||
" -n\n"
|
" -n\n"
|
||||||
" Do not read ~/.mspdebug on startup.\n"
|
" Do not read ~/.mspdebug on startup.\n"
|
||||||
" --no-reset\n"
|
|
||||||
" Do not reset the device on startup.\n"
|
|
||||||
" --long-password\n"
|
" --long-password\n"
|
||||||
" Send 32-byte IVT as BSL password (flash-bsl only)\n"
|
" Send 32-byte IVT as BSL password (flash-bsl only)\n"
|
||||||
" --help\n"
|
" --help\n"
|
||||||
|
@ -379,7 +374,6 @@ static int parse_cmdline_args(int argc, char **argv,
|
||||||
{"fet-force-id", 1, 0, 'F'},
|
{"fet-force-id", 1, 0, 'F'},
|
||||||
{"usb-list", 0, 0, 'I'},
|
{"usb-list", 0, 0, 'I'},
|
||||||
{"version", 0, 0, 'V'},
|
{"version", 0, 0, 'V'},
|
||||||
{"no-reset", 0, 0, 'R'},
|
|
||||||
{"long-password", 0, 0, 'P'},
|
{"long-password", 0, 0, 'P'},
|
||||||
{NULL, 0, 0, 0}
|
{NULL, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
@ -439,10 +433,6 @@ static int parse_cmdline_args(int argc, char **argv,
|
||||||
args->no_rc = 1;
|
args->no_rc = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
|
||||||
args->no_reset = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
args->long_password = 1;
|
args->long_password = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -47,8 +47,6 @@ Specify a particular USB device to connect to. Without this option,
|
||||||
the first device of the appropriate type is opened.
|
the first device of the appropriate type is opened.
|
||||||
.IP "\-n"
|
.IP "\-n"
|
||||||
Do not process the startup file (~/.mspdebug).
|
Do not process the startup file (~/.mspdebug).
|
||||||
.IP "\--no-reset"
|
|
||||||
Do not reset the device on startup.
|
|
||||||
.IP "\--long-password"
|
.IP "\--long-password"
|
||||||
When using the flash-bsl driver, send a 32-byte BSL password instead
|
When using the flash-bsl driver, send a 32-byte BSL password instead
|
||||||
of the standard 16-byte password.
|
of the standard 16-byte password.
|
||||||
|
|
Loading…
Reference in New Issue