From: openocd-gerrit <ope...@us...> - 2025-02-11 11:58:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d09f53a930676817a49ae7c575c705487ea51861 (commit) from 82277462b91506a9e7ee4bdcee86d6b414d59149 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d09f53a930676817a49ae7c575c705487ea51861 Author: Richard Pasek <rp...@go...> Date: Thu Jan 30 05:38:08 2025 -0500 driver/linuxspidev: Clear queue on allocation SWD idle clocks are added to the queue by advancing the queue index assuming the queue is zeroed. If the queue isn't zeroed, these idle clocks end up being filled with junk data. Lets clear the queue and associated buffers on queue allocation. TEST: Connects successfully and ran the following TCL command: dump_image /dev/null 0x20000000 0x42000 Host: Unnamed Qualcomm SoC with QUPv3 based SPI port Target: RT500 Signed-off-by: Richard Pasek <rp...@go...> Change-Id: Ie660c10c27c4d0937ab0629138935ddbf5aeb0ae Fixes: 83e0293f7ba3 ("Add Linux SPI device SWD adapter support") Reviewed-on: https://review.openocd.org/c/openocd/+/8730 Reviewed-by: Tomas Vanek <va...@fb...> Reviewed-by: Jonathon Reinhart <jrr...@go...> Tested-by: jenkins diff --git a/src/jtag/drivers/linuxspidev.c b/src/jtag/drivers/linuxspidev.c index 73d5e8bed..6a149a977 100644 --- a/src/jtag/drivers/linuxspidev.c +++ b/src/jtag/drivers/linuxspidev.c @@ -230,10 +230,21 @@ static void spidev_free_queue(void) tx_flip_buf = NULL; } +static void spidev_clear_queue(void) +{ + queue_fill = 0; + queue_buf_fill = 0; + + memset(queue_infos, 0, sizeof(struct queue_info) * max_queue_entries); + memset(queue_tx_buf, 0, queue_buf_size); + memset(queue_rx_buf, 0, queue_buf_size); + memset(tx_flip_buf, 0, queue_buf_size); +} + static int spidev_alloc_queue(unsigned int new_queue_entries) { if (queue_fill || queue_buf_fill) { - LOG_ERROR("Can't realloc allocate queue when queue is in use"); + LOG_ERROR("Can't realloc queue when queue is in use"); return ERROR_FAIL; } @@ -259,6 +270,8 @@ static int spidev_alloc_queue(unsigned int new_queue_entries) max_queue_entries = new_queue_entries; queue_buf_size = new_queue_buf_size; + spidev_clear_queue(); + LOG_DEBUG("Set queue entries to %u (buffers %u bytes)", max_queue_entries, queue_buf_size); return ERROR_OK; @@ -400,12 +413,7 @@ static int spidev_swd_execute_queue(unsigned int end_idle_bytes) } skip: - // Clear everything in the queue - queue_fill = 0; - queue_buf_fill = 0; - memset(queue_infos, 0, sizeof(queue_infos[0]) * max_queue_entries); - memset(queue_tx_buf, 0, queue_buf_size); - memset(queue_rx_buf, 0, queue_buf_size); + spidev_clear_queue(); int retval = queue_retval; queue_retval = ERROR_OK; ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/linuxspidev.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) hooks/post-receive -- Main OpenOCD repository |