This is an automated email from Gerrit.

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

-- gerrit

commit 0a080329650360cfd67ad048f8e89654c24daf10
Author: Antonio Borneo <[email protected]>
Date:   Thu Jan 2 10:23:16 2020 +0100

    TEST: cmsis_dap_usb: add command to control adapter's led
    
    DO NOT MERGE THIS PATCH
    
    This patch is for testing http://openocd.zylin.com/5385/ only.
    Should not be merged as is and I will abandon it soon.
    It adds the command "cmsis-dap led <led_N> <value>".
    
    If you really need a tcl command to control the leds of an adapter
    please consider adding a more generic command "adapter led ...",
    aligned with the patch http://openocd.zylin.com/4774/ and the
    following in the same series.
    
    Change-Id: I4a88bcf7fac8af517550ee2d5c31158c091fe514
    Signed-off-by: Antonio Borneo <[email protected]>

diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c
index 4c880ef..ead17bf 100644
--- a/src/jtag/drivers/cmsis_dap_usb.c
+++ b/src/jtag/drivers/cmsis_dap_usb.c
@@ -1688,6 +1688,23 @@ COMMAND_HANDLER(cmsis_dap_handle_cmd_command)
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(cmsis_dap_handle_led_command)
+{
+       unsigned long int led, state;
+
+       if (CMD_ARGC != 2)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       led = strtoul(CMD_ARGV[0], NULL, 0);
+       state = strtoul(CMD_ARGV[1], NULL, 0);
+       if (led > 255 || state > 255) {
+               LOG_ERROR("Value out of range");
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       }
+
+       return cmsis_dap_cmd_DAP_LED(led, state);
+}
+
 COMMAND_HANDLER(cmsis_dap_handle_vid_pid_command)
 {
        if (CMD_ARGC > MAX_USB_IDS * 2) {
@@ -1754,6 +1771,13 @@ static const struct command_registration 
cmsis_dap_subcommand_handlers[] = {
                .usage = "",
                .help = "issue cmsis-dap command",
        },
+       {
+               .name = "led",
+               .handler = &cmsis_dap_handle_led_command,
+               .mode = COMMAND_ANY,
+               .usage = "<led_N> <value>",
+               .help = "set led value",
+       },
        COMMAND_REGISTRATION_DONE
 };
 

-- 


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

Reply via email to