summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-03-07 15:11:28 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-03-13 14:55:03 +0100
commit2c4f7f1dd4b75f8d958ca66f971ead3adc81d24f (patch)
tree21e3a44cace4057a728cd249f385e90a0c21db2c /src
parentbce76b80ccc1eca1f71327f27febf5c52b69b3ad (diff)
downloadopenocd_libswd-2c4f7f1dd4b75f8d958ca66f971ead3adc81d24f.tar.gz
openocd_libswd-2c4f7f1dd4b75f8d958ca66f971ead3adc81d24f.tar.bz2
openocd_libswd-2c4f7f1dd4b75f8d958ca66f971ead3adc81d24f.tar.xz
openocd_libswd-2c4f7f1dd4b75f8d958ca66f971ead3adc81d24f.zip
jlink: add detect hw type
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
Diffstat (limited to 'src')
-rw-r--r--src/jtag/drivers/jlink.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index 6507403e..174f7b34 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -159,6 +159,20 @@ static char *jlink_cap_str[] = {
/* max speed 12MHz v5.0 jlink */
#define JLINK_MAX_SPEED 12000
+/* J-Link hardware versions */
+#define JLINK_HW_TYPE_JLINK 0
+#define JLINK_HW_TYPE_JTRACE 1
+#define JLINK_HW_TYPE_FLASHER 2
+#define JLINK_HW_TYPE_JLINK_PRO 3
+#define JLINK_HW_TYPE_MAX 4
+
+static char *jlink_hw_type_str[] = {
+ "J-Link",
+ "J-Trace",
+ "Flasher",
+ "J-Link Pro",
+};
+
/* Queue command functions */
static void jlink_end_state(tap_state_t state);
static void jlink_state_move(void);
@@ -206,6 +220,7 @@ static uint16_t vids[] = { VID, 0 };
static uint16_t pids[] = { PID, 0 };
static uint32_t jlink_caps;
+static uint32_t jlink_hw_type;
/***************************************************************************/
/* External interface implementation */
@@ -687,10 +702,16 @@ static int jlink_get_version_info(void)
uint32_t jlink_hw_version = buf_get_u32(usb_in_buffer, 0, 32);
uint32_t major_revision = (jlink_hw_version / 10000) % 100;
+ jlink_hw_type = (jlink_hw_version / 1000000) % 100;
if (major_revision >= 5)
jlink_hw_jtag_version = 3;
LOG_INFO("J-Link hw version %i", (int)jlink_hw_version);
+
+ if (jlink_hw_type >= JLINK_HW_TYPE_MAX)
+ LOG_INFO("J-Link hw type uknown 0x%x", jlink_hw_type);
+ else
+ LOG_INFO("J-Link hw type %s", jlink_hw_type_str[jlink_hw_type]);
}
if (jlink_caps & (1 << EMU_CAP_GET_MAX_BLOCK_SIZE))