This is an automated email from Gerrit.

Anonymous Coward ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/5336

-- gerrit

commit 57b744cc0b23064b79ad60782effec792d7d8644
Author: Alexandru Gagniuc <[email protected]>
Date:   Sun Oct 27 12:04:11 2019 -0500

    jtag: cmsis-dap: Add support for JTAG_PINS command
    
    The cmsis-dap protocol supports controlling JTAG pins via the
    DAP_SWJ_PINS command. It is already done in other places in the
    cmsis-dap driver.
    
    The call to cmsis_dap_get_status() is done in order to have a log that
    the JTAG pins have indeed been toggled.
    
    Change-Id: I6102a3593ec5e4205f9bc02ecd4806fc6d3e3634
    Signed-off-by: Alexandru Gagniuc <[email protected]>

diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c
index d52d698..81ca128 100644
--- a/src/jtag/drivers/cmsis_dap_usb.c
+++ b/src/jtag/drivers/cmsis_dap_usb.c
@@ -1576,6 +1576,27 @@ static void cmsis_dap_execute_tms(struct jtag_command 
*cmd)
        cmsis_dap_cmd_DAP_SWJ_Sequence(cmd->cmd.tms->num_bits, 
cmd->cmd.tms->bits);
 }
 
+static uint8_t map_oocd_pin_mask_to_cmsis_dap(uint8_t pin_mask)
+{
+       /* OpeonOCD definitions match the CMSIS-DAP spec (for now). */
+       return pin_mask;
+}
+
+static void cmsis_dap_execute_pins(struct jtag_command *cmd)
+{
+       uint8_t pin_values, pins;
+       int ret;
+
+       pin_values = map_oocd_pin_mask_to_cmsis_dap(cmd->cmd.pins->pin_state);
+       pins = map_oocd_pin_mask_to_cmsis_dap(cmd->cmd.pins->pin_mask);
+
+       ret = cmsis_dap_cmd_DAP_SWJ_Pins(pin_values, pins, 0, NULL);
+       if (ret != ERROR_OK)
+               return;
+
+       cmsis_dap_get_status();
+}
+
 /* TODO: Is there need to call cmsis_dap_flush() for the JTAG_PATHMOVE,
  * JTAG_RUNTEST, JTAG_STABLECLOCKS? */
 static void cmsis_dap_execute_command(struct jtag_command *cmd)
@@ -1608,6 +1629,9 @@ static void cmsis_dap_execute_command(struct jtag_command 
*cmd)
                case JTAG_TMS:
                        cmsis_dap_execute_tms(cmd);
                        break;
+               case JTAG_PINS:
+                       cmsis_dap_execute_pins(cmd);
+                       break;
                default:
                        LOG_ERROR("BUG: unknown JTAG command type 0x%X 
encountered", cmd->type);
                        exit(-1);

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to