From 450581cc0aac6911fb1b1f22350dd7d60f8d1975 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Wed, 10 Aug 2022 00:27:55 +0100 Subject: [PATCH] hosted/bmp_remote: Implemented support for the new remote protocol target clock tristating --- src/platforms/hosted/bmp_remote.c | 11 +++++++++++ src/platforms/hosted/bmp_remote.h | 14 ++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/platforms/hosted/bmp_remote.c b/src/platforms/hosted/bmp_remote.c index 4444112..0c9354c 100644 --- a/src/platforms/hosted/bmp_remote.c +++ b/src/platforms/hosted/bmp_remote.c @@ -180,6 +180,17 @@ const char *remote_target_voltage(void) return (char *)&construct[1]; } +void remote_target_clk_output_enable(const bool enable) +{ + char buffer[REMOTE_MAX_MSG_SIZE]; + int length = snprintf(buffer, REMOTE_MAX_MSG_SIZE, REMOTE_TARGET_CLK_OE_STR, enable ? '1' : '0'); + platform_buffer_write((uint8_t *)buffer, length); + + length = platform_buffer_read((uint8_t *)buffer, REMOTE_MAX_MSG_SIZE); + if (length < 1 || buffer[0] == REMOTE_RESP_ERR) + DEBUG_WARN("remote_target_clk_output_enable failed, error %s\n", length ? buffer + 1 : "unknown"); +} + static uint32_t remote_adiv5_dp_read(ADIv5_DP_t *dp, uint16_t addr) { (void)dp; diff --git a/src/platforms/hosted/bmp_remote.h b/src/platforms/hosted/bmp_remote.h index 8711c08..294da90 100644 --- a/src/platforms/hosted/bmp_remote.h +++ b/src/platforms/hosted/bmp_remote.h @@ -16,8 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#if !defined(__BMP_REMOTE_H_) -#define __BMP_REMOTE_H_ +#ifndef __BMP_REMOTE_H_ +#define __BMP_REMOTE_H_ + #include "jtagtap.h" #include "adiv5.h" #include "target.h" @@ -33,13 +34,14 @@ int remote_swdptap_init(ADIv5_DP_t *dp); int remote_jtagtap_init(jtag_proc_t *jtag_proc); bool remote_target_get_power(void); const char *remote_target_voltage(void); -bool remote_target_set_power(const bool power); +bool remote_target_set_power(bool power); void remote_nrst_set_val(bool assert); bool remote_nrst_get_val(void); void remote_max_frequency_set(uint32_t freq); uint32_t remote_max_frequency_get(void); -const char *platform_target_voltage(void); +void remote_target_clk_output_enable(bool enable); + void remote_adiv5_dp_defaults(ADIv5_DP_t *dp); void remote_add_jtag_dev(uint32_t i, const jtag_dev_t *jtag_dev); -#define __BMP_REMOTE_H_ -#endif + +#endif /*__BMP_REMOTE_H_*/