)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9ebb87aeb0ff018fa0c4af95dbdde83d1ea5c487","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":1,"id":"1a32fb8d_ee588ed3","updated":"2024-12-11 08:43:36.000000000","message":"Looks interesting.\n\nPlease fix all style errors reported by checkpatch - you may run `tools/checkpatch.sh` locally after `git commit ...`\n\nThe driver should be described in doc/openocd.texi, chapter `8.2 Interface Drivers`","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"9b3f5c3410640dff0d79f8ebc799f45a4ea850ad","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"5516cdb4_042485a9","in_reply_to":"1a32fb8d_ee588ed3","updated":"2024-12-11 16:26:33.000000000","message":"Done","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"35d3857eb9a36e6938bfe4ac73686afb43771419","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"57d170e7_ac523e04","in_reply_to":"5516cdb4_042485a9","updated":"2024-12-18 16:59:32.000000000","message":"Hi Tomas, do you have any more thoughts here?","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4feb2fe8b316cc4d20df482c250175ed71f092a9","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"8e9e7532_a5d6a3ed","updated":"2024-12-19 16:21:18.000000000","message":"Antonio, could you take a look to https://review.openocd.org/c/openocd/+/8645/comment/20307b3d_7b8bc6f9/\nThanks","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"c3ebc17c_23714c11","updated":"2024-12-19 15:33:32.000000000","message":"I tested spidev on RPi5.\nKind of slowish performance (~84 KiB/s @ adapter speed 10000) in comparison to USB FS based and properly buffered CMSIS-DAP (376 KiB/s up, 496 KiB/s down @ adapter speed 10000). However still more than 2 times faster than linuxgpiod (28 KiB/s up, 37 KiB/s down). Could be the negative impact of PCI-E connection of RP1 io chip.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"f0e68b98_75ad88c1","updated":"2024-12-19 15:33:32.000000000","message":"I tested spidev on RPi5.\nThe adapter is kind of slowish performance (~84 KiB/s @ adapter speed 10000) in comparison to USB FS based and properly buffered CMSIS-DAP (376 KiB/s up, 496 KiB/s down @ adapter speed 10000). However still more than 2 times faster than linuxgpiod (28 KiB/s up, 37 KiB/s down). Could be the negative impact of PCI-E connection of RP1 io chip.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"74e4db06259bd5e8201bc3c39431c3552a95ef62","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"dd34668c_dbbb2dd4","in_reply_to":"1a9c1749_abff4712","updated":"2024-12-19 20:46:16.000000000","message":"Nothing special in my setup. Running the fresh build without installing:\n```\n~/openocd/build/src/openocd -s ~/openocd/tcl -c \u0027adapter driver linuxspidev;spidev path /dev/spidev0.0\u0027 -f stm32h7x.cfg -c \u0027source ../speed_test.tcl\u0027\n```\nThe target MCU is STM32H7A3. MOSI to SWDIO resistor is probably 470 ohm.\nI should upload speed_test script somewhere.\nBasically I first do\n```\n\u003e adapter speed 10000\n\u003e halt\n\u003e poll off\n```\n\nto avoid interference and then run several times\n```\n\u003e dump_image ram_content.bin $ram_addr $ram_size\ndumped 131072 bytes in 1.520326s (84.192 KiB/s)\n \n\u003e dump_image /dev/null $ram_addr $ram_size\ndumped 131072 bytes in 1.520097s (84.205 KiB/s)\n \n\u003e dump_image /dev/null $ram_addr $ram_size\ndumped 131072 bytes in 1.516809s (84.388 KiB/s)\n\n\u003e load_image ram_content.bin $ram_addr\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 1.511451s (84.687 KiB/s)\n \n\u003e load_image ram_content.bin $ram_addr\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 1.515299s (84.472 KiB/s)\n \n\u003e load_image ram_content.bin $ram_addr\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 1.516352s (84.413 KiB/s)\n\n```\nwhere the parameters are `{ ram_size 0x20000 } { ram_addr 0x20000000 }`\n\nI also tested to change cpufreq governor and /sys/module/pcie_aspm/parameters/policy to `performance` but the results were almost the same. \nI assume RPi4 and RPi3 perform faster without delays on PCI-E bus.\nBut they also perform reasonably fast with the native bitbang (bcm2835gpio driver).\nI used intentionally RPi5 for testing as it has no native bitbang support and the linuxgpiod driver is slow and doesn\u0027t have speed setting.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"d63939b8e8cadc811528e7197c95d8b1ae5114a4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"dbeb8764_19fb19fa","in_reply_to":"3ef7f97e_8d3a2c73","updated":"2024-12-20 09:42:49.000000000","message":"\u003e Maybe our performance would be improved by queuing up multiple SWD transactions into single SPI transactions? 6 bytes per round trip doesn\u0027t sound like we are making best use of these architectures.\n\nSure it would boost the performance. Most of OpenOCD adapter drivers do so (except bitbanged ones). But the driver would get much more complicated with queuing.... As the spidev adapter will always be of limited use due to the resistor hack I\u0027m not sure if the queuing is worth to implement.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"f2c97efa9186e4b71164c3292262e1eb7ec3d85f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"1a9c1749_abff4712","in_reply_to":"c3ebc17c_23714c11","updated":"2024-12-19 18:14:14.000000000","message":"I\u0027m pretty surprised how slow that is. Can you share with me your test setup and how you performed the test?","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"d0cfb2ffec40bd8ef486f5a0c97ff96e532daaf4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"3ef7f97e_8d3a2c73","in_reply_to":"dd34668c_dbbb2dd4","updated":"2024-12-19 23:10:27.000000000","message":"I\u0027m traveling at the moment so I\u0027ve used the unnamed Qualcomm part connected to the computer at my desk to speak to the RP 2040 at 4 MHz. The performance is quite poor\n\n```\u003e dump_image /dev/null 0x20000000 0x42000      \ndumped 270336 bytes in 21.766741s (12.129 KiB/s)```\n\nLooking at `top` I see that there is only 3% CPU usage when running that command so we are certainly not CPU bound.\n\nThis design, like RPI 5, has the SPI bus on a separate system. I suspect the performance is poor here as well because we are paying multiple penalties to get to the SPI port.\n\nMaybe our performance would be improved by queuing up multiple SWD transactions into single SPI transactions? 6 bytes per round trip doesn\u0027t sound like we are making best use of these architectures.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":10,"id":"d950e0a9_29e6c506","updated":"2024-12-21 14:43:01.000000000","message":"Thanks for this patch.\nI have seen it from the original developer, but I never had time to port it to upstream.\nI have not really reviewed the adapter\u0027s code, I just run a quick check around. I plan to return on it soon","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"94937de205c774f593cf95ae0150df4decda324e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":14,"id":"d81a2fac_73348464","updated":"2024-12-24 09:40:35.000000000","message":"Jenkins try to build this driver on Windows and fails for lack of `sys/ioctl.h`.\nI\u0027m checking what\u0027s wrong with configure","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"09c83113e775bd279e90ed6425eb804ba913a936","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":22,"id":"21c44d35_6cbdf3fa","updated":"2025-01-05 19:18:11.000000000","message":"Thanks!","commit_id":"0720fc865c2946e1a382223aff7561f8cd0d0426"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"8b53d27f3f7d4bc6d011c93fd3228829fd364088","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":24,"id":"25237cde_289980f7","updated":"2025-01-07 16:32:44.000000000","message":"Looks mostly ok, thanks.\nI have two further comments below","commit_id":"b95b908002dc68e3a0764c0581b98c12f29aae50"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"db57811cf6049c377764159050e62b9d952d4df0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"53a9b2da_368af0bc","updated":"2025-01-08 10:32:41.000000000","message":"Please make your comments consistent:\n\n```\n// Single line comments.\n\n/*\n * Multi-line\n * comments.\n */\n```","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"faba3a843b528fa78ebb08b9f1eb6312d00851c5","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"99dbdd2b_c3ff2a68","updated":"2025-01-08 09:31:52.000000000","message":"Thanks!","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"73c13e464c8ec2ebc33663c212480560b8ba3551","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"dbec4370_226895ec","in_reply_to":"0dc18d3d_679e739c","updated":"2025-01-11 17:03:08.000000000","message":"Thanks for the changes Richard! I have only two general thoughts (also @Antonio and @Tomas):\n\n - Why is the driver name different from the registered commands: `spidev` vs `linuxspidev`? What is the reason for this decision?\n - Should the user have to read a Linux header file to understand `spi_mode`? Would it be possible (and more user-friendly) to use strings for `spi_mode`?","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"546dbd3c42ccd57be5223b2fcd3f14c49400e8bc","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"0dc18d3d_679e739c","in_reply_to":"53a9b2da_368af0bc","updated":"2025-01-10 01:48:00.000000000","message":"Hi Marc,\nAny other thoughts on this CL?","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"482fc6df1b58c2896fe212c4e76a82ec2dacc598","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":25,"id":"aa55473a_f8f405e5","in_reply_to":"dbec4370_226895ec","updated":"2025-01-11 21:14:42.000000000","message":"* While I haven\u0027t mentioned it anywhere I\u0027m optimistic that spidev can be applied to other platforms as well, for example https://learn.microsoft.com/en-us/uwp/api/windows.devices.spi. I\u0027m hopeful that .cfg files would be able to function on any spidev enabled platform. But to be honest, I don\u0027t know if anyone will put in the effort to port this to Windows.\n\n* I think the default spi_mode should always work (mode 3 matches SWD requirements) except in circumstances where the driver is written improperly or some additional advanced features are needed. For example SPI_MOSI_IDLE_LOW or SPI_NO_CS. I\u0027d like to provide the pointer to this information but not document the advanced features as these features will likely be added to in Linux in the future. I suppose for most users I\u0027d like them to ignore that spi_mode exists.","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"f842cf035f02ddafe519f81d451c15d88fe522a0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":32,"id":"1da6179c_94de3aad","updated":"2025-01-14 15:53:14.000000000","message":"Marc?","commit_id":"b03903bfb07c27b75edc45261ea5c4f11ffe8830"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"edb3b6c24f83606096f04d9c5b134692d08f8b9a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":32,"id":"7a64741e_542d1733","updated":"2025-01-22 15:21:02.000000000","message":"Richard, a recommendation for future development of spidev: the driver needs a way to handle SRST signal. Ideally reuse a part of linuxgpiod.c and make it optionally available for other adapter drivers.","commit_id":"b03903bfb07c27b75edc45261ea5c4f11ffe8830"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"1fe2ac8ac2dfc68d691e210dbf531085d3aea332","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":32,"id":"882360b0_c2012cc0","updated":"2025-01-15 10:42:34.000000000","message":"Thanks!","commit_id":"b03903bfb07c27b75edc45261ea5c4f11ffe8830"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"c664660c5c2639265d0fc19711d6f009c0d11648","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":32,"id":"ad23a886_7c7812f7","updated":"2025-01-15 00:02:15.000000000","message":"Thanks!","commit_id":"b03903bfb07c27b75edc45261ea5c4f11ffe8830"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"ba521e283478a856eddedbdccfa204da4a98bd5c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":33,"id":"71f276f1_0a08d5f2","updated":"2025-01-23 14:06:28.000000000","message":"Thanks everyone!\n\nI appreciate the additional input by the OpenOCD team. It led to remarkable improvement of Linuxspidev.","commit_id":"83e0293f7ba3604b4ad98b3a8101388e3e52f9fe"}],"configure.ac":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":297,"context_line":"  LIBJAYLINK_ADAPTERS"},{"line_number":298,"context_line":"  ],[auto])"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"AC_ARG_ADAPTERS([LINUXSPIDEV_ADAPTER],[no])"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"AC_ARG_ADAPTERS([DUMMY_ADAPTER],[no])"},{"line_number":303,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":10,"id":"fb9a0019_989aaef7","line":300,"updated":"2024-12-21 14:43:01.000000000","message":"I prefer having it in the list above, so it gets `[auto]`\nWe want a wider compile coverage of these optional drivers, so let user disable them if they really need to save few memory in the OpenOCD binary.\nThere are incoming patches on this topic, if you are interested:\nhttps://review.openocd.org/q/author:rdiezmail-openocd%2540yahoo.de+configure.ac","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":297,"context_line":"  LIBJAYLINK_ADAPTERS"},{"line_number":298,"context_line":"  ],[auto])"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"AC_ARG_ADAPTERS([LINUXSPIDEV_ADAPTER],[no])"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"AC_ARG_ADAPTERS([DUMMY_ADAPTER],[no])"},{"line_number":303,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":10,"id":"bf0e0ef1_f3b290bb","line":300,"in_reply_to":"fb9a0019_989aaef7","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":372,"context_line":"  AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),"},{"line_number":373,"context_line":"  [build_sysfsgpio\u003d$enableval], [build_sysfsgpio\u003dno])"},{"line_number":374,"context_line":""},{"line_number":375,"context_line":"AC_ARG_ENABLE([linuxspidev],"},{"line_number":376,"context_line":"  AS_HELP_STRING([--enable-linuxspidev], [Enable building support for SWD via Linux SPI DEV]),"},{"line_number":377,"context_line":"  [build_linuxspidev\u003d$enableval], [build_linuxspidev\u003dno])"},{"line_number":378,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":10,"id":"04dfd85c_de156d86","line":375,"updated":"2024-12-21 14:43:01.000000000","message":"this can be dropped, as it is already partially covered inside the use of `AC_ARG_ADAPTERS` macro above.\nIt automatically triggers a set of other cleanup...","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":372,"context_line":"  AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),"},{"line_number":373,"context_line":"  [build_sysfsgpio\u003d$enableval], [build_sysfsgpio\u003dno])"},{"line_number":374,"context_line":""},{"line_number":375,"context_line":"AC_ARG_ENABLE([linuxspidev],"},{"line_number":376,"context_line":"  AS_HELP_STRING([--enable-linuxspidev], [Enable building support for SWD via Linux SPI DEV]),"},{"line_number":377,"context_line":"  [build_linuxspidev\u003d$enableval], [build_linuxspidev\u003dno])"},{"line_number":378,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":10,"id":"d309e8be_99e409d4","line":375,"in_reply_to":"04dfd85c_de156d86","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":385,"context_line":"      AC_MSG_ERROR([sysfsgpio is only available on linux])"},{"line_number":386,"context_line":"    ])"},{"line_number":387,"context_line":""},{"line_number":388,"context_line":"    AS_IF([test \"x$build_linuxspidev\" \u003d \"xyes\"], ["},{"line_number":389,"context_line":"      AC_MSG_ERROR([linuxspidev is only available on linux])"},{"line_number":390,"context_line":"    ])"},{"line_number":391,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":10,"id":"15c66eaf_5de1d8b3","line":388,"updated":"2024-12-21 14:43:01.000000000","message":"No, please drop it here, as it should use the macro `is_linux` some lines below. I will show you where...","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":385,"context_line":"      AC_MSG_ERROR([sysfsgpio is only available on linux])"},{"line_number":386,"context_line":"    ])"},{"line_number":387,"context_line":""},{"line_number":388,"context_line":"    AS_IF([test \"x$build_linuxspidev\" \u003d \"xyes\"], ["},{"line_number":389,"context_line":"      AC_MSG_ERROR([linuxspidev is only available on linux])"},{"line_number":390,"context_line":"    ])"},{"line_number":391,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":10,"id":"66561e69_b5f5dfd6","line":388,"in_reply_to":"15c66eaf_5de1d8b3","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":645,"context_line":"  AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don\u0027t want SysfsGPIO driver.])"},{"line_number":646,"context_line":"])"},{"line_number":647,"context_line":""},{"line_number":648,"context_line":"AS_IF([test \"x$build_linuxspidev\" !\u003d \"xno\"], ["},{"line_number":649,"context_line":"  AC_DEFINE([BUILD_LINUXSPIDEV], [1], [1 if you want the Linux SPI DEV driver.])"},{"line_number":650,"context_line":"], ["},{"line_number":651,"context_line":"  AC_DEFINE([BUILD_LINUXSPIDEV], [0], [0 if you don\u0027t want the Linux SPI DEV driver.])"}],"source_content_type":"application/octet-stream","patch_set":10,"id":"f55db63b_2469d660","line":648,"updated":"2024-12-21 14:43:01.000000000","message":"Drop this too","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":645,"context_line":"  AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don\u0027t want SysfsGPIO driver.])"},{"line_number":646,"context_line":"])"},{"line_number":647,"context_line":""},{"line_number":648,"context_line":"AS_IF([test \"x$build_linuxspidev\" !\u003d \"xno\"], ["},{"line_number":649,"context_line":"  AC_DEFINE([BUILD_LINUXSPIDEV], [1], [1 if you want the Linux SPI DEV driver.])"},{"line_number":650,"context_line":"], ["},{"line_number":651,"context_line":"  AC_DEFINE([BUILD_LINUXSPIDEV], [0], [0 if you don\u0027t want the Linux SPI DEV driver.])"}],"source_content_type":"application/octet-stream","patch_set":10,"id":"492a8d53_025dbc24","line":648,"in_reply_to":"f55db63b_2469d660","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":747,"context_line":"PROCESS_ADAPTERS([PCIE_ADAPTERS], [\"x$is_linux\" \u003d \"xyes\"], [Linux build])"},{"line_number":748,"context_line":"PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], [\"x$can_build_buspirate\" \u003d \"xyes\"],"},{"line_number":749,"context_line":"                                         [internal error: validation should happen beforehand])"},{"line_number":750,"context_line":"PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], [true], [unused])"},{"line_number":751,"context_line":"PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])"},{"line_number":752,"context_line":""},{"line_number":753,"context_line":"AS_IF([test \"x$enable_linuxgpiod\" !\u003d \"xno\"], ["}],"source_content_type":"application/octet-stream","patch_set":10,"id":"015a4be5_389b58d1","line":750,"updated":"2024-12-21 14:43:01.000000000","message":"Copy from `PCIE_ADAPTERS`:\n`PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], [\"x$is_linux\" \u003d \"xyes\"], [Linux build])`","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":747,"context_line":"PROCESS_ADAPTERS([PCIE_ADAPTERS], [\"x$is_linux\" \u003d \"xyes\"], [Linux build])"},{"line_number":748,"context_line":"PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], [\"x$can_build_buspirate\" \u003d \"xyes\"],"},{"line_number":749,"context_line":"                                         [internal error: validation should happen beforehand])"},{"line_number":750,"context_line":"PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], [true], [unused])"},{"line_number":751,"context_line":"PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])"},{"line_number":752,"context_line":""},{"line_number":753,"context_line":"AS_IF([test \"x$enable_linuxgpiod\" !\u003d \"xno\"], ["}],"source_content_type":"application/octet-stream","patch_set":10,"id":"0a6746ba_e0977180","line":750,"in_reply_to":"015a4be5_389b58d1","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":803,"context_line":"AM_CONDITIONAL([GW16012], [test \"x$build_gw16012\" \u003d \"xyes\"])"},{"line_number":804,"context_line":"AM_CONDITIONAL([REMOTE_BITBANG], [test \"x$build_remote_bitbang\" \u003d \"xyes\"])"},{"line_number":805,"context_line":"AM_CONDITIONAL([SYSFSGPIO], [test \"x$build_sysfsgpio\" \u003d \"xyes\"])"},{"line_number":806,"context_line":"AM_CONDITIONAL([LINUXSPIDEV], [test \"x$build_linuxspidev\" \u003d \"xyes\"])"},{"line_number":807,"context_line":"AM_CONDITIONAL([USE_LIBUSB1], [test \"x$use_libusb1\" \u003d \"xyes\"])"},{"line_number":808,"context_line":"AM_CONDITIONAL([IS_CYGWIN], [test \"x$is_cygwin\" \u003d \"xyes\"])"},{"line_number":809,"context_line":"AM_CONDITIONAL([IS_MINGW], [test \"x$is_mingw\" \u003d \"xyes\"])"}],"source_content_type":"application/octet-stream","patch_set":10,"id":"42233eeb_5e2b7a60","line":806,"updated":"2024-12-21 14:43:01.000000000","message":"No need for this line, drop it","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":803,"context_line":"AM_CONDITIONAL([GW16012], [test \"x$build_gw16012\" \u003d \"xyes\"])"},{"line_number":804,"context_line":"AM_CONDITIONAL([REMOTE_BITBANG], [test \"x$build_remote_bitbang\" \u003d \"xyes\"])"},{"line_number":805,"context_line":"AM_CONDITIONAL([SYSFSGPIO], [test \"x$build_sysfsgpio\" \u003d \"xyes\"])"},{"line_number":806,"context_line":"AM_CONDITIONAL([LINUXSPIDEV], [test \"x$build_linuxspidev\" \u003d \"xyes\"])"},{"line_number":807,"context_line":"AM_CONDITIONAL([USE_LIBUSB1], [test \"x$use_libusb1\" \u003d \"xyes\"])"},{"line_number":808,"context_line":"AM_CONDITIONAL([IS_CYGWIN], [test \"x$is_cygwin\" \u003d \"xyes\"])"},{"line_number":809,"context_line":"AM_CONDITIONAL([IS_MINGW], [test \"x$is_mingw\" \u003d \"xyes\"])"}],"source_content_type":"application/octet-stream","patch_set":10,"id":"1dd9cc8d_10f14d82","line":806,"in_reply_to":"42233eeb_5e2b7a60","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"6f7a12ccea3ca35dd5dea9c104f99a54e60d917a","unresolved":true,"context_lines":[{"line_number":730,"context_line":"PROCESS_ADAPTERS([PCIE_ADAPTERS], [\"x$is_linux\" \u003d \"xyes\"], [Linux build])"},{"line_number":731,"context_line":"PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], [\"x$can_build_buspirate\" \u003d \"xyes\"],"},{"line_number":732,"context_line":"                                         [internal error: validation should happen beforehand])"},{"line_number":733,"context_line":"PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], [true], [\"x$is_linux\" \u003d \"xyes\"], [Linux spidev])"},{"line_number":734,"context_line":"PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":"AS_IF([test \"x$enable_linuxgpiod\" !\u003d \"xno\"], ["}],"source_content_type":"application/octet-stream","patch_set":14,"id":"129a722f_5a33cb0a","line":733,"updated":"2024-12-24 09:50:21.000000000","message":"The build issue is here. There is a `[true],` that should be dropped:\n`PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], [\"x$is_linux\" \u003d \"xyes\"], [Linux spidev])`","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":false,"context_lines":[{"line_number":730,"context_line":"PROCESS_ADAPTERS([PCIE_ADAPTERS], [\"x$is_linux\" \u003d \"xyes\"], [Linux build])"},{"line_number":731,"context_line":"PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], [\"x$can_build_buspirate\" \u003d \"xyes\"],"},{"line_number":732,"context_line":"                                         [internal error: validation should happen beforehand])"},{"line_number":733,"context_line":"PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], [true], [\"x$is_linux\" \u003d \"xyes\"], [Linux spidev])"},{"line_number":734,"context_line":"PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])"},{"line_number":735,"context_line":""},{"line_number":736,"context_line":"AS_IF([test \"x$enable_linuxgpiod\" !\u003d \"xno\"], ["}],"source_content_type":"application/octet-stream","patch_set":14,"id":"fd28a4cd_7a27bea1","line":733,"in_reply_to":"129a722f_5a33cb0a","updated":"2024-12-24 13:05:14.000000000","message":"Thanks! Good find!","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"}],"doc/openocd.texi":[{"author":{"_account_id":1002348,"name":"Jonathon Reinhart","email":"jrreinhart@google.com"},"change_message_id":"0a191049e1c349c51481038d189a347708c621f9","unresolved":true,"context_lines":[{"line_number":634,"context_line":"@end example"},{"line_number":635,"context_line":""},{"line_number":636,"context_line":"The 1K resistor works well with most MCUs up to 3 MHz. A lower resistance"},{"line_number":637,"context_line":"could be used to achieve higher speeds granted that the client SWDIO pin has"},{"line_number":638,"context_line":"enough drive strength to pull the signal high while being pulled low by this"},{"line_number":639,"context_line":"resistor."},{"line_number":640,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":3,"id":"28b47fe2_37e76127","line":637,"updated":"2024-12-11 17:03:47.000000000","message":"s/client/target/","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"322aa74eb872cdad6afc1fb04bd54988919299d5","unresolved":false,"context_lines":[{"line_number":634,"context_line":"@end example"},{"line_number":635,"context_line":""},{"line_number":636,"context_line":"The 1K resistor works well with most MCUs up to 3 MHz. A lower resistance"},{"line_number":637,"context_line":"could be used to achieve higher speeds granted that the client SWDIO pin has"},{"line_number":638,"context_line":"enough drive strength to pull the signal high while being pulled low by this"},{"line_number":639,"context_line":"resistor."},{"line_number":640,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":3,"id":"d68f7fa4_14db302d","line":637,"in_reply_to":"28b47fe2_37e76127","updated":"2024-12-11 18:00:24.000000000","message":"Done","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":620,"context_line":"Full duplex SPI transactions are used to simultaneously read and write to/from"},{"line_number":621,"context_line":"the target."},{"line_number":622,"context_line":""},{"line_number":623,"context_line":"Electrical connections:"},{"line_number":624,"context_line":"@example"},{"line_number":625,"context_line":"+--------------+                +--------------+"},{"line_number":626,"context_line":"|              |     1K         |              |"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"b73dbf5a_9a6b3cdb","line":623,"updated":"2024-12-21 14:43:01.000000000","message":"It could be interesting to evaluate also another connection.\n- MOSI pin configured as open-collector\n- MISO, MOSI, SWDIO connected together and with a pull-up resistor, eventually re-using the pull-up in MISO and/or MOSI pins.\n\nThis would not be possible in every SoC, but could sometimes offer higher speed than the 1K series resistor.\nFrom SW point of view it would require driving MOSI high to permit MISO to read from SWDIO. I think this driver can be made working in both modes by forcing MOSI high in every time there is no output to SWDIO.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":620,"context_line":"Full duplex SPI transactions are used to simultaneously read and write to/from"},{"line_number":621,"context_line":"the target."},{"line_number":622,"context_line":""},{"line_number":623,"context_line":"Electrical connections:"},{"line_number":624,"context_line":"@example"},{"line_number":625,"context_line":"+--------------+                +--------------+"},{"line_number":626,"context_line":"|              |     1K         |              |"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"0b7e8c71_5e76f9fd","line":623,"in_reply_to":"0cbb5a1a_eeb3964f","updated":"2024-12-23 21:40:07.000000000","message":"I certainly have worked on designs that were asymmetric but I don\u0027t think they are very common anymore.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"601223aa177f81447af57ea0f4c1dfb66a25dee3","unresolved":true,"context_lines":[{"line_number":620,"context_line":"Full duplex SPI transactions are used to simultaneously read and write to/from"},{"line_number":621,"context_line":"the target."},{"line_number":622,"context_line":""},{"line_number":623,"context_line":"Electrical connections:"},{"line_number":624,"context_line":"@example"},{"line_number":625,"context_line":"+--------------+                +--------------+"},{"line_number":626,"context_line":"|              |     1K         |              |"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"c8aef508_7f9978d8","line":623,"in_reply_to":"191bfe15_788fc2ec","updated":"2024-12-21 16:40:56.000000000","message":"4 bit mode does not seem capable enough for SWD anyway:\nThe second TRN of SWD write would be driven by SPI - the series resistor required\nTwo bits after the end of SWD read would not be driven by SPI - pull-down required","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"5271886abb6d5d44cd54adb918b5ae5c86e6170e","unresolved":true,"context_lines":[{"line_number":620,"context_line":"Full duplex SPI transactions are used to simultaneously read and write to/from"},{"line_number":621,"context_line":"the target."},{"line_number":622,"context_line":""},{"line_number":623,"context_line":"Electrical connections:"},{"line_number":624,"context_line":"@example"},{"line_number":625,"context_line":"+--------------+                +--------------+"},{"line_number":626,"context_line":"|              |     1K         |              |"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"ac51068c_55ac8075","line":623,"in_reply_to":"67ece65e_db50af05","updated":"2024-12-21 16:07:24.000000000","message":"There is an additional option of using 4 bit mode instead of 8 bit mode (some SOCs appear to support it) and using 3WIRE mode. With 4 bit mode we will reliably be able to capture the ACK bits on a SWD write. Sadly not a lot of hosts support 3WIRE mode. This will allow for no resistor and very high clock speeds. I think the Broadcom chipsets support this mode of operation.\n\nIt\u0027s possible that it won\u0027t be as fast in practice because we will need to submit RX and TX transactions separately to spidev.\n\nThe unnamed Qualcomm host that I\u0027m using right now doesn\u0027t support 3WIRE mode so I can\u0027t test this idea right now. \n\nIt may be different enough in functionality that it might make sense to have a different driver.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"8941b24d6877baf3b95b969109d6b2eaaf6346d8","unresolved":true,"context_lines":[{"line_number":620,"context_line":"Full duplex SPI transactions are used to simultaneously read and write to/from"},{"line_number":621,"context_line":"the target."},{"line_number":622,"context_line":""},{"line_number":623,"context_line":"Electrical connections:"},{"line_number":624,"context_line":"@example"},{"line_number":625,"context_line":"+--------------+                +--------------+"},{"line_number":626,"context_line":"|              |     1K         |              |"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"191bfe15_788fc2ec","line":623,"in_reply_to":"ac51068c_55ac8075","updated":"2024-12-21 16:23:49.000000000","message":"Re-reading the drivers, it doesn\u0027t appear like Broadcom (or any chipset) supports 4 bit mode and 3WIRE mode so it seems like this idea is out.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"a7ff812a7f62933a3c3cb7ddb56accbfef67b612","unresolved":true,"context_lines":[{"line_number":620,"context_line":"Full duplex SPI transactions are used to simultaneously read and write to/from"},{"line_number":621,"context_line":"the target."},{"line_number":622,"context_line":""},{"line_number":623,"context_line":"Electrical connections:"},{"line_number":624,"context_line":"@example"},{"line_number":625,"context_line":"+--------------+                +--------------+"},{"line_number":626,"context_line":"|              |     1K         |              |"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"67ece65e_db50af05","line":623,"in_reply_to":"b73dbf5a_9a6b3cdb","updated":"2024-12-21 15:36:16.000000000","message":"Antonio,\nI wouldn\u0027t expect any speedup from open-collector/pull-up wiring. The signal slower edge slope always depends on RC constant no matter if the resistor is a pull-up or in series to an output. And the minimal R value is in both cases limited by the lower Iout of both outputs.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3feb18d2e5a578ea4b0ec4070d8f76f7d8960e7a","unresolved":true,"context_lines":[{"line_number":620,"context_line":"Full duplex SPI transactions are used to simultaneously read and write to/from"},{"line_number":621,"context_line":"the target."},{"line_number":622,"context_line":""},{"line_number":623,"context_line":"Electrical connections:"},{"line_number":624,"context_line":"@example"},{"line_number":625,"context_line":"+--------------+                +--------------+"},{"line_number":626,"context_line":"|              |     1K         |              |"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"0cbb5a1a_eeb3964f","line":623,"in_reply_to":"c8aef508_7f9978d8","updated":"2024-12-21 22:59:01.000000000","message":"Tomas,\nI remember of some output circuit of GPIO being asymmetric, with lower Isource than Isink, with higher resistance in the high transistor than in the low one.\nBut I just checked the datasheet of various STM32; the GPIO characteristics seams fully symmetric.\nI probably have my brain lost in an old TTL era.\nLet\u0027s forget my comment!","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":3457,"context_line":"This will create an extra edge when the host releases control of the SPI port"},{"line_number":3458,"context_line":"at the end of a transaction. You\u0027ll need to confirm this with a scope or meter."},{"line_number":3459,"context_line":"Try installing 10K resistors on SWDIO and SWDCLK to ground to stop this."},{"line_number":3460,"context_line":""},{"line_number":3461,"context_line":"@end itemize"},{"line_number":3462,"context_line":"@end deffn"},{"line_number":3463,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":14,"id":"38a9575d_6f237475","line":3460,"updated":"2024-12-24 10:49:05.000000000","message":"You should add here something like:\n```\n@deffn {Config Command} {spidev path} path_to_spidev\nSet the path to the spidev device.\n@end deffn\n\n@deffn {Config Command} {spidev path} mode\nSet the mode of the spi port with optional bit flags (default\u003d3).\n@end deffn\n```\n\nEventually report also that there is an example config file `interface/spidev_example.cfg`","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":true,"context_lines":[{"line_number":3457,"context_line":"This will create an extra edge when the host releases control of the SPI port"},{"line_number":3458,"context_line":"at the end of a transaction. You\u0027ll need to confirm this with a scope or meter."},{"line_number":3459,"context_line":"Try installing 10K resistors on SWDIO and SWDCLK to ground to stop this."},{"line_number":3460,"context_line":""},{"line_number":3461,"context_line":"@end itemize"},{"line_number":3462,"context_line":"@end deffn"},{"line_number":3463,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":14,"id":"ad3c55bd_f8b53e72","line":3460,"in_reply_to":"38a9575d_6f237475","updated":"2024-12-24 13:05:14.000000000","message":"I\u0027ve added the information for where the example is located in the previous commit in doc/openocd.texi at line 3418. Is this not the correct section for these? I figured it was better to have the driver features first and then the electrical connections and then the tips.","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a0358585b4863d93b15c2acb6b25e8d955a3df83","unresolved":false,"context_lines":[{"line_number":3457,"context_line":"This will create an extra edge when the host releases control of the SPI port"},{"line_number":3458,"context_line":"at the end of a transaction. You\u0027ll need to confirm this with a scope or meter."},{"line_number":3459,"context_line":"Try installing 10K resistors on SWDIO and SWDCLK to ground to stop this."},{"line_number":3460,"context_line":""},{"line_number":3461,"context_line":"@end itemize"},{"line_number":3462,"context_line":"@end deffn"},{"line_number":3463,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":14,"id":"c97fbd26_56c521f0","line":3460,"in_reply_to":"ad3c55bd_f8b53e72","updated":"2024-12-24 14:54:13.000000000","message":"I read too quickly and I missed it! Sorry","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"}],"src/jtag/drivers/linuxspidev.c":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9ebb87aeb0ff018fa0c4af95dbdde83d1ea5c487","unresolved":true,"context_lines":[{"line_number":7,"context_line":" *   Copyright (C) 2024 by Richard Pasek                                   *"},{"line_number":8,"context_line":" *   rpasek@google.com\t\t\t\t\t\t\t\t\t\t\t\t\t   *"},{"line_number":9,"context_line":" * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   *"},{"line_number":10,"context_line":" *   This program is free software; you can redistribute it and/or modify  *"},{"line_number":11,"context_line":" *   it under the terms of the GNU General Public License as published by  *"},{"line_number":12,"context_line":" *   the Free Software Foundation; either version 2 of the License, or     *"},{"line_number":13,"context_line":" *   (at your option) any later version.                                   *"},{"line_number":14,"context_line":" *                                                                         *"},{"line_number":15,"context_line":" *   This program is distributed in the hope that it will be useful,       *"},{"line_number":16,"context_line":" *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *"},{"line_number":17,"context_line":" *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *"},{"line_number":18,"context_line":" *   GNU General Public License for more details.                          *"},{"line_number":19,"context_line":" *                                                                         *"},{"line_number":20,"context_line":" *   You should have received a copy of the GNU General Public License     *"},{"line_number":21,"context_line":" *   along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e. *"},{"line_number":22,"context_line":" ***************************************************************************/"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":" /**"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"b17316d3_0e828d36","line":21,"range":{"start_line":10,"start_character":0,"end_line":21,"end_character":76},"updated":"2024-12-11 08:43:36.000000000","message":"Licence text is not needed, SPDX ident is enough","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"9b3f5c3410640dff0d79f8ebc799f45a4ea850ad","unresolved":false,"context_lines":[{"line_number":7,"context_line":" *   Copyright (C) 2024 by Richard Pasek                                   *"},{"line_number":8,"context_line":" *   rpasek@google.com\t\t\t\t\t\t\t\t\t\t\t\t\t   *"},{"line_number":9,"context_line":" * \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   *"},{"line_number":10,"context_line":" *   This program is free software; you can redistribute it and/or modify  *"},{"line_number":11,"context_line":" *   it under the terms of the GNU General Public License as published by  *"},{"line_number":12,"context_line":" *   the Free Software Foundation; either version 2 of the License, or     *"},{"line_number":13,"context_line":" *   (at your option) any later version.                                   *"},{"line_number":14,"context_line":" *                                                                         *"},{"line_number":15,"context_line":" *   This program is distributed in the hope that it will be useful,       *"},{"line_number":16,"context_line":" *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *"},{"line_number":17,"context_line":" *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *"},{"line_number":18,"context_line":" *   GNU General Public License for more details.                          *"},{"line_number":19,"context_line":" *                                                                         *"},{"line_number":20,"context_line":" *   You should have received a copy of the GNU General Public License     *"},{"line_number":21,"context_line":" *   along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e. *"},{"line_number":22,"context_line":" ***************************************************************************/"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":" /**"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"d6aeac92_352c7c23","line":21,"range":{"start_line":10,"start_character":0,"end_line":21,"end_character":76},"in_reply_to":"b17316d3_0e828d36","updated":"2024-12-11 16:26:33.000000000","message":"Done","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9ebb87aeb0ff018fa0c4af95dbdde83d1ea5c487","unresolved":true,"context_lines":[{"line_number":82,"context_line":"#define DATA_BITS 32"},{"line_number":83,"context_line":"#define PARITY_BITS 1"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"#define SWD_TX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + TURN_BITS + DATA_BITS + PARITY_BITS, 8))"},{"line_number":86,"context_line":"#define SWD_RX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS, 8))"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"/// File descriptor for SPI device"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"07c1aa93_8feccccd","line":85,"range":{"start_line":85,"start_character":12,"end_line":85,"end_character":14},"updated":"2024-12-11 08:43:36.000000000","message":"Use SWD_WR_ and SWD_RD_ to comply ADI terminology and to avoid mismatch with SPI TX/RX","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"9b3f5c3410640dff0d79f8ebc799f45a4ea850ad","unresolved":false,"context_lines":[{"line_number":82,"context_line":"#define DATA_BITS 32"},{"line_number":83,"context_line":"#define PARITY_BITS 1"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"#define SWD_TX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + TURN_BITS + DATA_BITS + PARITY_BITS, 8))"},{"line_number":86,"context_line":"#define SWD_RX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS, 8))"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"/// File descriptor for SPI device"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"f1e2960d_70a8f100","line":85,"range":{"start_line":85,"start_character":12,"end_line":85,"end_character":14},"in_reply_to":"07c1aa93_8feccccd","updated":"2024-12-11 16:26:33.000000000","message":"Done","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9ebb87aeb0ff018fa0c4af95dbdde83d1ea5c487","unresolved":true,"context_lines":[{"line_number":83,"context_line":"#define PARITY_BITS 1"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"#define SWD_TX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + TURN_BITS + DATA_BITS + PARITY_BITS, 8))"},{"line_number":86,"context_line":"#define SWD_RX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS, 8))"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"/// File descriptor for SPI device"},{"line_number":89,"context_line":"static int spi_fd \u003d -1;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"d973760d_db5fa5a4","line":86,"range":{"start_line":86,"start_character":106,"end_line":86,"end_character":107},"updated":"2024-12-11 08:43:36.000000000","message":"This should be `spi_bits`","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"9b3f5c3410640dff0d79f8ebc799f45a4ea850ad","unresolved":false,"context_lines":[{"line_number":83,"context_line":"#define PARITY_BITS 1"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"#define SWD_TX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + TURN_BITS + DATA_BITS + PARITY_BITS, 8))"},{"line_number":86,"context_line":"#define SWD_RX_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS, 8))"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"/// File descriptor for SPI device"},{"line_number":89,"context_line":"static int spi_fd \u003d -1;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"fc27bcd5_3e5cc89e","line":86,"range":{"start_line":86,"start_character":106,"end_line":86,"end_character":107},"in_reply_to":"d973760d_db5fa5a4","updated":"2024-12-11 16:26:33.000000000","message":"Done","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9ebb87aeb0ff018fa0c4af95dbdde83d1ea5c487","unresolved":true,"context_lines":[{"line_number":199,"context_line":"}"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"/// Set JTAG delay (not used)"},{"line_number":202,"context_line":"static int spidev_speed(int speed)"},{"line_number":203,"context_line":"{"},{"line_number":204,"context_line":"\treturn ERROR_OK;"},{"line_number":205,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"90597c12_aed04a74","line":202,"range":{"start_line":202,"start_character":11,"end_line":202,"end_character":23},"updated":"2024-12-11 08:43:36.000000000","message":"Do not expose a non functional stub.\nEither make speed configuration functional or remove this function from\n`struct adapter_driver` and OpenOCD will show the adapter doesn\u0027t support configurable speed","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"9b3f5c3410640dff0d79f8ebc799f45a4ea850ad","unresolved":false,"context_lines":[{"line_number":199,"context_line":"}"},{"line_number":200,"context_line":""},{"line_number":201,"context_line":"/// Set JTAG delay (not used)"},{"line_number":202,"context_line":"static int spidev_speed(int speed)"},{"line_number":203,"context_line":"{"},{"line_number":204,"context_line":"\treturn ERROR_OK;"},{"line_number":205,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"b8a360e7_8e0fda10","line":202,"range":{"start_line":202,"start_character":11,"end_line":202,"end_character":23},"in_reply_to":"90597c12_aed04a74","updated":"2024-12-11 16:26:33.000000000","message":"Done","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9ebb87aeb0ff018fa0c4af95dbdde83d1ea5c487","unresolved":true,"context_lines":[{"line_number":254,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":255,"context_line":"\t}"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"\tspidev_swd_switch_seq(JTAG_TO_SWD);"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"\tLOG_INFO(\"Opened SPI device at %s in mode %d with %d bits per transfer at %u kHz\", spi_path, spi_mode, spi_bits, speed_khz);"},{"line_number":260,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"c81e19fd_a20737f5","line":257,"range":{"start_line":257,"start_character":1,"end_line":257,"end_character":36},"updated":"2024-12-11 08:43:36.000000000","message":"Should not be emitted by the driver itself, ADI SWD layer takes care of it.","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"9b3f5c3410640dff0d79f8ebc799f45a4ea850ad","unresolved":false,"context_lines":[{"line_number":254,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":255,"context_line":"\t}"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"\tspidev_swd_switch_seq(JTAG_TO_SWD);"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"\tLOG_INFO(\"Opened SPI device at %s in mode %d with %d bits per transfer at %u kHz\", spi_path, spi_mode, spi_bits, speed_khz);"},{"line_number":260,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"ce71da3d_234e0c0b","line":257,"range":{"start_line":257,"start_character":1,"end_line":257,"end_character":36},"in_reply_to":"c81e19fd_a20737f5","updated":"2024-12-11 16:26:33.000000000","message":"Done","commit_id":"4343e856172deb6d8f50e4d9e144f575b31e655d"},{"author":{"_account_id":1002348,"name":"Jonathon Reinhart","email":"jrreinhart@google.com"},"change_message_id":"0a191049e1c349c51481038d189a347708c621f9","unresolved":true,"context_lines":[{"line_number":102,"context_line":"\t}"},{"line_number":103,"context_line":"\t// Transmit the MSB buffer to SPI device."},{"line_number":104,"context_line":"\tstruct spi_ioc_transfer tr \u003d {"},{"line_number":105,"context_line":"\t\t.tx_buf \u003d (__u64)(txbuf ? tx_buf : NULL),"},{"line_number":106,"context_line":"\t\t.rx_buf \u003d (__u64)(rxbuf ? rx_buf : NULL),"},{"line_number":107,"context_line":"\t\t.len \u003d len,"},{"line_number":108,"context_line":"\t\t.delay_usecs \u003d SPI_DESELECT_DELAY,"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"71386924_9750da5a","line":105,"range":{"start_line":105,"start_character":20,"end_line":105,"end_character":34},"updated":"2024-12-11 17:03:47.000000000","message":"These names are very similar, which makes it hard to follow.\n\nHow about `tx_data`/`rx_data` for the parameters?","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"322aa74eb872cdad6afc1fb04bd54988919299d5","unresolved":false,"context_lines":[{"line_number":102,"context_line":"\t}"},{"line_number":103,"context_line":"\t// Transmit the MSB buffer to SPI device."},{"line_number":104,"context_line":"\tstruct spi_ioc_transfer tr \u003d {"},{"line_number":105,"context_line":"\t\t.tx_buf \u003d (__u64)(txbuf ? tx_buf : NULL),"},{"line_number":106,"context_line":"\t\t.rx_buf \u003d (__u64)(rxbuf ? rx_buf : NULL),"},{"line_number":107,"context_line":"\t\t.len \u003d len,"},{"line_number":108,"context_line":"\t\t.delay_usecs \u003d SPI_DESELECT_DELAY,"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"26562f8f_d738ad45","line":105,"range":{"start_line":105,"start_character":20,"end_line":105,"end_character":34},"in_reply_to":"71386924_9750da5a","updated":"2024-12-11 18:00:24.000000000","message":"Done","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002348,"name":"Jonathon Reinhart","email":"jrreinhart@google.com"},"change_message_id":"0a191049e1c349c51481038d189a347708c621f9","unresolved":true,"context_lines":[{"line_number":137,"context_line":"{"},{"line_number":138,"context_line":"\tconst uint8_t zero \u003d 0;"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"\tfor (unsigned int i \u003d 0; i \u003c DIV_ROUND_UP(cycles, SPI_BITS); i++)"},{"line_number":141,"context_line":"\t\tspi_exchange(\u0026zero, NULL, sizeof(zero));"},{"line_number":142,"context_line":"}"},{"line_number":143,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"de877bba_7ed61d63","line":140,"range":{"start_line":140,"start_character":30,"end_line":140,"end_character":60},"updated":"2024-12-11 17:03:47.000000000","message":"Is it okay to round this up to the next multiple of 8? Or will the protocol get out-of-sync if someone requests a non-multiple of 8?","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"322aa74eb872cdad6afc1fb04bd54988919299d5","unresolved":false,"context_lines":[{"line_number":137,"context_line":"{"},{"line_number":138,"context_line":"\tconst uint8_t zero \u003d 0;"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"\tfor (unsigned int i \u003d 0; i \u003c DIV_ROUND_UP(cycles, SPI_BITS); i++)"},{"line_number":141,"context_line":"\t\tspi_exchange(\u0026zero, NULL, sizeof(zero));"},{"line_number":142,"context_line":"}"},{"line_number":143,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"2a486906_9adf3403","line":140,"range":{"start_line":140,"start_character":30,"end_line":140,"end_character":60},"in_reply_to":"de877bba_7ed61d63","updated":"2024-12-11 18:00:24.000000000","message":"Looking at ARM Debug Interface v5 Architecture Specification (IHI0031.pdf) page 86, 5.1.1 Operational requirement for synchronous SW-DP serial interface, it appears valid to clock an arbitrary amount of cycles after the transfer is complete.\n\nIt seems a new transaction is begun by raising a 1 on SWDIO to create a start bit but otherwise the clocks after a transaction are irrelevant.","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002348,"name":"Jonathon Reinhart","email":"jrreinhart@google.com"},"change_message_id":"0a191049e1c349c51481038d189a347708c621f9","unresolved":true,"context_lines":[{"line_number":446,"context_line":"COMMAND_HANDLER(spidev_handle_mode_command)"},{"line_number":447,"context_line":"{"},{"line_number":448,"context_line":"\tif (CMD_ARGC \u003d\u003d 1)"},{"line_number":449,"context_line":"\t\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], spi_mode);"},{"line_number":450,"context_line":"\telse"},{"line_number":451,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":452,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"90e166c7_37a8188c","line":449,"updated":"2024-12-11 17:03:47.000000000","message":"Should this function limit the valid values to [0, 3] (or `SPI_MODE_X_MASK`)? Otherwise, a user could provide a value that sets some of the upper flag bits.","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"322aa74eb872cdad6afc1fb04bd54988919299d5","unresolved":false,"context_lines":[{"line_number":446,"context_line":"COMMAND_HANDLER(spidev_handle_mode_command)"},{"line_number":447,"context_line":"{"},{"line_number":448,"context_line":"\tif (CMD_ARGC \u003d\u003d 1)"},{"line_number":449,"context_line":"\t\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], spi_mode);"},{"line_number":450,"context_line":"\telse"},{"line_number":451,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":452,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"a857113e_748fbb68","line":449,"in_reply_to":"90e166c7_37a8188c","updated":"2024-12-11 18:00:24.000000000","message":"I\u0027m intentionally allowing a 32 bit range to allow for setting the upper bits. During my testing I didn\u0027t need to set \"SPI_MOSI_IDLE_LOW\" to have the bus idle low but I imagine some SPI implementations will need it.","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002348,"name":"Jonathon Reinhart","email":"jrreinhart@google.com"},"change_message_id":"0a191049e1c349c51481038d189a347708c621f9","unresolved":true,"context_lines":[{"line_number":469,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","},{"line_number":470,"context_line":"\t\t.usage \u003d \"example: /dev/spidev0.0\","},{"line_number":471,"context_line":"\t},"},{"line_number":472,"context_line":"\t{"},{"line_number":473,"context_line":"\t\t.name \u003d \"mode\","},{"line_number":474,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":475,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":476,"context_line":"\t\t.help \u003d \"set the mode of the spi port\","},{"line_number":477,"context_line":"\t\t.usage \u003d \"(number in decimal)\","},{"line_number":478,"context_line":"\t},"},{"line_number":479,"context_line":"};"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"static const struct command_registration spidev_command_handlers[] \u003d {"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"273635ad_b2ec1b48","line":478,"range":{"start_line":472,"start_character":0,"end_line":478,"end_character":3},"updated":"2024-12-11 17:03:47.000000000","message":"Does this actually work in a mode other than 3?","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"322aa74eb872cdad6afc1fb04bd54988919299d5","unresolved":false,"context_lines":[{"line_number":469,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","},{"line_number":470,"context_line":"\t\t.usage \u003d \"example: /dev/spidev0.0\","},{"line_number":471,"context_line":"\t},"},{"line_number":472,"context_line":"\t{"},{"line_number":473,"context_line":"\t\t.name \u003d \"mode\","},{"line_number":474,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":475,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":476,"context_line":"\t\t.help \u003d \"set the mode of the spi port\","},{"line_number":477,"context_line":"\t\t.usage \u003d \"(number in decimal)\","},{"line_number":478,"context_line":"\t},"},{"line_number":479,"context_line":"};"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"static const struct command_registration spidev_command_handlers[] \u003d {"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"9b2bfa3b_11981e6b","line":478,"range":{"start_line":472,"start_character":0,"end_line":478,"end_character":3},"in_reply_to":"273635ad_b2ec1b48","updated":"2024-12-11 18:00:24.000000000","message":"Looking at the rpi implementation that inspired this work, they were using mode 0. When I used it with a different host, mode 0 didn\u0027t work for me. Mode 2 and 3 appear to work. I figure if changing that field around allows someone to get it working without rebuilding then I should offer that flexibility.","commit_id":"633400b88836ecd4ca0af92b6ddc225f786b0993"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":43,"context_line":" *     should be attached to the target."},{"line_number":44,"context_line":" *   * Make sure that your host and target are using the same I/O voltage"},{"line_number":45,"context_line":" *     (for example both are using 3.3 volts)."},{"line_number":46,"context_line":" *   * Your host\u0027s SPI port may not idle low. This will lead to an additional"},{"line_number":47,"context_line":" *     clock edge being sent to the target, causing the host and target being"},{"line_number":48,"context_line":" *     1 clock off from each other. Try setting SPI_MOSI_IDLE_LOW in spi_mode."},{"line_number":49,"context_line":" *     Try using a different spi_mode (0 - 3)."},{"line_number":50,"context_line":" *   * Your target may pull SWDIO and/or SWDCLK high, creating an extra edge"},{"line_number":51,"context_line":" *     when the host releases control of the SPI port at the end of a"},{"line_number":52,"context_line":" *     transaction. You\u0027ll need to confirm this with a scope or meter. Try"},{"line_number":53,"context_line":" *     installing 10K resistors on SWDIO and SWDCLK to ground to stop this."},{"line_number":54,"context_line":" */"},{"line_number":55,"context_line":"// #define LOG_SPI_EXCHANGE"},{"line_number":56,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"5f13956c_8da24868","line":53,"range":{"start_line":46,"start_character":5,"end_line":53,"end_character":75},"updated":"2024-12-19 15:33:32.000000000","message":"Consider adding these hints to openocd.texi\nAlso reference /usr/include/linux/spi/spi.h where the additional bit flags are defined","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"9898e27cf71249126ce5d54afe17df860a8dd79d","unresolved":false,"context_lines":[{"line_number":43,"context_line":" *     should be attached to the target."},{"line_number":44,"context_line":" *   * Make sure that your host and target are using the same I/O voltage"},{"line_number":45,"context_line":" *     (for example both are using 3.3 volts)."},{"line_number":46,"context_line":" *   * Your host\u0027s SPI port may not idle low. This will lead to an additional"},{"line_number":47,"context_line":" *     clock edge being sent to the target, causing the host and target being"},{"line_number":48,"context_line":" *     1 clock off from each other. Try setting SPI_MOSI_IDLE_LOW in spi_mode."},{"line_number":49,"context_line":" *     Try using a different spi_mode (0 - 3)."},{"line_number":50,"context_line":" *   * Your target may pull SWDIO and/or SWDCLK high, creating an extra edge"},{"line_number":51,"context_line":" *     when the host releases control of the SPI port at the end of a"},{"line_number":52,"context_line":" *     transaction. You\u0027ll need to confirm this with a scope or meter. Try"},{"line_number":53,"context_line":" *     installing 10K resistors on SWDIO and SWDCLK to ground to stop this."},{"line_number":54,"context_line":" */"},{"line_number":55,"context_line":"// #define LOG_SPI_EXCHANGE"},{"line_number":56,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"f6230ade_7f2ed134","line":53,"range":{"start_line":46,"start_character":5,"end_line":53,"end_character":75},"in_reply_to":"5f13956c_8da24868","updated":"2024-12-20 00:52:52.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":81,"context_line":"// Time in uS after the last bit of transfer before deselecting the device"},{"line_number":82,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"// Default speed"},{"line_number":85,"context_line":"#define SPI_SPEED (3000 * 1000)"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"// LSB to MSB buffer sizes"},{"line_number":88,"context_line":"#define MAX_SPI_EXCH_SIZE 32"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"c641a14f_d292319c","line":85,"range":{"start_line":84,"start_character":1,"end_line":85,"end_character":31},"updated":"2024-12-19 15:33:32.000000000","message":"Please remove","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":81,"context_line":"// Time in uS after the last bit of transfer before deselecting the device"},{"line_number":82,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"// Default speed"},{"line_number":85,"context_line":"#define SPI_SPEED (3000 * 1000)"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"// LSB to MSB buffer sizes"},{"line_number":88,"context_line":"#define MAX_SPI_EXCH_SIZE 32"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"7beff29f_d0510cc1","line":85,"range":{"start_line":84,"start_character":1,"end_line":85,"end_character":31},"in_reply_to":"c641a14f_d292319c","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"// SPI Configuration"},{"line_number":103,"context_line":"static char *spi_path;"},{"line_number":104,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":105,"context_line":"static uint32_t spi_speed;"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"static int queued_retval;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"20307b3d_7b8bc6f9","line":104,"range":{"start_line":104,"start_character":7,"end_line":104,"end_character":15},"updated":"2024-12-19 15:33:32.000000000","message":"Although OpenOCD discourages use of __u32 type, ioctl dereferences a pointer to this variable. I\u0027d prefer using the exactly same type as used in SPI_IOC_WR_MODE32 definition.\nBut wait, let\u0027s ask Antonio first.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"// SPI Configuration"},{"line_number":103,"context_line":"static char *spi_path;"},{"line_number":104,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":105,"context_line":"static uint32_t spi_speed;"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"static int queued_retval;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"a14c1d71_38da1773","line":104,"range":{"start_line":104,"start_character":7,"end_line":104,"end_character":15},"in_reply_to":"20307b3d_7b8bc6f9","updated":"2024-12-19 17:53:16.000000000","message":"I agree with your point especially since we are dereferencing. I\u0027ve transitioned this to `__u32` but I\u0027ll leave this unresolved for Antonio\u0027s perspective. It\u0027s a little uncomfortable that the next line uses uint32_t but I suppose these thing need to happen sometimes.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"// SPI Configuration"},{"line_number":103,"context_line":"static char *spi_path;"},{"line_number":104,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":105,"context_line":"static uint32_t spi_speed;"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"static int queued_retval;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"c3f71390_f7ab1afd","line":104,"range":{"start_line":104,"start_character":7,"end_line":104,"end_character":15},"in_reply_to":"a14c1d71_38da1773","updated":"2024-12-21 14:43:01.000000000","message":"While Linux uses its own types, here we should only guarantee we use a type of the same size and sign.\nIn kernel code there are also the examples `tools/spi/spidev_fdx.c` and `tools/spi/spidev_test.c`.\nWith no coherence, one uses `__u32 mode` and the other `uint32_t mode` ! \nhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/spi/\n\nI don\u0027t expect any warning/issue from the compiler.\n\nSince I feel strange to mix `__u32` and `uint32_t`, I would slightly prefer the types from `stdint.h`, not from `linux/types.h`.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":101,"context_line":""},{"line_number":102,"context_line":"// SPI Configuration"},{"line_number":103,"context_line":"static char *spi_path;"},{"line_number":104,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":105,"context_line":"static uint32_t spi_speed;"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"static int queued_retval;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"04ce96d5_2549b6d1","line":104,"range":{"start_line":104,"start_character":7,"end_line":104,"end_character":15},"in_reply_to":"c3f71390_f7ab1afd","updated":"2024-12-23 21:40:07.000000000","message":"Reverted to uint32_t. In other locations I have converted to uint8_t and uint64_t.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":114,"context_line":"\tstatic uint8_t tx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":115,"context_line":"\tstatic uint8_t rx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"#ifdef LOG_SPI_EXCHANGE"},{"line_number":118,"context_line":"\tLOG_OUTPUT(\"exchange: len\u003d%d\\n\", len);"},{"line_number":119,"context_line":"#endif // LOG_SPI_EXCHANGE"},{"line_number":120,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"b03c97d7_9900395b","line":117,"updated":"2024-12-19 15:33:32.000000000","message":"I\u0027d recommend to use the lowest debug level `LOG_DEBUG_IO()` for all spi exchange logs. \nWe could keep conditional compilation based on LOG_SPI_EXCHANGE for performance reasons.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":114,"context_line":"\tstatic uint8_t tx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":115,"context_line":"\tstatic uint8_t rx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"#ifdef LOG_SPI_EXCHANGE"},{"line_number":118,"context_line":"\tLOG_OUTPUT(\"exchange: len\u003d%d\\n\", len);"},{"line_number":119,"context_line":"#endif // LOG_SPI_EXCHANGE"},{"line_number":120,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"b87a46f9_64beb97d","line":117,"in_reply_to":"9c9f9549_2dd0ead1","updated":"2024-12-23 21:40:07.000000000","message":"Closing for now. With the current conditional compilation configuration this is currently a no op. Let me know if you\u0027d like me to make a change here.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":true,"context_lines":[{"line_number":114,"context_line":"\tstatic uint8_t tx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":115,"context_line":"\tstatic uint8_t rx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"#ifdef LOG_SPI_EXCHANGE"},{"line_number":118,"context_line":"\tLOG_OUTPUT(\"exchange: len\u003d%d\\n\", len);"},{"line_number":119,"context_line":"#endif // LOG_SPI_EXCHANGE"},{"line_number":120,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"9c9f9549_2dd0ead1","line":117,"in_reply_to":"b03c97d7_9900395b","updated":"2024-12-19 17:53:16.000000000","message":"In my attempts to use LOG_DEBUG_IO() I was having an issue with \\n being injected on every call to LOG_DEBUG_IO() which makes it difficult to compare the TX and RX packets. I considered using something like a sprintf to build the string beforehand and sending that to LOG_DEBUG_IO() but then I need to malloc, allocate a buffer on the stack or allocate an additional buffer statically. \n\nAllocating on the stack doesn\u0027t seem that great to me because that means I need MAX_SPI_EXCH_SIZE (32) * 3 (2 nibbles and 1 space) \u003d 96 bytes on the stack.\n\nI\u0027m more in favor to using a static buffer so we don\u0027t need to malloc and free every call. I can take that route if you like.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":115,"context_line":"\tstatic uint8_t rx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"#ifdef LOG_SPI_EXCHANGE"},{"line_number":118,"context_line":"\tLOG_OUTPUT(\"exchange: len\u003d%d\\n\", len);"},{"line_number":119,"context_line":"#endif // LOG_SPI_EXCHANGE"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"\tif (len \u003d\u003d 0) {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"e1a04ac2_322d188a","line":118,"range":{"start_line":118,"start_character":28,"end_line":118,"end_character":29},"updated":"2024-12-19 15:33:32.000000000","message":"%u","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":115,"context_line":"\tstatic uint8_t rx_buf[MAX_SPI_EXCH_SIZE];"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"#ifdef LOG_SPI_EXCHANGE"},{"line_number":118,"context_line":"\tLOG_OUTPUT(\"exchange: len\u003d%d\\n\", len);"},{"line_number":119,"context_line":"#endif // LOG_SPI_EXCHANGE"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"\tif (len \u003d\u003d 0) {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"b56bf8f3_a2c7496b","line":118,"range":{"start_line":118,"start_character":28,"end_line":118,"end_character":29},"in_reply_to":"e1a04ac2_322d188a","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":142,"context_line":"\t\tif (len !\u003d 0) {"},{"line_number":143,"context_line":"\t\t\tLOG_OUTPUT(\" tx_buf\u003d\");"},{"line_number":144,"context_line":"\t\t\tfor (unsigned int i \u003d 0; i \u003c len; i++)"},{"line_number":145,"context_line":"\t\t\t\tLOG_OUTPUT(\"%.2X \", tx_buf[i]);"},{"line_number":146,"context_line":"\t\t}"},{"line_number":147,"context_line":"\t\tLOG_OUTPUT(\"\\n\");"},{"line_number":148,"context_line":"#endif // LOG_SPI_EXCHANGE"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"04330358_ed85aa2e","line":145,"range":{"start_line":145,"start_character":15,"end_line":145,"end_character":22},"updated":"2024-12-19 15:33:32.000000000","message":"\"%.2\" PRIx8 \" \"","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":142,"context_line":"\t\tif (len !\u003d 0) {"},{"line_number":143,"context_line":"\t\t\tLOG_OUTPUT(\" tx_buf\u003d\");"},{"line_number":144,"context_line":"\t\t\tfor (unsigned int i \u003d 0; i \u003c len; i++)"},{"line_number":145,"context_line":"\t\t\t\tLOG_OUTPUT(\"%.2X \", tx_buf[i]);"},{"line_number":146,"context_line":"\t\t}"},{"line_number":147,"context_line":"\t\tLOG_OUTPUT(\"\\n\");"},{"line_number":148,"context_line":"#endif // LOG_SPI_EXCHANGE"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"fb6f551b_7f8fbb3a","line":145,"range":{"start_line":145,"start_character":15,"end_line":145,"end_character":22},"in_reply_to":"04330358_ed85aa2e","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":190,"context_line":""},{"line_number":191,"context_line":"static int spidev_speed(int speed)"},{"line_number":192,"context_line":"{"},{"line_number":193,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MAX_SPEED_HZ, \u0026speed);"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":196,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI %u speed\", speed);"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"ce68031a_cc376e2a","line":193,"updated":"2024-12-19 15:33:32.000000000","message":"speed should be copied first to a variable of `__u32` type and then used in ioctl or we got endianess problem on be64 host","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":190,"context_line":""},{"line_number":191,"context_line":"static int spidev_speed(int speed)"},{"line_number":192,"context_line":"{"},{"line_number":193,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MAX_SPEED_HZ, \u0026speed);"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":196,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI %u speed\", speed);"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"302f8c26_ec246bf0","line":193,"in_reply_to":"ce68031a_cc376e2a","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":246,"context_line":"\t}"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"\t// Set SPI mode."},{"line_number":249,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MODE, \u0026spi_mode);"},{"line_number":250,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":251,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI mode %d\", spi_mode);"},{"line_number":252,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"774160a8_51a83c6e","line":249,"range":{"start_line":249,"start_character":25,"end_line":249,"end_character":40},"updated":"2024-12-19 15:33:32.000000000","message":"Should be SPI_IOC_WR_MODE32 to comply spi_mode size and to allow bit flags","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":246,"context_line":"\t}"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"\t// Set SPI mode."},{"line_number":249,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MODE, \u0026spi_mode);"},{"line_number":250,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":251,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI mode %d\", spi_mode);"},{"line_number":252,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"7b8e98dd_f861470e","line":249,"range":{"start_line":249,"start_character":25,"end_line":249,"end_character":40},"in_reply_to":"774160a8_51a83c6e","updated":"2024-12-19 17:53:16.000000000","message":"Good call! Thanks!","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":248,"context_line":"\t// Set SPI mode."},{"line_number":249,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MODE, \u0026spi_mode);"},{"line_number":250,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":251,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI mode %d\", spi_mode);"},{"line_number":252,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":253,"context_line":"\t}"},{"line_number":254,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"148c6f9e_abeb6064","line":251,"range":{"start_line":251,"start_character":36,"end_line":251,"end_character":38},"updated":"2024-12-19 15:33:32.000000000","message":"Check **all** numeric format specifiers and for fixed size stdint arguments use the symbolic specifier, e.g. here PRIu32 (or better PRIx32 for readable bit flags above mode bits?)","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":248,"context_line":"\t// Set SPI mode."},{"line_number":249,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MODE, \u0026spi_mode);"},{"line_number":250,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":251,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI mode %d\", spi_mode);"},{"line_number":252,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":253,"context_line":"\t}"},{"line_number":254,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"63eabf30_2150a55c","line":251,"range":{"start_line":251,"start_character":36,"end_line":251,"end_character":38},"in_reply_to":"148c6f9e_abeb6064","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":253,"context_line":"\t}"},{"line_number":254,"context_line":""},{"line_number":255,"context_line":"\t// Set SPI bits per word."},{"line_number":256,"context_line":"\tuint8_t spi_bits \u003d SPI_BITS;"},{"line_number":257,"context_line":"\tret \u003d ioctl(spi_fd, SPI_IOC_WR_BITS_PER_WORD, \u0026spi_bits);"},{"line_number":258,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":259,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI %d bits per transfer\", spi_bits);"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"c37920eb_d0cd2b36","line":256,"range":{"start_line":256,"start_character":1,"end_line":256,"end_character":8},"updated":"2024-12-19 15:33:32.000000000","message":"__u8","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":253,"context_line":"\t}"},{"line_number":254,"context_line":""},{"line_number":255,"context_line":"\t// Set SPI bits per word."},{"line_number":256,"context_line":"\tuint8_t spi_bits \u003d SPI_BITS;"},{"line_number":257,"context_line":"\tret \u003d ioctl(spi_fd, SPI_IOC_WR_BITS_PER_WORD, \u0026spi_bits);"},{"line_number":258,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":259,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI %d bits per transfer\", spi_bits);"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"9d42d635_ec20b48d","line":256,"range":{"start_line":256,"start_character":1,"end_line":256,"end_character":8},"in_reply_to":"c37920eb_d0cd2b36","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":264,"context_line":"\t\tspi_path, spi_mode, spi_bits);"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"\t// Set SPI read and write max speed."},{"line_number":267,"context_line":"\tret \u003d spidev_speed(SPI_SPEED);"},{"line_number":268,"context_line":"\tif (ret !\u003d ERROR_OK)"},{"line_number":269,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":270,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"68899cb6_cd4c00d3","line":267,"range":{"start_line":267,"start_character":20,"end_line":267,"end_character":29},"updated":"2024-12-19 15:33:32.000000000","message":"Use `adapter_get_speed_khz()` instead of adapter private default.\nIt would require `#include \u003cjtag/adapter.h\u003e`","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":264,"context_line":"\t\tspi_path, spi_mode, spi_bits);"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"\t// Set SPI read and write max speed."},{"line_number":267,"context_line":"\tret \u003d spidev_speed(SPI_SPEED);"},{"line_number":268,"context_line":"\tif (ret !\u003d ERROR_OK)"},{"line_number":269,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":270,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"a410911d_988787a9","line":267,"range":{"start_line":267,"start_character":20,"end_line":267,"end_character":29},"in_reply_to":"68899cb6_cd4c00d3","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":304,"context_line":""},{"line_number":305,"context_line":"\tint retval \u003d queued_retval;"},{"line_number":306,"context_line":"\tqueued_retval \u003d ERROR_OK;"},{"line_number":307,"context_line":"\tLOG_DEBUG_IO(\"SWD queue return value: %02x\", retval);"},{"line_number":308,"context_line":"\treturn retval;"},{"line_number":309,"context_line":"}"},{"line_number":310,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"c8b342cc_b5047acf","line":307,"range":{"start_line":307,"start_character":40,"end_line":307,"end_character":43},"updated":"2024-12-19 15:33:32.000000000","message":"Please %d to make retval at least little bit readable","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":304,"context_line":""},{"line_number":305,"context_line":"\tint retval \u003d queued_retval;"},{"line_number":306,"context_line":"\tqueued_retval \u003d ERROR_OK;"},{"line_number":307,"context_line":"\tLOG_DEBUG_IO(\"SWD queue return value: %02x\", retval);"},{"line_number":308,"context_line":"\treturn retval;"},{"line_number":309,"context_line":"}"},{"line_number":310,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"ba78f8f0_8fc3e50e","line":307,"range":{"start_line":307,"start_character":40,"end_line":307,"end_character":43},"in_reply_to":"c8b342cc_b5047acf","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":490,"context_line":"\t\tfree(spi_path);"},{"line_number":491,"context_line":"\t\tspi_path \u003d strdup(CMD_ARGV[0]);"},{"line_number":492,"context_line":"\t} else {"},{"line_number":493,"context_line":"\t\tLOG_ERROR(\"expected exactly one argument to spidev path \u003cpath\u003e\");"},{"line_number":494,"context_line":"\t}"},{"line_number":495,"context_line":""},{"line_number":496,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"e741d1d3_7e3d4928","line":493,"range":{"start_line":493,"start_character":2,"end_line":493,"end_character":67},"updated":"2024-12-19 15:33:32.000000000","message":"`return ERROR_COMMAND_SYNTAX_ERROR;`\nmight be better as the special error code forces OpenOCD to print the command usage.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":490,"context_line":"\t\tfree(spi_path);"},{"line_number":491,"context_line":"\t\tspi_path \u003d strdup(CMD_ARGV[0]);"},{"line_number":492,"context_line":"\t} else {"},{"line_number":493,"context_line":"\t\tLOG_ERROR(\"expected exactly one argument to spidev path \u003cpath\u003e\");"},{"line_number":494,"context_line":"\t}"},{"line_number":495,"context_line":""},{"line_number":496,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"437b5637_7bb546ae","line":493,"range":{"start_line":493,"start_character":2,"end_line":493,"end_character":67},"in_reply_to":"e741d1d3_7e3d4928","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":526,"context_line":"\t\t.name \u003d \"mode\","},{"line_number":527,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":528,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":529,"context_line":"\t\t.help \u003d \"set the mode of the spi port\","},{"line_number":530,"context_line":"\t\t.usage \u003d \"(number in decimal)\","},{"line_number":531,"context_line":"\t},"},{"line_number":532,"context_line":"\tCOMMAND_REGISTRATION_DONE"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"51c639cd_9d2cdf29","line":529,"updated":"2024-12-19 15:33:32.000000000","message":"with optional bit flags","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":526,"context_line":"\t\t.name \u003d \"mode\","},{"line_number":527,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":528,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":529,"context_line":"\t\t.help \u003d \"set the mode of the spi port\","},{"line_number":530,"context_line":"\t\t.usage \u003d \"(number in decimal)\","},{"line_number":531,"context_line":"\t},"},{"line_number":532,"context_line":"\tCOMMAND_REGISTRATION_DONE"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"94b26f59_40503586","line":529,"in_reply_to":"51c639cd_9d2cdf29","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":527,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":528,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":529,"context_line":"\t\t.help \u003d \"set the mode of the spi port\","},{"line_number":530,"context_line":"\t\t.usage \u003d \"(number in decimal)\","},{"line_number":531,"context_line":"\t},"},{"line_number":532,"context_line":"\tCOMMAND_REGISTRATION_DONE"},{"line_number":533,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"7bc520fe_b94dd015","line":530,"range":{"start_line":530,"start_character":12,"end_line":530,"end_character":31},"updated":"2024-12-19 15:33:32.000000000","message":"The parameter could be in hex as well - if one needs to add optional bits\n`.usage \u003d \"mode_num\"`","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":527,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":528,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":529,"context_line":"\t\t.help \u003d \"set the mode of the spi port\","},{"line_number":530,"context_line":"\t\t.usage \u003d \"(number in decimal)\","},{"line_number":531,"context_line":"\t},"},{"line_number":532,"context_line":"\tCOMMAND_REGISTRATION_DONE"},{"line_number":533,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"1c54e197_b49c28ca","line":530,"range":{"start_line":530,"start_character":12,"end_line":530,"end_character":31},"in_reply_to":"7bc520fe_b94dd015","updated":"2024-12-19 17:53:16.000000000","message":"Done","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"91ae85b8c1da9a5c2013886e325bd66ba1916963","unresolved":true,"context_lines":[{"line_number":552,"context_line":"\t.commands \u003d spidev_command_handlers,"},{"line_number":553,"context_line":""},{"line_number":554,"context_line":"\t.init \u003d spidev_init,"},{"line_number":555,"context_line":"\t.quit \u003d spidev_quit,"},{"line_number":556,"context_line":"\t.speed \u003d spidev_speed,"},{"line_number":557,"context_line":"\t.khz \u003d spidev_khz,"},{"line_number":558,"context_line":"\t.speed_div \u003d spidev_speed_div,"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"ed5c4b3d_beed27d9","line":555,"updated":"2024-12-19 15:33:32.000000000","message":"The current OpenOCD version requires also `.reset` to be defined or any `reset` use causes segfault. Please don\u0027t fix it now.\n\nUnfortunately there are more drivers without `.reset` defined so we should better fix the problem in jtag/core.c","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"7b36f5b1ee2a95416c976bb584ff4cbfdc69f805","unresolved":false,"context_lines":[{"line_number":552,"context_line":"\t.commands \u003d spidev_command_handlers,"},{"line_number":553,"context_line":""},{"line_number":554,"context_line":"\t.init \u003d spidev_init,"},{"line_number":555,"context_line":"\t.quit \u003d spidev_quit,"},{"line_number":556,"context_line":"\t.speed \u003d spidev_speed,"},{"line_number":557,"context_line":"\t.khz \u003d spidev_khz,"},{"line_number":558,"context_line":"\t.speed_div \u003d spidev_speed_div,"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"596693d4_bcaade3e","line":555,"in_reply_to":"ed5c4b3d_beed27d9","updated":"2024-12-19 17:53:16.000000000","message":"Got it. Will leave it as is.","commit_id":"0b7a7f0c0f54f594c570d61bf350c126dbc8e9fa"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"74e4db06259bd5e8201bc3c39431c3552a95ef62","unresolved":true,"context_lines":[{"line_number":264,"context_line":"\t\tspi_path, spi_mode, spi_bits);"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"\t// Set SPI read and write max speed."},{"line_number":267,"context_line":"\tret \u003d spidev_speed(adapter_get_speed_khz());"},{"line_number":268,"context_line":"\tif (ret !\u003d ERROR_OK)"},{"line_number":269,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":270,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":7,"id":"f20c13ac_59dcf35d","line":267,"range":{"start_line":267,"start_character":20,"end_line":267,"end_character":43},"updated":"2024-12-19 20:46:16.000000000","message":"Sorry, I was wrong. `adapter_get_speed_khz()` result should be also converted to Hz by calling `spidev_khz()` or better `adapter_get_speed()`.\n\nAnyway we can safely remove the speed setting at all as `adapter_init()` always calls `.speed` method just after `.init` (if .speed is not NULL)","commit_id":"05f3d86667edacb64cbd55c87965113bcee7071f"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"5102c5bf38780ef10795c3ca78c29cb3dd21bab7","unresolved":false,"context_lines":[{"line_number":264,"context_line":"\t\tspi_path, spi_mode, spi_bits);"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"\t// Set SPI read and write max speed."},{"line_number":267,"context_line":"\tret \u003d spidev_speed(adapter_get_speed_khz());"},{"line_number":268,"context_line":"\tif (ret !\u003d ERROR_OK)"},{"line_number":269,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"},{"line_number":270,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":7,"id":"494b383c_9997b7fb","line":267,"range":{"start_line":267,"start_character":20,"end_line":267,"end_character":43},"in_reply_to":"f20c13ac_59dcf35d","updated":"2024-12-20 00:52:29.000000000","message":"Used adapter_get_speed()","commit_id":"05f3d86667edacb64cbd55c87965113bcee7071f"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"d63939b8e8cadc811528e7197c95d8b1ae5114a4","unresolved":true,"context_lines":[{"line_number":165,"context_line":"\t}"},{"line_number":166,"context_line":"}"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"static void spi_delay(unsigned int cycles)"},{"line_number":169,"context_line":"{"},{"line_number":170,"context_line":"\tconst uint8_t zero \u003d 0;"},{"line_number":171,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":9,"id":"5bb905c0_ddd39f20","line":168,"range":{"start_line":168,"start_character":12,"end_line":168,"end_character":21},"updated":"2024-12-20 09:42:49.000000000","message":"This shrinks down the performance to almost half because another spi transaction is called.\n\nI commented out `spi_exchange()` in `spi_delay()` and got\n```\ndumped 131072 bytes in 0.886025s (144.465 KiB/s)\n\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.883479s (144.882 KiB/s)\n```\n\nTo comply with ARM ADI protocol we have to clock at least 8 idle cycles after the last transaction. Instead of `spi_delay()` call from `run_queue()` it could be faster to add 8 idle cycles to each SWD transaction (without queuing we don\u0027t know which transaction is the last one). And for AP rd/wr we should extend idling to ap_delay_clk cycles if it is \u003e 8.\n\nI would recommend to change `spi_exchange()` len parameter to bits and do DIVROUNDUP inside of it. `swd_read/write_reg()` then could pass the sum of transaction bits and required delay clocks.\n\nUntil we find some unwanted delays imposed by spidev this is probably the best we can do without the queue implementation.","commit_id":"af8d78a1d110ba9351ebdfca12826e2c7caeeb76"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1504f004fed591b6c60dc901113494bb5ef2cc25","unresolved":false,"context_lines":[{"line_number":165,"context_line":"\t}"},{"line_number":166,"context_line":"}"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"static void spi_delay(unsigned int cycles)"},{"line_number":169,"context_line":"{"},{"line_number":170,"context_line":"\tconst uint8_t zero \u003d 0;"},{"line_number":171,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":9,"id":"fb84fa3d_b6cbdf01","line":168,"range":{"start_line":168,"start_character":12,"end_line":168,"end_character":21},"in_reply_to":"0d604ff4_eb65c023","updated":"2024-12-21 05:51:03.000000000","message":"Wow!","commit_id":"af8d78a1d110ba9351ebdfca12826e2c7caeeb76"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"b2fb028b09550e288b16934bc4e9a22eb026926c","unresolved":true,"context_lines":[{"line_number":165,"context_line":"\t}"},{"line_number":166,"context_line":"}"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"static void spi_delay(unsigned int cycles)"},{"line_number":169,"context_line":"{"},{"line_number":170,"context_line":"\tconst uint8_t zero \u003d 0;"},{"line_number":171,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":9,"id":"0d604ff4_eb65c023","line":168,"range":{"start_line":168,"start_character":12,"end_line":168,"end_character":21},"in_reply_to":"5bb905c0_ddd39f20","updated":"2024-12-21 02:40:28.000000000","message":"I decided to try to implement queuing. On the unnamed Qualcomm part connected to the computer at my desk speaking to the RP 2040 at 4 MHz\n\nwithout queuing: \n`\u003e dump_image /dev/null 0x20000000 0x42000      \ndumped 270336 bytes in 21.766741s (12.129 KiB/s)`\n\nwith queuing:\n`dump_image /dev/null 0x20000000 0x42000\ndumped 270336 bytes in 1.139412s (231.698 KiB/s)`","commit_id":"af8d78a1d110ba9351ebdfca12826e2c7caeeb76"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1504f004fed591b6c60dc901113494bb5ef2cc25","unresolved":true,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"dde5e3be_dc6e1020","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"updated":"2024-12-21 05:51:03.000000000","message":"Consider that in case of SWD FAULT or WAIT the whole queue is \"exchanged\" and the rest after error discarded. And the longer queue the smaller increase in performance. 32 entries seems me enough for performance and keeps the error recovery reasonably fast.\n\nRPi5, adapter speed 4 MHz, 256 swd ops in queue:\n```\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.479926s (266.708 KiB/s)\n\ndumped 131072 bytes in 0.478024s (267.769 KiB/s)\n```\n\nSlower by 7% with 32 ops in queue:\n```\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.519032s (246.613 KiB/s)\n\ndumped 131072 bytes in 0.516869s (247.645 KiB/s)\n```\n\nStill very fast","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"38fe7b54_23c8ccb6","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"02c6b17b_57f275ba","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"601223aa177f81447af57ea0f4c1dfb66a25dee3","unresolved":true,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"f68590e1_337e6441","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"02f6b654_b8c61c0b","updated":"2024-12-21 16:40:56.000000000","message":"\u003e It\u0027s confusing that things slow down at 500 and outright fail at 1000. I\u0027m wondering if we hit some internal limit in OpenOCD or maybe a limit with the SPI hardware or driver implementation. I can\u0027t see why the target would care.\n\nThe limit is in spidev driver:\n```\n$ cat /sys/module/spidev/parameters/bufsiz\n4096\n```\n\nOn RPi5 there is no slowdown @ 500 swd ops/q\n```\ndumped 131072 bytes in 0.475096s (269.419 KiB/s)\n```\nPerhaps your unnamed Qualcomm host has some magic in spi driver.\n\n\u003e Using MAX_QUEUE_ENTRIES \u003d 32 in my opinion leaves too much performance off the table. I\u0027ve set the value to 64.\n\nOk\n\n\n\u003e It\u0027s possible we need two queues and two threads to keep the bus fully pumped. \n\nIMO no way... \nhttps://www.kernel.org/doc/Documentation/spi/spidev:\n\n\u003e NOTES:\n\u003e    - At this time there is no async I/O support; everything is purely\n\u003e      synchronous.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"3068ef7cf0e48d5f3619d452bd5e82110ba821ba","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"40534ebd_58ab7143","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"35d79d38_d99c335c","updated":"2024-12-27 13:11:52.000000000","message":"This is fantastic! Thanks for running these tests.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"94937de205c774f593cf95ae0150df4decda324e","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"da78b553_728d3e3a","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"38fe7b54_23c8ccb6","updated":"2024-12-24 09:40:35.000000000","message":"Please stay single threaded as all OpenOCD is.\n\nI plan to convert all OpenOCD transports to queued, including SWD.\nThis will require two levels of queuing, as usually already done for JTAG:\n- one queue at openocd level to get all the commands until a generic version of `jtag_execute_queue()`;\n- one optional queue in the adapter driver to collect data from the previous queue and prepare the \u0027long\u0027 message for the interface, if it supports such long message.\n\nThis will somehow help simplifying your code, but when? Not shortly!\nIn mean time, I invite you to go ahead in your optimization but please avoid adding too much complexity for few percent of speedup. Simpler code is much easier to maintain.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"916ef5650766fdd5904d24223aa00a28bcf0978a","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"7b7b2cc0_590115f7","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"40534ebd_58ab7143","updated":"2024-12-27 16:31:48.000000000","message":"The additional performance gain of `MAX_QUEUE_ENTRIES 300` is pretty valuable to me but I understand our previous reasoning to make it 32 or 64. I made this value configurable at runtime by dynamically allocating the buffers. With this I can now set\n\n```\nspidev queue_entries 300\nrp2040.dap0 memaccess 2\n```\n\nand I get 275.547 KiB/s on the Qualcomm chipset which I am satisfied with.\n\nLet me know what you think of this approach.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"69cae021b1f2f1ed11ffa7ebfc04928b6e1cd07f","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"c5ee2fc1_ed2fdadb","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"7b7b2cc0_590115f7","updated":"2025-01-06 16:28:45.000000000","message":"I\u0027m finally back at my desk. As an experiment I shorted MOSI and MISO together. This allows me to successfully connect at 20 MHz\n```\nInfo : clock speed 20000 kHz\nInfo : SWD DPIDR 0x0bc12477, DLPIDR 0x00000001\nInfo : SWD DPIDR 0x0bc12477, DLPIDR 0x10000001\nInfo : [rp2040.core0] Cortex-M0+ r0p1 processor detected\nInfo : [rp2040.core0] target has 4 breakpoints, 2 watchpoints\nInfo : [rp2040.core0] Examination succeed\nInfo : [rp2040.core1] Cortex-M0+ r0p1 processor detected\nInfo : [rp2040.core1] target has 4 breakpoints, 2 watchpoints\nInfo : [rp2040.core1] Examination succeed\nInfo : [rp2040.core0] starting gdb server on 3333\nInfo : Listening on port 3333 for gdb connections\n```\nI think this works because the target has a higher drive strength than the host.\n\nwith single threaded (using rp2040.dap0 memaccess 2) I get \n```\n\u003e dump_image /dev/null 0x20000000 0x42000\ndumped 270336 bytes in 0.313126s ( KiB/s)\n```\nwith multi threaded I get\n```\n\u003e dump_image /dev/null 0x20000000 0x42000\ndumped 270336 bytes in 0.243568s (1083.886 KiB/s)\n```\nAt higher speeds it seems like multi-threading has more of an impact. I still believe we should stick with the single threaded implementation for now considering the increase in complexity, the less desirable behavior of a single adapter implementation spooling up multiple threads and a potential decrease in performance with simple operations.\n\nMaybe in the future when we make a universal queuing system it should be implemented with multiple threads?","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7fc64fbe158daf1da61a123e3d20fa0c65808e48","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"35d79d38_d99c335c","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"a5b5c784_c7b98c4a","updated":"2024-12-26 20:08:54.000000000","message":"In the previous tests I used MAX_QUEUE_ENTRIES 360 as was in patchset 12. Thought that 300 was a typo.\n\nNow with the clean patchset 17 (MAX_QUEUE_ENTRIES 64), cpufreq governor ondemand,\nadapter speed 10000 kHz (freq checked by log analyser)\n\n```\ncpufreq 1500000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.222946s (574.130 KiB/s)\ncpufreq 1600000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.222928s (574.176 KiB/s)\ncpufreq 1600000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.222928s (574.176 KiB/s)\ncpufreq 1600000\ndumped 131072 bytes in 0.220144s (581.438 KiB/s)\ncpufreq 1600000\ndumped 131072 bytes in 0.220167s (581.377 KiB/s)\ncpufreq 1600000\ndumped 131072 bytes in 0.220179s (581.345 KiB/s)\ncpufreq 1600000\n[stm32h7x.cpu0] halted due to single-step, current mode: Thread\nxPSR: 0x41000000 pc: 0x0800a0a0 msp: 0x2001ff98\n2052 microseconds per iteration\n[stm32h7x.cpu0] halted due to single-step, current mode: Thread\nxPSR: 0x41000000 pc: 0x0800a0a0 msp: 0x2001ff98\n2085 microseconds per iteration\n[stm32h7x.cpu0] halted due to single-step, current mode: Thread\nxPSR: 0x41000000 pc: 0x0800a0a0 msp: 0x2001ff98\n2024 microseconds per iteration\ncpufreq 1600000\n```\n\nWith performance governor:\n```\ncpufreq 2400000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.216517s (591.178 KiB/s)\ncpufreq 2400000\ndumped 131072 bytes in 0.215098s (595.078 KiB/s)\ncpufreq 2400000\n[stm32h7x.cpu0] halted due to single-step, current mode: Thread\nxPSR: 0x41000000 pc: 0x0800a0a0 msp: 0x2001ff98\n1883 microseconds per iteration\ncpufreq 2400000\n```\n\nNot surprisingly faster than CMSIS-DAP connected by USB FS\n(probably faster than any USB FS connected adapter).\nLog analyser: Burst 354 us, idle 76 us \u003d\u003e 18 % idle\nTheor max 10000000./8/7*4\u003d714285 (with 10 idle clk)\nReal load runs 80% (82.7%), dump 81% (83.3%) of theor max\nwith ondemand (performance) governor.\nIMO perfect from performance point of view, thanks a lot.\n\nI\u0027ll review the code later.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"ad9b3497af5e1a57db09113cc96bc96ac0c07a38","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"a5b5c784_c7b98c4a","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"b0daef32_a2f0d399","updated":"2024-12-26 14:22:24.000000000","message":"Thanks for running these tests. It\u0027s encouraging to see that we are getting very close to the theoretical maximum of 333 KiB/s even with single threading on RPi5. The unnamed Qualcomm part probably has some aggressive power saving features. that hurt performance. Adjusting CPU frequency is likely.\n\nOn my multithreading tests I used the same features (MAX_QUEUE_ENTRIES 300 and all transactions 6 bytes long) to make it possible to compare the multi threading results to the sweep of results I made before. I believe that the results would be quite similar to dap memaccess 2 but I haven\u0027t tested that yet so I\u0027m not sure.\n\nYou make a great point that the multithreading would add additional latency to operations like single stepping and makes it less valuable. With that, I\u0027m confident that the single threaded solution is the best all around performer especially on the RPi5, likely the largest consumer of this adapter.\n\nIf you have time, would you be interested in running the tests at `adapter speed 10000` like you attempted on your first performance tests? I\u0027d really like to see how spidev performs vs CMSIS-DAP now that we have queuing in place. I\u0027d attempt it myself but I don\u0027t have a way to connect a 470 ohm resistor remotely.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"89bdd0acc94f9972d7336cae6639a3a550d153ed","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"40a1bd74_d669e816","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"c5ee2fc1_ed2fdadb","updated":"2025-01-06 20:39:45.000000000","message":"I accidentally used cut instead of copy with the first result. The correct value is 843.111 KiB/s.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"72262f41ed150ee1640e944f68f95588ba254405","unresolved":false,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"b0daef32_a2f0d399","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"da78b553_728d3e3a","updated":"2024-12-26 11:42:47.000000000","message":"\u003e I\u0027ve been curious how efficient these SPI interfaces can be so decided to go\n\u003e for broke and attempt putting SPI transactions in their own thread and post\n\u003e processing in another thread (attempted in patchset 12 for future readers).\n\nAlthough I fully agree with Antonio\n\n\u003e Please stay single threaded as all OpenOCD is.\n\nthe threaded version was a valuable experiment.\nI thought that the data preparation during a long SWD transfer is nearly\nnegligible on a reasonable fast host.\n\n\u003e single threaded:\n\u003e 272.082 KiB/s\n\u003e\n\u003e multi threaded:\n\u003e 291.459 KiB/s\n\nThere is ~6.5% speed diff: more than I would expect.\nPerhaps your host is much slower or the tests was not fully comparable\nbecause of some unexpected influence (e.g. changed number of delay bits\nor the host CPU clock changed under cpufreq control?)\n\nI connected a logic analyser and rerun the tests on RPi5.\nIndeed, the threaded patchset inserted just 2 idle clocks whereas patchset 17 (with 360 ops/q) honoured `dap memaccess` and inserted 10 idles.\nWith `dap memaccess 2` which made the tests comparable the difference is\nmuch smaller:\n\nSingle thread, dap memaccess 2:\n```\ncpufreq 1500000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.412328s (310.432 KiB/s)\ncpufreq 1500000\ndumped 131072 bytes in 0.409101s (312.881 KiB/s)\ncpufreq 1500000\n[stm32h7x.cpu0] halted due to single-step, current mode: Thread\nxPSR: 0x41000000 pc: 0x0800a0a0 msp: 0x2001ff98\n3466 microseconds per iteration\ncpufreq 1500000\n```\n\nMulti threaded (fixed 2 idle clk cycles):\n```\ncpufreq 1500000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.400151s (319.879 KiB/s)\ncpufreq 1500000\ndumped 131072 bytes in 0.404980s (316.065 KiB/s)\ncpufreq 1500000\n[stm32h7x.cpu0] halted due to single-step, current mode: Thread\nxPSR: 0x41000000 pc: 0x0800a0a0 msp: 0x2001ff98\n3685 microseconds per iteration\ncpufreq 1500000\n```\n\nSo the multithreaded version is faster by 1.3% @ dump, by 3% @ load\nand roughly by 6% **SLOWER** for single stepping (a more complicated handling\nprobably slows down short transfers).\n\nAlso the logic analyser showed that the pauses between the SWD clocked bursts are approx 2.5% of the burst size in single thread and ~1% in multi threaded.\n\nUndoubtedly not worth to implement the more complex multithreaded handling for such disputable speed gain.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"69b6cc6a877073544ef57a03a694fb38fab57e19","unresolved":true,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"02f6b654_b8c61c0b","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"dde5e3be_dc6e1020","updated":"2024-12-21 15:55:35.000000000","message":"As an experiment, I made all transactions 6 bytes long. With this, at 4 MHz it seems like our theoretical maximum is 333 KiB/s\n(4000 KHz/8 bits)*(4 byte payload/6 bytes per SWD transaction)\n\nI sweeped through some MAX_QUEUE_ENTRIES values using `dump_image /dev/null 0x20000000 0x42000` as our test.\n\nResults:\n\n1000: exchange failed\nSWD DPIDR 0x0bc12477, DLPIDR 0x00000001\nFailed to read memory at 0xe000edf0\n500: 208.699 KiB/s\n400: 268.878 KiB/s\n300: 272.082 KiB/s\n256: 260.035 KiB/s\n200: 253.387 KiB/s\n100: 240.994 KiB/s\n50: 221.328 KiB/s\n32: 194.441 KiB/s\n25: 178.539 KiB/s\n\nIt\u0027s confusing that things slow down at 500 and outright fail at 1000. I\u0027m wondering if we hit some internal limit in OpenOCD or maybe a limit with the SPI hardware or driver implementation. I can\u0027t see why the target would care.\n\nMAX_QUEUE_ENTRIES \u003d 300 is 82% of our theoretical maximum. It\u0027s possible that we are CPU bound here as the CPU needs to prepare and process the transactions.\n\nUsing MAX_QUEUE_ENTRIES \u003d 32 in my opinion leaves too much performance off the table. I\u0027ve set the value to 64.\n\nIt\u0027s possible we need two queues and two threads to keep the bus fully pumped. This may help get the RAM requirements down, and not allowing the transactions to get too large.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"15db90629fe09f7f8a063cae880d017774004d2f","unresolved":true,"context_lines":[{"line_number":70,"context_line":"#define SPI_DESELECT_DELAY 0"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"// Maximum number of SWD transactions to queue together in a SPI exchange"},{"line_number":73,"context_line":"#define MAX_QUEUE_ENTRIES 256"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"#define CMD_BITS 8"},{"line_number":76,"context_line":"#define TURN_BITS 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"02c6b17b_57f275ba","line":73,"range":{"start_line":73,"start_character":26,"end_line":73,"end_character":29},"in_reply_to":"f68590e1_337e6441","updated":"2024-12-23 02:06:39.000000000","message":"I\u0027ve been curious how efficient these SPI interfaces can be so decided to go for broke and attempt putting SPI transactions in their own thread and post processing in another thread (attempted in patchset 12 for future readers). This results in a small increase in speed. \n\nwith MAX_QUEUE_ENTRIES 300\n\nsingle threaded:\n272.082 KiB/s\n\nmulti threaded:\n291.459 KiB/s\n\nI suppose some delay is going to be simply unavoidable because of CS setup/shutdown delay and linux scheduler latency. \n\nI will revert to single threaded as it adds quite a lot of complexity to the driver making it harder to follow and maintain. It\u0027s possible this will be more valuable for other implementations so I decided to push it here anyway.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"87dcecbf2001375a745f88db7a7c8fe3ce91752d","unresolved":true,"context_lines":[{"line_number":78,"context_line":"#define DATA_BITS 32"},{"line_number":79,"context_line":"#define PARITY_BITS 1"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"#define SWD_WR_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + TURN_BITS + DATA_BITS + PARITY_BITS, SPI_BITS))"},{"line_number":82,"context_line":"#define SWD_RD_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS, SPI_BITS))"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"#define DELAY_BYTES 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"adeba8cf_009a44de","line":81,"updated":"2024-12-21 12:00:07.000000000","message":"Now _WR_ is misleading and SWD_RD_BYTES is not used at all. Rename to SWD_OP_?","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"69b6cc6a877073544ef57a03a694fb38fab57e19","unresolved":false,"context_lines":[{"line_number":78,"context_line":"#define DATA_BITS 32"},{"line_number":79,"context_line":"#define PARITY_BITS 1"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"#define SWD_WR_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + TURN_BITS + DATA_BITS + PARITY_BITS, SPI_BITS))"},{"line_number":82,"context_line":"#define SWD_RD_BYTES (DIV_ROUND_UP(CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS, SPI_BITS))"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"#define DELAY_BYTES 1"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"99bc1b87_e5132011","line":81,"in_reply_to":"adeba8cf_009a44de","updated":"2024-12-21 15:55:35.000000000","message":"I\u0027ve changed this around a bit to use MAX of both values (even though it adds up to the same value). I\u0027d like to communicate that we\u0027re keeping the size of both values in account.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":226,"context_line":"\t\treturn ERROR_OK;"},{"line_number":227,"context_line":""},{"line_number":228,"context_line":"\t// Open SPI device."},{"line_number":229,"context_line":"\tspi_fd \u003d open(spi_path, O_RDWR);"},{"line_number":230,"context_line":"\tif (spi_fd \u003c 0) {"},{"line_number":231,"context_line":"\t\tLOG_ERROR(\"Failed to open SPI port at %s\", spi_path);"},{"line_number":232,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"725e0ccc_f5cc31dc","line":229,"updated":"2024-12-21 14:43:01.000000000","message":"I think we will get segmentation fault if `spi_path \u003d\u003d NULL`.\nAdd a check and print a message that the path is not set yet","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":226,"context_line":"\t\treturn ERROR_OK;"},{"line_number":227,"context_line":""},{"line_number":228,"context_line":"\t// Open SPI device."},{"line_number":229,"context_line":"\tspi_fd \u003d open(spi_path, O_RDWR);"},{"line_number":230,"context_line":"\tif (spi_fd \u003c 0) {"},{"line_number":231,"context_line":"\t\tLOG_ERROR(\"Failed to open SPI port at %s\", spi_path);"},{"line_number":232,"context_line":"\t\treturn ERROR_JTAG_INIT_FAILED;"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"6dda14fc_cecc2a1b","line":229,"in_reply_to":"725e0ccc_f5cc31dc","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1504f004fed591b6c60dc901113494bb5ef2cc25","unresolved":true,"context_lines":[{"line_number":349,"context_line":"\t cycles to ensure that data is clocked through the AP. Since the tx buffer"},{"line_number":350,"context_line":"\t is zeroed above, setting the buffer to 1 below will add on 8 idle cycles."},{"line_number":351,"context_line":"\t */"},{"line_number":352,"context_line":"\tqueue_buf_fill \u003d 1;"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"\tretval \u003d queued_retval;"},{"line_number":355,"context_line":"\tqueued_retval \u003d ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"7cc3b17e_19229119","line":352,"range":{"start_line":352,"start_character":1,"end_line":352,"end_character":19},"updated":"2024-12-21 05:51:03.000000000","message":"This does not meet ARM ADI.\nThe idle clocks should immediately follow the last transaction. If they are just queued for the next time the last SWD write could stay unfinished in SWD state machine, not propagated to APB/AHB/AXI bus until the next SWD op takes place. And the next SWD op always generates enough clocks, so it does not need to be prepended by idle clocks.\n\nActually works until one sets `dap.memaccess` below 8 (the value passed in ap_delay_clk)","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"69b6cc6a877073544ef57a03a694fb38fab57e19","unresolved":false,"context_lines":[{"line_number":349,"context_line":"\t cycles to ensure that data is clocked through the AP. Since the tx buffer"},{"line_number":350,"context_line":"\t is zeroed above, setting the buffer to 1 below will add on 8 idle cycles."},{"line_number":351,"context_line":"\t */"},{"line_number":352,"context_line":"\tqueue_buf_fill \u003d 1;"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"\tretval \u003d queued_retval;"},{"line_number":355,"context_line":"\tqueued_retval \u003d ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"7f7bbbf7_407ecffa","line":352,"range":{"start_line":352,"start_character":1,"end_line":352,"end_character":19},"in_reply_to":"7cc3b17e_19229119","updated":"2024-12-21 15:55:35.000000000","message":"I\u0027ve moved advancing the buffer forward right before the SPI exchange when the queue is run. This ensures that 1 additional byte is clocked out after the queue is written out.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"87dcecbf2001375a745f88db7a7c8fe3ce91752d","unresolved":true,"context_lines":[{"line_number":359,"context_line":""},{"line_number":360,"context_line":"static void spidev_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data, uint32_t ap_delay_clk)"},{"line_number":361,"context_line":"{"},{"line_number":362,"context_line":"\tuint32_t delay_bytes \u003d (cmd \u0026 SWD_CMD_APNDP) ? DIV_ROUND_UP(ap_delay_clk, SPI_BITS) : 0;"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"\tif (queue_fill \u003e\u003d MAX_QUEUE_ENTRIES || queue_buf_fill + SWD_WR_BYTES + delay_bytes \u003e\u003d QUEUE_BUF_BYTES) {"},{"line_number":365,"context_line":"\t\t// Not enough room in the queue. Run the queue."}],"source_content_type":"text/x-csrc","patch_set":10,"id":"73216144_b81a5c31","line":362,"updated":"2024-12-21 12:00:07.000000000","message":"Minor sub-optimality in the number of delay bits:\nSWD op has 46 bits so 2 delay bits are always added to align at byte boundary.\nAlso accidentally 2 delay clocks are the working minimum for a modern Cortex-M MCU.\nSo the following computation could speed up the transfer by factor 7/6 with `dap memaccess 2` (or by factor 8/7 with memaccess 9 or 10)\n```\nunsigned int swd_op_bytes \u003d DIV_ROUND_UP(\n   SWD_OP_BITS + ((cmd \u0026 SWD_CMD_APNDP) ? ap_delay_clk : 0),\n   SPI_BITS)\n```","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":359,"context_line":""},{"line_number":360,"context_line":"static void spidev_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data, uint32_t ap_delay_clk)"},{"line_number":361,"context_line":"{"},{"line_number":362,"context_line":"\tuint32_t delay_bytes \u003d (cmd \u0026 SWD_CMD_APNDP) ? DIV_ROUND_UP(ap_delay_clk, SPI_BITS) : 0;"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"\tif (queue_fill \u003e\u003d MAX_QUEUE_ENTRIES || queue_buf_fill + SWD_WR_BYTES + delay_bytes \u003e\u003d QUEUE_BUF_BYTES) {"},{"line_number":365,"context_line":"\t\t// Not enough room in the queue. Run the queue."}],"source_content_type":"text/x-csrc","patch_set":10,"id":"af53e7d6_20f3c83e","line":362,"in_reply_to":"4ec6039e_7c6b46c7","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"69b6cc6a877073544ef57a03a694fb38fab57e19","unresolved":true,"context_lines":[{"line_number":359,"context_line":""},{"line_number":360,"context_line":"static void spidev_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data, uint32_t ap_delay_clk)"},{"line_number":361,"context_line":"{"},{"line_number":362,"context_line":"\tuint32_t delay_bytes \u003d (cmd \u0026 SWD_CMD_APNDP) ? DIV_ROUND_UP(ap_delay_clk, SPI_BITS) : 0;"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"\tif (queue_fill \u003e\u003d MAX_QUEUE_ENTRIES || queue_buf_fill + SWD_WR_BYTES + delay_bytes \u003e\u003d QUEUE_BUF_BYTES) {"},{"line_number":365,"context_line":"\t\t// Not enough room in the queue. Run the queue."}],"source_content_type":"text/x-csrc","patch_set":10,"id":"c8b6e80f_f9d5e3fc","line":362,"in_reply_to":"73216144_b81a5c31","updated":"2024-12-21 15:55:35.000000000","message":"It seems to me that when performing `dump_image /dev/null 0x20000000 0x42000` almost all of the commands queued use ap_delay_clk \u003d 8, making these transactions 7 bytes long.\n\nI couldn\u0027t find in IHI0031G_debug_interface_v5_2_architecture_specification.pdf where when APnDP is set that 8 cycles must be added. I\u0027m sure there is a reason that OpenOCD has this.","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3feb18d2e5a578ea4b0ec4070d8f76f7d8960e7a","unresolved":true,"context_lines":[{"line_number":359,"context_line":""},{"line_number":360,"context_line":"static void spidev_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data, uint32_t ap_delay_clk)"},{"line_number":361,"context_line":"{"},{"line_number":362,"context_line":"\tuint32_t delay_bytes \u003d (cmd \u0026 SWD_CMD_APNDP) ? DIV_ROUND_UP(ap_delay_clk, SPI_BITS) : 0;"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"\tif (queue_fill \u003e\u003d MAX_QUEUE_ENTRIES || queue_buf_fill + SWD_WR_BYTES + delay_bytes \u003e\u003d QUEUE_BUF_BYTES) {"},{"line_number":365,"context_line":"\t\t// Not enough room in the queue. Run the queue."}],"source_content_type":"text/x-csrc","patch_set":10,"id":"4ec6039e_7c6b46c7","line":362,"in_reply_to":"c8b6e80f_f9d5e3fc","updated":"2024-12-21 22:59:01.000000000","message":"Richard, this is not really written in IHI0031.\n\nEvery R/W in the DP is immediate. Do not expect it to return WAIT in the ACK field. Actually IHI0031 say that only R/W to DPIDR, CTRL/STAT and ABORT don\u0027t return WAIT. Anyway, for DP access we do not add delay.\n\nInstead R/W to AP often return WAIT.\nThe action requested after a WAIT is to retry the operation, but this means OpenOCD has to check for WAIT at every R/W... so no queue, slow.\nSome intelligent adapter is able to do it transparently for us, but not spidev!\nSince the WAIT from AP is mainly due to SoC bus latency, we inject a pre-defined delay in every AP R/W, delay set by `dap memaccess` command. Such delay is enough to compensate the SoC bus delay so every R/W after the delay would not return WAIT.\n\nAnyway, OpenOCD checks all the WAIT after a queue flush and eventually re-run it slowly.\n\nRegarding the code, here:\nThe SWD framework only set `ap_delay_clk` for AP R/W. It is zero for DP.\nYou do not need to check APNDP again. Simply:\n`uint32_t delay_bytes \u003d DIV_ROUND_UP(ap_delay_clk, SPI_BITS);`","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":452,"context_line":"\t\tfree(spi_path);"},{"line_number":453,"context_line":"\t\tspi_path \u003d strdup(CMD_ARGV[0]);"},{"line_number":454,"context_line":"\t} else {"},{"line_number":455,"context_line":"\t\tLOG_ERROR(\"expected exactly one argument to spidev path \u003cpath\u003e\");"},{"line_number":456,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":457,"context_line":"\t}"},{"line_number":458,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":10,"id":"a3c54245_0ebbf28f","line":455,"updated":"2024-12-21 14:43:01.000000000","message":"Drop this LOG_xxx, it is handled by `ERROR_COMMAND_SYNTAX_ERROR`.\nI prefer you re-write this functions as:\n```\nif (CMD_ARGC !\u003d 1)\n\treturn ERROR_COMMAND_SYNTAX_ERROR;\nfree(spi_path);\nspi_path \u003d strdup(CMD_ARGV[0]);\nif (!spi_path) {\n\tLOG_ERROR(\"Out of memory\");\n\treturn ERROR_FAIL;\n}\nreturn ERROR_OK;\n```","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":452,"context_line":"\t\tfree(spi_path);"},{"line_number":453,"context_line":"\t\tspi_path \u003d strdup(CMD_ARGV[0]);"},{"line_number":454,"context_line":"\t} else {"},{"line_number":455,"context_line":"\t\tLOG_ERROR(\"expected exactly one argument to spidev path \u003cpath\u003e\");"},{"line_number":456,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":457,"context_line":"\t}"},{"line_number":458,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":10,"id":"38e4b147_c88e249d","line":455,"in_reply_to":"a3c54245_0ebbf28f","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":461,"context_line":""},{"line_number":462,"context_line":"COMMAND_HANDLER(spidev_handle_mode_command)"},{"line_number":463,"context_line":"{"},{"line_number":464,"context_line":"\tif (CMD_ARGC \u003d\u003d 1)"},{"line_number":465,"context_line":"\t\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], spi_mode);"},{"line_number":466,"context_line":"\telse"},{"line_number":467,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"0f6a2f26_9325ee59","line":464,"updated":"2024-12-21 14:43:01.000000000","message":"Also this is preferred as:\n```\nif (CMD_ARGC !\u003d 1)\n\treturn ERROR_COMMAND_SYNTAX_ERROR;\nCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], spi_mode);\nreturn ERROR_OK;\n```","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":461,"context_line":""},{"line_number":462,"context_line":"COMMAND_HANDLER(spidev_handle_mode_command)"},{"line_number":463,"context_line":"{"},{"line_number":464,"context_line":"\tif (CMD_ARGC \u003d\u003d 1)"},{"line_number":465,"context_line":"\t\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], spi_mode);"},{"line_number":466,"context_line":"\telse"},{"line_number":467,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"48ff80f6_4d689f19","line":464,"in_reply_to":"0f6a2f26_9325ee59","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":479,"context_line":""},{"line_number":480,"context_line":"static const struct command_registration spidev_subcommand_handlers[] \u003d {"},{"line_number":481,"context_line":"\t{"},{"line_number":482,"context_line":"\t\t.name \u003d \"path\","},{"line_number":483,"context_line":"\t\t.handler \u003d \u0026spidev_handle_path_command,"},{"line_number":484,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":485,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","}],"source_content_type":"text/x-csrc","patch_set":10,"id":"5df029cf_0461f927","line":482,"updated":"2024-12-21 14:43:01.000000000","message":"This and next command should be documented","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":false,"context_lines":[{"line_number":479,"context_line":""},{"line_number":480,"context_line":"static const struct command_registration spidev_subcommand_handlers[] \u003d {"},{"line_number":481,"context_line":"\t{"},{"line_number":482,"context_line":"\t\t.name \u003d \"path\","},{"line_number":483,"context_line":"\t\t.handler \u003d \u0026spidev_handle_path_command,"},{"line_number":484,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":485,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","}],"source_content_type":"text/x-csrc","patch_set":10,"id":"c6828419_da36da0b","line":482,"in_reply_to":"4c5a761c_58ab0b40","updated":"2024-12-24 13:05:14.000000000","message":"I\u0027ve added these in the previous commit in doc/openocd.texi at line 3412. Is this not the correct section for these?","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":479,"context_line":""},{"line_number":480,"context_line":"static const struct command_registration spidev_subcommand_handlers[] \u003d {"},{"line_number":481,"context_line":"\t{"},{"line_number":482,"context_line":"\t\t.name \u003d \"path\","},{"line_number":483,"context_line":"\t\t.handler \u003d \u0026spidev_handle_path_command,"},{"line_number":484,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":485,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","}],"source_content_type":"text/x-csrc","patch_set":10,"id":"b5b27168_01156dfe","line":482,"in_reply_to":"5df029cf_0461f927","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":479,"context_line":""},{"line_number":480,"context_line":"static const struct command_registration spidev_subcommand_handlers[] \u003d {"},{"line_number":481,"context_line":"\t{"},{"line_number":482,"context_line":"\t\t.name \u003d \"path\","},{"line_number":483,"context_line":"\t\t.handler \u003d \u0026spidev_handle_path_command,"},{"line_number":484,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":485,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","}],"source_content_type":"text/x-csrc","patch_set":10,"id":"4c5a761c_58ab0b40","line":482,"in_reply_to":"b5b27168_01156dfe","updated":"2024-12-24 10:49:05.000000000","message":"I mean, there should be the relevant entry in the doc/openocd.texi for the two commands:\n`spidev path`\n`spidev mode`\nI have added a draft in another comment, please reword it as you prefer","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":483,"context_line":"\t\t.handler \u003d \u0026spidev_handle_path_command,"},{"line_number":484,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":485,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","},{"line_number":486,"context_line":"\t\t.usage \u003d \"example: /dev/spidev0.0\","},{"line_number":487,"context_line":"\t},"},{"line_number":488,"context_line":"\t{"},{"line_number":489,"context_line":"\t\t.name \u003d \"mode\","}],"source_content_type":"text/x-csrc","patch_set":10,"id":"a8cf3f46_cceaf1f2","line":486,"updated":"2024-12-21 14:43:01.000000000","message":"simply:\n`.usage \u003d \"path_to_spidev\",`\nthe example can eventually go in the documentation.\nOr, it could be nice to have a config script in `tcl/interface/spidev_example.cfg` to report such example","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":483,"context_line":"\t\t.handler \u003d \u0026spidev_handle_path_command,"},{"line_number":484,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":485,"context_line":"\t\t.help \u003d \"set the path to the spidev device\","},{"line_number":486,"context_line":"\t\t.usage \u003d \"example: /dev/spidev0.0\","},{"line_number":487,"context_line":"\t},"},{"line_number":488,"context_line":"\t{"},{"line_number":489,"context_line":"\t\t.name \u003d \"mode\","}],"source_content_type":"text/x-csrc","patch_set":10,"id":"3e50adc0_b7e629c3","line":486,"in_reply_to":"a8cf3f46_cceaf1f2","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":489,"context_line":"\t\t.name \u003d \"mode\","},{"line_number":490,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":491,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":492,"context_line":"\t\t.help \u003d \"set the mode of the spi port with optional bit flags\","},{"line_number":493,"context_line":"\t\t.usage \u003d \"(number in decimal or hex)\","},{"line_number":494,"context_line":"\t},"},{"line_number":495,"context_line":"\tCOMMAND_REGISTRATION_DONE"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"b38abad2_965e048c","line":492,"updated":"2024-12-21 14:43:01.000000000","message":"please report the default value, e.g.:\n`.help \u003d \"set the mode of the spi port with optional bit flags (default\u003d3)\",`","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":489,"context_line":"\t\t.name \u003d \"mode\","},{"line_number":490,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":491,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":492,"context_line":"\t\t.help \u003d \"set the mode of the spi port with optional bit flags\","},{"line_number":493,"context_line":"\t\t.usage \u003d \"(number in decimal or hex)\","},{"line_number":494,"context_line":"\t},"},{"line_number":495,"context_line":"\tCOMMAND_REGISTRATION_DONE"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"44d45b3f_625e335e","line":492,"in_reply_to":"b38abad2_965e048c","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"c645fcaeee783216209f7695a06a3e4418c5ca3e","unresolved":true,"context_lines":[{"line_number":490,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":491,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":492,"context_line":"\t\t.help \u003d \"set the mode of the spi port with optional bit flags\","},{"line_number":493,"context_line":"\t\t.usage \u003d \"(number in decimal or hex)\","},{"line_number":494,"context_line":"\t},"},{"line_number":495,"context_line":"\tCOMMAND_REGISTRATION_DONE"},{"line_number":496,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"967e1ae8_619a5d93","line":493,"updated":"2024-12-21 14:43:01.000000000","message":"use simply\n`.usage \u003d \"mode\",`","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"a305ac86983d48df9337429e50e04b62e7c2c1a2","unresolved":false,"context_lines":[{"line_number":490,"context_line":"\t\t.handler \u003d \u0026spidev_handle_mode_command,"},{"line_number":491,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":492,"context_line":"\t\t.help \u003d \"set the mode of the spi port with optional bit flags\","},{"line_number":493,"context_line":"\t\t.usage \u003d \"(number in decimal or hex)\","},{"line_number":494,"context_line":"\t},"},{"line_number":495,"context_line":"\tCOMMAND_REGISTRATION_DONE"},{"line_number":496,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"733737b5_e27aed48","line":493,"in_reply_to":"967e1ae8_619a5d93","updated":"2024-12-23 21:40:07.000000000","message":"Done","commit_id":"c91fe76e74ac34dd4125243f1846b353a3811bda"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":47,"context_line":""},{"line_number":48,"context_line":"#include \u003cstdint.h\u003e"},{"line_number":49,"context_line":"#include \u003cunistd.h\u003e"},{"line_number":50,"context_line":"#include \u003cstdio.h\u003e"},{"line_number":51,"context_line":"#include \u003cstdlib.h\u003e"},{"line_number":52,"context_line":"#include \u003cgetopt.h\u003e"},{"line_number":53,"context_line":"#include \u003cfcntl.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"a658c907_ad9b5e3b","line":50,"updated":"2024-12-24 10:49:05.000000000","message":"I think this is not needed.","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":false,"context_lines":[{"line_number":47,"context_line":""},{"line_number":48,"context_line":"#include \u003cstdint.h\u003e"},{"line_number":49,"context_line":"#include \u003cunistd.h\u003e"},{"line_number":50,"context_line":"#include \u003cstdio.h\u003e"},{"line_number":51,"context_line":"#include \u003cstdlib.h\u003e"},{"line_number":52,"context_line":"#include \u003cgetopt.h\u003e"},{"line_number":53,"context_line":"#include \u003cfcntl.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"de5e34b9_4c814ceb","line":50,"in_reply_to":"a658c907_ad9b5e3b","updated":"2024-12-24 13:05:14.000000000","message":"Done","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":49,"context_line":"#include \u003cunistd.h\u003e"},{"line_number":50,"context_line":"#include \u003cstdio.h\u003e"},{"line_number":51,"context_line":"#include \u003cstdlib.h\u003e"},{"line_number":52,"context_line":"#include \u003cgetopt.h\u003e"},{"line_number":53,"context_line":"#include \u003cfcntl.h\u003e"},{"line_number":54,"context_line":"#include \u003csys/ioctl.h\u003e"},{"line_number":55,"context_line":"#include \u003clinux/types.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"fdccc2b7_b0f308f3","line":52,"updated":"2024-12-24 10:49:05.000000000","message":"I see this `getopt.h` is not used. drop it","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":false,"context_lines":[{"line_number":49,"context_line":"#include \u003cunistd.h\u003e"},{"line_number":50,"context_line":"#include \u003cstdio.h\u003e"},{"line_number":51,"context_line":"#include \u003cstdlib.h\u003e"},{"line_number":52,"context_line":"#include \u003cgetopt.h\u003e"},{"line_number":53,"context_line":"#include \u003cfcntl.h\u003e"},{"line_number":54,"context_line":"#include \u003csys/ioctl.h\u003e"},{"line_number":55,"context_line":"#include \u003clinux/types.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"8a11f170_f09e2b67","line":52,"in_reply_to":"fdccc2b7_b0f308f3","updated":"2024-12-24 13:05:14.000000000","message":"Done","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":52,"context_line":"#include \u003cgetopt.h\u003e"},{"line_number":53,"context_line":"#include \u003cfcntl.h\u003e"},{"line_number":54,"context_line":"#include \u003csys/ioctl.h\u003e"},{"line_number":55,"context_line":"#include \u003clinux/types.h\u003e"},{"line_number":56,"context_line":"#include \u003clinux/spi/spidev.h\u003e"},{"line_number":57,"context_line":"#include \u003cjtag/adapter.h\u003e"},{"line_number":58,"context_line":"#include \u003cjtag/swd.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"3d655fda_bdaa7271","line":55,"updated":"2024-12-24 10:49:05.000000000","message":"removed linux types, the include is not needed\nadd\n`#include \u003cstring.h\u003e` for `strdup()`","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":false,"context_lines":[{"line_number":52,"context_line":"#include \u003cgetopt.h\u003e"},{"line_number":53,"context_line":"#include \u003cfcntl.h\u003e"},{"line_number":54,"context_line":"#include \u003csys/ioctl.h\u003e"},{"line_number":55,"context_line":"#include \u003clinux/types.h\u003e"},{"line_number":56,"context_line":"#include \u003clinux/spi/spidev.h\u003e"},{"line_number":57,"context_line":"#include \u003cjtag/adapter.h\u003e"},{"line_number":58,"context_line":"#include \u003cjtag/swd.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"ab128d40_9ec8ec36","line":55,"in_reply_to":"3d655fda_bdaa7271","updated":"2024-12-24 13:05:14.000000000","message":"Done","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":58,"context_line":"#include \u003cjtag/swd.h\u003e"},{"line_number":59,"context_line":"#include \u003cjtag/interface.h\u003e"},{"line_number":60,"context_line":"#include \u003cjtag/commands.h\u003e"},{"line_number":61,"context_line":"#include \u003chelper/time_support.h\u003e"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"// Timeout for retrying on SWD WAIT in msec"},{"line_number":64,"context_line":"#define SWD_WAIT_TIMEOUT 500"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"b5abaeb5_163686f1","line":61,"updated":"2024-12-24 10:49:05.000000000","message":"not used, drop it","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":false,"context_lines":[{"line_number":58,"context_line":"#include \u003cjtag/swd.h\u003e"},{"line_number":59,"context_line":"#include \u003cjtag/interface.h\u003e"},{"line_number":60,"context_line":"#include \u003cjtag/commands.h\u003e"},{"line_number":61,"context_line":"#include \u003chelper/time_support.h\u003e"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"// Timeout for retrying on SWD WAIT in msec"},{"line_number":64,"context_line":"#define SWD_WAIT_TIMEOUT 500"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"ee6cce42_65193739","line":61,"in_reply_to":"b5abaeb5_163686f1","updated":"2024-12-24 13:05:14.000000000","message":"Done","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":182,"context_line":"\tuint32_t tmp_speed \u003d speed;"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MAX_SPEED_HZ, \u0026tmp_speed);"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":187,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI %d speed\", speed);"},{"line_number":188,"context_line":"\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"60308f04_860b7250","line":185,"updated":"2024-12-24 10:49:05.000000000","message":"minor, please remove this empty line","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":false,"context_lines":[{"line_number":182,"context_line":"\tuint32_t tmp_speed \u003d speed;"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_WR_MAX_SPEED_HZ, \u0026tmp_speed);"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"\tif (ret \u003d\u003d -1) {"},{"line_number":187,"context_line":"\t\tLOG_ERROR(\"Failed to set SPI %d speed\", speed);"},{"line_number":188,"context_line":"\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"827d65ad_b716597b","line":185,"in_reply_to":"60308f04_860b7250","updated":"2024-12-24 13:05:14.000000000","message":"Done","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b1f387ad0cf81a7ebfef2ebcda3bc618e8a8f698","unresolved":true,"context_lines":[{"line_number":355,"context_line":"\t}"},{"line_number":356,"context_line":""},{"line_number":357,"context_line":"skip:"},{"line_number":358,"context_line":"\tretval \u003d spidev_queue.retval;"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"\t// Clear everything in the queue"},{"line_number":361,"context_line":"\tmemset(\u0026spidev_queue, 0, sizeof(spidev_queue));"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"7c4e60a0_380ae6c2","line":358,"updated":"2024-12-24 10:49:05.000000000","message":"move here the declaration:\n`int retval \u003d ...`","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a0358585b4863d93b15c2acb6b25e8d955a3df83","unresolved":false,"context_lines":[{"line_number":355,"context_line":"\t}"},{"line_number":356,"context_line":""},{"line_number":357,"context_line":"skip:"},{"line_number":358,"context_line":"\tretval \u003d spidev_queue.retval;"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"\t// Clear everything in the queue"},{"line_number":361,"context_line":"\tmemset(\u0026spidev_queue, 0, sizeof(spidev_queue));"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"c3311221_b6de6c29","line":358,"in_reply_to":"0d5b8770_26c42822","updated":"2024-12-24 14:54:13.000000000","message":"Ack","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"1cb9e76b4a82bf8f45ffe630649dee39cfb3b416","unresolved":true,"context_lines":[{"line_number":355,"context_line":"\t}"},{"line_number":356,"context_line":""},{"line_number":357,"context_line":"skip:"},{"line_number":358,"context_line":"\tretval \u003d spidev_queue.retval;"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"\t// Clear everything in the queue"},{"line_number":361,"context_line":"\tmemset(\u0026spidev_queue, 0, sizeof(spidev_queue));"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"0d5b8770_26c42822","line":358,"in_reply_to":"7c4e60a0_380ae6c2","updated":"2024-12-24 13:05:14.000000000","message":"This is a new one for me\n\n```src/jtag/drivers/linuxspidev.c:353:2: error: label followed by a declaration is a C23 extension [-Werror,-Wc23-extensions]\n  353 |         int retval \u003d spidev_queue.retval;\n ```\n \nThe compiler doesn\u0027t appear to want a declaration directly after a goto label.","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"e57b2f1fbf05dca2fa61730902bb51d9260d68da","unresolved":false,"context_lines":[{"line_number":355,"context_line":"\t}"},{"line_number":356,"context_line":""},{"line_number":357,"context_line":"skip:"},{"line_number":358,"context_line":"\tretval \u003d spidev_queue.retval;"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"\t// Clear everything in the queue"},{"line_number":361,"context_line":"\tmemset(\u0026spidev_queue, 0, sizeof(spidev_queue));"}],"source_content_type":"text/x-csrc","patch_set":14,"id":"57223ec1_f4850409","line":358,"in_reply_to":"c3311221_b6de6c29","updated":"2025-01-06 15:04:58.000000000","message":"Antonio, do you have any additional thoughts on this CL?","commit_id":"135047a058d0a616631f9ced2d5412cf6431ca38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a0358585b4863d93b15c2acb6b25e8d955a3df83","unresolved":true,"context_lines":[{"line_number":143,"context_line":"\t}"},{"line_number":144,"context_line":"\t// Transmit the MSB buffer to SPI device."},{"line_number":145,"context_line":"\tstruct spi_ioc_transfer tr \u003d {"},{"line_number":146,"context_line":"\t\t.tx_buf \u003d (uint64_t)(tx_data ? tx_buf : NULL),"},{"line_number":147,"context_line":"\t\t.rx_buf \u003d (uint64_t)rx_data,"},{"line_number":148,"context_line":"\t\t.len \u003d len,"},{"line_number":149,"context_line":"\t\t.delay_usecs \u003d SPI_DESELECT_DELAY,"},{"line_number":150,"context_line":"\t\t.speed_hz \u003d spi_speed,"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"eafe7f2b_6e3609fb","line":147,"range":{"start_line":146,"start_character":2,"end_line":147,"end_character":30},"updated":"2024-12-24 14:54:13.000000000","message":"On 32 bit kernel the pointers are 32 bits.\nCasting a pointer to `(uint64_t)` returns error by jenkins:\n`error: cast from pointer to integer of different size`\nLooking in the spidev examples in kernel `tools/spi/*.c`, the way to be independent between 32 and 64 bits kernel is to use here a cast `(unsigned long)`, even if the destination `[rt]x_buf` is a `uint64_t`.\nMaybe we would need a comment above this line to avoid someone else try to \u0027fix\u0027 this apparently inconsistent assignment of `unsigned long` value to a `uint64_t` container.","commit_id":"6790522eb72d16da8031aecd8295fad48a136112"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"17de50db9894bb77065ffdb61c2ef83fc7f54dfb","unresolved":false,"context_lines":[{"line_number":143,"context_line":"\t}"},{"line_number":144,"context_line":"\t// Transmit the MSB buffer to SPI device."},{"line_number":145,"context_line":"\tstruct spi_ioc_transfer tr \u003d {"},{"line_number":146,"context_line":"\t\t.tx_buf \u003d (uint64_t)(tx_data ? tx_buf : NULL),"},{"line_number":147,"context_line":"\t\t.rx_buf \u003d (uint64_t)rx_data,"},{"line_number":148,"context_line":"\t\t.len \u003d len,"},{"line_number":149,"context_line":"\t\t.delay_usecs \u003d SPI_DESELECT_DELAY,"},{"line_number":150,"context_line":"\t\t.speed_hz \u003d spi_speed,"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"47a0e58a_304daf32","line":147,"range":{"start_line":146,"start_character":2,"end_line":147,"end_character":30},"in_reply_to":"eafe7f2b_6e3609fb","updated":"2024-12-24 15:45:03.000000000","message":"Thanks for finding the solution here!","commit_id":"6790522eb72d16da8031aecd8295fad48a136112"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8758ec77a99a950c6cc7b7c0d1e7f6e75dfcb379","unresolved":true,"context_lines":[{"line_number":57,"context_line":"#include \u003cjtag/interface.h\u003e"},{"line_number":58,"context_line":"#include \u003cjtag/commands.h\u003e"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"// Timeout for retrying on SWD WAIT in msec"},{"line_number":61,"context_line":"#define SWD_WAIT_TIMEOUT 500"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"// Number of bits per SPI exchange"},{"line_number":64,"context_line":"#define SPI_BITS 8"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"eb517c8d_8cb18621","line":61,"range":{"start_line":60,"start_character":0,"end_line":61,"end_character":28},"updated":"2024-12-30 16:38:34.000000000","message":"Unused","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"22b1cd188e3093e688e5ee70f247e3c6303146d2","unresolved":false,"context_lines":[{"line_number":57,"context_line":"#include \u003cjtag/interface.h\u003e"},{"line_number":58,"context_line":"#include \u003cjtag/commands.h\u003e"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"// Timeout for retrying on SWD WAIT in msec"},{"line_number":61,"context_line":"#define SWD_WAIT_TIMEOUT 500"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"// Number of bits per SPI exchange"},{"line_number":64,"context_line":"#define SPI_BITS 8"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"570ccf50_d5b3974b","line":61,"range":{"start_line":60,"start_character":0,"end_line":61,"end_character":28},"in_reply_to":"eb517c8d_8cb18621","updated":"2024-12-31 03:36:53.000000000","message":"Thanks. Good catch.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8758ec77a99a950c6cc7b7c0d1e7f6e75dfcb379","unresolved":true,"context_lines":[{"line_number":79,"context_line":"#define SWD_RD_BITS (CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS)"},{"line_number":80,"context_line":"#define SWD_OP_BITS (MAX(SWD_WR_BITS, SWD_RD_BITS))"},{"line_number":81,"context_line":"#define SWD_OP_BYTES (DIV_ROUND_UP(SWD_OP_BITS, SPI_BITS))"},{"line_number":82,"context_line":"#define DELAY_CLOCKS 2"},{"line_number":83,"context_line":"#define DELAY_BYTES (DIV_ROUND_UP(DELAY_CLOCKS, SPI_BITS))"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"/// File descriptor for SPI device"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"322ad7a7_aa8bfe24","line":82,"updated":"2024-12-30 16:38:34.000000000","message":"Please clarify if you mean the expected `ap_delay_clk` (normally 8) or idle clocks to follow the last transaction (also 8) or anything else?","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"22b1cd188e3093e688e5ee70f247e3c6303146d2","unresolved":false,"context_lines":[{"line_number":79,"context_line":"#define SWD_RD_BITS (CMD_BITS + TURN_BITS + ACK_BITS + DATA_BITS + PARITY_BITS + TURN_BITS)"},{"line_number":80,"context_line":"#define SWD_OP_BITS (MAX(SWD_WR_BITS, SWD_RD_BITS))"},{"line_number":81,"context_line":"#define SWD_OP_BYTES (DIV_ROUND_UP(SWD_OP_BITS, SPI_BITS))"},{"line_number":82,"context_line":"#define DELAY_CLOCKS 2"},{"line_number":83,"context_line":"#define DELAY_BYTES (DIV_ROUND_UP(DELAY_CLOCKS, SPI_BITS))"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"/// File descriptor for SPI device"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"a5587eef_3df13ebe","line":82,"in_reply_to":"322ad7a7_aa8bfe24","updated":"2024-12-31 03:36:53.000000000","message":"I\u0027ve changed this to `#define AP_DELAY_CLOCKS 8` to be more clear. \n\nThe initial intent was to add on DP cycles when a DP transaction was being requested or add on ap_delay_clk when a AP transaction is requested. Later Antonio pointed out that we can simply consume the ap_delay_clk value ignoring if it\u0027s AP or DP.\n\nSince this is now only used for buffer size calculations, we\u0027re really only looking for worst case now so 8 cycles is appropriate.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8758ec77a99a950c6cc7b7c0d1e7f6e75dfcb379","unresolved":true,"context_lines":[{"line_number":210,"context_line":"\treturn ERROR_OK;"},{"line_number":211,"context_line":"}"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":"static bool spidev_swd_mode_possible(void)"},{"line_number":214,"context_line":"{"},{"line_number":215,"context_line":"\treturn 1;"},{"line_number":216,"context_line":"}"},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"static void spidev_free_queue(void)"},{"line_number":219,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"50b1eae2_de0f15ae","line":216,"range":{"start_line":213,"start_character":0,"end_line":216,"end_character":1},"updated":"2024-12-30 16:38:34.000000000","message":"Useless, please simplify.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"22b1cd188e3093e688e5ee70f247e3c6303146d2","unresolved":false,"context_lines":[{"line_number":210,"context_line":"\treturn ERROR_OK;"},{"line_number":211,"context_line":"}"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":"static bool spidev_swd_mode_possible(void)"},{"line_number":214,"context_line":"{"},{"line_number":215,"context_line":"\treturn 1;"},{"line_number":216,"context_line":"}"},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"static void spidev_free_queue(void)"},{"line_number":219,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"0110c5bc_9345a358","line":216,"range":{"start_line":213,"start_character":0,"end_line":216,"end_character":1},"in_reply_to":"50b1eae2_de0f15ae","updated":"2024-12-31 03:36:53.000000000","message":"Done","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8758ec77a99a950c6cc7b7c0d1e7f6e75dfcb379","unresolved":true,"context_lines":[{"line_number":219,"context_line":"{"},{"line_number":220,"context_line":"\tmax_queue_entries \u003d 0;"},{"line_number":221,"context_line":"\tqueue_buf_size \u003d 0;"},{"line_number":222,"context_line":"\tif (queue_infos)"},{"line_number":223,"context_line":"\t\tfree(queue_infos);"},{"line_number":224,"context_line":""},{"line_number":225,"context_line":"\tif (queue_tx_buf)"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"d77c573f_8062234e","line":222,"range":{"start_line":222,"start_character":1,"end_line":222,"end_character":17},"updated":"2024-12-30 16:38:34.000000000","message":"Please remove the test, `free()` guaranties no operation on NULL ptr.\n\nOn the other hand the ptr should be assigned to NULL after `free()` as `spidev_free_queue()` is also called in the case of `realloc()` fail.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"22b1cd188e3093e688e5ee70f247e3c6303146d2","unresolved":false,"context_lines":[{"line_number":219,"context_line":"{"},{"line_number":220,"context_line":"\tmax_queue_entries \u003d 0;"},{"line_number":221,"context_line":"\tqueue_buf_size \u003d 0;"},{"line_number":222,"context_line":"\tif (queue_infos)"},{"line_number":223,"context_line":"\t\tfree(queue_infos);"},{"line_number":224,"context_line":""},{"line_number":225,"context_line":"\tif (queue_tx_buf)"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"488e90ac_4c45a2c1","line":222,"range":{"start_line":222,"start_character":1,"end_line":222,"end_character":17},"in_reply_to":"d77c573f_8062234e","updated":"2024-12-31 03:36:53.000000000","message":"Good catch. Got a little mixed up here.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8758ec77a99a950c6cc7b7c0d1e7f6e75dfcb379","unresolved":true,"context_lines":[{"line_number":239,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":240,"context_line":"\t}"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"\tunsigned int new_queue_buf_size \u003d new_queue_entries * (SWD_OP_BYTES + DELAY_BYTES);"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"\tqueue_infos \u003d realloc(queue_infos, sizeof(queue_info_t) * new_queue_entries);"},{"line_number":245,"context_line":"\tif (!queue_infos)"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"47d08f80_8c1f55a8","line":242,"updated":"2024-12-30 16:38:34.000000000","message":"\\+ 1 for `run_queue()` line 374 ?","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"22b1cd188e3093e688e5ee70f247e3c6303146d2","unresolved":false,"context_lines":[{"line_number":239,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":240,"context_line":"\t}"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"\tunsigned int new_queue_buf_size \u003d new_queue_entries * (SWD_OP_BYTES + DELAY_BYTES);"},{"line_number":243,"context_line":""},{"line_number":244,"context_line":"\tqueue_infos \u003d realloc(queue_infos, sizeof(queue_info_t) * new_queue_entries);"},{"line_number":245,"context_line":"\tif (!queue_infos)"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"0b771ff6_5e75c85f","line":242,"in_reply_to":"47d08f80_8c1f55a8","updated":"2024-12-31 03:36:53.000000000","message":"Agreed. Thank you.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8758ec77a99a950c6cc7b7c0d1e7f6e75dfcb379","unresolved":true,"context_lines":[{"line_number":371,"context_line":"\t is zeroed after each queue run, adding 1 to the buffer fill will add on"},{"line_number":372,"context_line":"\t an additional 8 idle cycles."},{"line_number":373,"context_line":"\t */"},{"line_number":374,"context_line":"\tqueue_buf_fill++;"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"\tspi_exchange(queue_tx_buf, queue_rx_buf, queue_buf_fill);"},{"line_number":377,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":18,"id":"89590fc9_7bb87c67","line":374,"updated":"2024-12-30 16:38:34.000000000","message":"BTW It could be avoided (and 8 idle clk saved) in case `run_queue()` is called from `queue_cmd()` and also if the last queued cmd was followed by at least 8 idles (if you really care about speed...)","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"22b1cd188e3093e688e5ee70f247e3c6303146d2","unresolved":false,"context_lines":[{"line_number":371,"context_line":"\t is zeroed after each queue run, adding 1 to the buffer fill will add on"},{"line_number":372,"context_line":"\t an additional 8 idle cycles."},{"line_number":373,"context_line":"\t */"},{"line_number":374,"context_line":"\tqueue_buf_fill++;"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"\tspi_exchange(queue_tx_buf, queue_rx_buf, queue_buf_fill);"},{"line_number":377,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":18,"id":"6de39f9e_c05f8734","line":374,"in_reply_to":"89590fc9_7bb87c67","updated":"2024-12-31 03:36:53.000000000","message":"This likely won\u0027t make much of a difference for speed as the typical tx and rx buffer sizes are 449 bytes ((64 * 7) + 1) and this situation can only occur when the queue is full. I decided to implement it anyway because it was so low cost to do it.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8758ec77a99a950c6cc7b7c0d1e7f6e75dfcb379","unresolved":true,"context_lines":[{"line_number":436,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":439,"context_line":"\t    queue_buf_fill + swd_op_bytes + DELAY_BYTES \u003e\u003d queue_buf_size) {"},{"line_number":440,"context_line":"\t\t// Not enough room in the queue. Run the queue."},{"line_number":441,"context_line":"\t\tqueue_retval \u003d spidev_swd_run_queue();"},{"line_number":442,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"f17335f8_10831001","line":439,"range":{"start_line":439,"start_character":37,"end_line":439,"end_character":48},"updated":"2024-12-30 16:38:34.000000000","message":"Not quite clear. The additional queue space is required by `run_queue()` line 374, isn\u0027t it?\nIn that case DELAY_BYTES has accidentally correct value but is computed from different number of clocks.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"22b1cd188e3093e688e5ee70f247e3c6303146d2","unresolved":false,"context_lines":[{"line_number":436,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":439,"context_line":"\t    queue_buf_fill + swd_op_bytes + DELAY_BYTES \u003e\u003d queue_buf_size) {"},{"line_number":440,"context_line":"\t\t// Not enough room in the queue. Run the queue."},{"line_number":441,"context_line":"\t\tqueue_retval \u003d spidev_swd_run_queue();"},{"line_number":442,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":18,"id":"97ce3fd7_87c72c34","line":439,"range":{"start_line":439,"start_character":37,"end_line":439,"end_character":48},"in_reply_to":"f17335f8_10831001","updated":"2024-12-31 03:36:53.000000000","message":"You are right. Good catch. I\u0027ve changed this to END_IDLE_BYTES to be more clear.","commit_id":"35a528b9cf14c02896fbcd2b2ec247eb2a9d6556"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"43c1983825f692644f0688a1b28ce545a7c0f9c1","unresolved":true,"context_lines":[{"line_number":432,"context_line":""},{"line_number":433,"context_line":"static void spidev_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data, uint32_t ap_delay_clk)"},{"line_number":434,"context_line":"{"},{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"171de05c_03af0199","line":435,"range":{"start_line":435,"start_character":56,"end_line":435,"end_character":68},"updated":"2024-12-31 09:58:27.000000000","message":"This is suboptimal. Not sure if there is some other reason for this,\n`ap_delay_clock` should be added only if `cmd \u0026 SWD_CMD_APNDP`","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"375b5ecd29350aa9d292b2edbd5eb22c7257bd06","unresolved":true,"context_lines":[{"line_number":432,"context_line":""},{"line_number":433,"context_line":"static void spidev_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data, uint32_t ap_delay_clk)"},{"line_number":434,"context_line":"{"},{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"b421a899_7e324e0e","line":435,"range":{"start_line":435,"start_character":56,"end_line":435,"end_character":68},"in_reply_to":"171de05c_03af0199","updated":"2024-12-31 12:37:48.000000000","message":"I previously had this method but it was changed at Antonio\u0027s suggestion. Please see the last paragraph of his comment:\n\nAntonio Borneo\nPatchset 10\nDec 21\nRichard, this is not really written in IHI0031.\n\nEvery R/W in the DP is immediate. Do not expect it to return WAIT in the ACK field. Actually IHI0031 say that only R/W to DPIDR, CTRL/STAT and ABORT don\u0027t return WAIT. Anyway, for DP access we do not add delay.\n\nInstead R/W to AP often return WAIT.\nThe action requested after a WAIT is to retry the operation, but this means OpenOCD has to check for WAIT at every R/W... so no queue, slow.\nSome intelligent adapter is able to do it transparently for us, but not spidev!\nSince the WAIT from AP is mainly due to SoC bus latency, we inject a pre-defined delay in every AP R/W, delay set by dap memaccess command. Such delay is enough to compensate the SoC bus delay so every R/W after the delay would not return WAIT.\n\nAnyway, OpenOCD checks all the WAIT after a queue flush and eventually re-run it slowly.\n\nRegarding the code, here:\nThe SWD framework only set ap_delay_clk for AP R/W. It is zero for DP.\nYou do not need to check APNDP again. Simply:\nuint32_t delay_bytes \u003d DIV_ROUND_UP(ap_delay_clk, SPI_BITS);","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"5858488d2335553f825b4469fea86f955c08c36e","unresolved":false,"context_lines":[{"line_number":432,"context_line":""},{"line_number":433,"context_line":"static void spidev_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data, uint32_t ap_delay_clk)"},{"line_number":434,"context_line":"{"},{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"ce460ff6_3708ab52","line":435,"range":{"start_line":435,"start_character":56,"end_line":435,"end_character":68},"in_reply_to":"b421a899_7e324e0e","updated":"2025-01-03 13:25:26.000000000","message":"Yes, Antonio is right. adi_v5_swd.c passes zero in ap_delay_clk for DP ops.\nThe ap_delay_hint is little bit misleading name and comment in swd.h does not give any clue what is passed for DP ops. No wonder we have the same superfluous check in bitbang.c and maybe in some other adapters. Sorry, my bad.","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"68bec3f6d67c4f818b527c0ccd5eb94a9cdd0221","unresolved":true,"context_lines":[{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"},{"line_number":439,"context_line":"\t\t/* Not enough room in the queue. Run the queue. No idle bytes are"},{"line_number":440,"context_line":"\t\t  needed because we are going to execute transactions right after"},{"line_number":441,"context_line":"\t\t  the queue is emptied. */"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"4ddc154d_de7dd68e","line":438,"range":{"start_line":438,"start_character":5,"end_line":438,"end_character":34},"updated":"2024-12-31 09:03:07.000000000","message":"Some problem in queue length management:\n```\ncpufreq 1500000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.222087s (576.351 KiB/s)\ncpufreq 1600000\nError: exchange too large len\u003d449\nError: Error connecting DP: cannot read IDR\nError: Failed to write memory and, additionally, failed to find out where\n```\n\nIMO we should always reserve END_IDLE_BYTES as we don\u0027t know when\n`run_queue()` will be called.\nThe following change:\n```\nqueue_buf_fill + swd_op_bytes + END_IDLE_BYTES \u003e\u003d queue_buf_size\n``` \nseems to fixe the problem.","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"b550731f5ea1abb836e2b8584650cd7f77044afc","unresolved":true,"context_lines":[{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"},{"line_number":439,"context_line":"\t\t/* Not enough room in the queue. Run the queue. No idle bytes are"},{"line_number":440,"context_line":"\t\t  needed because we are going to execute transactions right after"},{"line_number":441,"context_line":"\t\t  the queue is emptied. */"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"dc9f156b_71388a99","line":438,"range":{"start_line":438,"start_character":5,"end_line":438,"end_character":34},"in_reply_to":"158c7e79_d575a324","updated":"2025-01-05 00:59:26.000000000","message":"Sorry, I realize I didn\u0027t share enough information with that last comment. I meant the `if (len \u003e\u003d queue_buf_size) {`on line 128 (although looking at it, it\u0027s essentially the same kind of comparison). I did change this one on the last commit. \n\nCan you share why you think `\u003e\u003d` is correct? I think using `\u003e\u003d` results in the last byte being unused.","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"5858488d2335553f825b4469fea86f955c08c36e","unresolved":false,"context_lines":[{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"},{"line_number":439,"context_line":"\t\t/* Not enough room in the queue. Run the queue. No idle bytes are"},{"line_number":440,"context_line":"\t\t  needed because we are going to execute transactions right after"},{"line_number":441,"context_line":"\t\t  the queue is emptied. */"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"158c7e79_d575a324","line":438,"range":{"start_line":438,"start_character":5,"end_line":438,"end_character":34},"in_reply_to":"411a379b_ed04f8b3","updated":"2025-01-03 13:25:26.000000000","message":"Seems that I was lucky I got the issue on the first run.\nIt happens just if the queue is full and then `run_queue()` takes place.\nI think you may try `mdw` or `dump_image` of size in words somewhat smaller than swd ops/q (e.g. address preparation to TAR takes some additional space).\n\nIMO the `\u003e\u003d` is correct.","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"54fa4fb8bbc96b33c828f9afc74d6e84dd9f58bc","unresolved":true,"context_lines":[{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"},{"line_number":439,"context_line":"\t\t/* Not enough room in the queue. Run the queue. No idle bytes are"},{"line_number":440,"context_line":"\t\t  needed because we are going to execute transactions right after"},{"line_number":441,"context_line":"\t\t  the queue is emptied. */"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"f9e8ecdd_d3f5a3ac","line":438,"range":{"start_line":438,"start_character":5,"end_line":438,"end_character":34},"in_reply_to":"429d2b30_dea18f7c","updated":"2025-01-05 11:07:40.000000000","message":"```\n\u003e debug_level 4;mww 0x20000000 0 126;debug_level 2\n```\nwith unmodified patchset 19 code\n```\nDebug: 1319 309852 command.c:153 script_debug(): command - mww 0x20000000 0 126\nDebug: 1320 309852 adi_v5_swd.c:552 swd_queue_ap_bankselect(): AP BANK SELECT: 0\nDebug: 1321 309852 linuxspidev.c:353 spidev_swd_execute_queue(): Executing 64 queued transactions\nDebug: 1322 309853 linuxspidev.c:383 spidev_swd_execute_queue(): OK DP write reg 8 \u003d 00000000\nDebug: 1323 309853 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg 4 \u003d 20000000\nDebug: 1324 309853 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\n...\nDebug: 1385 309853 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\nDebug: 1386 309853 linuxspidev.c:353 spidev_swd_execute_queue(): Executing 63 queued transactions\nDebug: 1387 309854 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\n...\nDebug: 1449 309855 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\nDebug: 1450 309855 linuxspidev.c:353 spidev_swd_execute_queue(): Executing 1 queued transactions\nDebug: 1451 309855 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\nDebug: 1452 309855 command.c:153 script_debug(): command - debug_level 2\n```\n- the first run have 64 ops because one DP write without idles, the second run has only 63 as all ops are AP writes.\n\nWith `\u003e` @ 438:\n```\nDebug: 23 56490 command.c:153 script_debug(): command - mww 0x20000000 0 126\nDebug: 24 56490 adi_v5_swd.c:552 swd_queue_ap_bankselect(): AP BANK SELECT: 0\nDebug: 25 56490 linuxspidev.c:353 spidev_swd_execute_queue(): Executing 64 queued transactions\nDebug: 26 56491 linuxspidev.c:383 spidev_swd_execute_queue(): OK DP write reg 8 \u003d 00000000\nDebug: 27 56491 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg 4 \u003d 20000000\nDebug: 28 56491 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\n...\nDebug: 89 56491 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\nDebug: 90 56491 linuxspidev.c:353 spidev_swd_execute_queue(): Executing 64 queued transactions\nDebug: 91 56492 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\n...\nDebug: 153 56493 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\nDebug: 154 56493 linuxspidev.c:383 spidev_swd_execute_queue(): OK AP write reg C \u003d 00000000\nDebug: 155 56493 command.c:153 script_debug(): command - debug_level 2\n```\nworks as expected and the speed went up a little bit (as we do not waste the last op space in the queue):\n```\ncpufreq 1600000\n131072 bytes written at address 0x20000000\ndownloaded 131072 bytes in 0.222151s (576.185 KiB/s)\ncpufreq 1600000\ndumped 131072 bytes in 0.219246s (583.819 KiB/s)\ncpufreq 1600000\n```","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"66ec877f32692c5c247bec1435157797e487e908","unresolved":true,"context_lines":[{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"},{"line_number":439,"context_line":"\t\t/* Not enough room in the queue. Run the queue. No idle bytes are"},{"line_number":440,"context_line":"\t\t  needed because we are going to execute transactions right after"},{"line_number":441,"context_line":"\t\t  the queue is emptied. */"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"411a379b_ed04f8b3","line":438,"range":{"start_line":438,"start_character":5,"end_line":438,"end_character":34},"in_reply_to":"4ddc154d_de7dd68e","updated":"2024-12-31 13:05:16.000000000","message":"Thanks, I think you are right and I\u0027ve made this change.\n\nSadly this issue doesn\u0027t reproduce for me but I think the issue you are encountering is caused by using `if (len \u003e\u003d queue_buf_size) {` as the buffer size should already be 449. I believe it should be `if (len \u003e queue_buf_size) {`. Let me know what you think.","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6b9d6f6d4211aaf09ad2ba4b9f44450c5320aef7","unresolved":true,"context_lines":[{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"},{"line_number":439,"context_line":"\t\t/* Not enough room in the queue. Run the queue. No idle bytes are"},{"line_number":440,"context_line":"\t\t  needed because we are going to execute transactions right after"},{"line_number":441,"context_line":"\t\t  the queue is emptied. */"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"429d2b30_dea18f7c","line":438,"range":{"start_line":438,"start_character":5,"end_line":438,"end_character":34},"in_reply_to":"dc9f156b_71388a99","updated":"2025-01-05 04:33:16.000000000","message":"Oh yes, I agree with the change to `\u003e` on line 128 (queue size out of bounds).\n\nI thought you meant the condition on line 438. Indeed there should be `\u003e` too.\nPreviously I thought `\u003e\u003d` is correct as the queue should be run as soon as its size with the processed command and with eventual end idles would be full or bigger. However if the queue is going to be exactly full we could wait for `run_queue()` or the next cmd. Good catch!\n\nI will test with line 438\n```\nqueue_buf_fill + swd_op_bytes + END_IDLE_BYTES \u003e queue_buf_size\n```\n\nAlso the line 437 would be more readable and better correspond with 438 if changed to\n```\nqueue_fill + 1 \u003e max_queue_entries\n```","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"d92d086dd1ee82aa06f5db17a0f53c18a8b4d894","unresolved":false,"context_lines":[{"line_number":435,"context_line":"\tunsigned int swd_op_bytes \u003d DIV_ROUND_UP(SWD_OP_BITS + ap_delay_clk, SPI_BITS);"},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"\tif (queue_fill \u003e\u003d max_queue_entries ||"},{"line_number":438,"context_line":"\t    queue_buf_fill + swd_op_bytes \u003e\u003d queue_buf_size) {"},{"line_number":439,"context_line":"\t\t/* Not enough room in the queue. Run the queue. No idle bytes are"},{"line_number":440,"context_line":"\t\t  needed because we are going to execute transactions right after"},{"line_number":441,"context_line":"\t\t  the queue is emptied. */"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"b7b63194_487c21c5","line":438,"range":{"start_line":438,"start_character":5,"end_line":438,"end_character":34},"in_reply_to":"f9e8ecdd_d3f5a3ac","updated":"2025-01-05 17:21:45.000000000","message":"Thanks for running these tests and sharing the output! This makes it very clear that `\u003e` is the right move. I\u0027ve made the change on line 438 to `\u003e`","commit_id":"5542c694078b350ba060e659cf7d5ec570257a5e"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6b9d6f6d4211aaf09ad2ba4b9f44450c5320aef7","unresolved":true,"context_lines":[{"line_number":258,"context_line":"\tmax_queue_entries \u003d new_queue_entries;"},{"line_number":259,"context_line":"\tqueue_buf_size \u003d new_queue_buf_size;"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"\tLOG_INFO(\"Set queue entries to %u %u\", max_queue_entries, new_queue_buf_size);"},{"line_number":262,"context_line":""},{"line_number":263,"context_line":"\treturn ERROR_OK;"},{"line_number":264,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":21,"id":"1ece0b90_66823182","line":261,"range":{"start_line":261,"start_character":34,"end_line":261,"end_character":37},"updated":"2025-01-05 04:33:16.000000000","message":"This deserves some text","commit_id":"6512c7e812eccdd7619bbb02948aa10e6033b097"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"d92d086dd1ee82aa06f5db17a0f53c18a8b4d894","unresolved":false,"context_lines":[{"line_number":258,"context_line":"\tmax_queue_entries \u003d new_queue_entries;"},{"line_number":259,"context_line":"\tqueue_buf_size \u003d new_queue_buf_size;"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"\tLOG_INFO(\"Set queue entries to %u %u\", max_queue_entries, new_queue_buf_size);"},{"line_number":262,"context_line":""},{"line_number":263,"context_line":"\treturn ERROR_OK;"},{"line_number":264,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":21,"id":"2e144bed_d5a49577","line":261,"range":{"start_line":261,"start_character":34,"end_line":261,"end_character":37},"in_reply_to":"1ece0b90_66823182","updated":"2025-01-05 17:21:45.000000000","message":"Sorry, this was only for debugging purposes. Either way, I think it\u0027s worth keeping and I\u0027ve added some text for this.","commit_id":"6512c7e812eccdd7619bbb02948aa10e6033b097"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"8b53d27f3f7d4bc6d011c93fd3228829fd364088","unresolved":true,"context_lines":[{"line_number":147,"context_line":"\t// Transmit the MSB buffer to SPI device."},{"line_number":148,"context_line":"\tstruct spi_ioc_transfer tr \u003d {"},{"line_number":149,"context_line":"\t\t/* The following must be cast to unsigned long to compile correctly on"},{"line_number":150,"context_line":"\t\t   32 and 64 bit machines. */"},{"line_number":151,"context_line":"\t\t.tx_buf \u003d (unsigned long)(tx_data ? tx_flip_buf : NULL),"},{"line_number":152,"context_line":"\t\t.rx_buf \u003d (unsigned long)rx_data,"},{"line_number":153,"context_line":"\t\t.len \u003d len,"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"b76d5c13_ee02d79b","line":150,"updated":"2025-01-07 16:32:44.000000000","message":"Add in the comment something like: \"as is done in the spidev examples in Linux kernel code in tools/spi/\"","commit_id":"b95b908002dc68e3a0764c0581b98c12f29aae50"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"379f4a169231a185befe5e8ceb5a009b3748ce0f","unresolved":false,"context_lines":[{"line_number":147,"context_line":"\t// Transmit the MSB buffer to SPI device."},{"line_number":148,"context_line":"\tstruct spi_ioc_transfer tr \u003d {"},{"line_number":149,"context_line":"\t\t/* The following must be cast to unsigned long to compile correctly on"},{"line_number":150,"context_line":"\t\t   32 and 64 bit machines. */"},{"line_number":151,"context_line":"\t\t.tx_buf \u003d (unsigned long)(tx_data ? tx_flip_buf : NULL),"},{"line_number":152,"context_line":"\t\t.rx_buf \u003d (unsigned long)rx_data,"},{"line_number":153,"context_line":"\t\t.len \u003d len,"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"6d277dc3_187bf76d","line":150,"in_reply_to":"b76d5c13_ee02d79b","updated":"2025-01-07 17:26:19.000000000","message":"Done","commit_id":"b95b908002dc68e3a0764c0581b98c12f29aae50"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"8b53d27f3f7d4bc6d011c93fd3228829fd364088","unresolved":true,"context_lines":[{"line_number":269,"context_line":"\treturn ERROR_FAIL;"},{"line_number":270,"context_line":"}"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":""},{"line_number":273,"context_line":"static int spidev_init(void)"},{"line_number":274,"context_line":"{"},{"line_number":275,"context_line":"\tLOG_INFO(\"SPI SWD driver\");"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"2b54d23b_916f396f","line":272,"updated":"2025-01-07 16:32:44.000000000","message":"Use only one empty line","commit_id":"b95b908002dc68e3a0764c0581b98c12f29aae50"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"379f4a169231a185befe5e8ceb5a009b3748ce0f","unresolved":false,"context_lines":[{"line_number":269,"context_line":"\treturn ERROR_FAIL;"},{"line_number":270,"context_line":"}"},{"line_number":271,"context_line":""},{"line_number":272,"context_line":""},{"line_number":273,"context_line":"static int spidev_init(void)"},{"line_number":274,"context_line":"{"},{"line_number":275,"context_line":"\tLOG_INFO(\"SPI SWD driver\");"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"c1d49046_10539e1d","line":272,"in_reply_to":"2b54d23b_916f396f","updated":"2025-01-07 17:26:19.000000000","message":"Done","commit_id":"b95b908002dc68e3a0764c0581b98c12f29aae50"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"db57811cf6049c377764159050e62b9d952d4df0","unresolved":true,"context_lines":[{"line_number":91,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":92,"context_line":"static uint32_t spi_speed;"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"typedef struct _queue_info_t {"},{"line_number":95,"context_line":"\tunsigned int buf_idx;"},{"line_number":96,"context_line":"\tuint32_t *rx_ptr;"},{"line_number":97,"context_line":"} queue_info_t;"}],"source_content_type":"text/x-csrc","patch_set":25,"id":"7c86e5f7_3c3a71c1","line":94,"updated":"2025-01-08 10:32:41.000000000","message":"Simply use \"struct queue_info\", see coding style.","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"70a4cd9a8f47956deaf20f13e818c15734cdf70d","unresolved":false,"context_lines":[{"line_number":91,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":92,"context_line":"static uint32_t spi_speed;"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"typedef struct _queue_info_t {"},{"line_number":95,"context_line":"\tunsigned int buf_idx;"},{"line_number":96,"context_line":"\tuint32_t *rx_ptr;"},{"line_number":97,"context_line":"} queue_info_t;"}],"source_content_type":"text/x-csrc","patch_set":25,"id":"13498eb7_1106d3ae","line":94,"in_reply_to":"7c86e5f7_3c3a71c1","updated":"2025-01-08 11:50:06.000000000","message":"Done","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"db57811cf6049c377764159050e62b9d952d4df0","unresolved":true,"context_lines":[{"line_number":158,"context_line":"\t};"},{"line_number":159,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_MESSAGE(1), \u0026tr);"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"\t// Check SPI result."},{"line_number":162,"context_line":"\tif (ret \u003c 1) {"},{"line_number":163,"context_line":"\t\tLOG_ERROR(\"exchange failed\");"},{"line_number":164,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":25,"id":"beab5c21_18fc10fb","line":161,"updated":"2025-01-08 10:32:41.000000000","message":"Do not \u0027over-comment\u0027, it is clear that you check the result here.","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"70a4cd9a8f47956deaf20f13e818c15734cdf70d","unresolved":false,"context_lines":[{"line_number":158,"context_line":"\t};"},{"line_number":159,"context_line":"\tint ret \u003d ioctl(spi_fd, SPI_IOC_MESSAGE(1), \u0026tr);"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"\t// Check SPI result."},{"line_number":162,"context_line":"\tif (ret \u003c 1) {"},{"line_number":163,"context_line":"\t\tLOG_ERROR(\"exchange failed\");"},{"line_number":164,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":25,"id":"5b66a34c_13c29c4e","line":161,"in_reply_to":"beab5c21_18fc10fb","updated":"2025-01-08 11:50:06.000000000","message":"Done","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"db57811cf6049c377764159050e62b9d952d4df0","unresolved":true,"context_lines":[{"line_number":259,"context_line":"\tmax_queue_entries \u003d new_queue_entries;"},{"line_number":260,"context_line":"\tqueue_buf_size \u003d new_queue_buf_size;"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"\tLOG_INFO(\"Set queue entries to %u (buffers %u bytes)\", max_queue_entries, queue_buf_size);"},{"line_number":263,"context_line":""},{"line_number":264,"context_line":"\treturn ERROR_OK;"},{"line_number":265,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":25,"id":"53b56e78_15c0047a","line":262,"updated":"2025-01-08 10:32:41.000000000","message":"Rather use LOG_DEBUG() because it is not of interest for the normal user?","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"70a4cd9a8f47956deaf20f13e818c15734cdf70d","unresolved":false,"context_lines":[{"line_number":259,"context_line":"\tmax_queue_entries \u003d new_queue_entries;"},{"line_number":260,"context_line":"\tqueue_buf_size \u003d new_queue_buf_size;"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"\tLOG_INFO(\"Set queue entries to %u (buffers %u bytes)\", max_queue_entries, queue_buf_size);"},{"line_number":263,"context_line":""},{"line_number":264,"context_line":"\treturn ERROR_OK;"},{"line_number":265,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":25,"id":"e05b1e3e_53c2dc49","line":262,"in_reply_to":"53b56e78_15c0047a","updated":"2025-01-08 11:50:06.000000000","message":"Done","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"db57811cf6049c377764159050e62b9d952d4df0","unresolved":true,"context_lines":[{"line_number":410,"context_line":"\t}"},{"line_number":411,"context_line":""},{"line_number":412,"context_line":"skip:"},{"line_number":413,"context_line":"\tretval \u003d queue_retval;"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"\t// Clear everything in the queue"},{"line_number":416,"context_line":"\tqueue_fill \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":25,"id":"eeaea894_00a20cf5","line":413,"updated":"2025-01-08 10:32:41.000000000","message":"Declare \u0027retval\u0027 here","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"dee3cb6232de778cb7bbe3357d320d3684a05662","unresolved":false,"context_lines":[{"line_number":410,"context_line":"\t}"},{"line_number":411,"context_line":""},{"line_number":412,"context_line":"skip:"},{"line_number":413,"context_line":"\tretval \u003d queue_retval;"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"\t// Clear everything in the queue"},{"line_number":416,"context_line":"\tqueue_fill \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":25,"id":"7b25e8d1_52e91db7","line":413,"in_reply_to":"eeaea894_00a20cf5","updated":"2025-01-08 11:55:45.000000000","message":"This was covered in a previous comment. Surprisingly we can\u0027t declare a variable right after a goto label without enabling C23 extensions. \n\n`error: label followed by a declaration is a C23 extension [-Werror,-Wc23-extensions]`\n\nAnyway the design of this function has changed that I can simply move around the assignment of retval.","commit_id":"e53fa57f8db92c93d8fbbb64c4607632f15e2a0d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"63d131357e78f9741571a6f252dbe0017ce65536","unresolved":true,"context_lines":[{"line_number":91,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":92,"context_line":"static uint32_t spi_speed;"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"struct queue_info_t {"},{"line_number":95,"context_line":"\tunsigned int buf_idx;"},{"line_number":96,"context_line":"\tuint32_t *rx_ptr;"},{"line_number":97,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":29,"id":"d2f3cb50_707128cb","line":94,"range":{"start_line":94,"start_character":17,"end_line":94,"end_character":19},"updated":"2025-01-08 17:24:47.000000000","message":"Please remove `_t` suffix as Marc suggested, the name now belongs to struct not type.","commit_id":"babf8d824a9007ceb65de08d0e5da7126dc79739"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"245675841d843bdf2a390f755e2de93030faa0f8","unresolved":false,"context_lines":[{"line_number":91,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":92,"context_line":"static uint32_t spi_speed;"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"struct queue_info_t {"},{"line_number":95,"context_line":"\tunsigned int buf_idx;"},{"line_number":96,"context_line":"\tuint32_t *rx_ptr;"},{"line_number":97,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":29,"id":"e53c34b9_4e5b1102","line":94,"range":{"start_line":94,"start_character":17,"end_line":94,"end_character":19},"in_reply_to":"4e973f48_aa46f8f5","updated":"2025-01-08 18:28:47.000000000","message":"Sorry about that!","commit_id":"babf8d824a9007ceb65de08d0e5da7126dc79739"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"87453e2df38bf7ddaef9144a8b0e1ec69d583535","unresolved":false,"context_lines":[{"line_number":91,"context_line":"static uint32_t spi_mode \u003d SPI_MODE_3; // Note: SPI in LSB mode is not often supported. We\u0027ll flip LSB to MSB ourselves."},{"line_number":92,"context_line":"static uint32_t spi_speed;"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"struct queue_info_t {"},{"line_number":95,"context_line":"\tunsigned int buf_idx;"},{"line_number":96,"context_line":"\tuint32_t *rx_ptr;"},{"line_number":97,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":29,"id":"4e973f48_aa46f8f5","line":94,"range":{"start_line":94,"start_character":17,"end_line":94,"end_character":19},"in_reply_to":"d2f3cb50_707128cb","updated":"2025-01-08 18:28:20.000000000","message":"Done","commit_id":"babf8d824a9007ceb65de08d0e5da7126dc79739"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7cdade7e9c9a2068298b1aa0a7dc608edec8262c","unresolved":true,"context_lines":[{"line_number":256,"context_line":"\tif (!tx_flip_buf)"},{"line_number":257,"context_line":"\t\tgoto realloc_fail;"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"\tmax_queue_entries \u003d new_queue_entries;"},{"line_number":260,"context_line":"\tqueue_buf_size \u003d new_queue_buf_size;"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"\tLOG_DEBUG(\"Set queue entries to %u (buffers %u bytes)\", max_queue_entries, queue_buf_size);"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"46f3d291_bf064554","line":259,"updated":"2025-01-29 06:33:02.000000000","message":"At least `queue_tx_buf` should be zeroed here!\nWithout this I get bogus SWD read data early after innit (look for Read incorrect DLPIDR 0x52d20657, repeated multidrop select is ok):\n```\nInfo : 105 4 adapter.c:180 adapter_init(): clock speed 1000 kHz\nDebug: 106 4 openocd.c:133 handle_init_command(): Debug Adapter init complete\nDebug: 107 4 command.c:153 script_debug(): command - transport init\nDebug: 108 4 transport.c:219 handle_transport_init(): handle_transport_init\nDebug: 109 4 command.c:153 script_debug(): command - dap init\nDebug: 110 4 arm_dap.c:96 dap_init_all(): Initializing all DAPs ...\nDebug: 111 4 arm_dap.c:120 dap_init_all(): DAP stm32h7x.cpu configured by default to use ADIv5 protocol\nDebug: 112 4 linuxspidev.c:501 spidev_swd_switch_seq(): JTAG-to-DORMANT\nexchange: len\u003d5\n tx_buf\u003dff ae ee ee e6\nDebug: 121 4 linuxspidev.c:513 spidev_swd_switch_seq(): DORMANT-to-SWD\nexchange: len\u003d28\n tx_buf\u003dff 49 cf 90 46 a9 b4 a1 61 97 f5 bb c7 45 70 3d 98 05 8f ff ff ff ff ff ff ff ff 00\nDebug: 153 5 adi_v5_swd.c:116 swd_queue_dp_bankselect(): DP BANK SELECT: 3\nDebug: 154 5 linuxspidev.c:352 spidev_swd_execute_queue(): Executing 5 queued transactions\nexchange: len\u003d31\n tx_buf\u003d99 04 10 00 09 00 a5 00 00 00 00 00 81 03 c0 00 00 00 8d f6 00 00 00 02 b1 4e a6 04 b4 a6 6e\n rx_buf\u003d99 04 10 00 09 00 a5 4e e2 40 5d 68 81 43 c0 00 00 00 8d c6 00 00 00 02 b1 4e a6 04 b4 a6 6e\nDebug: 222 5 linuxspidev.c:382 spidev_swd_execute_queue(): ack ignored JUNK DP write reg C \u003d 04800041\nDebug: 223 5 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP read reg 0 \u003d 6ba02477\nDebug: 224 5 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP write reg 0 \u003d 0000001e\nDebug: 225 5 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP write reg 8 \u003d 00000003\nDebug: 226 5 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP read reg 4 \u003d 52d20657\nInfo : 227 5 adi_v5_swd.c:245 swd_multidrop_select_inner(): Read incorrect DLPIDR 0x52d20657 (possibly CTRL/STAT value)\nDebug: 228 6 linuxspidev.c:501 spidev_swd_switch_seq(): JTAG-to-DORMANT\nexchange: len\u003d5\n tx_buf\u003dff ae ee ee e6\nDebug: 237 6 linuxspidev.c:513 spidev_swd_switch_seq(): DORMANT-to-SWD\nexchange: len\u003d28\n tx_buf\u003dff 49 cf 90 46 a9 b4 a1 61 97 f5 bb c7 45 70 3d 98 05 8f ff ff ff ff ff ff ff ff 00\nDebug: 269 7 adi_v5_swd.c:116 swd_queue_dp_bankselect(): DP BANK SELECT: 3\nDebug: 270 7 linuxspidev.c:352 spidev_swd_execute_queue(): Executing 5 queued transactions\nexchange: len\u003d31\n tx_buf\u003d99 04 10 00 09 00 a5 00 00 00 00 00 81 03 c0 00 00 00 8d 06 00 00 00 00 b1 00 00 00 00 00 00\n rx_buf\u003d99 04 10 00 09 00 a5 4e e2 40 5d 68 81 43 c0 00 00 00 8d 46 00 00 00 00 b1 48 00 00 00 08 00\nDebug: 338 7 linuxspidev.c:382 spidev_swd_execute_queue(): ack ignored JUNK DP write reg C \u003d 04800041\nDebug: 339 7 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP read reg 0 \u003d 6ba02477\nDebug: 340 7 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP write reg 0 \u003d 0000001e\nDebug: 341 7 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP write reg 8 \u003d 00000003\nDebug: 342 7 linuxspidev.c:382 spidev_swd_execute_queue(): OK DP read reg 4 \u003d 00000001\nDebug: 343 7 adi_v5_swd.c:251 swd_multidrop_select_inner(): Selected DP_TARGETSEL 0x04800041\nInfo : 344 7 adi_v5_swd.c:328 swd_connect_multidrop(): SWD DPIDR 0x6ba02477, DLPIDR 0x00000001\n```","commit_id":"83e0293f7ba3604b4ad98b3a8101388e3e52f9fe"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"3be753bf03d621fbdf7c7a474f594550bb92fb69","unresolved":true,"context_lines":[{"line_number":256,"context_line":"\tif (!tx_flip_buf)"},{"line_number":257,"context_line":"\t\tgoto realloc_fail;"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"\tmax_queue_entries \u003d new_queue_entries;"},{"line_number":260,"context_line":"\tqueue_buf_size \u003d new_queue_buf_size;"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"\tLOG_DEBUG(\"Set queue entries to %u (buffers %u bytes)\", max_queue_entries, queue_buf_size);"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"6c273c25_a8f92ff4","line":259,"in_reply_to":"46f3d291_bf064554","updated":"2025-01-29 22:13:34.000000000","message":"Got it. Will follow up with another CL. Thanks for finding this.","commit_id":"83e0293f7ba3604b4ad98b3a8101388e3e52f9fe"},{"author":{"_account_id":1002347,"name":"Richard Pasek","email":"rpasek@google.com","username":"rpasek"},"change_message_id":"fe79173af248fc8529d06e29f4fbf12ad8f21f39","unresolved":false,"context_lines":[{"line_number":256,"context_line":"\tif (!tx_flip_buf)"},{"line_number":257,"context_line":"\t\tgoto realloc_fail;"},{"line_number":258,"context_line":""},{"line_number":259,"context_line":"\tmax_queue_entries \u003d new_queue_entries;"},{"line_number":260,"context_line":"\tqueue_buf_size \u003d new_queue_buf_size;"},{"line_number":261,"context_line":""},{"line_number":262,"context_line":"\tLOG_DEBUG(\"Set queue entries to %u (buffers %u bytes)\", max_queue_entries, queue_buf_size);"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"23624c8e_973621e1","line":259,"in_reply_to":"6c273c25_a8f92ff4","updated":"2025-01-30 10:42:47.000000000","message":"I\u0027ve created a follow up CL located here: https://review.openocd.org/c/openocd/+/8730","commit_id":"83e0293f7ba3604b4ad98b3a8101388e3e52f9fe"}]}
