This is an automated email from Gerrit. Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4029
-- gerrit commit 6a7e5123b7eca873fddb7b4b29112495498d8f57 Author: Tomas Vanek <[email protected]> Date: Tue Feb 28 22:52:24 2017 +0100 jtag/drivers KitProg: add JTAG_TO_SWD sequence An USB command to generate JTAG_TO_SWD was discovered in KitProg firmware. PSoC 5LP and other SWJ equipped devices now work without Cypress' proprietary acquire command. While on it add a define DEVICE_UNKNOWN as a ACQUIRE_SWD_TARGET parameter. Change-Id: I70cb121f7b0311bfb21faf5bde2fe9e1d5bdfe36 Signed-off-by: Tomas Vanek <[email protected]> diff --git a/src/jtag/drivers/kitprog.c b/src/jtag/drivers/kitprog.c index 1fe8d27..869bcf1 100644 --- a/src/jtag/drivers/kitprog.c +++ b/src/jtag/drivers/kitprog.c @@ -66,13 +66,17 @@ #define PROTOCOL_JTAG 0x00 #define PROTOCOL_SWD 0x01 -#define DEVICE_PSOC4 0x00 -#define DEVICE_PSOC3 0x01 -#define DEVICE_PSOC5 0x03 +#define DEVICE_PSOC4 0x00 +#define DEVICE_PSOC3 0x01 +#define DEVICE_UNKNOWN 0x02 +#define DEVICE_PSOC5 0x03 #define ACQUIRE_MODE_RESET 0x00 #define ACQUIRE_MODE_POWER_CYCLE 0x01 +#define RESET_BUS_LINE_RESET 0x00 +#define RESET_BUS_JTAG_TO_SWD 0x01 + #define PROGRAMMER_NOK_NACK 0x00 #define PROGRAMMER_OK_ACK 0x01 @@ -133,7 +137,7 @@ static int kitprog_acquire_psoc(uint8_t psoc_type, uint8_t acquire_mode, uint8_t max_attempts); static int kitprog_reset_target(void); static int kitprog_swd_sync(void); -static int kitprog_swd_reset(void); +static int kitprog_swd_reset(uint8_t seq_type); static int kitprog_generic_acquire(void); @@ -174,7 +178,7 @@ static int kitprog_init(void) return ERROR_FAIL; /* Reset the SWD bus */ - if (kitprog_swd_reset() != ERROR_OK) + if (kitprog_swd_reset(RESET_BUS_LINE_RESET) != ERROR_OK) return ERROR_FAIL; if (kitprog_init_acquire_psoc) { @@ -540,7 +544,7 @@ static int kitprog_swd_sync(void) return ERROR_OK; } -static int kitprog_swd_reset(void) +static int kitprog_swd_reset(uint8_t seq_type) { int transferred; char status = PROGRAMMER_NOK_NACK; @@ -549,7 +553,7 @@ static int kitprog_swd_reset(void) LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, CONTROL_TYPE_WRITE, (CONTROL_MODE_RESET_SWD_BUS << 8) | CONTROL_COMMAND_PROGRAM, - 0, &status, 1, 0); + seq_type, &status, 1, 0); if (transferred == 0) { LOG_DEBUG("Zero bytes transferred"); @@ -633,11 +637,13 @@ static int kitprog_swd_switch_seq(enum swd_special_seq seq) { switch (seq) { case JTAG_TO_SWD: - LOG_INFO("KitProg adapters do not support the JTAG-to-SWD sequence. An SWD line reset will be performed instead."); - /* Fall through to fix target reset issue */ + LOG_DEBUG("JTAG to SWD"); + if (kitprog_swd_reset(RESET_BUS_JTAG_TO_SWD) != ERROR_OK) + return ERROR_FAIL; + break; case LINE_RESET: LOG_DEBUG("SWD line reset"); - if (kitprog_swd_reset() != ERROR_OK) + if (kitprog_swd_reset(RESET_BUS_LINE_RESET) != ERROR_OK) return ERROR_FAIL; break; default: -- ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
