diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2018-09-23 16:42:07 +0200 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2018-12-06 13:04:09 +0000 |
commit | ab9221f80592bd99c017c3689ae3b805c01a0743 (patch) | |
tree | 968865c5b453e36efdee4e9249ee5c41afcc5824 /src/jtag | |
parent | 3148bf838dc67c2b356a38fec6a979bc78ae2b0e (diff) | |
download | riscv-openocd-ab9221f80592bd99c017c3689ae3b805c01a0743.zip riscv-openocd-ab9221f80592bd99c017c3689ae3b805c01a0743.tar.gz riscv-openocd-ab9221f80592bd99c017c3689ae3b805c01a0743.tar.bz2 |
stlink: add STLINK_F_HAS_TARGET_VOLT
Use an alias to STLINK_F_HAS_TRACE, both are added in the same version
Change-Id: Iabf2fdac407f5c4737c3da942323d60ee50c3470
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4708
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/drivers/stlink_usb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 1688599..a0ee44c 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -280,6 +280,7 @@ enum stlink_mode { #define STLINK_F_HAS_TRACE (1UL << 0) /* aliases */ +#define STLINK_F_HAS_TARGET_VOLT STLINK_F_HAS_TRACE struct speed_map { int speed; @@ -669,6 +670,7 @@ static int stlink_usb_version(void *handle) h->version.jtag_api_max = STLINK_JTAG_API_V2; /* API for trace from J13 */ + /* API for target voltage from J13 */ if (h->version.jtag >= 13) flags |= STLINK_F_HAS_TRACE; @@ -694,8 +696,8 @@ static int stlink_usb_check_voltage(void *handle, float *target_voltage) struct stlink_usb_handle_s *h = handle; uint32_t adc_results[2]; - /* only supported by stlink/v2 and for firmware >= 13 */ - if (h->version.stlink == 1 || h->version.jtag < 13) + /* no error message, simply quit with error */ + if (!(h->version.flags & STLINK_F_HAS_TARGET_VOLT)) return ERROR_COMMAND_NOTFOUND; stlink_usb_init_buffer(handle, h->rx_ep, 8); |