fet: by default, reset chip on startup.
This commit is contained in:
parent
d3f50bef75
commit
2ef8f7574b
7
fet.c
7
fet.c
|
@ -888,6 +888,13 @@ 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,6 +26,7 @@
|
||||||
#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);
|
||||||
|
|
11
main.c
11
main.c
|
@ -124,6 +124,7 @@ 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;
|
||||||
};
|
};
|
||||||
|
@ -141,6 +142,8 @@ 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) {
|
||||||
|
@ -271,6 +274,8 @@ 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"
|
||||||
|
" -r\n"
|
||||||
|
" Do not reset the device on startup.\n"
|
||||||
" --help\n"
|
" --help\n"
|
||||||
" Show this help text.\n"
|
" Show this help text.\n"
|
||||||
" --fet-list\n"
|
" --fet-list\n"
|
||||||
|
@ -357,7 +362,7 @@ static int parse_cmdline_args(int argc, char **argv,
|
||||||
{NULL, 0, 0, 0}
|
{NULL, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, "d:jv:nU:q",
|
while ((opt = getopt_long(argc, argv, "d:jv:nU:qr",
|
||||||
longopts, NULL)) >= 0)
|
longopts, NULL)) >= 0)
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'q':
|
case 'q':
|
||||||
|
@ -412,6 +417,10 @@ 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 '?':
|
case '?':
|
||||||
printc_err("Try --help for usage information.\n");
|
printc_err("Try --help for usage information.\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -47,6 +47,8 @@ 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 "\-r"
|
||||||
|
Do not reset the device on startup.
|
||||||
.IP "\-\-help"
|
.IP "\-\-help"
|
||||||
Display a brief help message and exit.
|
Display a brief help message and exit.
|
||||||
.IP "\-\-fet\-list"
|
.IP "\-\-fet\-list"
|
||||||
|
|
Loading…
Reference in New Issue