Add --fet-skip-close option.

Supplying this option causes the JTAG close procedure to be skipped
when closing the FET driver.
This commit is contained in:
Daniel Beer 2013-05-21 15:59:17 +12:00
parent 250ce908a1
commit df6f0ec3bc
6 changed files with 19 additions and 11 deletions

View File

@ -144,8 +144,3 @@ int device_erase(device_erase_type_t et, address_t addr)
return device_default->type->erase(device_default, et, addr);
}
int device_needs_skip_close(device_t dev)
{
return (dev->dev_id[0] == 0x51) && (dev->dev_id[1] == 0x37);
}

View File

@ -70,6 +70,7 @@ struct device_breakpoint {
#define DEVICE_FLAG_TTY 0x04 /* default is USB */
#define DEVICE_FLAG_FORCE_RESET 0x08
#define DEVICE_FLAG_DO_FWUPDATE 0x10
#define DEVICE_FLAG_SKIP_CLOSE 0x20
struct device_args {
int flags;
@ -140,11 +141,6 @@ int device_probe_id(device_t dev);
*/
int device_is_fram(device_t dev);
/* Determine, from the device ID bytes, whether this chip has problems
* with the FET close procedure.
*/
int device_needs_skip_close(device_t dev);
/* Set or clear a breakpoint. The index of the modified entry is
* returned, or -1 if no free entries were available. The modified
* entry is flagged so that it will be reloaded on the next run.

View File

@ -717,7 +717,7 @@ void fet_destroy(device_t dev_base)
{
struct fet_device *dev = (struct fet_device *)dev_base;
if (device_needs_skip_close(dev_base)) {
if (dev->fet_flags & FET_SKIP_CLOSE) {
printc_dbg("Skipping close procedure\n");
} else {
/* The second argument to C_RESET is a boolean which
@ -1020,6 +1020,9 @@ device_t fet_open(const struct device_args *args,
struct fet_device *dev = malloc(sizeof(*dev));
int i;
if (args->flags & DEVICE_FLAG_SKIP_CLOSE)
fet_flags |= FET_SKIP_CLOSE;
if (!dev) {
pr_error("fet: failed to allocate memory");
return NULL;

View File

@ -22,6 +22,9 @@
#include "device.h"
#include "transport.h"
/* Don't attempt to close JTAG on exit */
#define FET_SKIP_CLOSE 0x04
/* The new identify method should always be used */
#define FET_IDENTIFY_NEW 0x08

View File

@ -73,6 +73,9 @@ When using a FET device, force the connected chip to be recognised by
MSPDebug as one of the given type during initialization. This overrides
the device ID returned by the FET. The given string should be a chip
name in long form, for example "MSP430F2274".
.IP "\-\-fet\-skip\-close"
When using a FET device, skip the JTAG close procedure when disconnecting.
With some boards, this removes the need to replug the debugger after use.
.IP "\-\-usb\-list"
List available USB devices and exit.
.IP "\-\-force-reset"

View File

@ -118,6 +118,8 @@ static void usage(const char *progname)
" Show a list of devices supported by the FET driver.\n"
" --fet-force-id string\n"
" Override the device ID returned by the FET.\n"
" --fet-skip-close\n"
" Skip the JTAG close procedure when using the FET driver.\n"
" --usb-list\n"
" Show a list of available USB devices.\n"
" --force-reset\n"
@ -221,6 +223,7 @@ static int parse_cmdline_args(int argc, char **argv,
LOPT_HELP = 0x100,
LOPT_FET_LIST,
LOPT_FET_FORCE_ID,
LOPT_FET_SKIP_CLOSE,
LOPT_USB_LIST,
LOPT_VERSION,
LOPT_LONG_PASSWORD,
@ -234,6 +237,7 @@ static int parse_cmdline_args(int argc, char **argv,
{"help", 0, 0, LOPT_HELP},
{"fet-list", 0, 0, LOPT_FET_LIST},
{"fet-force-id", 1, 0, LOPT_FET_FORCE_ID},
{"fet-skip-close", 0, 0, LOPT_FET_SKIP_CLOSE},
{"usb-list", 0, 0, LOPT_USB_LIST},
{"version", 0, 0, LOPT_VERSION},
{"long-password", 0, 0, LOPT_LONG_PASSWORD},
@ -304,6 +308,10 @@ static int parse_cmdline_args(int argc, char **argv,
args->devarg.forced_chip_id = optarg;
break;
case LOPT_FET_SKIP_CLOSE:
args->devarg.flags |= DEVICE_FLAG_SKIP_CLOSE;
break;
case LOPT_HELP:
usage(argv[0]);
exit(0);