This is an automated email from Gerrit. "liangzhen <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9692
-- gerrit commit 3eb86f23baf6ead6b2493e4d011beb48f56a6247 Author: Zane Leung <[email protected]> Date: Thu May 21 12:31:54 2026 +0800 target: add poll_interval command support Add poll_interval command to allow adjustment of target state polling interval. Change-Id: Id3e45f704b0866914f3d62cbc7a077f5de4fb843 Signed-off-by: Zane Leung <[email protected]> diff --git a/src/target/target.c b/src/target/target.c index 4d87412381..fc688454a1 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -119,7 +119,7 @@ static struct target_timer_callback *target_timer_callbacks; static int64_t target_timer_next_event_value; static OOCD_LIST_HEAD(target_reset_callback_list); static OOCD_LIST_HEAD(target_trace_callback_list); -static const unsigned int polling_interval = TARGET_DEFAULT_POLLING_INTERVAL; +static unsigned int polling_interval = TARGET_DEFAULT_POLLING_INTERVAL; static OOCD_LIST_HEAD(empty_smp_targets); enum nvp_assert { @@ -3144,6 +3144,38 @@ COMMAND_HANDLER(handle_poll_command) return retval; } +COMMAND_HANDLER(handle_poll_interval_command) +{ + int retval = ERROR_OK; + + switch (CMD_ARGC) { + case 0: + command_print(CMD, "target state polling interval: %dms", polling_interval); + break; + case 1: + retval = parse_uint(CMD_ARGV[0], &polling_interval); + if (retval != ERROR_OK) + return ERROR_COMMAND_SYNTAX_ERROR; + + /* If target has been initialized, update the timer callback */ + if (CMD_CTX->mode == COMMAND_EXEC) { + retval = target_unregister_timer_callback(&handle_target, CMD_CTX->interp); + if (retval != ERROR_OK) + return retval; + + retval = target_register_timer_callback(&handle_target, + polling_interval, TARGET_TIMER_TYPE_PERIODIC, CMD_CTX->interp); + if (retval != ERROR_OK) + return retval; + } + break; + default: + return ERROR_COMMAND_SYNTAX_ERROR; + } + + return retval; +} + COMMAND_HANDLER(handle_wait_halt_command) { if (CMD_ARGC > 1) @@ -6230,6 +6262,13 @@ static const struct command_registration target_command_handlers[] = { .chain = target_subcommand_handlers, .usage = "", }, + { + .name = "poll_interval", + .handler = handle_poll_interval_command, + .mode = COMMAND_ANY, + .help = "set the target state polling interval", + .usage = "[milliseconds]", + }, COMMAND_REGISTRATION_DONE }; --
