)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"df59a587_a71173c6","updated":"2023-10-14 17:25:53.000000000","message":"Thanks for the patch, Matthias.\nAs you have probably already seen, we had already two proposals\nhttps://review.openocd.org/7692/ and https://review.openocd.org/7808/\nbut cannot be accepted due to GPL incompatibility.\nThis your proposal looks ok from GPL point of view.\n\nI have just run a quick check and I would like to point few requests:\n- please split this in two patches: the extension of jtag_libusb_open() + the new driver;\n- remove the new typedef, not welcome in new code; use struct and enum in place of typedef;\n- please update the documentation with the new adapter description and with the new commands;\n- minor reorder in 60-openocd.rules\n\nWhy are used #pragma pack() ? Which are the struct that require it? Can this be reworked to drop the pragma?","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"4dd26874_d1b600fa","in_reply_to":"df59a587_a71173c6","updated":"2023-10-14 22:19:03.000000000","message":"Thanks for the review, Antonio.\nI\u0027ve split it into the Extension of jtag_libusb_open https://review.openocd.org/7938 and updated this change. The typedefs are removed. I\u0027ve updated the documentation, but I\u0027m not sure if I found all places where I shouls add information. The reorder in 60-openocd.rules is done. The pragma pack is removed.","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":3,"id":"50446355_0fecfbba","updated":"2023-10-16 08:34:04.000000000","message":"Matthias,\nI know you are not the original author of the code.\nUnfortunately the code quality is quite below an acceptable level and needs a lot of work.\n\nTypes usage: please see\nhttps://openocd.org/doc/doxygen/html/stylec.html#styletypes\n\nUsing valgrind and Clang Static Analyzer:\nhttps://openocd.org/doc/doxygen/html/patchguide.html","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"7fd43750_fcd905c3","in_reply_to":"50446355_0fecfbba","updated":"2023-10-16 22:55:25.000000000","message":"Thanks for your great review, Tomas.\nI\u0027ve reworked many code lines and use now integer instead of uint64_t or unsigned long. I\u0027ve also done the Clang Static Analyzer thing. Now, no new flaws will be introduced by the new driver.\nHopefully the code quality is now better then before.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"352b5020b8cb8ac86ccedf186625cbc3daf76004","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"be2d6b3a_a827e282","updated":"2023-10-15 21:23:18.000000000","message":"Again, not reviewed yet, I just checked what the build error is.\n\nSide question. I\u0027m buying one of these CH347T adapters, also to test this new driver.\nI haven\u0027t found online any doc about the USB protocol or packets of this chip. Did you get it through NDA or is it publicly available?","commit_id":"334f15d512c5dc7605ead6eb3a6ae873f596f048"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c527766d239873993750b71fa27a84f341c344a6","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"55510166_0024e9aa","in_reply_to":"64949406_fa293151","updated":"2023-10-15 22:19:29.000000000","message":"Now the build is successfully run. I hope it\u0027s now ready for review.","commit_id":"334f15d512c5dc7605ead6eb3a6ae873f596f048"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a3e19c29915818937a9dfbf39087425aa3291851","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"64949406_fa293151","in_reply_to":"be2d6b3a_a827e282","updated":"2023-10-15 22:02:03.000000000","message":"Good question. I\u0027ve written a little documentation by myself after I\u0027ve researched so many things in different source codes on github. So that documentation is the result of researching in public available code.\n\nHere is my documentation: https://www.easydevkits.com/wch-ch347-jtag-interface/","commit_id":"334f15d512c5dc7605ead6eb3a6ae873f596f048"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"f5a8205ba79789798d8ec44412ef666e476f3a65","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":9,"id":"abc42e36_51191bc3","updated":"2023-10-16 23:13:43.000000000","message":"Any idea why the build is not working for Linux32? It can\u0027t checkout:\n\n \u003e git checkout -f d76badfdf26d31f3af1f0f8efa7f764aa1a26036 # timeout\u003d10\nCommit message: \"jtag/drivers: Add general support for CH347 based interfaces\"\n \u003e git rev-parse FETCH_HEAD^{commit} # timeout\u003d10\nFATAL: Invalid id: d76badfdf26d31f3af1f0f8efa7f764aa1a26036","commit_id":"d76badfdf26d31f3af1f0f8efa7f764aa1a26036"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"35f316830ebc512e6a7ec1e9b113f15a72dc7535","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"2e92f4a3_b15406da","in_reply_to":"abc42e36_51191bc3","updated":"2023-10-17 15:07:08.000000000","message":"Interessing. Deleted one empty line for triggering a new build. Now the build is working.","commit_id":"d76badfdf26d31f3af1f0f8efa7f764aa1a26036"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"3fceb78f033127da1c285bf6a2e6c5b18df2e33b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":12,"id":"b11193d4_c0a274e9","updated":"2023-10-17 22:50:08.000000000","message":"Fixed a possible memory leak in ch347_open_device. I think, now it\u0027s ready for the next review round.","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"d60fc3d627450c25a1df44886b6f67684940c3c0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":16,"id":"2207495a_3b10a7eb","updated":"2023-10-25 22:02:13.000000000","message":"Tomas, thank you very much for this highly valuable review.\nI have revised the driver. Especially the part that contains the buffer for the compilation of the commands is completely reworked. Now I have a \"scratch pad\" in which I collect all bytes for a command and then create a command for a queue. Only when something has to be transferred I make individual packets from the command queue.","commit_id":"f480ea9dd895dcebeff2069e00938f30d17144f0"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":20,"id":"e7329bdd_b6d7cec8","updated":"2023-10-26 19:36:34.000000000","message":"@EasyDevKits, I left a few minor comments. \n\nPlease send me a test board to verify Espressif related changes.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"d5710e1d76f81ada4420259e95511a6eab39e48a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":20,"id":"f355f037_3f1692c1","updated":"2023-10-26 15:05:08.000000000","message":"I\u0027ve also tested with Valgrind Memcheck and Clang Static Analyzer. If someone need a CH347 JTAG Adapter with integrated ESP32 target, I\u0027ve some to give for free.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"db37e453e116f470ab5827943e13ded0d5668080","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":20,"id":"77d35ce0_9e176855","updated":"2023-10-26 14:40:01.000000000","message":"Now I\u0027ve finished the refactoring of the CH347 JTAG driver. @Antonio, @Tomas, can you please be so kind and make another code review?","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":20,"id":"9a9eeffa_48d0d1be","in_reply_to":"e7329bdd_b6d7cec8","updated":"2023-10-26 22:08:58.000000000","message":"Thanks for the comments. I\u0027ll send you an email to get in touch for sending a test board.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":22,"id":"1bd8a0d0_cf086da5","updated":"2023-10-27 14:34:29.000000000","message":"Matthias,\nthis work on CH347 is very interesting because can provide a low-cost replacement for the expensive FTDI chips. So, high attention on this patch.\nI have also ordered one sample to test it.\n\nThere are two versions: CH347F and CH347T. I cannot find any \"F\" version to purchase it and apparently only the \"T\" version is used everywhere.\nWhile I expect some high compatibility between the two, please report in commit message, in code and in documentation that only the \"T\" is being used and tested with this patch.\nBut, still use only the generic name \"ch347\" in the adapter\u0027s name and in the new OpenOCD command\u0027s syntax; we will try to reuse the same commands once the \"F\" would be available.\n\nI\u0027ve run some initial review, but I\u0027m far to have completed it. Some remark below.\nThanks.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":22,"id":"7a4a4be7_28c4fba7","in_reply_to":"1bd8a0d0_cf086da5","updated":"2023-10-27 23:40:00.000000000","message":"Antonio,\nthanks for the remarks. I\u0027ve incorporated the changes for your comments. You are right the CH347 is a low-cost replacement for the expensive FTDI chips. I found an entry in a forum where someone mentioned this.\n\nAnd yes, the datasheet of the CH347 mention two versions. But I\u0027ve also only seen the \"T\" version. I\u0027ve mentioned this in code, documentation and commit message.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"12190b8a9545e273f697d8e76f19ce9340533c43","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":24,"id":"03e2b2d5_f5dbc6bc","updated":"2023-11-03 19:41:11.000000000","message":"I managed to get SWD working with 4.14 and the latest driver code.\nSee comments.\n\nUnfortunately the SWD performance is a disaster:\n```\nadapter speed: 7500 kHz\n\u003e dump_image /run/user/1000/ram128k.bin 0x1fff0000 0x20000\ndumped 131072 bytes in 19.867664s (6.443 KiB/s)\n\n\u003e load_image /run/user/1000/ram128k.bin 0x1fff0000\n131072 bytes written at address 0x1fff0000\ndownloaded 131072 bytes in 19.857601s (6.446 KiB/s)\n```\n\nFor comparison a USB FS based CMSIS-DAP adapter can make 130..200 KiB/s\n\nJTAG performance is better but still comparable to USB FS adapters and\nby far lower than FT232H.\nCH347 with ESP32 target (EasyDevKit):\n```\nadapter speed: 30000 kHz\n\u003e dump_image /run/user/1000/ram256.bin 0x60000000 0x40000\ndumped 262144 bytes in 8.876739s (28.839 KiB/s)\n \n\u003e load_image /run/user/1000/ram256.bin 0x60000000\n262144 bytes written at address 0x60000000\ndownloaded 262144 bytes in 3.349011s (76.440 KiB/s)\n \n\u003e time step\n105572 microseconds per iteration\n114708 microseconds per iteration\n116073 microseconds per iteration\n```\n\nFor comparison FT232H with ESP32 target:\n```\nadapter speed: 30000 kHz\n\u003e dump_image /run/user/1000/ram256.bin 0x60000000 0x40000\ndumped 262144 bytes in 0.708136s (361.512 KiB/s)\n\n\u003e load_image /run/user/1000/ram256.bin 0x60000000\n262144 bytes written at address 0x60000000\ndownloaded 262144 bytes in 0.902259s (283.732 KiB/s)\n\n\u003e time step\n13998 microseconds per iteration\n13256 microseconds per iteration\n13439 microseconds per iteration\n```","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"880ddbfa62e4500e960b049512524426cc807178","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":24,"id":"11a87306_909b8d4f","updated":"2023-11-02 17:28:58.000000000","message":"Matthias,\nI got a CH347T board and tested the adapter with a Cortex-M4 MCU.\n\nPatchset 7 to 13 works in JTAG mode. Since scratchpad introduction in patchset 15 JTAG mode is broken:\n```\nInfo : 63 20 ch347.c:1171 ch347_open_device(): CH347 (unknown) from vendor wch.cn with serial number 0123456789 found. (Chip version\u003d2.41, Firmware\u003d0x41)\nDebug: 64 20 adapter.c:213 adapter_khz_to_speed(): convert khz to adapter specific speed value\nDebug: 65 20 adapter.c:217 adapter_khz_to_speed(): have adapter set up\nDebug: 66 20 adapter.c:213 adapter_khz_to_speed(): convert khz to adapter specific speed value\nDebug: 67 20 adapter.c:217 adapter_khz_to_speed(): have adapter set up\nInfo : 68 20 adapter.c:177 adapter_init(): clock speed 1875 kHz\nDebug: 69 20 openocd.c:133 handle_init_command(): Debug Adapter init complete\nDebug: 70 20 command.c:154 script_debug(): command - transport init\nDebug: 71 20 transport.c:219 handle_transport_init(): handle_transport_init\nDebug: 72 20 core.c:830 jtag_add_reset(): SRST line released\nDebug: 73 20 core.c:855 jtag_add_reset(): TRST line released\nDebug: 74 20 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset\nDebug: 75 20 command.c:154 script_debug(): command - jtag arp_init\nDebug: 76 20 core.c:1509 jtag_init_inner(): Init JTAG chain\nDebug: 77 21 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset\nDebug: 78 21 core.c:1234 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS\nDebug: 79 21 core.c:328 jtag_call_event_callbacks(): jtag event: TAP reset\nDebug: 80 21 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[672], read from bit offset: 0\nInfo : 81 21 core.c:1133 jtag_examine_chain_display(): JTAG tap: kx.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd), part: 0xba00, ver: 0x4)\nDebug: 82 21 core.c:1364 jtag_validate_ircapture(): IR capture validation scan\nDebug: 83 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[6], read from bit offset: 0\nDebug: 84 22 core.c:1421 jtag_validate_ircapture(): kx.cpu: IR capture 0x01\nDebug: 85 22 command.c:154 script_debug(): command - dap init\nDebug: 86 22 arm_dap.c:95 dap_init_all(): Initializing all DAPs ...\nDebug: 87 22 arm_dap.c:119 dap_init_all(): DAP kx.cpu configured by default to use ADIv5 protocol\nDebug: 88 22 arm_adi_v5.c:679 dap_dp_init(): kx.dap\nDebug: 89 22 arm_adi_v5.c:711 dap_dp_init(): DAP: wait CDBGPWRUPACK\nDebug: 90 22 arm_adi_v5.h:641 dap_dp_poll_register(): DAP: poll 4, mask 0x20000000, value 0x20000000\nDebug: 91 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 0\nDebug: 92 22 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 93 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 40\nDebug: 94 22 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 43\nDebug: 95 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 80\nDebug: 96 22 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 83\nDebug: 97 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 120\nDebug: 98 22 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 123\nDebug: 99 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 160\nDebug: 100 22 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 163\nDebug: 101 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 0\nDebug: 102 22 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 103 22 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 40\nDebug: 104 22 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 43\nDebug: 105 22 arm_adi_v5.c:719 dap_dp_init(): DAP: wait CSYSPWRUPACK\nDebug: 106 22 arm_adi_v5.h:641 dap_dp_poll_register(): DAP: poll 4, mask 0x80000000, value 0x80000000\nDebug: 107 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 0\nDebug: 108 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 108 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 109 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 40\nDebug: 110 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 43\nDebug: 111 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 0\nDebug: 112 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 113 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 40\nDebug: 114 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 43\nDebug: 115 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 0\nDebug: 116 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 117 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 40\nDebug: 118 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 43\nDebug: 119 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 80\nDebug: 120 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 83\nDebug: 121 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 0\nDebug: 122 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 123 23 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 40\nDebug: 124 23 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 43\nDebug: 125 23 openocd.c:150 handle_init_command(): Examining targets...\nDebug: 126 23 target.c:1805 target_call_event_callbacks(): target event 19 (examine-start) for core kx.cpu\nDebug: 127 23 arm_adi_v5.c:1095 dap_get_ap(): refcount AP#0x0 get 1\nDebug: 128 24 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 0\nDebug: 129 24 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 3\nDebug: 130 24 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 40\nDebug: 131 24 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 43\nDebug: 132 24 ch347.c:464 ch347_scan_data_to_fields(): fields[0].in_value[3], read from bit offset: 80\nDebug: 133 24 ch347.c:464 ch347_scan_data_to_fields(): fields[1].in_value[32], read from bit offset: 83\nError: 134 24 adi_v5_jtag.c:446 jtagdp_overrun_check(): Invalid ACK (5) in DAP response\n```\n\nAnd more nonsense ACK values are read:\n```\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (7) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (7) in DAP response\nError: Invalid ACK (7) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (5) in DAP response\nError: Invalid ACK (0) in DAP response\nError: Invalid ACK (0) in DAP response\nError: [kx.cpu] Could not find MEM-AP to control the core\nError: Invalid ACK (0) in DAP response\nError: MDM: failed to read ID register\nWarn : target kx.cpu examination failed\n```\n\nSWD mode seems to be broken since the patchset 7 (the first which compiles).\nThis log is from patchset 13:\n```\nInfo : 64 22 ch347.c:1171 ch347_open_device(): CH347 (unknown) from vendor wch.cn with serial number 0123456789 found. (Chip version\u003d2.41, Firmware\u003d0x41)\nError: 65 523 libusb_helper.c:276 jtag_libusb_bulk_read(): libusb_bulk_read error: LIBUSB_ERROR_TIMEOUT\nError: 66 523 ch347.c:289 ch347_read_data(): CH347 read fail\nDebug: 67 523 adapter.c:213 adapter_khz_to_speed(): convert khz to adapter specific speed value\nDebug: 68 523 adapter.c:217 adapter_khz_to_speed(): have adapter set up\nDebug: 69 523 adapter.c:213 adapter_khz_to_speed(): convert khz to adapter specific speed value\nDebug: 70 523 adapter.c:217 adapter_khz_to_speed(): have adapter set up\nInfo : 71 523 adapter.c:177 adapter_init(): clock speed 1875 kHz\nDebug: 72 523 openocd.c:133 handle_init_command(): Debug Adapter init complete\nDebug: 73 523 command.c:154 script_debug(): command - transport init\nDebug: 74 523 transport.c:219 handle_transport_init(): handle_transport_init\nDebug: 75 523 command.c:154 script_debug(): command - dap init\nDebug: 76 523 arm_dap.c:95 dap_init_all(): Initializing all DAPs ...\nDebug: 77 523 arm_dap.c:119 dap_init_all(): DAP kx.cpu configured by default to use ADIv5 protocol\nDebug: 78 523 ch347.c:1893 ch347_swd_switch_seq(): JTAG-to-SWD\n^CDebug: 79 900 server.c:607 sig_handler(): Terminating on Signal 2\nError: 80 1025 libusb_helper.c:276 jtag_libusb_bulk_read(): libusb_bulk_read error: LIBUSB_ERROR_TIMEOUT\nError: 81 1025 ch347.c:289 ch347_read_data(): CH347 read fail\nDebug: 82 1025 ch347.c:1563 ch347_swd_queue_flush(): CH347ReadData error\nError: 83 1025 ch347.c:1719 ch347_swd_run_queue(): CH347 usb write/read failed - queued_retval\nError: 84 1026 adi_v5_swd.c:366 swd_connect_single(): Error connecting DP: cannot read IDR\nDebug: 85 1026 command.c:543 run_command(): Command \u0027dap init\u0027 failed with error code -4\nUser : 86 1027 command.c:615 command_run_line():\nDebug: 87 1027 command.c:543 run_command(): Command \u0027init\u0027 failed with error code -4\nUser : 88 1027 command.c:615 command_run_line():\nDebug: 89 1027 target.c:2161 target_free_all_working_areas_restore(): freeing all working areas\nDebug: 90 1029 ch347.c:1902 ch347_swd_switch_seq(): SWD-to-DORMANT\nDebug: 91 1029 ch347.c:1908 ch347_swd_switch_seq(): DORMANT-to-JTAG\nError: 92 1530 libusb_helper.c:276 jtag_libusb_bulk_read(): libusb_bulk_read error: LIBUSB_ERROR_TIMEOUT\nError: 93 1530 ch347.c:289 ch347_read_data(): CH347 read fail\nDebug: 94 1530 ch347.c:1563 ch347_swd_queue_flush(): CH347ReadData error\nError: 95 1530 ch347.c:1719 ch347_swd_run_queue(): CH347 usb write/read failed - queued_retval\nSegmentation fault (core dumped)\n```\n\nThe latest patchset 24 segfaults even earlier:\n```\nInfo : CH347 SWD mode enabled\nswd\nInfo : add flash_bank kinetis kx.pflash\nInfo : Listening on port 6666 for tcl connections\nInfo : Listening on port 4444 for telnet connections\nInfo : CH347 (unknown) from vendor wch.cn with serial number 0123456789 found. (Chip version\u003d2.41, Firmware\u003d0x41)\nSegmentation fault (core dumped)\n```\n\nLet\u0027s focus first to the JTAG mode. Did you test patchset 24 with ESP? Does it work?","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"10e97ec5b6518105504abdd3d01237373045418e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":24,"id":"a7b671b1_678086a7","updated":"2023-11-03 10:34:01.000000000","message":"Matthias,\nthanks for the dev kits, I got them today.\nI can confirm that ESP32 JTAG works with both 2.41 and 4.41 chip versions.\nFortunately it\u0027s easy to disable ESP32 by clamping EN to GND and use\nJTAG pins as an universal adapter. I connected a Cortex-M4 to 4.41 chip\nand both JTAG and SWD works with patchset 13 (and JTAG also with the latest patchset with fixed RUNTEST). SWD is broken in the latest code - I will look to it later.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":24,"id":"8a9d033b_b58cb2c5","in_reply_to":"03e2b2d5_f5dbc6bc","updated":"2023-11-03 21:33:30.000000000","message":"Good to hear that. Currently I can\u0027t test the SWD mode. My dev board which supports also SWD mode didn\u0027t arrived today. Maybe I\u0027ve it tomorrow for testing at the weekend.\n\nI\u0027ve also seen the far lower JTAG performance compared against an FT2232H. The debugger reacts much slower when using a CH347T chip. Maybe the key to get more performance is to reduce the count of USB round trips. Now I\u0027ve at least three round trips for each execute_queue. One for switching the activity LED on, one for the commands and one for switching the activity LED of. For each round trip at least two libusb_bulk_transfer calls are needed. One for writing data to the CH347T and one for reading data from the CH347T chip.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e811772b1fcc44f5171f023435c74a3ee1a1e5b1","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":24,"id":"a5745342_c03e6a68","in_reply_to":"109ec75e_bb813827","updated":"2023-11-02 23:11:59.000000000","message":"\u003e It\u0027s not a single core / dual core issue.\n\nThe problem is in RUNTEST implementation. Perhaps ESP32 does not use it.\nWith the fixed RUNTEST Cortex-M JTAG works.\n\n\u003e .. CH347T version 2.41 supports is 1875 kHz. Newer chips are version 4.41 and supports also 938 kHz and 469 kHz speeds.\n\nUnfortunately I have the older one.\n\n\u003e But anyway I\u0027ve ordered a Cortex-M3 MCU. It\u0027s a Nucleo-64 board with STM32F103.\n\nGood. SWD looks quite broken even in the original code. Or silicon bugs in 2.41 version?","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"f255f9e6237a0561f01c644c4cc735962c73a1a0","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":24,"id":"37a64795_ad406f93","in_reply_to":"11a87306_909b8d4f","updated":"2023-11-02 17:48:23.000000000","message":"That\u0027s Tomas,\nyes, patchset 24 is working with the ESP32. But that\u0027s a dual core CPU with two TAP\u0027s. Maybe that\u0027s a problem. I\u0027ll test it now also with an ESP32-S2 which has a single core CPU with only one TAP. From the log I\u0027ve seen that the Cortex-M4 MCU that you have tested has also a single core cpu with one TAP.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"460956798ef0c45a7aa38d9b7d3e91fcd20beff5","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":24,"id":"109ec75e_bb813827","in_reply_to":"37a64795_ad406f93","updated":"2023-11-02 21:47:29.000000000","message":"It\u0027s not a single core / dual core issue. I\u0027ve tested again and found that patchset 24 is working for me with ESP32 dual core (two TAP\u0027s) and ESP32-S2 single core (one TAP).\n\nWhat target.cfg do you use? Maybe the target.cfg wishes to set 1000 kHz adapter speed, but the lowest speed that the CH347T version 2.41 supports is 1875 kHz. Newer chips are version 4.41 and supports also 938 kHz and 469 kHz speeds.\n\nBut anyway I\u0027ve ordered a Cortex-M3 MCU. It\u0027s a Nucleo-64 board with STM32F103. The datasheet states that this chip supports JTAG and SWD mode debugging. I\u0027ll test with that also.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"0bff8b36d6fa516854777535d072a823e166a4b3","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":24,"id":"c5c3db03_a8a44328","in_reply_to":"8a9d033b_b58cb2c5","updated":"2023-11-04 17:52:56.000000000","message":"\u003e Maybe the key to get more performance is to reduce the count of USB round trips.\n\nWell the round trip time should be much lower on USB HS (8 microframes per ms) then on USB FS.\n\n\u003e One for switching the activity LED on, ... and one for switching the activity LED of.\n\nRemoving LED handling gains about 10% in JTAG performance. SWD does not\nhandle LED at all.\n\n\u003e For each round trip at least two libusb_bulk_transfer calls are needed. One for writing data to the CH347T and one for reading data from the CH347T chip.\n\nTheoretically we could use pipelining of bulk packets as I introduced for CMSIS-DAP in 7365: jtag/drivers/cmsis_dap_bulk: use asynchronous libusb transfer | https://review.openocd.org/c/openocd/+/7365\nBut the miserable performance of CH347 is caused mainly by the poor design of the chip, not by the driver.\n\nJTAG:\nPoor performance is clearly visible on a logic analyser.\nA typical ADIv5 AP r/w sequence has 48 clocks. Only 8 and 24 generated by CMD_JTAG_DATA_SHIFT are clocked at full speed (I set 15 MHz). CMD_JTAG_BIT_OP runs at ~ 1.6 MHz (almost 10 times slower) and there are 5 pauses between the instructions as big as 6 us. One sequence takes 33 us so the effective clock speed is 48 / 33 \u003d 1.45 MHz, more than 10 times slower than requested clock!\n\nSWD:\nThe disastrous performance of 6 KiB/s transfers was caused by very low SWD clock 100 kHz (adapter default, not set from OpenOCD). Since then I found CMD_SWD_INIT parameter for speed setting. But it\u0027s a plain divisor of maximum 1 MHz clock. The performance of long transfers increased to 42 KiB/s @ adapter speed 1 MHz. Damn too low for a fast USB HS adapter!\n\nLogic analyser shows that 58% of time SWD is runing, the rest of time SWD is idle because the adapter communicates over USB or waits for a packet. So even if we eliminated idle times completely (probably impossible), we would get no more than 75 KiB/s transfer speed.\n\nLet\u0027s make the driver working but don\u0027t spend much time on it.\nCH347 crap will never be comparable replacement of FTDI chips.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":24,"id":"df626c93_011d1f05","in_reply_to":"a5745342_c03e6a68","updated":"2023-11-03 21:33:30.000000000","message":"I\u0027ll test the SWD part after I get my board with the STM32F103.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7f56a06601bbf31ef0763a2978808da6c554383d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":24,"id":"e16c31d9_13f84a58","in_reply_to":"c5c3db03_a8a44328","updated":"2023-11-05 17:09:02.000000000","message":"More crap in chip version 2.41 JTAG timing:\n- with adapter speed 1875 kHz the shortest TCLK positive pulse is as short as 24 ns instead of 266 ns corresponding to the clock speed\n- CMD_JTAG_DATA_SHIFT_RD runs clock at 4.6 MHz, substantially above the selected speed\n- the timing is almost same for all clocks settings! E.g. with adapter speed 60 MHz CMD_JTAG_DATA_SHIFT_RD runs at ~ 8 MHz\n\nVersion 4.41 fixes the timing problems.\n\nAnd another problem in 4.41 SWD:\nWhen reading AP reg CH347 **erroneously drives SWDIO to H** for 392 ns after the last ACK bit and just before sampling of the first data bit. During this time the target is driving SWDIO by ADI specs and if drives to L, a harmful current pulse is generated. Some targets (namely STM32F103 or Kinetis K66) get so upset that a wrong data with parity error are received by the adapter. A resistor in SWDIO circuit mitigates the problem.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"af0f39a0626fc3862b63e17845e60201e28737cf","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":26,"id":"82b63aad_5cff92c1","updated":"2023-11-04 10:56:03.000000000","message":"Received the board I\u0027ve ordered. It\u0027s a rev 2.41! So my tests would be limited to this device only.\n\nI\u0027m checking the existing OpenOCD commands \"adapter gpio\".\nThis can be used to define the GPIOs that should be used for TRST, SRST and LED, including the properties for active low/high, open-drain/push-pull.\nI would prefer to remove from this patch the commands \"ch347 activity_led\" and \"jtag_ntrst_delay\", focusing only on JTAG and SWD support.\nThen in a next patch use \"adapter gpio\" to extend the driver\u0027s support to TRST, SRST and LED.\n\nRegarding the device STM32F103 you have ordered, please consider that it supports both JTAG and SWD. You can use it for testing both.","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"286b8c6deeaf0a71db09e5dc9ce1270285e0be97","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":26,"id":"34deb821_b064b5c4","updated":"2023-11-04 14:35:00.000000000","message":"With rev 2.41 I get libusb timeout at the read after the command to enter in SWD.\nEither 2.41 does not support SWD or it uses a different protocol.","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89d04719406dd2b6361d630a2a2ab4c4eebdbe7c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":26,"id":"5812ee73_1d122a8c","in_reply_to":"82b63aad_5cff92c1","updated":"2023-11-06 00:07:27.000000000","message":"OK, I\u0027ve removed this. I can implement it later in another patch.","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7aead640f11c9b4c5051007c513b4a2d798b1d50","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":27,"id":"616f0afe_9d51b2e7","updated":"2023-11-08 13:42:51.000000000","message":"JTAG with Cortex-M works. SWD needs a small fix...","commit_id":"8c1ec6ae4c730cc42f924fe849c4c4e19983c680"},{"author":{"_account_id":1000859,"name":"Karl Palsson","email":"karlp@tweak.au","username":"karlp"},"change_message_id":"74f499253db93fee04b1e7065502e1a998f1b9d1","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":28,"id":"1cf17b8c_8fb87b3f","updated":"2023-11-10 10:50:48.000000000","message":"just some dangling esp code that should be dropped","commit_id":"e44b0b5c6b37c589194efaa9263e18ebc3b85c1d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"217898340b73b66bf999fd8e272d9bc3cb88f6a2","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":30,"id":"7cddcdc6_7e1d8199","updated":"2023-11-19 19:36:46.000000000","message":"Do we have any news for that change? Something that needs to be changed? Or can this be merged now?","commit_id":"4b1736cf2db64eb55ccd6c7a441552e416f7de49"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"599fc1dc20cfba5a3c4a8f96c93d033778d06568","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":31,"id":"3c4f786a_33ae8265","updated":"2024-04-08 05:22:15.000000000","message":"Hi Matthias,\nWhen I tried to use 347F for experimentation, I encountered Error: libusd_bulk_write error: LIBUSB_ERROR_NOT_FOUND, and the driver installation method is the same as 347T.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"5dcee1c3a08510cb6342e08c2a38a4059f32874b","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":31,"id":"6cf18555_d5e8eed7","updated":"2024-04-11 02:00:50.000000000","message":"Hi, \nWhen I was using 347T to download STM32F1, the following error occurred, I noticed the SWD part of the code in the WCH official repository(https://github.com/WCHSoftGroup/ch347), and I haven’t found the problem with your driver yet.:\nInfo : Requested speed of 1000 kHz is not possible. Using the next higher speed of 1875 kHz!\nInfo : Requested speed of 1000 kHz is not possible. Using the next higher speed of 1875 kHz!\nInfo : clock speed 1875 kHz\nInfo : SWD DPIDR 0x1ba01477\nInfo : [stm32f1x.cpu] Cortex-M3 r1p1 processor detected\nInfo : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints\nInfo : [stm32f1x.cpu] Examination succeed\nInfo : starting gdb server for stm32f1x.cpu on 3333\nInfo : Listening on port 3333 for gdb connections\nError: SRST error\n[stm32f1x.cpu] halted due to debug-request, current mode: Thread\nxPSR: 0x01000000 pc: 0x080008bc msp: 0x20000688\n** Programming Started **\nInfo : device id \u003d 0x10036414\nInfo : flash size \u003d 512 KiB\nWarn : Adding extra erase range, 0x080009f8 .. 0x08000fff\nError: CH347 usb write/read failed - not CH347_CMD_SWD_SEQ_W\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD_SEQ_W\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD\nError: CH347 usb write/read failed - not CH347_CMD_SWD","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"e7b3c3f44566585401098cc0d09cd04429c2616a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":31,"id":"7f5c4976_505b2a7c","updated":"2024-04-03 03:20:57.000000000","message":"looks like there\u0027s no problem","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"d44269f40010f9af3ed8f64ea0c993ef303a8c6a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":31,"id":"86bd807c_ed9239d9","in_reply_to":"3c4f786a_33ae8265","updated":"2024-04-10 16:08:22.000000000","message":"The issue here is that I couldn\u0027t find a supplier that delivers the CH347F to Germany. So I can\u0027t test it. Beside that I\u0027m not sure if the CH347 at all will be a great success. The little brother of the CH347F the CH347T is already discontinued at LCSC.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"3ef8e1d7cd0b3e26c1188d2c662d2b1983addde9","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":31,"id":"d7a6559c_67f511b3","in_reply_to":"5efc6bcf_2064af74","updated":"2024-04-11 05:19:46.000000000","message":"Don\u0027t worry, the Chinese market alone has a large number of users. In addition to the 347, they have also launched other multifunctional products with JTAG ports, such as 339.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1683f048b741552a59300d10666cf5a9dda98c21","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":31,"id":"f13b29ab_cbdbe4ba","in_reply_to":"6cf18555_d5e8eed7","updated":"2024-04-12 21:25:00.000000000","message":"Is the SWD mode working with the code from the WCH official repository?","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"08b8c7879b1efabf79b4c278bfcdd6ca5a791302","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":31,"id":"5efc6bcf_2064af74","in_reply_to":"86bd807c_ed9239d9","updated":"2024-04-10 20:25:07.000000000","message":"Hi ZhiYuanNJ,\nfor getting it running with CH347F you need to set the product id to 0x55de. So you need the line \"ch347 vid_pid 0x1a86 0x55de\" in your interface configuration file. Hope that helps.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"e43e3550593aa8550da37ba57c1b5f4fbc3d34fe","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":31,"id":"ac25b21c_f7fbc6f9","in_reply_to":"8f218dce_d98c362c","updated":"2025-01-24 16:28:57.000000000","message":"Found the missing do/while loop in my driver. Added it in ch347_swd_queue_flush because it is also there in the WCH official repository. Now it should work the same.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"1c5222f3eb7545e1523d682df91eb5f9dcf067ba","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":31,"id":"8f218dce_d98c362c","in_reply_to":"f13b29ab_cbdbe4ba","updated":"2024-04-13 01:55:00.000000000","message":"After testing, the SWD part in the official WCH code can be used normally under CH347. The above errors are from your driver.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":33,"id":"19f07016_bdbe5692","updated":"2024-04-26 09:41:17.000000000","message":"Hi, I continue to review later. For now I have following comments.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002364,"name":"Deomid Ryabkov","username":"rojer"},"change_message_id":"c6118c3744ea98d65f22fb5aa1009fbe5c4b84bb","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":34,"id":"987d291f_561e424d","updated":"2025-01-22 21:25:59.000000000","message":"Found this while searching for CH347 support - confirming that it works, and quality seems superior to the vendor\u0027s repo (which has a buffer overflow that causes a crash).\n\nWould be nice to see it merged, CH347 is used in Qualcomm devkits (QCC730, QCC74x).","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002339,"name":"swk","username":"123swk123"},"change_message_id":"a81c102c2427a5e07eeed7aab999254f82e61537","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":34,"id":"08fe3be4_a3f9d52b","updated":"2024-11-19 17:25:52.000000000","message":"I missed to add this one. Btw I have CH347F \u0026 CH347T (old) boards and using it for soft core RISC-V debugging. If you need some support in testing, I am happy to.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002339,"name":"swk","username":"123swk123"},"change_message_id":"193fe0f95ea4519598013cbc25c33674adf8ca22","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":34,"id":"ca35452a_0faba815","updated":"2024-11-19 17:14:45.000000000","message":"during my recent search for OpenOCD for CH347 I landed on this patch review, I had some time to go thourgh the code and here are my feedback.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"4c596c57efd084b60c772cd5e6ee2ce42b8be751","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":34,"id":"63554152_0b8bf546","in_reply_to":"045d17ea_e26ea70c","updated":"2025-01-23 08:56:24.000000000","message":"I will ack this driver as soon as my review comments are addressed.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":34,"id":"fa62f047_89d8d3c2","in_reply_to":"281bdcd0_9e9bff07","updated":"2025-01-24 01:13:03.000000000","message":"@Oleksij Rempel your review comments are now addressed.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"5698e17aadbdc2b2e4914146fab4edf707170c6d","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":34,"id":"281bdcd0_9e9bff07","in_reply_to":"63554152_0b8bf546","updated":"2025-01-23 09:42:00.000000000","message":"I\u0027ll address the comments ASAP. That\u0027s for waiting.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"d823afeb3669a8c3a180f42423d389ea83e4e235","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":34,"id":"045d17ea_e26ea70c","in_reply_to":"987d291f_561e424d","updated":"2025-01-23 02:58:47.000000000","message":"Hi Deomid,\nthe openocd code of vendor\u0027s repo，crash due to log printing function, i fixed it at \n8612: jtag/drivers: Add support for WCH CH347T/F interfaces | https://review.openocd.org/c/openocd/+/8612\nglad for you review.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"f238714c18acfefa817afc25ab0445c6fd69cfd1","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":39,"id":"6221816f_80dfc3d3","updated":"2025-01-24 16:39:12.000000000","message":"Matthias,\nSWD is completely screwed in patchsets 39 and 40 - fails in adapter init.\nPatchset 34 worked normally.\n\n```\nDebug: 93 4 target.c:1588 handle_target_init_command(): Initializing targets...\nDebug: 94 4 mem_ap.c:61 mem_ap_init_target(): [stm32h7x.ap2] mem_ap_init_target\nDebug: 95 4 semihosting_common.c:109 semihosting_common_init():\nInfo : 96 10 ch347.c:1320 ch347_open_device(): CH347 EasyDevKit from vendor EasyDevKits with serial number ACBACJGAAF found. (Chip version\u003d4.41, Firmware\u003d0x41)\nError: 97 10 ch347.c:604 ch347_cmd_transmit_queue(): Nothing to send!\nDebug: 98 10 command.c:528 exec_command(): Command \u0027init\u0027 failed with error code -4\n```\n\ngdb backtrace at `Nothing to send` error:\n\n```\nThread 1 \"openocd\" hit Breakpoint 1, ch347_cmd_transmit_queue () at ../src/jtag/drivers/ch347.c:604\n604                             LOG_ERROR(\"Nothing to send!\");\n(gdb) bt\n#0  ch347_cmd_transmit_queue () at ../src/jtag/drivers/ch347.c:604\n#1  0x00005555555bff00 in ch347_single_read_get_byte (byte\u003d\u003csynthetic pointer\u003e, read_buf_idx\u003d0) at ../src/jtag/drivers/ch347.c:741\n#2  ch347_swd_init_cmd () at ../src/jtag/drivers/ch347.c:1619\n#3  ch347_init () at ../src/jtag/drivers/ch347.c:1652\n#4  0x00005555555b6ca4 in adapter_init (cmd_ctx\u003d\u003coptimized out\u003e) at ../src/jtag/adapter.c:151\n#5  0x00005555555b3098 in handle_init_command (cmd\u003d0x7fffffffeff8) at ../src/openocd.c:127\n#6  0x00005555556370dc in exec_command (argv\u003d0x7ffffffff140, argc\u003d1, c\u003d0x5555559abb10, context\u003d0x55555598c2a0, interp\u003d0x55555598c300) at ../src/helper/command.c:520\n#7  jim_command_dispatch (interp\u003d0x55555598c300, argc\u003d1, argv\u003d0x7ffffffff140) at ../src/helper/command.c:931\n#8  0x000055555579828c in JimInvokeCommand ()\n#9  0x0000555555799830 in Jim_EvalObj ()\n#10 0x000055555579a530 in Jim_EvalSource ()\n#11 0x0000555555636b94 in command_run_line (context\u003dcontext@entry\u003d0x55555598c2a0, line\u003d0x1 \u003cerror: Cannot access memory at address 0x1\u003e, line@entry\u003d0x5555557b8af8 \"init\")\n    at ../src/helper/command.c:573\n#12 0x00005555555b34dc in openocd_thread (cmd_ctx\u003d0x55555598c2a0, argv\u003d0x7ffffffff3c8, argc\u003d5) at ../src/openocd.c:306\n#13 openocd_main (argc\u003d5, argv\u003d0x7ffffffff3c8) at ../src/openocd.c:352\n#14 0x00007ffff7d47740 in __libc_start_call_main (main\u003dmain@entry\u003d0x5555555b2d80 \u003cmain\u003e, argc\u003dargc@entry\u003d5, argv\u003dargv@entry\u003d0x7ffffffff3c8) at ../sysdeps/nptl/libc_start_call_main.h:58\n#15 0x00007ffff7d47818 in __libc_start_main_impl (main\u003d0x5555555b2d80 \u003cmain\u003e, argc\u003d5, argv\u003d0x7ffffffff3c8, init\u003d\u003coptimized out\u003e, fini\u003d\u003coptimized out\u003e, rtld_fini\u003d\u003coptimized out\u003e,\n    stack_end\u003d\u003coptimized out\u003e) at ../csu/libc-start.c:360\n#16 0x00005555555b2ef0 in _start ()\n```","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"9286b24af2c80a6d8ae83d723a51da16668405f4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":39,"id":"da3dd30e_3f230d5f","updated":"2025-01-24 08:54:47.000000000","message":"There seems to be a misunderstanding regarding error handling. Proper error propagation is essential not only to detect issues promptly (e.g., stopping operations when USB is unstable) but also for diagnostics. Clear and accurate error codes help users understand what is happening. For this reason, error values should not be reduced to simple boolean checks. It\u0027s critical to forward error values without altering them unnecessarily.\n\nIn this patch, there are two problematic patterns that modify error values:\n\n1. Overwriting the error value:\n   if (function() !\u003d ERROR_OK)\n       return ERROR_FAIL;\n\n2. ORing error values, which can result in unexpected or incorrect error values under certain conditions:\n   retval \u003d function1();\n   retval |\u003d function2();\n\nTo ensure consistent and meaningful error propagation, please follow this pattern instead:\n   retval \u003d function();\n   if (retval !\u003d ERROR_OK)\n       return retval;","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"ac1eee8368ed73a81927959544e3d84db535a427","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":39,"id":"c61aaefd_b8deb57f","in_reply_to":"6221816f_80dfc3d3","updated":"2025-01-24 22:39:17.000000000","message":"Thanks for point this out! I\u0027d broke the complete adapter init function. And it worked also not normal jtag mode. Now it\u0027s fixed.","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"264d47bce57728252bd177bcec279be5cee3e137","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":39,"id":"d254bd66_09d1356f","in_reply_to":"63552b04_66b443e3","updated":"2025-01-25 09:52:21.000000000","message":"Found it. Need to call ch347_init_pack_size also for the SWD mode. Hope it works now also for SWD mode.","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":39,"id":"2ce2e1cb_06777829","in_reply_to":"a39d2a00_1d852995","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve removed the backported do/while loop. That was the only difference in the SWD part regarding the official code from the manufacturer of the chip.","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"55ef5001e99420d15cd07000bc54313bddf92ed5","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":39,"id":"63552b04_66b443e3","in_reply_to":"c61aaefd_b8deb57f","updated":"2025-01-25 06:51:10.000000000","message":"Again `Error: Nothing to send!` on SWD init","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":39,"id":"a39d2a00_1d852995","in_reply_to":"d254bd66_09d1356f","updated":"2025-01-26 12:43:29.000000000","message":"Patchset 42 in SWD mode goes over speed setting and fails in USB read after sending JTAG-to-SWD seq.\n```\nInfo : 96 10 ch347.c:1394 ch347_open_device(): CH347 EasyDevKit from vendor EasyDevKits with serial number ACBACJGAAF found. (Chip version\u003d4.41, Firmware\u003d0x41)\nDebug: 97 10 ch347.c:541 ch347_scan_data_to_fields(): single read of 1 bytes\nDebug: 98 10 ch347.c:541 ch347_scan_data_to_fields(): single read of 1 bytes\nDebug: 99 10 adapter.c:216 adapter_khz_to_speed(): convert khz to adapter specific speed value\nDebug: 100 10 adapter.c:220 adapter_khz_to_speed(): have adapter set up\nInfo : 101 10 ch347.c:1599 ch347_speed_get_index(): Requested speed of 1800 kHz is not possible. Using the next higher speed of 1875 kHz!\nDebug: 102 10 adapter.c:216 adapter_khz_to_speed(): convert khz to adapter specific speed value\nDebug: 103 10 adapter.c:220 adapter_khz_to_speed(): have adapter set up\nInfo : 104 10 ch347.c:1599 ch347_speed_get_index(): Requested speed of 1800 kHz is not possible. Using the next higher speed of 1875 kHz!\nInfo : 105 10 adapter.c:180 adapter_init(): clock speed 1875 kHz\nDebug: 106 10 openocd.c:133 handle_init_command(): Debug Adapter init complete\nDebug: 107 10 command.c:153 script_debug(): command - transport init\nDebug: 108 10 transport.c:219 handle_transport_init(): handle_transport_init\nDebug: 109 10 command.c:153 script_debug(): command - dap init\nDebug: 110 10 arm_dap.c:96 dap_init_all(): Initializing all DAPs ...\nDebug: 111 10 arm_dap.c:120 dap_init_all(): DAP stm32h7x.cpu configured by default to use ADIv5 protocol\nDebug: 112 10 ch347.c:2176 ch347_swd_switch_seq(): JTAG-to-SWD\nError: 113 512 libusb_helper.c:276 jtag_libusb_bulk_read(): libusb_bulk_read error: LIBUSB_ERROR_TIMEOUT\nError: 114 512 ch347.c:318 ch347_read_data(): CH347 read fail\nDebug: 115 512 ch347.c:1825 ch347_swd_queue_flush(): CH347ReadData error\nError: 116 514 adi_v5_swd.c:381 swd_connect_single(): Error connecting DP: cannot read IDR\n```\n\nSee also https://review.openocd.org/c/openocd/+/7937/comment/0b0c237e_cbc42ae3/","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"ac1eee8368ed73a81927959544e3d84db535a427","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":39,"id":"5b9882a3_a312c475","in_reply_to":"da3dd30e_3f230d5f","updated":"2025-01-24 22:39:17.000000000","message":"I\u0027ve corrected this.","commit_id":"4444a994268e09fd0f8fdb22b388c61bd09c3dce"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"ac1eee8368ed73a81927959544e3d84db535a427","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":41,"id":"e3ffa47c_4143b563","updated":"2025-01-24 22:39:17.000000000","message":"Now all the issues are addressed. Ready for review.","commit_id":"6633e24d30c0f868535a5ec8ce86a8621c7a38c4"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"d98e88f2b8e9cd34da81742a6fceb0489ba93a1c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":42,"id":"446bf5db_b14095b4","updated":"2025-01-26 12:46:23.000000000","message":"Ah I forgot the score","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":42,"id":"b9003eba_68a160ae","updated":"2025-01-25 17:47:58.000000000","message":"Few minor comments below.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e4d557755ac864d37475ff9f83a5107613c61222","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"ee2f08d4_810c363a","updated":"2025-01-27 21:13:43.000000000","message":"Antonio, Oleksij\nI\u0027m not happy with the quality of this driver code. Despite Matthias efforts the complicated protocol and very bad quality of the vendors original code still shows.\nAnyway the CH347 chip itself has poor performance and both 2.41 and 4.41 versions it tested have serious design flaws. In that light I\u0027m ready to approve the code as is because neither a perfect driver code would not fix the problems in the adapter hw.\n\nI intent to add a couple of patches targeted to the SWD part and also add warnings informing about hw problems of CH347. Please put your score but wait with submitting of this patch. I\u0027d prefer to submit this one together with the planned follow-ups. Thanks","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002429,"name":"Danielle Church","username":"dmchurch"},"change_message_id":"90ce88df0ac7321b65304725be4f377503314063","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"c89d3cb3_60926b89","updated":"2025-07-30 21:09:38.000000000","message":"Hello! I just picked up a device with a CH347T that reports a version of 5.44. I see that there has been a lot of work done on this, but that it seems to have stalled; is there anything I can do to help move things forward?","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002298,"name":"Marek Kraus","email":"gamelaster@outlook.com","username":"gamelaster"},"change_message_id":"0c1afdd8f1843c5f2d50840d5e09ced704937eb3","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"3c1cbad6_5bf69e4c","updated":"2025-03-02 14:43:41.000000000","message":"Hi everyone, firstly, thanks to everyone involved in this effort! I tried this patch with one of devboards which contains CH347F for JTAG debugging. At beginning I applied this patch upon upstream, but there were some compilation issues, so I just tried it directly based on Tomas\u0027x latest changes with all history. That worked. Although, I encountered issue, where when TCL script calls `runtest 10` to get into stable known state, it resulted into `Error: call ch347_next_cmd first!`. I workaround it by using `pathmove RESET RUN/IDLE` instead, but still, I presume `runtest` command should work, and this is a bug? Or maybe chip limitation? I saw in some comment that there were issues with runtest, so maybe it\u0027s related?","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1cae66fb988fd51620097c322c6d4ceb99c0d489","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"897f4140_f4846af6","in_reply_to":"03dd5c63_af38e16e","updated":"2025-08-04 20:27:45.000000000","message":"The confirmed problem in JTAG mode is fixed now","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"b353fc60208e6b78b0a0707e747ea2913adb998a","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"d4fb0dd6_e234f8be","in_reply_to":"3c1cbad6_5bf69e4c","updated":"2025-03-05 21:32:31.000000000","message":"I confirm this problem. The commands to reproduce:\n`pathmove RESET RUN/IDLE;runtest 10`\n\nMatthias, could you fix it please?","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7f99bf6036234d717284bb0608964766046ca1db","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"cf4fc5f0_a9036d3e","in_reply_to":"55ec54c4_66a3e44e","updated":"2025-02-08 16:39:40.000000000","message":"Both 4.41 defect I\u0027m aware of are in SWD\nhttps://review.openocd.org/c/openocd/+/7937/comments/03e2b2d5_f5dbc6bc\nhttps://review.openocd.org/c/openocd/+/7937/comment/1319a20f_087118e1/\nAnd maximal SWD clock 1MHz ensures poor performance.\n\nJTAG in 4.41 has just poor performance (slower clocked bit ops and pauses)","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"5e72783fb06dcc07ab87c612e28146daeb189c01","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":43,"id":"2a6e51bf_91f01b11","in_reply_to":"897f4140_f4846af6","updated":"2025-08-05 18:42:52.000000000","message":"The discussion for the SWD issues are ongoing in this change: https://review.openocd.org/c/openocd/+/8746","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"97f2eeeefd16f649819632ca394464a7dbb732f4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":43,"id":"5cae402d_294e2aa8","in_reply_to":"bf150307_5e729f2b","updated":"2025-05-26 11:05:11.000000000","message":"Done","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"c04e1813ad7ae69920b88107c92ac656b7419a35","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"03dd5c63_af38e16e","in_reply_to":"c89d3cb3_60926b89","updated":"2025-08-01 07:52:21.000000000","message":"Let me give a short summary of blockers:\n- there is a confirmed problem in JTAG mode https://review.openocd.org/c/openocd/+/7937/comments/3c1cbad6_5bf69e4c - probably easy to fix, but nobody cares.\n- my follow-up patches mainly with SWD fixes are not reviewed - I refuse to merge this version without the fixes in the relation chain.\n\nOf course any testing with the new version is welcomed.","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6274312748b870eef050863a75a6a033a847cf96","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"bf150307_5e729f2b","in_reply_to":"cf4fc5f0_a9036d3e","updated":"2025-02-08 22:55:50.000000000","message":"I submitted the follow-up patches as I promised. Please find them in `Relation chain`. I\u0027ll appreciate your reviews. Also testing especially in SWD mode is highly welcomed. I\u0027d prefer to merge the whole series at once.","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1cae66fb988fd51620097c322c6d4ceb99c0d489","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":43,"id":"b7a22232_d4fbc53b","in_reply_to":"d4fb0dd6_e234f8be","updated":"2025-08-04 20:27:45.000000000","message":"Done. Fixed in ch347_scratchpad_add_stableclocks","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"4fc5be0b8bb226886d856cc8d916244d34eedbcf","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":43,"id":"55ec54c4_66a3e44e","in_reply_to":"ee2f08d4_810c363a","updated":"2025-02-06 01:47:23.000000000","message":"Yes, I also found defects with 2.21, Can you tell me about the defects with 4.41?","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6ddb3c1cfa1c0893a38dd232dd3c282f0967b109","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":50,"id":"44a4fd2e_1cdaa8cd","updated":"2025-08-05 20:24:36.000000000","message":"Matthias,\nthe driver now looks good to me.\nI spotted just a very minor problem: doc does not reflect the new multiple vid pid setting.\n\nI updated my follow-up patches for version 5.44\nSo far I tested with SWD only and the adapter finally seems me quite usable.\nDid you test JTAG with version 5.44 ?","commit_id":"4be52f9b0515b4b9c09f0c679a236b907a854079"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"9cb05028deaa14361bd2135fef67b910dc689c12","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":50,"id":"64c0b1f9_23bcbf60","in_reply_to":"44a4fd2e_1cdaa8cd","updated":"2025-08-05 21:51:49.000000000","message":"I\u0027ve changed the documentation to reflect the new multiple vid pid setting, and also adjusted the commit message a little bit.","commit_id":"4be52f9b0515b4b9c09f0c679a236b907a854079"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a5e51e8569683fa819069fa952bcac4229f5cd90","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":50,"id":"a1f6a806_a93cd96a","in_reply_to":"64c0b1f9_23bcbf60","updated":"2025-08-05 21:53:49.000000000","message":"I haven\u0027t tested JTAG with firmware version 5.44 yet. I still need to obtain a device running that version.","commit_id":"4be52f9b0515b4b9c09f0c679a236b907a854079"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"5fd793b6a9e8fe4e2b41a0934d50fdc009d8be75","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":50,"id":"b809c1b8_79c54162","in_reply_to":"a1f6a806_a93cd96a","updated":"2025-08-07 22:06:18.000000000","message":"I now have a CH347T with firmware version 5.44. I tested the JTAG mode and found that it works exactly the same as in firmware versions 2.41 and 4.41. I have successfully debugged an ESP32 program with all three firmware versions — all working perfectly.","commit_id":"4be52f9b0515b4b9c09f0c679a236b907a854079"}],"configure.ac":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":121,"context_line":""},{"line_number":122,"context_line":"m4_define([USB1_ADAPTERS],"},{"line_number":123,"context_line":"\t[[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],"},{"line_number":124,"context_line":"\t[[ch347], [Mode 3 of CH347 based devices], [CH347]],"},{"line_number":125,"context_line":"\t[[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],"},{"line_number":126,"context_line":"\t[[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],"},{"line_number":127,"context_line":"\t[[ulink], [Keil ULINK JTAG Programmer], [ULINK]],"}],"source_content_type":"application/octet-stream","patch_set":42,"id":"791b9797_4ace6238","line":124,"updated":"2025-01-25 17:47:58.000000000","message":"This is the only line you need to add in `configure.ac`\nAll the other lines you have added are not necessarily; you can drop all of them","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":121,"context_line":""},{"line_number":122,"context_line":"m4_define([USB1_ADAPTERS],"},{"line_number":123,"context_line":"\t[[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],"},{"line_number":124,"context_line":"\t[[ch347], [Mode 3 of CH347 based devices], [CH347]],"},{"line_number":125,"context_line":"\t[[stlink], [ST-Link Programmer], [HLADAPTER_STLINK]],"},{"line_number":126,"context_line":"\t[[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],"},{"line_number":127,"context_line":"\t[[ulink], [Keil ULINK JTAG Programmer], [ULINK]],"}],"source_content_type":"application/octet-stream","patch_set":42,"id":"97cdffa0_dcef3f7e","line":124,"in_reply_to":"791b9797_4ace6238","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve dropped all other lines. Didn\u0027t know that I only need this one line.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"}],"contrib/60-openocd.rules":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":241,"context_line":"ATTRS{product}\u003d\u003d\"*CMSIS-DAP*\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":242,"context_line":""},{"line_number":243,"context_line":"# WCH CH347 chip in mode 3"},{"line_number":244,"context_line":"ATTRS{idVendor}\u003d\u003d\"1a86\", ATTRS{idProduct}\u003d\u003d\"55dd\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":245,"context_line":""},{"line_number":246,"context_line":"LABEL\u003d\"openocd_rules_end\""}],"source_content_type":"application/octet-stream","patch_set":1,"id":"c1a9d793_d0fefd29","line":244,"updated":"2023-10-14 17:25:53.000000000","message":"please keep the file sorted by idVendor.\nThis 1a86 should be placed at line 198, after\n\\# USBprog with OpenOCD firmware\nATTRS{idVendor}\u003d\u003d\"1781\", ...","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[{"line_number":241,"context_line":"ATTRS{product}\u003d\u003d\"*CMSIS-DAP*\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":242,"context_line":""},{"line_number":243,"context_line":"# WCH CH347 chip in mode 3"},{"line_number":244,"context_line":"ATTRS{idVendor}\u003d\u003d\"1a86\", ATTRS{idProduct}\u003d\u003d\"55dd\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":245,"context_line":""},{"line_number":246,"context_line":"LABEL\u003d\"openocd_rules_end\""}],"source_content_type":"application/octet-stream","patch_set":1,"id":"ab665c27_37949e77","line":244,"in_reply_to":"c1a9d793_d0fefd29","updated":"2023-10-14 22:19:03.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6952199bd2b9f830bf801d1e19d9370f2d48ed62","unresolved":true,"context_lines":[{"line_number":221,"context_line":"ATTRS{idVendor}\u003d\u003d\"1781\", ATTRS{idProduct}\u003d\u003d\"0c63\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":222,"context_line":""},{"line_number":223,"context_line":"# WCH CH347 chip in mode 3"},{"line_number":224,"context_line":"ATTRS{idVendor}\u003d\u003d\"1a86\", ATTRS{idProduct}\u003d\u003d\"55dd\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"# TI/Luminary Stellaris In-Circuit Debug Interface (ICDI) Board"},{"line_number":227,"context_line":"ATTRS{idVendor}\u003d\u003d\"1cbe\", ATTRS{idProduct}\u003d\u003d\"00fd\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""}],"source_content_type":"application/octet-stream","patch_set":47,"id":"86fcd6a0_cd0f7181","line":224,"updated":"2025-08-04 10:12:55.000000000","message":"Additional pid:vid pairs are missing","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1cae66fb988fd51620097c322c6d4ceb99c0d489","unresolved":false,"context_lines":[{"line_number":221,"context_line":"ATTRS{idVendor}\u003d\u003d\"1781\", ATTRS{idProduct}\u003d\u003d\"0c63\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":222,"context_line":""},{"line_number":223,"context_line":"# WCH CH347 chip in mode 3"},{"line_number":224,"context_line":"ATTRS{idVendor}\u003d\u003d\"1a86\", ATTRS{idProduct}\u003d\u003d\"55dd\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"# TI/Luminary Stellaris In-Circuit Debug Interface (ICDI) Board"},{"line_number":227,"context_line":"ATTRS{idVendor}\u003d\u003d\"1cbe\", ATTRS{idProduct}\u003d\u003d\"00fd\", MODE\u003d\"660\", GROUP\u003d\"plugdev\", TAG+\u003d\"uaccess\""}],"source_content_type":"application/octet-stream","patch_set":47,"id":"67e901fe_cc5b1a7e","line":224,"in_reply_to":"86fcd6a0_cd0f7181","updated":"2025-08-04 20:27:45.000000000","message":"Added also the pid/vid for the CH347F chip","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"}],"doc/openocd.texi":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":2546,"context_line":"Driver for WCH CH347T chips in mode 3 (UART + JTAG)."},{"line_number":2547,"context_line":"This driver has these driver-specific command:"},{"line_number":2548,"context_line":""},{"line_number":2549,"context_line":"@deffn {Config Command} {vid_pid}"},{"line_number":2550,"context_line":"The vendor ID and product ID of the CH347 device. If not specified"},{"line_number":2551,"context_line":"the driver will use vendor ID 0x1a86 and product ID 0x55dd."},{"line_number":2552,"context_line":"@example"}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"986a7877_ae3efa9d","line":2549,"updated":"2023-10-27 14:34:29.000000000","message":"The syntax we use in this file would require writing:\n@deffn {Config Command} {ch347 vid_pid} vid pid","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":2546,"context_line":"Driver for WCH CH347T chips in mode 3 (UART + JTAG)."},{"line_number":2547,"context_line":"This driver has these driver-specific command:"},{"line_number":2548,"context_line":""},{"line_number":2549,"context_line":"@deffn {Config Command} {vid_pid}"},{"line_number":2550,"context_line":"The vendor ID and product ID of the CH347 device. If not specified"},{"line_number":2551,"context_line":"the driver will use vendor ID 0x1a86 and product ID 0x55dd."},{"line_number":2552,"context_line":"@example"}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"ce1150d7_331d6e3b","line":2549,"in_reply_to":"986a7877_ae3efa9d","updated":"2023-10-27 23:40:00.000000000","message":"I\u0027ve changed this.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":2554,"context_line":"@end example"},{"line_number":2555,"context_line":"@end deffn"},{"line_number":2556,"context_line":""},{"line_number":2557,"context_line":"@deffn {Config Command} {device_desc}"},{"line_number":2558,"context_line":"If specified connect to a device which exactly has this product description"},{"line_number":2559,"context_line":"string. If not specified the first found device with the correct vendor"},{"line_number":2560,"context_line":"and product ID will be connected."}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"eb45f8bf_60fe7b25","line":2557,"updated":"2023-10-27 14:34:29.000000000","message":"@deffn {Config Command} {ch347 device_desc} description","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":2554,"context_line":"@end example"},{"line_number":2555,"context_line":"@end deffn"},{"line_number":2556,"context_line":""},{"line_number":2557,"context_line":"@deffn {Config Command} {device_desc}"},{"line_number":2558,"context_line":"If specified connect to a device which exactly has this product description"},{"line_number":2559,"context_line":"string. If not specified the first found device with the correct vendor"},{"line_number":2560,"context_line":"and product ID will be connected."}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"b1f51e1d_9d47a66e","line":2557,"in_reply_to":"eb45f8bf_60fe7b25","updated":"2023-10-27 23:40:00.000000000","message":"Also changed this.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":2563,"context_line":"@end example"},{"line_number":2564,"context_line":"@end deffn"},{"line_number":2565,"context_line":""},{"line_number":2566,"context_line":"@deffn {Config Command} {activity_led}"},{"line_number":2567,"context_line":"If specified the drive let an activity LED blink during JTAG operations."},{"line_number":2568,"context_line":"The number is the GPIO number of the CH347 chip. If prefixed with \"n\","},{"line_number":2569,"context_line":"then this GPIO should be low active. The example configures GPIO4 as"}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"435f621b_6fa734fd","line":2566,"updated":"2023-10-27 14:34:29.000000000","message":"@deffn {Config Command} {ch347 activity_led} [n]gpio_number","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":2563,"context_line":"@end example"},{"line_number":2564,"context_line":"@end deffn"},{"line_number":2565,"context_line":""},{"line_number":2566,"context_line":"@deffn {Config Command} {activity_led}"},{"line_number":2567,"context_line":"If specified the drive let an activity LED blink during JTAG operations."},{"line_number":2568,"context_line":"The number is the GPIO number of the CH347 chip. If prefixed with \"n\","},{"line_number":2569,"context_line":"then this GPIO should be low active. The example configures GPIO4 as"}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"311d4df6_be73de19","line":2566,"in_reply_to":"435f621b_6fa734fd","updated":"2023-10-27 23:40:00.000000000","message":"This also.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":2574,"context_line":"@end example"},{"line_number":2575,"context_line":"@end deffn"},{"line_number":2576,"context_line":""},{"line_number":2577,"context_line":"@deffn {Command} {jtag_ntrst_delay}"},{"line_number":2578,"context_line":"Triggers a tap reset via trst pin. The value specifies the duration of"},{"line_number":2579,"context_line":"the low pulse in milliseconds."},{"line_number":2580,"context_line":"@example"}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"082163aa_b642e9fb","line":2577,"updated":"2023-10-27 14:34:29.000000000","message":"this command should not be needed... let me carefully check in the code and return later on this topic.\n\nFirst observation, the width for TRST is already set by the command \"jtag_ntrst_assert_width\". Eventually it should be used instead of another parameter. But this is not the real issue.\n\nThe chip version F (CH347F) has also SRST pin, apparently not present in the version T (CH247T) mode-3 used here.\nTRST is JTAG only and is not really useful for JTAG as it can be emulated with the special TMS sequence named TLR.\nIt could be very interesting to check if this TRST pin can be used as a GPIO, and give the user the possibility to use it as SRST if he wants so.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":2574,"context_line":"@end example"},{"line_number":2575,"context_line":"@end deffn"},{"line_number":2576,"context_line":""},{"line_number":2577,"context_line":"@deffn {Command} {jtag_ntrst_delay}"},{"line_number":2578,"context_line":"Triggers a tap reset via trst pin. The value specifies the duration of"},{"line_number":2579,"context_line":"the low pulse in milliseconds."},{"line_number":2580,"context_line":"@example"}],"source_content_type":"text/x-texinfo","patch_set":22,"id":"228aaeec_d108b83a","line":2577,"in_reply_to":"082163aa_b642e9fb","updated":"2023-10-27 23:40:00.000000000","message":"For SRST we could use also another GPIO. I\u0027ve tested, that GPIO3 (Pin11 / SCL), GPIO4 (Pin15 / ACT), GPIO5 (Pin9 / TRST) and GPIO6 (Pin2 / CTS1) can be used as GPIO. So there is no need to reassign the TRST pin as SRST pin. We could use both.\n\nIf you have information about TRST functionality, I can also drop this command. Please let me know.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1389e226808f4918e1295b2ce404d0af571ed789","unresolved":true,"context_lines":[{"line_number":9004,"context_line":"the default log output channel is stderr."},{"line_number":9005,"context_line":"@end deffn"},{"line_number":9006,"context_line":""},{"line_number":9007,"context_line":"@deffn {Command} {log_non_error_levels_to_stdout} [on | off]"},{"line_number":9008,"context_line":"This command can be used when there is a desire to change the default channel for non-error messages."},{"line_number":9009,"context_line":"@end deffn"},{"line_number":9010,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":28,"id":"54a62eec_09311ee5","line":9007,"updated":"2023-11-11 22:18:14.000000000","message":"This change and all following ones are not related to CH347 as well","commit_id":"e44b0b5c6b37c589194efaa9263e18ebc3b85c1d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1bf204030a03a406be1cb245d6653dc8aab98e3f","unresolved":false,"context_lines":[{"line_number":9004,"context_line":"the default log output channel is stderr."},{"line_number":9005,"context_line":"@end deffn"},{"line_number":9006,"context_line":""},{"line_number":9007,"context_line":"@deffn {Command} {log_non_error_levels_to_stdout} [on | off]"},{"line_number":9008,"context_line":"This command can be used when there is a desire to change the default channel for non-error messages."},{"line_number":9009,"context_line":"@end deffn"},{"line_number":9010,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":28,"id":"d3006474_fc7eaaef","line":9007,"in_reply_to":"54a62eec_09311ee5","updated":"2023-11-11 22:50:46.000000000","message":"Sorry, that was my mistake. I\u0027ve removed this.","commit_id":"e44b0b5c6b37c589194efaa9263e18ebc3b85c1d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":13612,"context_line":"@unnumbered Command and Driver Index"},{"line_number":13613,"context_line":"@printindex fn"},{"line_number":13614,"context_line":""},{"line_number":13615,"context_line":"@bye"}],"source_content_type":"text/x-texinfo","patch_set":42,"id":"9027fa90_71d62eff","line":13615,"updated":"2025-01-25 17:47:58.000000000","message":"There is an incorrect modification at the end of the file.\nThe last line has lost the trailing newline, as reported by gerrit.\nPlease re-add it, without adding extra empty lines.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":13612,"context_line":"@unnumbered Command and Driver Index"},{"line_number":13613,"context_line":"@printindex fn"},{"line_number":13614,"context_line":""},{"line_number":13615,"context_line":"@bye"}],"source_content_type":"text/x-texinfo","patch_set":42,"id":"7621e8a1_495461e7","line":13615,"in_reply_to":"9027fa90_71d62eff","updated":"2025-01-27 19:55:58.000000000","message":"Sorry, I\u0027ve not seen this change.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"}],"doc/usb_adapters/ch347/1a86_55dd_easydevkit.txt":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":2,"context_line":""},{"line_number":3,"context_line":"# Link: https://www.easydevkits.com"},{"line_number":4,"context_line":"# PCB: ESP32-WROVER-E WCH JTAG DevKit v0.1"},{"line_number":5,"context_line":"# Chip: CH347T"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Bus 001 Device 016: ID 1a86:55dd QinHeng Electronics EasyDevKit"},{"line_number":8,"context_line":"Device Descriptor:"}],"source_content_type":"text/plain","patch_set":22,"id":"b88ffaa9_0d26c90d","line":5,"updated":"2023-10-27 14:34:29.000000000","message":"From the datasheet, the USB PID of the device CH347T changes with the mode.\nThe one listed here is for mode 3 only.\nCan you please add that this is for mode 3 only?","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":2,"context_line":""},{"line_number":3,"context_line":"# Link: https://www.easydevkits.com"},{"line_number":4,"context_line":"# PCB: ESP32-WROVER-E WCH JTAG DevKit v0.1"},{"line_number":5,"context_line":"# Chip: CH347T"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Bus 001 Device 016: ID 1a86:55dd QinHeng Electronics EasyDevKit"},{"line_number":8,"context_line":"Device Descriptor:"}],"source_content_type":"text/plain","patch_set":22,"id":"9e4ee26e_66a0a59b","line":5,"in_reply_to":"b88ffaa9_0d26c90d","updated":"2023-10-27 23:40:00.000000000","message":"I\u0027ve mentioned this and also updated this document with the latest EasyDevKits version. It has a newer CH347T chip version, which also supports the LARGER_PACK mode.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"}],"src/jtag/drivers/ch347.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":17,"context_line":" *   The USB2.0 to JTAG scheme based on CH347 can be used to build         *"},{"line_number":18,"context_line":" *   customized USB high-speed JTAG debugger and other products.           *"},{"line_number":19,"context_line":" *                                                                         *"},{"line_number":20,"context_line":" *   This program is free software; you can redistribute it and/or modify  *"},{"line_number":21,"context_line":" *   it under the terms of the GNU General Public License as published by  *"},{"line_number":22,"context_line":" *   the Free Software Foundation; either version 2 of the License, or     *"},{"line_number":23,"context_line":" *   (at your option) any later version.                                   *"},{"line_number":24,"context_line":" *                                                                         *"},{"line_number":25,"context_line":" *            _____________                                                *"},{"line_number":26,"context_line":" *           |             |____JTAG/SWD (TDO,TDI,TMS,TCK,TRST)            *"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"6a4a9a2f_43b7c547","line":23,"range":{"start_line":20,"start_character":0,"end_line":23,"end_character":76},"updated":"2023-10-14 17:25:53.000000000","message":"This text can be dropped. It is already clear from the SPDX line above","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[{"line_number":17,"context_line":" *   The USB2.0 to JTAG scheme based on CH347 can be used to build         *"},{"line_number":18,"context_line":" *   customized USB high-speed JTAG debugger and other products.           *"},{"line_number":19,"context_line":" *                                                                         *"},{"line_number":20,"context_line":" *   This program is free software; you can redistribute it and/or modify  *"},{"line_number":21,"context_line":" *   it under the terms of the GNU General Public License as published by  *"},{"line_number":22,"context_line":" *   the Free Software Foundation; either version 2 of the License, or     *"},{"line_number":23,"context_line":" *   (at your option) any later version.                                   *"},{"line_number":24,"context_line":" *                                                                         *"},{"line_number":25,"context_line":" *            _____________                                                *"},{"line_number":26,"context_line":" *           |             |____JTAG/SWD (TDO,TDI,TMS,TCK,TRST)            *"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"b96d50f5_ba1bddb3","line":23,"range":{"start_line":20,"start_character":0,"end_line":23,"end_character":76},"in_reply_to":"6a4a9a2f_43b7c547","updated":"2023-10-14 22:19:03.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":31,"context_line":" *           | 8 MHz XTAL  |                                               *"},{"line_number":32,"context_line":" *           |_____________|                                               *"},{"line_number":33,"context_line":" *                                                                         *"},{"line_number":34,"context_line":" *   This program is distributed in the hope that it will be useful,       *"},{"line_number":35,"context_line":" *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *"},{"line_number":36,"context_line":" *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *"},{"line_number":37,"context_line":" *   GNU General Public License for more details.                          *"},{"line_number":38,"context_line":" *                                                                         *"},{"line_number":39,"context_line":" *   You should have received a copy of the GNU General Public License     *"},{"line_number":40,"context_line":" *   along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e. *"},{"line_number":41,"context_line":" ***************************************************************************/"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"#ifdef HAVE_CONFIG_H"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"77108a36_93743903","line":40,"range":{"start_line":34,"start_character":0,"end_line":40,"end_character":76},"updated":"2023-10-14 17:25:53.000000000","message":"Also this can be dropped","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[{"line_number":31,"context_line":" *           | 8 MHz XTAL  |                                               *"},{"line_number":32,"context_line":" *           |_____________|                                               *"},{"line_number":33,"context_line":" *                                                                         *"},{"line_number":34,"context_line":" *   This program is distributed in the hope that it will be useful,       *"},{"line_number":35,"context_line":" *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *"},{"line_number":36,"context_line":" *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *"},{"line_number":37,"context_line":" *   GNU General Public License for more details.                          *"},{"line_number":38,"context_line":" *                                                                         *"},{"line_number":39,"context_line":" *   You should have received a copy of the GNU General Public License     *"},{"line_number":40,"context_line":" *   along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e. *"},{"line_number":41,"context_line":" ***************************************************************************/"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"#ifdef HAVE_CONFIG_H"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"dd0f0860_03edf74a","line":40,"range":{"start_line":34,"start_character":0,"end_line":40,"end_character":76},"in_reply_to":"77108a36_93743903","updated":"2023-10-14 22:19:03.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":131,"context_line":""},{"line_number":132,"context_line":"#pragma pack(1)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"typedef unsigned char UCHAR;"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"typedef enum {"},{"line_number":137,"context_line":"\tSTANDARD_PACK \u003d 0,"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"a2f64244_4282567c","line":134,"updated":"2023-10-14 17:25:53.000000000","message":"drop the typedef and use uint8_t.","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[{"line_number":131,"context_line":""},{"line_number":132,"context_line":"#pragma pack(1)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"typedef unsigned char UCHAR;"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"typedef enum {"},{"line_number":137,"context_line":"\tSTANDARD_PACK \u003d 0,"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"29eb0a63_43d7ac96","line":134,"in_reply_to":"a2f64244_4282567c","updated":"2023-10-14 22:19:03.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":136,"context_line":"typedef enum {"},{"line_number":137,"context_line":"\tSTANDARD_PACK \u003d 0,"},{"line_number":138,"context_line":"\tLARGER_PACK \u003d 1,"},{"line_number":139,"context_line":"} pack_size_t;"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"typedef void (*write_read_fn)(struct scan_command *cmd, uint8_t *bits, int nb_bits, enum scan_type scan);"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"9d765d04_fd1ce2bd","line":139,"updated":"2023-10-14 17:25:53.000000000","message":"enum pack_size {\nSTANDARD_PACK \u003d 0,\nLARGER_PACK \u003d 1,\n};","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[{"line_number":136,"context_line":"typedef enum {"},{"line_number":137,"context_line":"\tSTANDARD_PACK \u003d 0,"},{"line_number":138,"context_line":"\tLARGER_PACK \u003d 1,"},{"line_number":139,"context_line":"} pack_size_t;"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"typedef void (*write_read_fn)(struct scan_command *cmd, uint8_t *bits, int nb_bits, enum scan_type scan);"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"e3fa9947_1fb53e42","line":139,"in_reply_to":"9d765d04_fd1ce2bd","updated":"2023-10-14 22:19:03.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":138,"context_line":"\tLARGER_PACK \u003d 1,"},{"line_number":139,"context_line":"} pack_size_t;"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"typedef void (*write_read_fn)(struct scan_command *cmd, uint8_t *bits, int nb_bits, enum scan_type scan);"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"typedef struct {"},{"line_number":144,"context_line":"\t// Record the CH347 pin status"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"b1cc33bc_ebd7166f","line":141,"updated":"2023-10-14 17:25:53.000000000","message":"This typedef is ok!","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[{"line_number":138,"context_line":"\tLARGER_PACK \u003d 1,"},{"line_number":139,"context_line":"} pack_size_t;"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"typedef void (*write_read_fn)(struct scan_command *cmd, uint8_t *bits, int nb_bits, enum scan_type scan);"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"typedef struct {"},{"line_number":144,"context_line":"\t// Record the CH347 pin status"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"e1a418ae_ee7ef540","line":141,"in_reply_to":"b1cc33bc_ebd7166f","updated":"2023-10-14 22:19:03.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":160,"context_line":"\tstruct bit_copy_queue read_queue;"},{"line_number":161,"context_line":"\tpack_size_t pack_size;"},{"line_number":162,"context_line":"\twrite_read_fn write_read_fn;"},{"line_number":163,"context_line":"} ch347_info_t;"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"typedef struct {"},{"line_number":166,"context_line":"\tuint8_t usb_cmd; // 0xA0, 0xA1, 0xA2"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"eec85e78_8575e935","line":163,"updated":"2023-10-14 17:25:53.000000000","message":"struct ch347_info {\n...\n};","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"864d94afe60ced33a8c47a20232cc9f33b499a74","unresolved":false,"context_lines":[{"line_number":160,"context_line":"\tstruct bit_copy_queue read_queue;"},{"line_number":161,"context_line":"\tpack_size_t pack_size;"},{"line_number":162,"context_line":"\twrite_read_fn write_read_fn;"},{"line_number":163,"context_line":"} ch347_info_t;"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"typedef struct {"},{"line_number":166,"context_line":"\tuint8_t usb_cmd; // 0xA0, 0xA1, 0xA2"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"0bb4ce05_a95d996e","line":163,"in_reply_to":"eec85e78_8575e935","updated":"2023-10-14 22:45:59.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ff11f92c3c41d410d027cce61dea6f165641120d","unresolved":true,"context_lines":[{"line_number":255,"context_line":"\t\tch347_device_descriptor.bcdDevice \u0026 0xFF,"},{"line_number":256,"context_line":"\t\tfirmware_version);"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"\tif (ch347_device_descriptor.bcdDevice \u003c 0x241) {"},{"line_number":259,"context_line":"\t\tLOG_INFO(\"ch347 old version of the chip, JTAG only working in bitwise mode. For bytewise mode at least version 2.41 is needed.\");"},{"line_number":260,"context_line":"\t\tch347.write_read_fn \u003d ch347_write_read_bitwise;"},{"line_number":261,"context_line":"\t} else {"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"f7a964df_18c1dbfd","line":258,"range":{"start_line":258,"start_character":41,"end_line":258,"end_character":46},"updated":"2023-10-14 17:25:53.000000000","message":"the value 0x241 should be in a macro","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"2c4e9b190b19a829971389c5d30b80195b7a4c63","unresolved":false,"context_lines":[{"line_number":255,"context_line":"\t\tch347_device_descriptor.bcdDevice \u0026 0xFF,"},{"line_number":256,"context_line":"\t\tfirmware_version);"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"\tif (ch347_device_descriptor.bcdDevice \u003c 0x241) {"},{"line_number":259,"context_line":"\t\tLOG_INFO(\"ch347 old version of the chip, JTAG only working in bitwise mode. For bytewise mode at least version 2.41 is needed.\");"},{"line_number":260,"context_line":"\t\tch347.write_read_fn \u003d ch347_write_read_bitwise;"},{"line_number":261,"context_line":"\t} else {"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"5dd51ec4_94346e4a","line":258,"range":{"start_line":258,"start_character":41,"end_line":258,"end_character":46},"in_reply_to":"f7a964df_18c1dbfd","updated":"2023-10-14 22:19:03.000000000","message":"Done","commit_id":"3decb3ac11b98a52ed9fdc346d55581676d8850d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":259,"context_line":" * @param length Data length in and out"},{"line_number":260,"context_line":" * @return true at success"},{"line_number":261,"context_line":" */"},{"line_number":262,"context_line":"static bool ch347_write_data(uint8_t *data, uint64_t *length)"},{"line_number":263,"context_line":"{"},{"line_number":264,"context_line":"\tint ret, tmp \u003d 0;"},{"line_number":265,"context_line":"\tret \u003d jtag_libusb_bulk_write(ch347_handle, CH347_EPOUT, (char *)data, *length, USB_WRITE_TIMEOUT, \u0026tmp);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"f65d60b1_29301421","line":262,"range":{"start_line":262,"start_character":44,"end_line":262,"end_character":52},"updated":"2023-10-16 08:34:04.000000000","message":"WTF why 64 bit???","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":259,"context_line":" * @param length Data length in and out"},{"line_number":260,"context_line":" * @return true at success"},{"line_number":261,"context_line":" */"},{"line_number":262,"context_line":"static bool ch347_write_data(uint8_t *data, uint64_t *length)"},{"line_number":263,"context_line":"{"},{"line_number":264,"context_line":"\tint ret, tmp \u003d 0;"},{"line_number":265,"context_line":"\tret \u003d jtag_libusb_bulk_write(ch347_handle, CH347_EPOUT, (char *)data, *length, USB_WRITE_TIMEOUT, \u0026tmp);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"2c5d47c2_bbde5ca7","line":262,"range":{"start_line":262,"start_character":44,"end_line":262,"end_character":52},"in_reply_to":"f65d60b1_29301421","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve changed this to int.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":278,"context_line":" * @param length Data length in and out"},{"line_number":279,"context_line":" * @return true at success"},{"line_number":280,"context_line":" */"},{"line_number":281,"context_line":"static bool ch347_read_data(uint8_t *data, uint64_t *length)"},{"line_number":282,"context_line":"{"},{"line_number":283,"context_line":"\tint ret, tmp \u003d 0;"},{"line_number":284,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"2424bbf6_05281e8c","line":281,"range":{"start_line":281,"start_character":43,"end_line":281,"end_character":52},"updated":"2023-10-16 08:34:04.000000000","message":"Same as above","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":278,"context_line":" * @param length Data length in and out"},{"line_number":279,"context_line":" * @return true at success"},{"line_number":280,"context_line":" */"},{"line_number":281,"context_line":"static bool ch347_read_data(uint8_t *data, uint64_t *length)"},{"line_number":282,"context_line":"{"},{"line_number":283,"context_line":"\tint ret, tmp \u003d 0;"},{"line_number":284,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"88057d1a_6b0c55ec","line":281,"range":{"start_line":281,"start_character":43,"end_line":281,"end_character":52},"in_reply_to":"2424bbf6_05281e8c","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve changed this also to int.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":344,"context_line":" * @param size   Pointing to the length unit where data needs to be converted"},{"line_number":345,"context_line":" * @return Returns a converted string"},{"line_number":346,"context_line":" */"},{"line_number":347,"context_line":"static char *ch347_hex_to_string(uint8_t *buf, uint32_t size)"},{"line_number":348,"context_line":"{"},{"line_number":349,"context_line":"\tuint32_t i;"},{"line_number":350,"context_line":"\tif (!buf)"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"5e644dd1_93796f03","line":347,"range":{"start_line":347,"start_character":13,"end_line":347,"end_character":32},"updated":"2023-10-16 08:34:04.000000000","message":"Any reason to introduce a private version?\nUse buf_to_hex_str() from src/helper/binarybuffer.h","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":344,"context_line":" * @param size   Pointing to the length unit where data needs to be converted"},{"line_number":345,"context_line":" * @return Returns a converted string"},{"line_number":346,"context_line":" */"},{"line_number":347,"context_line":"static char *ch347_hex_to_string(uint8_t *buf, uint32_t size)"},{"line_number":348,"context_line":"{"},{"line_number":349,"context_line":"\tuint32_t i;"},{"line_number":350,"context_line":"\tif (!buf)"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"803cd5b5_9f072e56","line":347,"range":{"start_line":347,"start_character":13,"end_line":347,"end_character":32},"in_reply_to":"5e644dd1_93796f03","updated":"2023-10-16 22:55:25.000000000","message":"There\u0027s no reason to introduce a private version. I\u0027m using now buf_to_hex_str() from src/helper/binarybuffer.h","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":379,"context_line":"\t\t\treturn false;"},{"line_number":380,"context_line":"\t\t}"},{"line_number":381,"context_line":"\t\tLOG_DEBUG_IO(\"(size\u003d%\" PRIu64 \", buf\u003d[%s]) -\u003e %\" PRIu32, written_length,"},{"line_number":382,"context_line":"\t\t\t\t ch347_hex_to_string((uint8_t *)buffer, written_length),"},{"line_number":383,"context_line":"\t\t\t\t (uint32_t)written_length);"},{"line_number":384,"context_line":"\t\ti +\u003d written_length;"},{"line_number":385,"context_line":"\t\tif (i \u003e\u003d *length)"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"5ffc8081_233d5299","line":382,"range":{"start_line":382,"start_character":5,"end_line":382,"end_character":24},"updated":"2023-10-16 08:34:04.000000000","message":"Memory leak!!!","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":379,"context_line":"\t\t\treturn false;"},{"line_number":380,"context_line":"\t\t}"},{"line_number":381,"context_line":"\t\tLOG_DEBUG_IO(\"(size\u003d%\" PRIu64 \", buf\u003d[%s]) -\u003e %\" PRIu32, written_length,"},{"line_number":382,"context_line":"\t\t\t\t ch347_hex_to_string((uint8_t *)buffer, written_length),"},{"line_number":383,"context_line":"\t\t\t\t (uint32_t)written_length);"},{"line_number":384,"context_line":"\t\ti +\u003d written_length;"},{"line_number":385,"context_line":"\t\tif (i \u003e\u003d *length)"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"1ea57d19_6219cdb4","line":382,"range":{"start_line":382,"start_character":5,"end_line":382,"end_character":24},"in_reply_to":"5ffc8081_233d5299","updated":"2023-10-16 22:55:25.000000000","message":"That\u0027s right! Thanks for finding this. I\u0027ve changed the code.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":426,"context_line":"\t\t\tread_length \u003d *length - i;"},{"line_number":427,"context_line":"\t}"},{"line_number":428,"context_line":"\tLOG_DEBUG_IO(\"(size\u003d%\" PRIu64 \", buf\u003d[%s]) -\u003e %\" PRIu32, i,"},{"line_number":429,"context_line":"\t\t\t ch347_hex_to_string((uint8_t *)buffer, i), (uint32_t)i);"},{"line_number":430,"context_line":"\t*length \u003d i;"},{"line_number":431,"context_line":"\treturn true;"},{"line_number":432,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"ae873b77_6e1dfece","line":429,"range":{"start_line":429,"start_character":4,"end_line":429,"end_character":23},"updated":"2023-10-16 08:34:04.000000000","message":"Memory leak!!!","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":426,"context_line":"\t\t\tread_length \u003d *length - i;"},{"line_number":427,"context_line":"\t}"},{"line_number":428,"context_line":"\tLOG_DEBUG_IO(\"(size\u003d%\" PRIu64 \", buf\u003d[%s]) -\u003e %\" PRIu32, i,"},{"line_number":429,"context_line":"\t\t\t ch347_hex_to_string((uint8_t *)buffer, i), (uint32_t)i);"},{"line_number":430,"context_line":"\t*length \u003d i;"},{"line_number":431,"context_line":"\treturn true;"},{"line_number":432,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"b3033fb9_2e13c098","line":429,"range":{"start_line":429,"start_character":4,"end_line":429,"end_character":23},"in_reply_to":"ae873b77_6e1dfece","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve changed also this.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":447,"context_line":"\tint data_len \u003d 0, i \u003d 0;"},{"line_number":448,"context_line":"\tint bit_counter \u003d 0;"},{"line_number":449,"context_line":""},{"line_number":450,"context_line":"\tread_size \u003d length;"},{"line_number":451,"context_line":"\tread_len \u003d read_size;"},{"line_number":452,"context_line":"\tindex \u003d 0;"},{"line_number":453,"context_line":"\tread_buf_index \u003d 0;"},{"line_number":454,"context_line":"\tread_buf \u003d calloc(sizeof(unsigned char), read_size);"},{"line_number":455,"context_line":"\tif (!ch347_read(read_buf, \u0026read_len)) {"},{"line_number":456,"context_line":"\t\tLOG_ERROR(\"CH347 read fail\");"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"80faaf5b_dda57439","line":453,"range":{"start_line":450,"start_character":1,"end_line":453,"end_character":20},"updated":"2023-10-16 08:34:04.000000000","message":"The variables are first initialized to zero and then re-initialized? Simplify!","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":447,"context_line":"\tint data_len \u003d 0, i \u003d 0;"},{"line_number":448,"context_line":"\tint bit_counter \u003d 0;"},{"line_number":449,"context_line":""},{"line_number":450,"context_line":"\tread_size \u003d length;"},{"line_number":451,"context_line":"\tread_len \u003d read_size;"},{"line_number":452,"context_line":"\tindex \u003d 0;"},{"line_number":453,"context_line":"\tread_buf_index \u003d 0;"},{"line_number":454,"context_line":"\tread_buf \u003d calloc(sizeof(unsigned char), read_size);"},{"line_number":455,"context_line":"\tif (!ch347_read(read_buf, \u0026read_len)) {"},{"line_number":456,"context_line":"\t\tLOG_ERROR(\"CH347 read fail\");"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"c21a6434_73d4e52f","line":453,"range":{"start_line":450,"start_character":1,"end_line":453,"end_character":20},"in_reply_to":"80faaf5b_dda57439","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve simplified it.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":451,"context_line":"\tread_len \u003d read_size;"},{"line_number":452,"context_line":"\tindex \u003d 0;"},{"line_number":453,"context_line":"\tread_buf_index \u003d 0;"},{"line_number":454,"context_line":"\tread_buf \u003d calloc(sizeof(unsigned char), read_size);"},{"line_number":455,"context_line":"\tif (!ch347_read(read_buf, \u0026read_len)) {"},{"line_number":456,"context_line":"\t\tLOG_ERROR(\"CH347 read fail\");"},{"line_number":457,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"d1222135_d1a8997d","line":454,"range":{"start_line":454,"start_character":1,"end_line":454,"end_character":10},"updated":"2023-10-16 08:34:04.000000000","message":"Always check calloc/malloc returned value, log and propagate error if NULL\n(at least 3 occurrences)","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":451,"context_line":"\tread_len \u003d read_size;"},{"line_number":452,"context_line":"\tindex \u003d 0;"},{"line_number":453,"context_line":"\tread_buf_index \u003d 0;"},{"line_number":454,"context_line":"\tread_buf \u003d calloc(sizeof(unsigned char), read_size);"},{"line_number":455,"context_line":"\tif (!ch347_read(read_buf, \u0026read_len)) {"},{"line_number":456,"context_line":"\t\tLOG_ERROR(\"CH347 read fail\");"},{"line_number":457,"context_line":"\t\treturn;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"44d654c2_15b22fb6","line":454,"range":{"start_line":454,"start_character":1,"end_line":454,"end_character":10},"in_reply_to":"d1222135_d1a8997d","updated":"2023-10-16 22:55:25.000000000","message":"Now I\u0027m checking the return values of calloc/malloc and write an error to the log.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":470,"context_line":""},{"line_number":471,"context_line":"\t\t\tfor (i \u003d 0; i \u003c data_len; i++) {"},{"line_number":472,"context_line":"\t\t\t\tif (read_buf[index + 1 + i] \u0026 1)"},{"line_number":473,"context_line":"\t\t\t\t\t*(buffer + read_buf_index) |\u003d (1 \u003c\u003c i % 8);"},{"line_number":474,"context_line":"\t\t\t\telse"},{"line_number":475,"context_line":"\t\t\t\t\t*(buffer + read_buf_index) \u0026\u003d ~(1 \u003c\u003c i % 8);"},{"line_number":476,"context_line":"\t\t\t\tbit_counter++;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"ff7261a2_afd88fed","line":473,"range":{"start_line":473,"start_character":5,"end_line":473,"end_character":31},"updated":"2023-10-16 08:34:04.000000000","message":"Why not `buffer[read_buf_index] |\u003d ...`?\n(more occurrences below)\n\nBTW buffer is indexed by read_buf_index whereas read_buf is indexed by index.\nWhat a naming mess!","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":470,"context_line":""},{"line_number":471,"context_line":"\t\t\tfor (i \u003d 0; i \u003c data_len; i++) {"},{"line_number":472,"context_line":"\t\t\t\tif (read_buf[index + 1 + i] \u0026 1)"},{"line_number":473,"context_line":"\t\t\t\t\t*(buffer + read_buf_index) |\u003d (1 \u003c\u003c i % 8);"},{"line_number":474,"context_line":"\t\t\t\telse"},{"line_number":475,"context_line":"\t\t\t\t\t*(buffer + read_buf_index) \u0026\u003d ~(1 \u003c\u003c i % 8);"},{"line_number":476,"context_line":"\t\t\t\tbit_counter++;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"02328053_db0964bf","line":473,"range":{"start_line":473,"start_character":5,"end_line":473,"end_character":31},"in_reply_to":"ff7261a2_afd88fed","updated":"2023-10-16 22:55:25.000000000","message":"Now I\u0027m using the indexer. I\u0027ve also renamed the variables. Maybe now I can be better understood.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":517,"context_line":"\tif (ch347.read_count \u003d\u003d 0)"},{"line_number":518,"context_line":"\t\treturn;"},{"line_number":519,"context_line":"\tif (ch347.pack_size \u003d\u003d LARGER_PACK) {"},{"line_number":520,"context_line":"\t\tch347_read_scan(\u0026ch347.read_buffer[0], ch347.read_count);"},{"line_number":521,"context_line":"\t\tbit_copy_execute(\u0026ch347.read_queue);"},{"line_number":522,"context_line":"\t\tmemset(ch347.read_buffer, 0, SF_PACKET_BUF_SIZE);"},{"line_number":523,"context_line":"\t\tch347.read_count \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"3976f683_0a92ee17","line":520,"range":{"start_line":520,"start_character":18,"end_line":520,"end_character":39},"updated":"2023-10-16 08:34:04.000000000","message":"Remove useless \u0026 [0]","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":517,"context_line":"\tif (ch347.read_count \u003d\u003d 0)"},{"line_number":518,"context_line":"\t\treturn;"},{"line_number":519,"context_line":"\tif (ch347.pack_size \u003d\u003d LARGER_PACK) {"},{"line_number":520,"context_line":"\t\tch347_read_scan(\u0026ch347.read_buffer[0], ch347.read_count);"},{"line_number":521,"context_line":"\t\tbit_copy_execute(\u0026ch347.read_queue);"},{"line_number":522,"context_line":"\t\tmemset(ch347.read_buffer, 0, SF_PACKET_BUF_SIZE);"},{"line_number":523,"context_line":"\t\tch347.read_count \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"f33e02ac_52d5a906","line":520,"range":{"start_line":520,"start_character":18,"end_line":520,"end_character":39},"in_reply_to":"3976f683_0a92ee17","updated":"2023-10-16 22:55:25.000000000","message":"Removed the useless \u0026 [0].","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":1452,"context_line":"\tcmd_packet[byte_index++] \u003d CH347_CMD_JTAG_BIT_OP;"},{"line_number":1453,"context_line":"\tcmd_packet[byte_index++] \u003d 0x01;"},{"line_number":1454,"context_line":"\tcmd_packet[byte_index++] \u003d 0;"},{"line_number":1455,"context_line":"\tbyte \u003d ch347.tck_pin | ch347.tdi_pin | ch347.tms_pin | (ch347.trst_pin \u003d (status ? TRST_H : TRST_L));"},{"line_number":1456,"context_line":"\tcmd_packet[byte_index++] \u003d byte;"},{"line_number":1457,"context_line":""},{"line_number":1458,"context_line":"\tif (!ch347_write(cmd_packet, \u0026byte_index)) {"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"21c7e325_59dc8f9a","line":1455,"range":{"start_line":1455,"start_character":57,"end_line":1455,"end_character":74},"updated":"2023-10-16 08:34:04.000000000","message":"No assignments inside an expression!","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":1452,"context_line":"\tcmd_packet[byte_index++] \u003d CH347_CMD_JTAG_BIT_OP;"},{"line_number":1453,"context_line":"\tcmd_packet[byte_index++] \u003d 0x01;"},{"line_number":1454,"context_line":"\tcmd_packet[byte_index++] \u003d 0;"},{"line_number":1455,"context_line":"\tbyte \u003d ch347.tck_pin | ch347.tdi_pin | ch347.tms_pin | (ch347.trst_pin \u003d (status ? TRST_H : TRST_L));"},{"line_number":1456,"context_line":"\tcmd_packet[byte_index++] \u003d byte;"},{"line_number":1457,"context_line":""},{"line_number":1458,"context_line":"\tif (!ch347_write(cmd_packet, \u0026byte_index)) {"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"462156d2_28565637","line":1455,"range":{"start_line":1455,"start_character":57,"end_line":1455,"end_character":74},"in_reply_to":"21c7e325_59dc8f9a","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve changed this.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":1661,"context_line":""},{"line_number":1662,"context_line":"\tif (ch347_swd_context.need_recv_len \u003e ch347_swd_context.recv_len) {"},{"line_number":1663,"context_line":"\t\tLOG_ERROR(\"%s write/read failed %d %d %d\","},{"line_number":1664,"context_line":"\t\t\t  __func__,"},{"line_number":1665,"context_line":"\t\t\t  __LINE__,"},{"line_number":1666,"context_line":"\t\t\t  ch347_swd_context.recv_len,"},{"line_number":1667,"context_line":"\t\t\t  ch347_swd_context.need_recv_len);"},{"line_number":1668,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"d321da2e_3271aa6c","line":1665,"range":{"start_line":1664,"start_character":4,"end_line":1665,"end_character":14},"updated":"2023-10-16 08:34:04.000000000","message":"Please remove all \\__func__ and \\__LINE__ logs.\nOpenOCD inserts this info if runs at debug level 3 or higher.\nEg: \n`Error: 22 65 ch347.c:1663 ch347_swd_queue_flush(): ...`","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":1661,"context_line":""},{"line_number":1662,"context_line":"\tif (ch347_swd_context.need_recv_len \u003e ch347_swd_context.recv_len) {"},{"line_number":1663,"context_line":"\t\tLOG_ERROR(\"%s write/read failed %d %d %d\","},{"line_number":1664,"context_line":"\t\t\t  __func__,"},{"line_number":1665,"context_line":"\t\t\t  __LINE__,"},{"line_number":1666,"context_line":"\t\t\t  ch347_swd_context.recv_len,"},{"line_number":1667,"context_line":"\t\t\t  ch347_swd_context.need_recv_len);"},{"line_number":1668,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"5ed47373_f1e505b0","line":1665,"range":{"start_line":1664,"start_character":4,"end_line":1665,"end_character":14},"in_reply_to":"d321da2e_3271aa6c","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve removed it in all places.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":1840,"context_line":"\t\tgoto skip;"},{"line_number":1841,"context_line":"\t}"},{"line_number":1842,"context_line":""},{"line_number":1843,"context_line":"\tcmds_len \u003d BUILD_UINT16(recv_buf[recv_len], recv_buf[recv_len + 1]);"},{"line_number":1844,"context_line":"\trecv_len +\u003d 2; // cmds_len"},{"line_number":1845,"context_line":"\tif ((cmds_len + CH347_CMD_HEADER) \u003e ch347_swd_context.recv_len) {"},{"line_number":1846,"context_line":"\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"591aab77_3be6e937","line":1843,"range":{"start_line":1843,"start_character":12,"end_line":1843,"end_character":68},"updated":"2023-10-16 08:34:04.000000000","message":"Could we use `le_to_h_u16(\u0026recv_buf[recv_len])`\nand drop BUILD_UINT16 macro?","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":1840,"context_line":"\t\tgoto skip;"},{"line_number":1841,"context_line":"\t}"},{"line_number":1842,"context_line":""},{"line_number":1843,"context_line":"\tcmds_len \u003d BUILD_UINT16(recv_buf[recv_len], recv_buf[recv_len + 1]);"},{"line_number":1844,"context_line":"\trecv_len +\u003d 2; // cmds_len"},{"line_number":1845,"context_line":"\tif ((cmds_len + CH347_CMD_HEADER) \u003e ch347_swd_context.recv_len) {"},{"line_number":1846,"context_line":"\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"d4e5c6b0_a5f0fa32","line":1843,"range":{"start_line":1843,"start_character":12,"end_line":1843,"end_character":68},"in_reply_to":"591aab77_3be6e937","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve used this function and use it now also at other places.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"31ce2292824abecadf81397f510b12f42f908e8d","unresolved":true,"context_lines":[{"line_number":1996,"context_line":"\t// Insert idle cycles after AP accesses to avoid WAIT"},{"line_number":1997,"context_line":"\tif (cmd \u0026 SWD_CMD_APNDP) {"},{"line_number":1998,"context_line":"\t\tif (ap_delay_clk \u003d\u003d 0)"},{"line_number":1999,"context_line":"\t\t\tprintf(\"ap_delay_clk \u003d\u003d 0\");"},{"line_number":2000,"context_line":"\t\tch347_swd_send_idle(ap_delay_clk);"},{"line_number":2001,"context_line":"\t}"},{"line_number":2002,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"a604a330_3d1888b8","line":1999,"updated":"2023-10-16 08:34:04.000000000","message":"Remove all printf() calls or replace them by LOG_xxx()","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"6feebd564af2ed97a74ccde849f8bbe45f509b5d","unresolved":false,"context_lines":[{"line_number":1996,"context_line":"\t// Insert idle cycles after AP accesses to avoid WAIT"},{"line_number":1997,"context_line":"\tif (cmd \u0026 SWD_CMD_APNDP) {"},{"line_number":1998,"context_line":"\t\tif (ap_delay_clk \u003d\u003d 0)"},{"line_number":1999,"context_line":"\t\t\tprintf(\"ap_delay_clk \u003d\u003d 0\");"},{"line_number":2000,"context_line":"\t\tch347_swd_send_idle(ap_delay_clk);"},{"line_number":2001,"context_line":"\t}"},{"line_number":2002,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"9401bc90_d3172153","line":1999,"in_reply_to":"a604a330_3d1888b8","updated":"2023-10-16 22:55:25.000000000","message":"I\u0027ve removed the printf or replaced it with LOG_xxx calls.","commit_id":"80f252ea7a196b2a9043284119b9a737d19a9c47"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"352b5020b8cb8ac86ccedf186625cbc3daf76004","unresolved":true,"context_lines":[{"line_number":1610,"context_line":"\tch347_swd_context.need_recv_len \u003d CH347_CMD_HEADER;"},{"line_number":1611,"context_line":"\tch347_swd_context.ch347_cmd_buf \u003d malloc(128 * sizeof(struct ch347_swd_io));"},{"line_number":1612,"context_line":"\tif (ch347_swd_context.ch347_cmd_buf) {"},{"line_number":1613,"context_line":"\t\tpswd_io \u003d (struct ch347_swd_io *)ch347_swd_context.ch347_cmd_buf;"},{"line_number":1614,"context_line":"\t\tfor (int i \u003d 0; i \u003c 128; i++, pswd_io++) {"},{"line_number":1615,"context_line":"\t\t\tINIT_LIST_HEAD(\u0026pswd_io-\u003elist_entry);"},{"line_number":1616,"context_line":"\t\t\tlist_add_tail(\u0026pswd_io-\u003elist_entry,"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"012f4c5d_ab24c497","line":1613,"updated":"2023-10-15 21:23:18.000000000","message":"build detects an issue, here, when\nuint8_t \\*ch347_cmd_buf\nis converted to a (struct ch347_swd_io \\*)\nWhat about defining, directly above\n#define MAX_CMD_BUF 128\nstruct ch347_swd_context {\n...\nstruct ch347_swd_io ch347_cmd_buf[MAX_CMD_BUF];\n};\n\nBy the way, current implementation looks having a memory leak because ch347_cmd_buf that is malloc() above but it\u0027s never free()","commit_id":"334f15d512c5dc7605ead6eb3a6ae873f596f048"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"dade16bf3d2cee95ddb33217b0055d32e60a198e","unresolved":false,"context_lines":[{"line_number":1610,"context_line":"\tch347_swd_context.need_recv_len \u003d CH347_CMD_HEADER;"},{"line_number":1611,"context_line":"\tch347_swd_context.ch347_cmd_buf \u003d malloc(128 * sizeof(struct ch347_swd_io));"},{"line_number":1612,"context_line":"\tif (ch347_swd_context.ch347_cmd_buf) {"},{"line_number":1613,"context_line":"\t\tpswd_io \u003d (struct ch347_swd_io *)ch347_swd_context.ch347_cmd_buf;"},{"line_number":1614,"context_line":"\t\tfor (int i \u003d 0; i \u003c 128; i++, pswd_io++) {"},{"line_number":1615,"context_line":"\t\t\tINIT_LIST_HEAD(\u0026pswd_io-\u003elist_entry);"},{"line_number":1616,"context_line":"\t\t\tlist_add_tail(\u0026pswd_io-\u003elist_entry,"}],"source_content_type":"text/x-csrc","patch_set":5,"id":"ae4aa30e_c91606e3","line":1613,"in_reply_to":"012f4c5d_ab24c497","updated":"2023-10-15 21:47:09.000000000","message":"You are completely right. That\u0027s a memory leak. And yes, creating the struct directly is a good idea. Then I also don\u0027t need to malloc/free.\nThanks for your help.","commit_id":"334f15d512c5dc7605ead6eb3a6ae873f596f048"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":532,"context_line":"\t\tch347_flush_buffer();"},{"line_number":533,"context_line":"\tmemcpy(\u0026ch347.buffer[ch347.buffer_idx], bytes, count);"},{"line_number":534,"context_line":"\tch347.buffer_idx +\u003d count;"},{"line_number":535,"context_line":"\tif ((SF_PACKET_BUF_SIZE - ch347.buffer_idx) \u003c 1)"},{"line_number":536,"context_line":"\t\tch347_flush_buffer();"},{"line_number":537,"context_line":"}"},{"line_number":538,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"4f2dbd2f_1c65cbba","line":535,"range":{"start_line":535,"start_character":45,"end_line":535,"end_character":46},"updated":"2023-10-22 20:22:12.000000000","message":"Should not be same as line 520?","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":532,"context_line":"\t\tch347_flush_buffer();"},{"line_number":533,"context_line":"\tmemcpy(\u0026ch347.buffer[ch347.buffer_idx], bytes, count);"},{"line_number":534,"context_line":"\tch347.buffer_idx +\u003d count;"},{"line_number":535,"context_line":"\tif ((SF_PACKET_BUF_SIZE - ch347.buffer_idx) \u003c 1)"},{"line_number":536,"context_line":"\t\tch347_flush_buffer();"},{"line_number":537,"context_line":"}"},{"line_number":538,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"49cef0a7_788709c4","line":535,"range":{"start_line":535,"start_character":45,"end_line":535,"end_character":46},"in_reply_to":"4f2dbd2f_1c65cbba","updated":"2023-10-25 22:44:33.000000000","message":"This is also reworked now. I\u0027m using \"scratch pad\" buffer for collecting all bytes for a command and put the commands into a command queue.","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":1338,"context_line":"{"},{"line_number":1339,"context_line":"\tif (!swd_mode) {"},{"line_number":1340,"context_line":"\t\t// needs to be -1 because we use i+1 in the loop"},{"line_number":1341,"context_line":"\t\tint end \u003d sizeof(ch347_clock_speeds) / sizeof(int) - 1;"},{"line_number":1342,"context_line":"\t\tfor (int i \u003d 0; i \u003c end; i++) {"},{"line_number":1343,"context_line":"\t\t\tint ret_val \u003d -1;"},{"line_number":1344,"context_line":"\t\t\tif (speed \u003e\u003d ch347_clock_speeds[i] \u0026\u0026 speed \u003c\u003d ch347_clock_speeds[i + 1]) {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"ff4b1e9d_fef5b93e","line":1341,"range":{"start_line":1341,"start_character":12,"end_line":1341,"end_character":52},"updated":"2023-10-22 20:22:12.000000000","message":"ARRAY_SIZE(ch347_clock_speeds)","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":1338,"context_line":"{"},{"line_number":1339,"context_line":"\tif (!swd_mode) {"},{"line_number":1340,"context_line":"\t\t// needs to be -1 because we use i+1 in the loop"},{"line_number":1341,"context_line":"\t\tint end \u003d sizeof(ch347_clock_speeds) / sizeof(int) - 1;"},{"line_number":1342,"context_line":"\t\tfor (int i \u003d 0; i \u003c end; i++) {"},{"line_number":1343,"context_line":"\t\t\tint ret_val \u003d -1;"},{"line_number":1344,"context_line":"\t\t\tif (speed \u003e\u003d ch347_clock_speeds[i] \u0026\u0026 speed \u003c\u003d ch347_clock_speeds[i + 1]) {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"509a5430_c4b90bda","line":1341,"range":{"start_line":1341,"start_character":12,"end_line":1341,"end_character":52},"in_reply_to":"ff4b1e9d_fef5b93e","updated":"2023-10-25 22:44:33.000000000","message":"Thanks for pointing this out. I didn\u0027t know this.","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":1384,"context_line":"static int ch347_khz(int khz, int *jtag_speed)"},{"line_number":1385,"context_line":"{"},{"line_number":1386,"context_line":"\tif (khz \u003d\u003d 0) {"},{"line_number":1387,"context_line":"\t\tLOG_ERROR(\"Couldn\u0027t support the adapter speed\");"},{"line_number":1388,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1389,"context_line":"\t}"},{"line_number":1390,"context_line":"\t*jtag_speed \u003d khz * 1000;"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"a590a798_c57fbbdc","line":1387,"range":{"start_line":1387,"start_character":13,"end_line":1387,"end_character":47},"updated":"2023-10-22 20:22:12.000000000","message":"Adaptive clocking not supported","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":true,"context_lines":[{"line_number":1384,"context_line":"static int ch347_khz(int khz, int *jtag_speed)"},{"line_number":1385,"context_line":"{"},{"line_number":1386,"context_line":"\tif (khz \u003d\u003d 0) {"},{"line_number":1387,"context_line":"\t\tLOG_ERROR(\"Couldn\u0027t support the adapter speed\");"},{"line_number":1388,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1389,"context_line":"\t}"},{"line_number":1390,"context_line":"\t*jtag_speed \u003d khz * 1000;"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"cba51bfb_044668d3","line":1387,"range":{"start_line":1387,"start_character":13,"end_line":1387,"end_character":47},"in_reply_to":"a590a798_c57fbbdc","updated":"2023-10-25 22:44:33.000000000","message":"I\u0027ve changed the message.","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"52d6a7843052c8cdc3538f878441012f24dc386d","unresolved":false,"context_lines":[{"line_number":1384,"context_line":"static int ch347_khz(int khz, int *jtag_speed)"},{"line_number":1385,"context_line":"{"},{"line_number":1386,"context_line":"\tif (khz \u003d\u003d 0) {"},{"line_number":1387,"context_line":"\t\tLOG_ERROR(\"Couldn\u0027t support the adapter speed\");"},{"line_number":1388,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1389,"context_line":"\t}"},{"line_number":1390,"context_line":"\t*jtag_speed \u003d khz * 1000;"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"c259eee1_5a81bf09","line":1387,"range":{"start_line":1387,"start_character":13,"end_line":1387,"end_character":47},"in_reply_to":"cba51bfb_044668d3","updated":"2023-10-25 22:55:04.000000000","message":"Resolved.","commit_id":"ea128277d8dc77524af35c4b8b98c27b4d7f4d02"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":131,"context_line":"\tint trst_pin;"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"\tint buffer_idx;"},{"line_number":134,"context_line":"\tuint8_t buffer[SF_PACKET_BUF_SIZE];"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"\tint len_idx;"},{"line_number":137,"context_line":"\tint len_value;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"1770cb05_45e0fb01","line":134,"updated":"2023-10-22 20:22:12.000000000","message":"Long buffer: either make it shorter (would require working ch347_flush_buffer() - it\u0027s needed anyway) or allocate dynamically on driver open.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"5a287e1a01ad196ebcc8501fcda26067cf6f599f","unresolved":false,"context_lines":[{"line_number":131,"context_line":"\tint trst_pin;"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"\tint buffer_idx;"},{"line_number":134,"context_line":"\tuint8_t buffer[SF_PACKET_BUF_SIZE];"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"\tint len_idx;"},{"line_number":137,"context_line":"\tint len_value;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"1a5e184c_dcf4ebf0","line":134,"in_reply_to":"1770cb05_45e0fb01","updated":"2023-10-25 22:13:26.000000000","message":"I\u0027ve reworked the driver and have now a \"scratch pad\" for one 507 byte long command which I can put into a command queue.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":137,"context_line":"\tint len_value;"},{"line_number":138,"context_line":"\tuint8_t last_cmd;"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"\tuint8_t read_buffer[SF_PACKET_BUF_SIZE];"},{"line_number":141,"context_line":"\tint read_idx;"},{"line_number":142,"context_line":"\tint read_count;"},{"line_number":143,"context_line":"\tstruct bit_copy_queue read_queue;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"19ab932c_7718e6d3","line":140,"updated":"2023-10-22 20:22:12.000000000","message":"Same as above","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":137,"context_line":"\tint len_value;"},{"line_number":138,"context_line":"\tuint8_t last_cmd;"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"\tuint8_t read_buffer[SF_PACKET_BUF_SIZE];"},{"line_number":141,"context_line":"\tint read_idx;"},{"line_number":142,"context_line":"\tint read_count;"},{"line_number":143,"context_line":"\tstruct bit_copy_queue read_queue;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"a00241ed_b61ab700","line":140,"in_reply_to":"19ab932c_7718e6d3","updated":"2023-10-25 22:44:33.000000000","message":"It\u0027s also reworked.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":199,"context_line":" *"},{"line_number":200,"context_line":" * @return true at success"},{"line_number":201,"context_line":" */"},{"line_number":202,"context_line":"static bool ch347_open_device(void)"},{"line_number":203,"context_line":"{"},{"line_number":204,"context_line":"\tif (jtag_libusb_open(ch347_vids, ch347_pids, ch347_device_desc, \u0026ch347_handle, NULL) !\u003d ERROR_OK) {"},{"line_number":205,"context_line":"\t\tLOG_ERROR(\"CH347 not found: vid\u003d%04x, pid\u003d%04x\",  ch347_vids[0], ch347_pids[0]);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"cfd7f94e_49e20fa5","line":202,"range":{"start_line":202,"start_character":7,"end_line":202,"end_character":11},"updated":"2023-10-22 20:22:12.000000000","message":"Do not convert OpenOCD error codes to bool - keep using error code instead!\nA caller later converts the bool back to OpenOCD error code - but the error resolution is totally degraded to ERROR_FAIL only.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"5a287e1a01ad196ebcc8501fcda26067cf6f599f","unresolved":false,"context_lines":[{"line_number":199,"context_line":" *"},{"line_number":200,"context_line":" * @return true at success"},{"line_number":201,"context_line":" */"},{"line_number":202,"context_line":"static bool ch347_open_device(void)"},{"line_number":203,"context_line":"{"},{"line_number":204,"context_line":"\tif (jtag_libusb_open(ch347_vids, ch347_pids, ch347_device_desc, \u0026ch347_handle, NULL) !\u003d ERROR_OK) {"},{"line_number":205,"context_line":"\t\tLOG_ERROR(\"CH347 not found: vid\u003d%04x, pid\u003d%04x\",  ch347_vids[0], ch347_pids[0]);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"83fa2272_41906b63","line":202,"range":{"start_line":202,"start_character":7,"end_line":202,"end_character":11},"in_reply_to":"cfd7f94e_49e20fa5","updated":"2023-10-25 22:13:26.000000000","message":"Thanks. I\u0027ve missed that. Now I deliver the error code back.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":347,"context_line":"static bool ch347_write(uint8_t *buffer, int *length)"},{"line_number":348,"context_line":"{"},{"line_number":349,"context_line":"\tint written_len \u003d *length;"},{"line_number":350,"context_line":"\tif (*length \u003e\u003d HW_TDO_BUF_SIZE)"},{"line_number":351,"context_line":"\t\twritten_len \u003d HW_TDO_BUF_SIZE;"},{"line_number":352,"context_line":"\tint i \u003d 0;"},{"line_number":353,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"1def4ba5_b0130f9b","line":350,"updated":"2023-10-22 20:22:12.000000000","message":"Code quality: chunk length should be computed on one place (in beginning of the loop), not here and again before the end of loop\n\nBTW: src/helper/replacements.h ensures macros MIN() and MAX() are defined","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":347,"context_line":"static bool ch347_write(uint8_t *buffer, int *length)"},{"line_number":348,"context_line":"{"},{"line_number":349,"context_line":"\tint written_len \u003d *length;"},{"line_number":350,"context_line":"\tif (*length \u003e\u003d HW_TDO_BUF_SIZE)"},{"line_number":351,"context_line":"\t\twritten_len \u003d HW_TDO_BUF_SIZE;"},{"line_number":352,"context_line":"\tint i \u003d 0;"},{"line_number":353,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"2deb47c3_4131fbdc","line":350,"in_reply_to":"1def4ba5_b0130f9b","updated":"2023-10-25 22:44:33.000000000","message":"It\u0027s now computed in ch347_cmd_transmit_queue.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":487,"context_line":""},{"line_number":488,"context_line":"\twhile (ret \u003d\u003d ERROR_OK \u0026\u0026 nb \u003e 0) {"},{"line_number":489,"context_line":"\t\tret \u003d ch347_write(ch347.buffer, \u0026wr_len);"},{"line_number":490,"context_line":"\t\tnb -\u003d wr_len;"},{"line_number":491,"context_line":"\t}"},{"line_number":492,"context_line":"\tmemset(\u0026ch347.buffer, 0, sizeof(ch347.buffer));"},{"line_number":493,"context_line":"\tch347.buffer_idx \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"b2f6f585_cc9c6fb0","line":490,"updated":"2023-10-22 20:22:12.000000000","message":"If the packet is written partially, then re-sending it from beginning?\nStrange... Better just fail in such case...","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"5a287e1a01ad196ebcc8501fcda26067cf6f599f","unresolved":false,"context_lines":[{"line_number":487,"context_line":""},{"line_number":488,"context_line":"\twhile (ret \u003d\u003d ERROR_OK \u0026\u0026 nb \u003e 0) {"},{"line_number":489,"context_line":"\t\tret \u003d ch347_write(ch347.buffer, \u0026wr_len);"},{"line_number":490,"context_line":"\t\tnb -\u003d wr_len;"},{"line_number":491,"context_line":"\t}"},{"line_number":492,"context_line":"\tmemset(\u0026ch347.buffer, 0, sizeof(ch347.buffer));"},{"line_number":493,"context_line":"\tch347.buffer_idx \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"20ce3182_69e708ed","line":490,"in_reply_to":"b2f6f585_cc9c6fb0","updated":"2023-10-25 22:13:26.000000000","message":"That\u0027s bad. I\u0027ve reworked this part also.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":514,"context_line":"static void ch347_in_buffer(uint8_t byte)"},{"line_number":515,"context_line":"{"},{"line_number":516,"context_line":"\tif ((SF_PACKET_BUF_SIZE - ch347.buffer_idx) \u003c 1)"},{"line_number":517,"context_line":"\t\tch347_flush_buffer();"},{"line_number":518,"context_line":"\tch347.buffer[ch347.buffer_idx] \u003d byte;"},{"line_number":519,"context_line":"\tch347.buffer_idx++;"},{"line_number":520,"context_line":"\tif ((SF_PACKET_BUF_SIZE - ch347.buffer_idx) \u003d\u003d 0)"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"c87b4928_e3f1c343","line":517,"updated":"2023-10-22 20:22:12.000000000","message":"I have no idea if the commands (0xd1,d2,d3,d4) can span over USB packets borders. Probably not. LARGER_PACK mode does not work and STANDARD_PACK flushes buffer at the beginning and then chunks commands to USBHS packet size. And there is another chunking to HW_TDO_BUF_SIZE in ch347_write()! What a crazy mess!\n\nAnyway if ch347_flush_buffer() is ever fired from ch347_in_buffer() or ch347_in_buffer_bytes() a command with not yet updated data size is sent to ch347. Normally it does not happen because scans fit into the (oversized) buffer. But there are exceptions: e.g. FPGA is programmed by one very long scan!","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"5a287e1a01ad196ebcc8501fcda26067cf6f599f","unresolved":false,"context_lines":[{"line_number":514,"context_line":"static void ch347_in_buffer(uint8_t byte)"},{"line_number":515,"context_line":"{"},{"line_number":516,"context_line":"\tif ((SF_PACKET_BUF_SIZE - ch347.buffer_idx) \u003c 1)"},{"line_number":517,"context_line":"\t\tch347_flush_buffer();"},{"line_number":518,"context_line":"\tch347.buffer[ch347.buffer_idx] \u003d byte;"},{"line_number":519,"context_line":"\tch347.buffer_idx++;"},{"line_number":520,"context_line":"\tif ((SF_PACKET_BUF_SIZE - ch347.buffer_idx) \u003d\u003d 0)"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"a5d541c8_e61dc0bf","line":517,"in_reply_to":"c87b4928_e3f1c343","updated":"2023-10-25 22:13:26.000000000","message":"It depends on the pack mode. In STANDARD_PACK mode the command can\u0027t span over USB packet boarders. In LARGER_PACK mode which is now also working it can span over USB packet boarders. Now I create command by command in a \"scratch pad\" and put the commands into a queue for later transmission. If it comes to transmission I choose the right packet size depending on STANDARD_PACK/LARGER_PACK mode. I also take the HW_TDO_BUF_SIZE into account. That\u0027s all handled now in ch347_cmd_transmit_queue.\n\nIn LARGER_PACK mode I\u0027ve send packets over 18KB in one single transaction. That was after attaching gdb which reads all registers from the dual core ESP32.\n\nHow long can be a scan for FPGA? Over 51KB?","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":546,"context_line":" */"},{"line_number":547,"context_line":"static void ch347_combine_packets(uint8_t cmd, int cur_idx, int len)"},{"line_number":548,"context_line":"{"},{"line_number":549,"context_line":"\tif (cmd !\u003d ch347.last_cmd) {"},{"line_number":550,"context_line":"\t\tch347.buffer[cur_idx] \u003d cmd;"},{"line_number":551,"context_line":"\t\th_u16_to_le(\u0026ch347.buffer[cur_idx + 1], len - CH347_CMD_HEADER);"},{"line_number":552,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"17567f04_11053790","line":549,"updated":"2023-10-22 20:22:12.000000000","message":"Another piece of very awkward code - the header is first inserted to the buffer then optionally removed and the rest of data shifted.\nI fear that ch347_combine_packets() together with ch347_flush_buffer() triggered from command size overflow creates other hard to find bugs.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":546,"context_line":" */"},{"line_number":547,"context_line":"static void ch347_combine_packets(uint8_t cmd, int cur_idx, int len)"},{"line_number":548,"context_line":"{"},{"line_number":549,"context_line":"\tif (cmd !\u003d ch347.last_cmd) {"},{"line_number":550,"context_line":"\t\tch347.buffer[cur_idx] \u003d cmd;"},{"line_number":551,"context_line":"\t\th_u16_to_le(\u0026ch347.buffer[cur_idx + 1], len - CH347_CMD_HEADER);"},{"line_number":552,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"15820f80_d977c5c2","line":549,"in_reply_to":"17567f04_11053790","updated":"2023-10-25 22:44:33.000000000","message":"It\u0027s also reworked.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":579,"context_line":"static int ch347_clock_tms(bool tms, int buf_index)"},{"line_number":580,"context_line":"{"},{"line_number":581,"context_line":"\tuint8_t tms_bit \u003d tms ? TMS_H : TMS_L;"},{"line_number":582,"context_line":"\tuint8_t tdi_bit \u003d ch347.tdi_pin ? TDI_H : TDI_L;"},{"line_number":583,"context_line":"\tuint8_t trst_bit \u003d ch347.trst_pin ? TRST_H : TRST_L;"},{"line_number":584,"context_line":"\t// TCK \u003d L"},{"line_number":585,"context_line":"\tuint8_t data \u003d tms_bit | tdi_bit | TCK_L | trst_bit;"},{"line_number":586,"context_line":"\tch347_in_buffer(data);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"2e874ba4_76717109","line":583,"range":{"start_line":582,"start_character":1,"end_line":583,"end_character":53},"updated":"2023-10-22 20:22:12.000000000","message":"There is no point in keeping TDI and TRST in the last state. Just use default TDI_L and TRST_H","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":579,"context_line":"static int ch347_clock_tms(bool tms, int buf_index)"},{"line_number":580,"context_line":"{"},{"line_number":581,"context_line":"\tuint8_t tms_bit \u003d tms ? TMS_H : TMS_L;"},{"line_number":582,"context_line":"\tuint8_t tdi_bit \u003d ch347.tdi_pin ? TDI_H : TDI_L;"},{"line_number":583,"context_line":"\tuint8_t trst_bit \u003d ch347.trst_pin ? TRST_H : TRST_L;"},{"line_number":584,"context_line":"\t// TCK \u003d L"},{"line_number":585,"context_line":"\tuint8_t data \u003d tms_bit | tdi_bit | TCK_L | trst_bit;"},{"line_number":586,"context_line":"\tch347_in_buffer(data);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"f20544c5_c69cae0e","line":583,"range":{"start_line":582,"start_character":1,"end_line":583,"end_character":53},"in_reply_to":"2e874ba4_76717109","updated":"2023-10-25 22:44:33.000000000","message":"Well, I\u0027ve a target device that uses the TDI pin for flash voltage determination during reset. From ESP32 documentation for TDI/GPIO12 pin: \"If driven High, flash voltage (VDD_SDIO) is 1.8V not default 3.3V. Has internal pull-down, so unconnected \u003d Low \u003d 3.3V. May prevent flashing and/or booting if 3.3V flash is used and this pin is pulled high, causing the flash to brownout.\" So I need to remember the last TDI state. ESP32 target has also a function to output only one bit to set TDI to the right level. So I would remember the TDI state. And maybe there are other targets that need the last TRST state.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":603,"context_line":"\tuint8_t data \u003d TCK_L;"},{"line_number":604,"context_line":"\tdata |\u003d ch347.tms_pin ? TMS_H : TMS_L;"},{"line_number":605,"context_line":"\tdata |\u003d ch347.tdi_pin ? TDI_H : TDI_L;"},{"line_number":606,"context_line":"\tdata |\u003d ch347.trst_pin ? TRST_H : TRST_L;"},{"line_number":607,"context_line":"\tch347_in_buffer(data);"},{"line_number":608,"context_line":"\tch347.tck_pin \u003d TCK_L;"},{"line_number":609,"context_line":"\treturn buf_index + 1;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"ad11bc2c_bdd398d5","line":606,"range":{"start_line":606,"start_character":1,"end_line":606,"end_character":42},"updated":"2023-10-22 20:22:12.000000000","message":"Use default TRST as explained above.\nSame in ch347_write_read() and its _bitwise version","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":603,"context_line":"\tuint8_t data \u003d TCK_L;"},{"line_number":604,"context_line":"\tdata |\u003d ch347.tms_pin ? TMS_H : TMS_L;"},{"line_number":605,"context_line":"\tdata |\u003d ch347.tdi_pin ? TDI_H : TDI_L;"},{"line_number":606,"context_line":"\tdata |\u003d ch347.trst_pin ? TRST_H : TRST_L;"},{"line_number":607,"context_line":"\tch347_in_buffer(data);"},{"line_number":608,"context_line":"\tch347.tck_pin \u003d TCK_L;"},{"line_number":609,"context_line":"\treturn buf_index + 1;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"e1fd18ca_8c190322","line":606,"range":{"start_line":606,"start_character":1,"end_line":606,"end_character":42},"in_reply_to":"ad11bc2c_bdd398d5","updated":"2023-10-25 22:44:33.000000000","message":"I would remember the last state. Maybe there are target which use trst pin also for other purposes.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":699,"context_line":"static int ch347_reset(int trst, int srst)"},{"line_number":700,"context_line":"{"},{"line_number":701,"context_line":"\tLOG_DEBUG_IO(\"reset trst: %i srst %i\", trst, srst);"},{"line_number":702,"context_line":"\t/* have seen in ftdi driver, that reset does only the reset via trst or srst pins."},{"line_number":703,"context_line":"\t\tif both are unset the ftdi driver does nothing. \u003d\u003e do also nothing if both are unset */"},{"line_number":704,"context_line":"\tif (!trst \u0026\u0026 !srst)"},{"line_number":705,"context_line":"\t\treturn ERROR_OK;"},{"line_number":706,"context_line":""},{"line_number":707,"context_line":"\t/* untested! if not in swd mode and trst is defined we can give"},{"line_number":708,"context_line":"\t\ta 50µs pulse to the TRST pin via bit operations */"},{"line_number":709,"context_line":"\tif (!swd_mode \u0026\u0026 trst !\u003d 0) {"},{"line_number":710,"context_line":"\t\tunsigned long byte_index \u003d 0;"},{"line_number":711,"context_line":""},{"line_number":712,"context_line":"\t\tch347_in_buffer(CH347_CMD_JTAG_BIT_OP);"},{"line_number":713,"context_line":"\t\tch347_in_buffer(0x01);"},{"line_number":714,"context_line":"\t\tch347_in_buffer(0);"},{"line_number":715,"context_line":""},{"line_number":716,"context_line":"\t\tch347.trst_pin \u003d TRST_L;"},{"line_number":717,"context_line":"\t\tch347_idle_clock(byte_index);"},{"line_number":718,"context_line":""},{"line_number":719,"context_line":"\t\tch347_flush_buffer();"},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"\t\tusleep(50);"},{"line_number":722,"context_line":""},{"line_number":723,"context_line":"\t\tch347_in_buffer(CH347_CMD_JTAG_BIT_OP);"},{"line_number":724,"context_line":"\t\tch347_in_buffer(0x01);"},{"line_number":725,"context_line":"\t\tch347_in_buffer(0);"},{"line_number":726,"context_line":""},{"line_number":727,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":728,"context_line":"\t\tch347_idle_clock(byte_index);"},{"line_number":729,"context_line":""},{"line_number":730,"context_line":"\t\tch347_flush_buffer();"},{"line_number":731,"context_line":"\t}"},{"line_number":732,"context_line":"\treturn ERROR_OK;"},{"line_number":733,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"98e6bc29_c60e5202","line":730,"range":{"start_line":702,"start_character":1,"end_line":730,"end_character":23},"updated":"2023-10-22 20:22:12.000000000","message":"Mostly nonsense. See\nhttps://openocd.org/doc/doxygen/html/structadapter__driver.html#aa8256f4ca9f839aaf11a78cec36bf7c0","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":699,"context_line":"static int ch347_reset(int trst, int srst)"},{"line_number":700,"context_line":"{"},{"line_number":701,"context_line":"\tLOG_DEBUG_IO(\"reset trst: %i srst %i\", trst, srst);"},{"line_number":702,"context_line":"\t/* have seen in ftdi driver, that reset does only the reset via trst or srst pins."},{"line_number":703,"context_line":"\t\tif both are unset the ftdi driver does nothing. \u003d\u003e do also nothing if both are unset */"},{"line_number":704,"context_line":"\tif (!trst \u0026\u0026 !srst)"},{"line_number":705,"context_line":"\t\treturn ERROR_OK;"},{"line_number":706,"context_line":""},{"line_number":707,"context_line":"\t/* untested! if not in swd mode and trst is defined we can give"},{"line_number":708,"context_line":"\t\ta 50µs pulse to the TRST pin via bit operations */"},{"line_number":709,"context_line":"\tif (!swd_mode \u0026\u0026 trst !\u003d 0) {"},{"line_number":710,"context_line":"\t\tunsigned long byte_index \u003d 0;"},{"line_number":711,"context_line":""},{"line_number":712,"context_line":"\t\tch347_in_buffer(CH347_CMD_JTAG_BIT_OP);"},{"line_number":713,"context_line":"\t\tch347_in_buffer(0x01);"},{"line_number":714,"context_line":"\t\tch347_in_buffer(0);"},{"line_number":715,"context_line":""},{"line_number":716,"context_line":"\t\tch347.trst_pin \u003d TRST_L;"},{"line_number":717,"context_line":"\t\tch347_idle_clock(byte_index);"},{"line_number":718,"context_line":""},{"line_number":719,"context_line":"\t\tch347_flush_buffer();"},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"\t\tusleep(50);"},{"line_number":722,"context_line":""},{"line_number":723,"context_line":"\t\tch347_in_buffer(CH347_CMD_JTAG_BIT_OP);"},{"line_number":724,"context_line":"\t\tch347_in_buffer(0x01);"},{"line_number":725,"context_line":"\t\tch347_in_buffer(0);"},{"line_number":726,"context_line":""},{"line_number":727,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":728,"context_line":"\t\tch347_idle_clock(byte_index);"},{"line_number":729,"context_line":""},{"line_number":730,"context_line":"\t\tch347_flush_buffer();"},{"line_number":731,"context_line":"\t}"},{"line_number":732,"context_line":"\treturn ERROR_OK;"},{"line_number":733,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"c67d63f8_38667bbd","line":730,"range":{"start_line":702,"start_character":1,"end_line":730,"end_character":23},"in_reply_to":"98e6bc29_c60e5202","updated":"2023-10-25 22:44:33.000000000","message":"You are right. That\u0027s nonsense. I\u0027ve reworked this function also.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":803,"context_line":"\t\tnum_bits \u003d cmd-\u003efields[i].num_bits;"},{"line_number":804,"context_line":"\t\tif (cmd-\u003efields[i].in_value) {"},{"line_number":805,"context_line":"\t\t\tif (ch347.pack_size \u003d\u003d LARGER_PACK) {"},{"line_number":806,"context_line":"\t\t\t\tif (cmd-\u003efields[i].in_value)"},{"line_number":807,"context_line":"\t\t\t\t\tbit_copy_queued(\u0026ch347.read_queue, cmd-\u003efields[i].in_value,\t0,"},{"line_number":808,"context_line":"\t\t\t\t\t\t\u0026ch347.read_buffer[ch347.read_idx], offset, num_bits);"},{"line_number":809,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"8672c669_f9cc5b0f","line":806,"range":{"start_line":806,"start_character":4,"end_line":806,"end_character":32},"updated":"2023-10-22 20:22:12.000000000","message":"Useless to test again (line 804)","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":803,"context_line":"\t\tnum_bits \u003d cmd-\u003efields[i].num_bits;"},{"line_number":804,"context_line":"\t\tif (cmd-\u003efields[i].in_value) {"},{"line_number":805,"context_line":"\t\t\tif (ch347.pack_size \u003d\u003d LARGER_PACK) {"},{"line_number":806,"context_line":"\t\t\t\tif (cmd-\u003efields[i].in_value)"},{"line_number":807,"context_line":"\t\t\t\t\tbit_copy_queued(\u0026ch347.read_queue, cmd-\u003efields[i].in_value,\t0,"},{"line_number":808,"context_line":"\t\t\t\t\t\t\u0026ch347.read_buffer[ch347.read_idx], offset, num_bits);"},{"line_number":809,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"f2ffee76_e24fa8f0","line":806,"range":{"start_line":806,"start_character":4,"end_line":806,"end_character":32},"in_reply_to":"8672c669_f9cc5b0f","updated":"2023-10-25 22:44:33.000000000","message":"Yes, that\u0027s right. I\u0027ve changed this.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":823,"context_line":"\t\t\t\t\tLOG_DEBUG_IO(\"size\u003d%d, buf\u003d[%s]\", size, str);"},{"line_number":824,"context_line":"\t\t\t\t\tfree(str);"},{"line_number":825,"context_line":"\t\t\t\t}"},{"line_number":826,"context_line":"\t\t\t\tif (cmd-\u003efields[i].in_value)"},{"line_number":827,"context_line":"\t\t\t\t\tbuf_cpy(captured, cmd-\u003efields[i].in_value, num_bits);"},{"line_number":828,"context_line":"\t\t\t\tfree(buffer);"},{"line_number":829,"context_line":"\t\t\t}"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"c2ec5246_8078da1f","line":826,"range":{"start_line":826,"start_character":4,"end_line":826,"end_character":32},"updated":"2023-10-22 20:22:12.000000000","message":"As above","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":823,"context_line":"\t\t\t\t\tLOG_DEBUG_IO(\"size\u003d%d, buf\u003d[%s]\", size, str);"},{"line_number":824,"context_line":"\t\t\t\t\tfree(str);"},{"line_number":825,"context_line":"\t\t\t\t}"},{"line_number":826,"context_line":"\t\t\t\tif (cmd-\u003efields[i].in_value)"},{"line_number":827,"context_line":"\t\t\t\t\tbuf_cpy(captured, cmd-\u003efields[i].in_value, num_bits);"},{"line_number":828,"context_line":"\t\t\t\tfree(buffer);"},{"line_number":829,"context_line":"\t\t\t}"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"3c5d55bc_a5fc0b82","line":826,"range":{"start_line":826,"start_character":4,"end_line":826,"end_character":32},"in_reply_to":"c2ec5246_8078da1f","updated":"2023-10-25 22:44:33.000000000","message":"I\u0027ve also changed this.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":921,"context_line":"\t\tfree(read_data);"},{"line_number":922,"context_line":"\t}"},{"line_number":923,"context_line":""},{"line_number":924,"context_line":"\tint prev_index \u003d ch347.buffer_idx;"},{"line_number":925,"context_line":"\tfor (i \u003d 0; i \u003c CH347_CMD_HEADER; i++)"},{"line_number":926,"context_line":"\t\tch347_in_buffer(0);"},{"line_number":927,"context_line":"\tint buf_index \u003d CH347_CMD_HEADER;"},{"line_number":928,"context_line":"\tbuf_index \u003d ch347_idle_clock(buf_index);"},{"line_number":929,"context_line":"\tch347_combine_packets(CH347_CMD_JTAG_BIT_OP, prev_index, buf_index);"},{"line_number":930,"context_line":"}"},{"line_number":931,"context_line":""},{"line_number":932,"context_line":"/**"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"db8dd3a4_fcf9d677","line":929,"range":{"start_line":924,"start_character":1,"end_line":929,"end_character":69},"updated":"2023-10-22 20:22:12.000000000","message":"Is it necessary? TCK goes L at line 897","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":921,"context_line":"\t\tfree(read_data);"},{"line_number":922,"context_line":"\t}"},{"line_number":923,"context_line":""},{"line_number":924,"context_line":"\tint prev_index \u003d ch347.buffer_idx;"},{"line_number":925,"context_line":"\tfor (i \u003d 0; i \u003c CH347_CMD_HEADER; i++)"},{"line_number":926,"context_line":"\t\tch347_in_buffer(0);"},{"line_number":927,"context_line":"\tint buf_index \u003d CH347_CMD_HEADER;"},{"line_number":928,"context_line":"\tbuf_index \u003d ch347_idle_clock(buf_index);"},{"line_number":929,"context_line":"\tch347_combine_packets(CH347_CMD_JTAG_BIT_OP, prev_index, buf_index);"},{"line_number":930,"context_line":"}"},{"line_number":931,"context_line":""},{"line_number":932,"context_line":"/**"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"8f997eef_6696609a","line":929,"range":{"start_line":924,"start_character":1,"end_line":929,"end_character":69},"in_reply_to":"db8dd3a4_fcf9d677","updated":"2023-10-25 22:44:33.000000000","message":"That\u0027s not necessary. I\u0027ve removed it.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":939,"context_line":" */"},{"line_number":940,"context_line":"static void ch347_write_read(struct scan_command *cmd, uint8_t *bits, int nb_bits, enum scan_type scan)"},{"line_number":941,"context_line":"{"},{"line_number":942,"context_line":"\tint nb8 \u003d nb_bits / 8;"},{"line_number":943,"context_line":"\tint nb1 \u003d nb_bits % 8;"},{"line_number":944,"context_line":"\tstatic uint8_t byte0[SF_PACKET_BUF_SIZE];"},{"line_number":945,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"8afb677a_73d8238d","line":942,"updated":"2023-10-22 20:22:12.000000000","message":"There is big code duplicity between ch347_write_read_bitwise() and ch347_write_read(). Could ch347_write_read() also serve for bitwise operation if nb8 is kept at zero and all bits goes to nb1 - and forced chunking to MAX_BITS_PER_BIT_OP like in ch347_write_read_bitwise()?","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":939,"context_line":" */"},{"line_number":940,"context_line":"static void ch347_write_read(struct scan_command *cmd, uint8_t *bits, int nb_bits, enum scan_type scan)"},{"line_number":941,"context_line":"{"},{"line_number":942,"context_line":"\tint nb8 \u003d nb_bits / 8;"},{"line_number":943,"context_line":"\tint nb1 \u003d nb_bits % 8;"},{"line_number":944,"context_line":"\tstatic uint8_t byte0[SF_PACKET_BUF_SIZE];"},{"line_number":945,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"9b908ecf_18d0d23d","line":942,"in_reply_to":"8afb677a_73d8238d","updated":"2023-10-25 22:44:33.000000000","message":"Now I\u0027ve one function for both. With only one if-clause I can also achieve the bitwise mode for older CH347 versions. Chunking by MAX_BITS_PER_BIT_OP is also done.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":941,"context_line":"{"},{"line_number":942,"context_line":"\tint nb8 \u003d nb_bits / 8;"},{"line_number":943,"context_line":"\tint nb1 \u003d nb_bits % 8;"},{"line_number":944,"context_line":"\tstatic uint8_t byte0[SF_PACKET_BUF_SIZE];"},{"line_number":945,"context_line":""},{"line_number":946,"context_line":"\tif (ch347.pack_size \u003d\u003d LARGER_PACK) {"},{"line_number":947,"context_line":"\t\tif ((ch347.read_count \u003e\u003d (USBC_PACKET_USBHS_SINGLE * 1)))"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"2c1f5fda_464c3d74","line":944,"updated":"2023-10-22 20:22:12.000000000","message":"WTF: 51 kB of zeros, static allocation?!!","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":941,"context_line":"{"},{"line_number":942,"context_line":"\tint nb8 \u003d nb_bits / 8;"},{"line_number":943,"context_line":"\tint nb1 \u003d nb_bits % 8;"},{"line_number":944,"context_line":"\tstatic uint8_t byte0[SF_PACKET_BUF_SIZE];"},{"line_number":945,"context_line":""},{"line_number":946,"context_line":"\tif (ch347.pack_size \u003d\u003d LARGER_PACK) {"},{"line_number":947,"context_line":"\t\tif ((ch347.read_count \u003e\u003d (USBC_PACKET_USBHS_SINGLE * 1)))"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"d1602903_f70ee5d6","line":944,"in_reply_to":"2c1f5fda_464c3d74","updated":"2023-10-25 22:44:33.000000000","message":"That\u0027s useless. It\u0027s better to use memset for setting the zeros.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":1088,"context_line":"\tif (tap_get_state() !\u003d TAP_IDLE)"},{"line_number":1089,"context_line":"\t\tch347_move_state(TAP_IDLE, 0);"},{"line_number":1090,"context_line":""},{"line_number":1091,"context_line":"\tuint8_t tms_value \u003d 0;"},{"line_number":1092,"context_line":"\tch347_tms_change(\u0026tms_value, 7, 1);"},{"line_number":1093,"context_line":""},{"line_number":1094,"context_line":"\tch347.write_read_fn(NULL, NULL, cycles, SCAN_OUT);"},{"line_number":1095,"context_line":"\tch347_move_state(state, 0);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"7ac9476e_c095157b","line":1092,"range":{"start_line":1091,"start_character":1,"end_line":1092,"end_character":36},"updated":"2023-10-22 20:22:12.000000000","message":"Why 7 extra cycles?","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":1088,"context_line":"\tif (tap_get_state() !\u003d TAP_IDLE)"},{"line_number":1089,"context_line":"\t\tch347_move_state(TAP_IDLE, 0);"},{"line_number":1090,"context_line":""},{"line_number":1091,"context_line":"\tuint8_t tms_value \u003d 0;"},{"line_number":1092,"context_line":"\tch347_tms_change(\u0026tms_value, 7, 1);"},{"line_number":1093,"context_line":""},{"line_number":1094,"context_line":"\tch347.write_read_fn(NULL, NULL, cycles, SCAN_OUT);"},{"line_number":1095,"context_line":"\tch347_move_state(state, 0);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"c4fab168_cc7c2722","line":1092,"range":{"start_line":1091,"start_character":1,"end_line":1092,"end_character":36},"in_reply_to":"7ac9476e_c095157b","updated":"2023-10-25 22:44:33.000000000","message":"Not sure. I\u0027ve changed this to the number of given cycles. Hope that\u0027s correct.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":1170,"context_line":"\tfor (cmd \u003d jtag_command_queue; ret \u003d\u003d ERROR_OK \u0026\u0026 cmd;"},{"line_number":1171,"context_line":"\t\t cmd \u003d cmd-\u003enext) {"},{"line_number":1172,"context_line":"\t\tswitch (cmd-\u003etype) {"},{"line_number":1173,"context_line":"\t\tcase JTAG_RESET:"},{"line_number":1174,"context_line":"\t\t\tLOG_DEBUG_IO(\"JTAG_RESET : %d %d\","},{"line_number":1175,"context_line":"\t\t\t\t\t cmd-\u003ecmd.reset-\u003etrst,"},{"line_number":1176,"context_line":"\t\t\t\t\t cmd-\u003ecmd.reset-\u003esrst);"},{"line_number":1177,"context_line":"\t\t\tch347_reset(cmd-\u003ecmd.reset-\u003etrst, cmd-\u003ecmd.reset-\u003esrst);"},{"line_number":1178,"context_line":"\t\t\tbreak;"},{"line_number":1179,"context_line":"\t\tcase JTAG_RUNTEST:"},{"line_number":1180,"context_line":"\t\t\tch347_run_test(cmd-\u003ecmd.runtest-\u003enum_cycles,"},{"line_number":1181,"context_line":"\t\t\t\t\t  cmd-\u003ecmd.runtest-\u003eend_state);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"8babbbac_8681a91f","line":1178,"range":{"start_line":1173,"start_character":1,"end_line":1178,"end_character":9},"updated":"2023-10-22 20:22:12.000000000","message":"IIRC queued JTAG_RESET was superseded by adapter_driver method reset\n4895: swd: get rid of jtag queue to assert/deassert srst | https://review.openocd.org/c/openocd/+/4895\n\nDrop JTAG_RESET case.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":1170,"context_line":"\tfor (cmd \u003d jtag_command_queue; ret \u003d\u003d ERROR_OK \u0026\u0026 cmd;"},{"line_number":1171,"context_line":"\t\t cmd \u003d cmd-\u003enext) {"},{"line_number":1172,"context_line":"\t\tswitch (cmd-\u003etype) {"},{"line_number":1173,"context_line":"\t\tcase JTAG_RESET:"},{"line_number":1174,"context_line":"\t\t\tLOG_DEBUG_IO(\"JTAG_RESET : %d %d\","},{"line_number":1175,"context_line":"\t\t\t\t\t cmd-\u003ecmd.reset-\u003etrst,"},{"line_number":1176,"context_line":"\t\t\t\t\t cmd-\u003ecmd.reset-\u003esrst);"},{"line_number":1177,"context_line":"\t\t\tch347_reset(cmd-\u003ecmd.reset-\u003etrst, cmd-\u003ecmd.reset-\u003esrst);"},{"line_number":1178,"context_line":"\t\t\tbreak;"},{"line_number":1179,"context_line":"\t\tcase JTAG_RUNTEST:"},{"line_number":1180,"context_line":"\t\t\tch347_run_test(cmd-\u003ecmd.runtest-\u003enum_cycles,"},{"line_number":1181,"context_line":"\t\t\t\t\t  cmd-\u003ecmd.runtest-\u003eend_state);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"05547c20_cce457cc","line":1178,"range":{"start_line":1173,"start_character":1,"end_line":1178,"end_character":9},"in_reply_to":"8babbbac_8681a91f","updated":"2023-10-25 22:44:33.000000000","message":"I didn\u0027t know this. Now it\u0027s removed.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":1229,"context_line":"\tif (!swd_mode) {"},{"line_number":1230,"context_line":"\t\t// ch347 jtag init"},{"line_number":1231,"context_line":"\t\tch347.tck_pin \u003d TCK_L;"},{"line_number":1232,"context_line":"\t\tch347.tms_pin \u003d TMS_L;"},{"line_number":1233,"context_line":"\t\tch347.tdi_pin \u003d TDI_L;"},{"line_number":1234,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":1235,"context_line":"\t\tch347.buffer_idx \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"a1c0f6c8_b6b07a86","line":1232,"range":{"start_line":1232,"start_character":18,"end_line":1232,"end_character":23},"updated":"2023-10-22 20:22:12.000000000","message":"TMS should be init to H","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":1229,"context_line":"\tif (!swd_mode) {"},{"line_number":1230,"context_line":"\t\t// ch347 jtag init"},{"line_number":1231,"context_line":"\t\tch347.tck_pin \u003d TCK_L;"},{"line_number":1232,"context_line":"\t\tch347.tms_pin \u003d TMS_L;"},{"line_number":1233,"context_line":"\t\tch347.tdi_pin \u003d TDI_L;"},{"line_number":1234,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":1235,"context_line":"\t\tch347.buffer_idx \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"cc009f85_a9c3f66c","line":1232,"range":{"start_line":1232,"start_character":18,"end_line":1232,"end_character":23},"in_reply_to":"a1c0f6c8_b6b07a86","updated":"2023-10-25 22:44:33.000000000","message":"Thanks. I\u0027ve changed this.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":1330,"context_line":"\t\tit doesn\u0027t read any data. But fortunately it is possible to work"},{"line_number":1331,"context_line":"\t\twith the STANDARD_PACK also with a device that supports LARGER_PACK */"},{"line_number":1332,"context_line":"\tLOG_INFO(\"CH347 device supports LARGER_PACK mode. \""},{"line_number":1333,"context_line":"\t\t\t\t\"But the driver ist only working correctly for STANDARD_PACK mode. \""},{"line_number":1334,"context_line":"\t\t\t\t\"Switching to STANDARD_PACK mode.\");"},{"line_number":1335,"context_line":"\tch347.pack_size \u003d STANDARD_PACK;"},{"line_number":1336,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"5e09c787_c738571b","line":1333,"range":{"start_line":1333,"start_character":22,"end_line":1333,"end_character":23},"updated":"2023-10-22 20:22:12.000000000","message":"typo","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"286df30da54a16e8e62aae71dca2136c26a457eb","unresolved":false,"context_lines":[{"line_number":1330,"context_line":"\t\tit doesn\u0027t read any data. But fortunately it is possible to work"},{"line_number":1331,"context_line":"\t\twith the STANDARD_PACK also with a device that supports LARGER_PACK */"},{"line_number":1332,"context_line":"\tLOG_INFO(\"CH347 device supports LARGER_PACK mode. \""},{"line_number":1333,"context_line":"\t\t\t\t\"But the driver ist only working correctly for STANDARD_PACK mode. \""},{"line_number":1334,"context_line":"\t\t\t\t\"Switching to STANDARD_PACK mode.\");"},{"line_number":1335,"context_line":"\tch347.pack_size \u003d STANDARD_PACK;"},{"line_number":1336,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"1762b22e_cbfb7a36","line":1333,"range":{"start_line":1333,"start_character":22,"end_line":1333,"end_character":23},"in_reply_to":"5e09c787_c738571b","updated":"2023-10-25 22:44:33.000000000","message":"I don\u0027t need this workaround anymore. Deleted.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e871424fca9b920272526a0009675a3c988831c9","unresolved":true,"context_lines":[{"line_number":1396,"context_line":"\t\tLOG_ERROR(\"Couldn\u0027t support the adapter speed\");"},{"line_number":1397,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1398,"context_line":"\t}"},{"line_number":1399,"context_line":"\t*jtag_speed \u003d khz * 1000;"},{"line_number":1400,"context_line":"\treturn ERROR_OK;"},{"line_number":1401,"context_line":"}"},{"line_number":1402,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"39564588_fc4cbb3b","line":1399,"updated":"2023-10-22 20:22:12.000000000","message":"The concept of converting to adapter internal speed (this) and back (speed_div) was introduced to show real adapter speed after setting. Converting kHz to Hz does not help to get real speed. I recommend convert to speed index here and in ch347_speed_div() look up the real speed from ch347_clock_speeds array.\nch347_speed() gets speed index then.\n\nIssue a warning when selected speed is higher than requested","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"52d6a7843052c8cdc3538f878441012f24dc386d","unresolved":false,"context_lines":[{"line_number":1396,"context_line":"\t\tLOG_ERROR(\"Couldn\u0027t support the adapter speed\");"},{"line_number":1397,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1398,"context_line":"\t}"},{"line_number":1399,"context_line":"\t*jtag_speed \u003d khz * 1000;"},{"line_number":1400,"context_line":"\treturn ERROR_OK;"},{"line_number":1401,"context_line":"}"},{"line_number":1402,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":13,"id":"8a604511_958fdd24","line":1399,"in_reply_to":"39564588_fc4cbb3b","updated":"2023-10-25 22:55:04.000000000","message":"Thanks for the explanation. I\u0027ve changed this also.","commit_id":"6e957cd67533e3bbae85b605c8bdbb31091cf686"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":54,"context_line":"#include \u003ctime.h\u003e"},{"line_number":55,"context_line":"#include \u003cunistd.h\u003e"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"#define JTAGIO_STA_OUT_TDI\t\t\t\t(0x10)"},{"line_number":58,"context_line":"#define JTAGIO_STA_OUT_TMS\t\t\t\t(0x02)"},{"line_number":59,"context_line":"#define JTAGIO_STA_OUT_TCK\t\t\t\t(0x01)"},{"line_number":60,"context_line":"#define JTAGIO_STA_OUT_TRST\t\t\t\t(0x20)"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"a7649fcf_e621e457","line":57,"updated":"2023-10-26 19:36:34.000000000","message":"You can use BIT(nr) macro for the pin definitions. Inside \u003chelper/bits.h\u003e","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":54,"context_line":"#include \u003ctime.h\u003e"},{"line_number":55,"context_line":"#include \u003cunistd.h\u003e"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"#define JTAGIO_STA_OUT_TDI\t\t\t\t(0x10)"},{"line_number":58,"context_line":"#define JTAGIO_STA_OUT_TMS\t\t\t\t(0x02)"},{"line_number":59,"context_line":"#define JTAGIO_STA_OUT_TCK\t\t\t\t(0x01)"},{"line_number":60,"context_line":"#define JTAGIO_STA_OUT_TRST\t\t\t\t(0x20)"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"2b8b6536_c63f94bd","line":57,"in_reply_to":"a7649fcf_e621e457","updated":"2023-10-26 22:08:58.000000000","message":"Thanks. I didn\u0027t know this.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":358,"context_line":"\t\treturn;"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"\t// malloc for the command and data bytes"},{"line_number":361,"context_line":"\tstruct ch347_cmd *cmd \u003d malloc(sizeof(struct ch347_cmd));"},{"line_number":362,"context_line":"\tcmd-\u003ewrite_data \u003d malloc(ch347.scratchpad_idx);"},{"line_number":363,"context_line":"\tif (!cmd || !cmd-\u003ewrite_data) {"},{"line_number":364,"context_line":"\t\tLOG_ERROR(\"malloc failed\");"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"03ee3ee3_79a4b744","line":361,"updated":"2023-10-26 19:36:34.000000000","message":"struct ch347_cmd *cmd \u003d malloc(sizeof(*cmd));\nif (cmd) {\n  cmd-\u003ewrite_data \u003d malloc(ch347.scratchpad_idx);\n}","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":358,"context_line":"\t\treturn;"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"\t// malloc for the command and data bytes"},{"line_number":361,"context_line":"\tstruct ch347_cmd *cmd \u003d malloc(sizeof(struct ch347_cmd));"},{"line_number":362,"context_line":"\tcmd-\u003ewrite_data \u003d malloc(ch347.scratchpad_idx);"},{"line_number":363,"context_line":"\tif (!cmd || !cmd-\u003ewrite_data) {"},{"line_number":364,"context_line":"\t\tLOG_ERROR(\"malloc failed\");"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"2d26d1b6_c7019e5e","line":361,"in_reply_to":"03ee3ee3_79a4b744","updated":"2023-10-26 22:08:58.000000000","message":"Yes, that\u0027s correct. I\u0027ve changed this.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":603,"context_line":"\t\t\tfree(cmd-\u003ewrite_data);"},{"line_number":604,"context_line":"\t\t\tfree(cmd);"},{"line_number":605,"context_line":""},{"line_number":606,"context_line":"\t\t\tif (break_loop)"},{"line_number":607,"context_line":"\t\t\t\tbreak;"},{"line_number":608,"context_line":"\t\t}"},{"line_number":609,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"33e182a6_ce7cdb82","line":606,"updated":"2023-10-26 19:36:34.000000000","message":"You don\u0027t need a new variable here. \nif (cmd \u003d\u003d last_cmd)\n   break;","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":603,"context_line":"\t\t\tfree(cmd-\u003ewrite_data);"},{"line_number":604,"context_line":"\t\t\tfree(cmd);"},{"line_number":605,"context_line":""},{"line_number":606,"context_line":"\t\t\tif (break_loop)"},{"line_number":607,"context_line":"\t\t\t\tbreak;"},{"line_number":608,"context_line":"\t\t}"},{"line_number":609,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"8ddbe37e_3367a7af","line":606,"in_reply_to":"33e182a6_ce7cdb82","updated":"2023-10-26 22:08:58.000000000","message":"Yes, that\u0027s right. I\u0027ve removed the variable.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":610,"context_line":"\t\t// write data to device"},{"line_number":611,"context_line":"\t\tif (ch347_write_data(write_buf, \u0026idx) !\u003d ERROR_OK) {"},{"line_number":612,"context_line":"\t\t\tfree(write_buf);"},{"line_number":613,"context_line":"\t\t\tif (decoded_buf)"},{"line_number":614,"context_line":"\t\t\t\tfree(decoded_buf);"},{"line_number":615,"context_line":"\t\t\treturn;"},{"line_number":616,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"f2f260dc_8a2d53e1","line":613,"updated":"2023-10-26 19:36:34.000000000","message":"If decoded_buf is a null pointer, no action occurs. So, don\u0027t need to check for NULL. \nI see the same for \u0027ch347_device_desc\u0027 and \u0027cmd\u0027","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":610,"context_line":"\t\t// write data to device"},{"line_number":611,"context_line":"\t\tif (ch347_write_data(write_buf, \u0026idx) !\u003d ERROR_OK) {"},{"line_number":612,"context_line":"\t\t\tfree(write_buf);"},{"line_number":613,"context_line":"\t\t\tif (decoded_buf)"},{"line_number":614,"context_line":"\t\t\t\tfree(decoded_buf);"},{"line_number":615,"context_line":"\t\t\treturn;"},{"line_number":616,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"77298575_4e8ceb0c","line":613,"in_reply_to":"f2f260dc_8a2d53e1","updated":"2023-10-26 22:08:58.000000000","message":"Yes, that\u0027s correct. No need to NULL check before calling free. I\u0027ve changed all occurrences where I did it.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":695,"context_line":"static uint8_t ch347_single_read_get_byte(int read_buf_idx)"},{"line_number":696,"context_line":"{"},{"line_number":697,"context_line":"\tch347_cmd_transmit_queue();"},{"line_number":698,"context_line":"\tint idx \u003d read_buf_idx;"},{"line_number":699,"context_line":"\tif (read_buf_idx \u003e CH347_SINGLE_CMD_MAX_READ || read_buf_idx \u003c 0) {"},{"line_number":700,"context_line":"\t\tLOG_ERROR(\"read_buf_idx out of range\");"},{"line_number":701,"context_line":"\t\tidx \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"47af1ad2_e2ceb293","line":698,"updated":"2023-10-26 19:36:34.000000000","message":"You don\u0027t need a new variable here. Just use \u0027read_buf_idx\u0027","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":695,"context_line":"static uint8_t ch347_single_read_get_byte(int read_buf_idx)"},{"line_number":696,"context_line":"{"},{"line_number":697,"context_line":"\tch347_cmd_transmit_queue();"},{"line_number":698,"context_line":"\tint idx \u003d read_buf_idx;"},{"line_number":699,"context_line":"\tif (read_buf_idx \u003e CH347_SINGLE_CMD_MAX_READ || read_buf_idx \u003c 0) {"},{"line_number":700,"context_line":"\t\tLOG_ERROR(\"read_buf_idx out of range\");"},{"line_number":701,"context_line":"\t\tidx \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"714402c6_0f2b53a1","line":698,"in_reply_to":"47af1ad2_e2ceb293","updated":"2023-10-26 22:08:58.000000000","message":"Thank\u0027s for showing this.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":1007,"context_line":"\t// check in the read if the bit is set/cleared correctly"},{"line_number":1008,"context_line":"\tif ((ch347_single_read_get_byte(gpio) \u0026 0x40) \u003e\u003e 6 !\u003d data) {"},{"line_number":1009,"context_line":"\t\tLOG_ERROR(\"Output not set.\");"},{"line_number":1010,"context_line":"\t\treturn;"},{"line_number":1011,"context_line":"\t}"},{"line_number":1012,"context_line":"}"},{"line_number":1013,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"0b055a26_2c848ac1","line":1010,"updated":"2023-10-26 19:36:34.000000000","message":"No need for \"return\" statement","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":1007,"context_line":"\t// check in the read if the bit is set/cleared correctly"},{"line_number":1008,"context_line":"\tif ((ch347_single_read_get_byte(gpio) \u0026 0x40) \u003e\u003e 6 !\u003d data) {"},{"line_number":1009,"context_line":"\t\tLOG_ERROR(\"Output not set.\");"},{"line_number":1010,"context_line":"\t\treturn;"},{"line_number":1011,"context_line":"\t}"},{"line_number":1012,"context_line":"}"},{"line_number":1013,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"b7106e95_f8e78565","line":1010,"in_reply_to":"0b055a26_2c848ac1","updated":"2023-10-26 22:08:58.000000000","message":"Yes, no need to add this return.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":1142,"context_line":"\t}"},{"line_number":1143,"context_line":""},{"line_number":1144,"context_line":"\tstruct libusb_device_descriptor ch347_device_descriptor;"},{"line_number":1145,"context_line":"\tlibusb_get_device_descriptor(libusb_get_device(ch347_handle), \u0026ch347_device_descriptor);"},{"line_number":1146,"context_line":""},{"line_number":1147,"context_line":"\terr_code \u003d libusb_claim_interface(ch347_handle, CH347_MPHSI_INTERFACE);"},{"line_number":1148,"context_line":"\tif (err_code !\u003d ERROR_OK) {"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"3513e35b_c35c93d7","line":1145,"updated":"2023-10-26 19:36:34.000000000","message":"Please check return values of \"libusb_get_device_descriptor\" and \"libusb_get_device\"","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":1142,"context_line":"\t}"},{"line_number":1143,"context_line":""},{"line_number":1144,"context_line":"\tstruct libusb_device_descriptor ch347_device_descriptor;"},{"line_number":1145,"context_line":"\tlibusb_get_device_descriptor(libusb_get_device(ch347_handle), \u0026ch347_device_descriptor);"},{"line_number":1146,"context_line":""},{"line_number":1147,"context_line":"\terr_code \u003d libusb_claim_interface(ch347_handle, CH347_MPHSI_INTERFACE);"},{"line_number":1148,"context_line":"\tif (err_code !\u003d ERROR_OK) {"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"3066fd88_28d093c9","line":1145,"in_reply_to":"3513e35b_c35c93d7","updated":"2023-10-26 22:08:58.000000000","message":"I\u0027ve added the check.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":1330,"context_line":"COMMAND_HANDLER(ch347_handle_vid_pid_command)"},{"line_number":1331,"context_line":"{"},{"line_number":1332,"context_line":"\tif (CMD_ARGC !\u003d 2) {"},{"line_number":1333,"context_line":"\t\tLOG_ERROR(\"incomplete ch347 vid_pid configuration directive\");"},{"line_number":1334,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1335,"context_line":"\t}"},{"line_number":1336,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"738cabc9_fb7c6c2c","line":1333,"updated":"2023-10-26 19:36:34.000000000","message":"Use \"command_print\" for the error messages inside COMMAND_HANDLERs","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":1330,"context_line":"COMMAND_HANDLER(ch347_handle_vid_pid_command)"},{"line_number":1331,"context_line":"{"},{"line_number":1332,"context_line":"\tif (CMD_ARGC !\u003d 2) {"},{"line_number":1333,"context_line":"\t\tLOG_ERROR(\"incomplete ch347 vid_pid configuration directive\");"},{"line_number":1334,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1335,"context_line":"\t}"},{"line_number":1336,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"cc9ba9cb_3e5425c2","line":1333,"in_reply_to":"738cabc9_fb7c6c2c","updated":"2023-10-26 22:08:58.000000000","message":"I didn\u0027t know this, but I\u0027ve changed all places.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":1467,"context_line":"\tcmd_buf[i++] \u003d clock_index; // JTAG clock speed index"},{"line_number":1468,"context_line":"\ti +\u003d 3; // Reserved Bytes"},{"line_number":1469,"context_line":""},{"line_number":1470,"context_line":"\tint len \u003d i;"},{"line_number":1471,"context_line":"\tif (ch347_write_data(cmd_buf, \u0026len) !\u003d ERROR_OK)"},{"line_number":1472,"context_line":"\t\treturn false;"},{"line_number":1473,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"6f4c4fa3_b05c0aeb","line":1470,"updated":"2023-10-26 19:36:34.000000000","message":"You can use i or len. Don\u0027t need another variable.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":1467,"context_line":"\tcmd_buf[i++] \u003d clock_index; // JTAG clock speed index"},{"line_number":1468,"context_line":"\ti +\u003d 3; // Reserved Bytes"},{"line_number":1469,"context_line":""},{"line_number":1470,"context_line":"\tint len \u003d i;"},{"line_number":1471,"context_line":"\tif (ch347_write_data(cmd_buf, \u0026len) !\u003d ERROR_OK)"},{"line_number":1472,"context_line":"\t\treturn false;"},{"line_number":1473,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":20,"id":"3929eec6_13f2068f","line":1470,"in_reply_to":"6f4c4fa3_b05c0aeb","updated":"2023-10-26 22:08:58.000000000","message":"I\u0027ve refactored this function and queue a command now.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":1767,"context_line":"\t\t\t// read  Reg"},{"line_number":1768,"context_line":"\t\t\tif (recv_buf[recv_len] \u003d\u003d CH347_CMD_SWD_REG_R) {"},{"line_number":1769,"context_line":"\t\t\t\trecv_len++;"},{"line_number":1770,"context_line":"\t\t\t\tack \u003d buf_get_u32(\u0026recv_buf[recv_len++], 0, 3);"},{"line_number":1771,"context_line":"\t\t\t\t/* Devices do not reply to DP_TARGETSEL write"},{"line_number":1772,"context_line":"\t\t\t\t   cmd, ignore received ack */"},{"line_number":1773,"context_line":"\t\t\t\tcheck_ack \u003d swd_cmd_returns_ack(pswd_io-\u003ecmd);"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"fb91865a_96821ca8","line":1770,"updated":"2023-10-26 19:36:34.000000000","message":"Keep return value of buf_get_u32 inside uint32_t variable. I see the same many places.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":1767,"context_line":"\t\t\t// read  Reg"},{"line_number":1768,"context_line":"\t\t\tif (recv_buf[recv_len] \u003d\u003d CH347_CMD_SWD_REG_R) {"},{"line_number":1769,"context_line":"\t\t\t\trecv_len++;"},{"line_number":1770,"context_line":"\t\t\t\tack \u003d buf_get_u32(\u0026recv_buf[recv_len++], 0, 3);"},{"line_number":1771,"context_line":"\t\t\t\t/* Devices do not reply to DP_TARGETSEL write"},{"line_number":1772,"context_line":"\t\t\t\t   cmd, ignore received ack */"},{"line_number":1773,"context_line":"\t\t\t\tcheck_ack \u003d swd_cmd_returns_ack(pswd_io-\u003ecmd);"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"d3931282_3436e6f7","line":1770,"in_reply_to":"fb91865a_96821ca8","updated":"2023-10-26 22:08:58.000000000","message":"I\u0027ve changed the variables that store the result of buf_get_u32.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"2621260b64c80b980d2a730851a8e2feb98b0942","unresolved":true,"context_lines":[{"line_number":1884,"context_line":"\t} else {"},{"line_number":1885,"context_line":"\t\tpswd_io-\u003eusb_cmd \u003d CH347_CMD_SWD_REG_W;"},{"line_number":1886,"context_line":"\t\tpswd_io-\u003evalue \u003d data;"},{"line_number":1887,"context_line":"\t\tch347_write_swd_reg(pswd_io-\u003ecmd, (uint8_t *)\u0026data,\tparity_u32(data));"},{"line_number":1888,"context_line":"\t}"},{"line_number":1889,"context_line":""},{"line_number":1890,"context_line":"\tch347_swd_context.sent_cmd_count++;"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"85e3b5ce_609e0564","line":1887,"updated":"2023-10-26 19:36:34.000000000","message":"Be careful about endianness.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1884,"context_line":"\t} else {"},{"line_number":1885,"context_line":"\t\tpswd_io-\u003eusb_cmd \u003d CH347_CMD_SWD_REG_W;"},{"line_number":1886,"context_line":"\t\tpswd_io-\u003evalue \u003d data;"},{"line_number":1887,"context_line":"\t\tch347_write_swd_reg(pswd_io-\u003ecmd, (uint8_t *)\u0026data,\tparity_u32(data));"},{"line_number":1888,"context_line":"\t}"},{"line_number":1889,"context_line":""},{"line_number":1890,"context_line":"\tch347_swd_context.sent_cmd_count++;"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"96fb2a82_73991944","line":1887,"in_reply_to":"0aded310_98d4ecc2","updated":"2023-10-27 23:40:00.000000000","message":"Now I think, I got it. I\u0027ve changed this as Antonio proposed.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89df846fb4275b476539b92abb126f0ea7ba1cbf","unresolved":false,"context_lines":[{"line_number":1884,"context_line":"\t} else {"},{"line_number":1885,"context_line":"\t\tpswd_io-\u003eusb_cmd \u003d CH347_CMD_SWD_REG_W;"},{"line_number":1886,"context_line":"\t\tpswd_io-\u003evalue \u003d data;"},{"line_number":1887,"context_line":"\t\tch347_write_swd_reg(pswd_io-\u003ecmd, (uint8_t *)\u0026data,\tparity_u32(data));"},{"line_number":1888,"context_line":"\t}"},{"line_number":1889,"context_line":""},{"line_number":1890,"context_line":"\tch347_swd_context.sent_cmd_count++;"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"c355856c_aaa4fb1e","line":1887,"in_reply_to":"85e3b5ce_609e0564","updated":"2023-10-26 22:08:58.000000000","message":"I\u0027m not really sure what to do here, but for now I would leave it as it is.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"b518e8d2d0c42984e19ea2d927017b0dc1b6af50","unresolved":true,"context_lines":[{"line_number":1884,"context_line":"\t} else {"},{"line_number":1885,"context_line":"\t\tpswd_io-\u003eusb_cmd \u003d CH347_CMD_SWD_REG_W;"},{"line_number":1886,"context_line":"\t\tpswd_io-\u003evalue \u003d data;"},{"line_number":1887,"context_line":"\t\tch347_write_swd_reg(pswd_io-\u003ecmd, (uint8_t *)\u0026data,\tparity_u32(data));"},{"line_number":1888,"context_line":"\t}"},{"line_number":1889,"context_line":""},{"line_number":1890,"context_line":"\tch347_swd_context.sent_cmd_count++;"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"c9517112_970a8618","line":1887,"in_reply_to":"c355856c_aaa4fb1e","updated":"2023-10-26 22:53:20.000000000","message":"Erhan is right, the code will be broken if compiled and run on a big endian host. You should avoid pointer type casts between pointers to integer types of different size.\n\nI would recommend to change the type of the second parameter of ch347_write_swd_reg() to uint32_t (called by value) and use h_u32_to_le()\nconversion to store to ch347_swd_context.send_buf instead of byte by byte copy.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1884,"context_line":"\t} else {"},{"line_number":1885,"context_line":"\t\tpswd_io-\u003eusb_cmd \u003d CH347_CMD_SWD_REG_W;"},{"line_number":1886,"context_line":"\t\tpswd_io-\u003evalue \u003d data;"},{"line_number":1887,"context_line":"\t\tch347_write_swd_reg(pswd_io-\u003ecmd, (uint8_t *)\u0026data,\tparity_u32(data));"},{"line_number":1888,"context_line":"\t}"},{"line_number":1889,"context_line":""},{"line_number":1890,"context_line":"\tch347_swd_context.sent_cmd_count++;"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"0aded310_98d4ecc2","line":1887,"in_reply_to":"c9517112_970a8618","updated":"2023-10-27 14:34:29.000000000","message":"Agree with Erhan and Tomas.\nAnd passing \"data\" as uint32_t makes easy to drop the third parameter and instead compute the parity_u32() inside ch347_write_swd_reg().\nBy the way, there is a TAB before \"parity_u32\" that should be replaced by a space; but it would disappear if you agree moving the parity call inside the function.","commit_id":"90874db420f240fb911d21bc005c019a13306254"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":95,"context_line":"#define CH347_CMD_JTAG_DATA_SHIFT_RD\t0xD4 // JTAG interface data shift and read command"},{"line_number":96,"context_line":"/* there are \"single\" commands. These commands can\u0027t be chained together and"},{"line_number":97,"context_line":"\tneed to be send as single command and need a read after write */"},{"line_number":98,"context_line":"static inline bool ch347_is_single_cmd_type(uint8_t type)"},{"line_number":99,"context_line":"{"},{"line_number":100,"context_line":"\treturn type \u003d\u003d CH347_CMD_GPIO || type \u003d\u003d CH347_CMD_JTAG_INIT;"},{"line_number":101,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"6b4ab383_d0efa704","line":98,"updated":"2023-10-27 14:34:29.000000000","message":"please move this function below, after all the macros, structs and variables declarations; just before ch347_write_data()","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":95,"context_line":"#define CH347_CMD_JTAG_DATA_SHIFT_RD\t0xD4 // JTAG interface data shift and read command"},{"line_number":96,"context_line":"/* there are \"single\" commands. These commands can\u0027t be chained together and"},{"line_number":97,"context_line":"\tneed to be send as single command and need a read after write */"},{"line_number":98,"context_line":"static inline bool ch347_is_single_cmd_type(uint8_t type)"},{"line_number":99,"context_line":"{"},{"line_number":100,"context_line":"\treturn type \u003d\u003d CH347_CMD_GPIO || type \u003d\u003d CH347_CMD_JTAG_INIT;"},{"line_number":101,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"894c1b43_17971393","line":98,"in_reply_to":"6b4ab383_d0efa704","updated":"2023-10-27 23:40:00.000000000","message":"Done.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":402,"context_line":"\tint decoded_buf_idx \u003d 0;"},{"line_number":403,"context_line":""},{"line_number":404,"context_line":"\twhile (rd_idx \u003c read_len) {"},{"line_number":405,"context_line":"\t\tuint16_t type \u003d read_buf[rd_idx++];"},{"line_number":406,"context_line":"\t\tuint16_t data_len \u003d le_to_h_u16(\u0026read_buf[rd_idx]);"},{"line_number":407,"context_line":"\t\trd_idx +\u003d 2;"},{"line_number":408,"context_line":"\t\tif (decoded_buf_idx \u003e decoded_buf_len) {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"c1e2a3a2_b88354c7","line":405,"updated":"2023-10-27 14:34:29.000000000","message":"no need for uint16_t!\nIts value comes from a uint8_t and then it\u0027s used only in the switch().\nFor me this can be an unsigned int.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":402,"context_line":"\tint decoded_buf_idx \u003d 0;"},{"line_number":403,"context_line":""},{"line_number":404,"context_line":"\twhile (rd_idx \u003c read_len) {"},{"line_number":405,"context_line":"\t\tuint16_t type \u003d read_buf[rd_idx++];"},{"line_number":406,"context_line":"\t\tuint16_t data_len \u003d le_to_h_u16(\u0026read_buf[rd_idx]);"},{"line_number":407,"context_line":"\t\trd_idx +\u003d 2;"},{"line_number":408,"context_line":"\t\tif (decoded_buf_idx \u003e decoded_buf_len) {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"c06572dc_e91a8220","line":405,"in_reply_to":"c1e2a3a2_b88354c7","updated":"2023-10-27 23:40:00.000000000","message":"Yes, I can also use a unsigned int.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":428,"context_line":"\t\tcase CH347_CMD_JTAG_BIT_OP_RD:"},{"line_number":429,"context_line":"\t\t\t// for CH347_CMD_JTAG_BIT_OP_RD we need to copy bit by bit"},{"line_number":430,"context_line":"\t\t\tfor (int i \u003d 0; i \u003c data_len; i++) {"},{"line_number":431,"context_line":"\t\t\t\tif (read_buf[rd_idx + i] \u0026 1)"},{"line_number":432,"context_line":"\t\t\t\t\tdecoded_buf[decoded_buf_idx + i / 8] |\u003d (1 \u003c\u003c i % 8);"},{"line_number":433,"context_line":"\t\t\t\telse"},{"line_number":434,"context_line":"\t\t\t\t\tdecoded_buf[decoded_buf_idx + i / 8] \u0026\u003d ~(1 \u003c\u003c i % 8);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"50e11c9a_1b71357c","line":431,"updated":"2023-10-27 14:34:29.000000000","message":"Please use the equivalent, but more readable\nif (read_buf[rd_idx + i] \u0026 BIT(0))","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":428,"context_line":"\t\tcase CH347_CMD_JTAG_BIT_OP_RD:"},{"line_number":429,"context_line":"\t\t\t// for CH347_CMD_JTAG_BIT_OP_RD we need to copy bit by bit"},{"line_number":430,"context_line":"\t\t\tfor (int i \u003d 0; i \u003c data_len; i++) {"},{"line_number":431,"context_line":"\t\t\t\tif (read_buf[rd_idx + i] \u0026 1)"},{"line_number":432,"context_line":"\t\t\t\t\tdecoded_buf[decoded_buf_idx + i / 8] |\u003d (1 \u003c\u003c i % 8);"},{"line_number":433,"context_line":"\t\t\t\telse"},{"line_number":434,"context_line":"\t\t\t\t\tdecoded_buf[decoded_buf_idx + i / 8] \u0026\u003d ~(1 \u003c\u003c i % 8);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"cf28e0f7_6e3c770e","line":431,"in_reply_to":"50e11c9a_1b71357c","updated":"2023-10-27 23:40:00.000000000","message":"I\u0027ve changed this and also in other places where I thought that is makes sense.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":819,"context_line":""},{"line_number":820,"context_line":"\tch347_cmd_start_next(CH347_CMD_JTAG_BIT_OP);"},{"line_number":821,"context_line":"\tfor (int i \u003d 0; i \u003c cmd-\u003enum_states; i++) {"},{"line_number":822,"context_line":"\t\tif (tap_state_transition(tap_get_state(), false) \u003d\u003d\tcmd-\u003epath[i])"},{"line_number":823,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(0);"},{"line_number":824,"context_line":"\t\tif (tap_state_transition(tap_get_state(), true) \u003d\u003d cmd-\u003epath[i])"},{"line_number":825,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(1);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"9f66cc53_7a92ae70","line":822,"updated":"2023-10-27 14:34:29.000000000","message":"There is a TAB after \"\u003d\u003d\". Replace it with a space","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":819,"context_line":""},{"line_number":820,"context_line":"\tch347_cmd_start_next(CH347_CMD_JTAG_BIT_OP);"},{"line_number":821,"context_line":"\tfor (int i \u003d 0; i \u003c cmd-\u003enum_states; i++) {"},{"line_number":822,"context_line":"\t\tif (tap_state_transition(tap_get_state(), false) \u003d\u003d\tcmd-\u003epath[i])"},{"line_number":823,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(0);"},{"line_number":824,"context_line":"\t\tif (tap_state_transition(tap_get_state(), true) \u003d\u003d cmd-\u003epath[i])"},{"line_number":825,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(1);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"86ff16ba_cdec05ce","line":822,"in_reply_to":"9f66cc53_7a92ae70","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":871,"context_line":"\t}"},{"line_number":872,"context_line":""},{"line_number":873,"context_line":"\t// in bitwise mode only bits are allowed"},{"line_number":874,"context_line":"\tif (ch347.use_bitwise_mode)\t{"},{"line_number":875,"context_line":"\t\tbyte_count \u003d 0;"},{"line_number":876,"context_line":"\t\tbit_count \u003d bits_len;"},{"line_number":877,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"643f18be_12c91e71","line":874,"updated":"2023-10-27 14:34:29.000000000","message":"TAB before \"{\"; use space","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":871,"context_line":"\t}"},{"line_number":872,"context_line":""},{"line_number":873,"context_line":"\t// in bitwise mode only bits are allowed"},{"line_number":874,"context_line":"\tif (ch347.use_bitwise_mode)\t{"},{"line_number":875,"context_line":"\t\tbyte_count \u003d 0;"},{"line_number":876,"context_line":"\t\tbit_count \u003d bits_len;"},{"line_number":877,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"0e41aabc_dc074a1b","line":874,"in_reply_to":"643f18be_12c91e71","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1164,"context_line":""},{"line_number":1165,"context_line":"\tchar manufacturer[256 + 1];"},{"line_number":1166,"context_line":"\tif (libusb_get_string_descriptor_ascii(ch347_handle, ch347_device_descriptor.iManufacturer,"},{"line_number":1167,"context_line":"\t\t(unsigned char *)manufacturer, sizeof(manufacturer) - 1) \u003c 0)\t{"},{"line_number":1168,"context_line":"\t\tstrcpy(manufacturer, \"(unknown)\");"},{"line_number":1169,"context_line":"\t}"},{"line_number":1170,"context_line":"\tchar product[256 + 1];"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"8e3c11da_9cab70f2","line":1167,"updated":"2023-10-27 14:34:29.000000000","message":"TAB before \"{\"; use space","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1164,"context_line":""},{"line_number":1165,"context_line":"\tchar manufacturer[256 + 1];"},{"line_number":1166,"context_line":"\tif (libusb_get_string_descriptor_ascii(ch347_handle, ch347_device_descriptor.iManufacturer,"},{"line_number":1167,"context_line":"\t\t(unsigned char *)manufacturer, sizeof(manufacturer) - 1) \u003c 0)\t{"},{"line_number":1168,"context_line":"\t\tstrcpy(manufacturer, \"(unknown)\");"},{"line_number":1169,"context_line":"\t}"},{"line_number":1170,"context_line":"\tchar product[256 + 1];"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"ac2ac1f6_346741de","line":1167,"in_reply_to":"8e3c11da_9cab70f2","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1174,"context_line":"\t}"},{"line_number":1175,"context_line":"\tchar serial_number[256 + 1];"},{"line_number":1176,"context_line":"\tif (libusb_get_string_descriptor_ascii(ch347_handle, ch347_device_descriptor.iSerialNumber,"},{"line_number":1177,"context_line":"\t\t(unsigned char *)serial_number, sizeof(serial_number) - 1) \u003c 0)\t{"},{"line_number":1178,"context_line":"\t\tstrcpy(serial_number, \"(unknown)\");"},{"line_number":1179,"context_line":"\t}"},{"line_number":1180,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":22,"id":"75a7ec5b_4ceed389","line":1177,"updated":"2023-10-27 14:34:29.000000000","message":"TAB before \"{\", use space","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1174,"context_line":"\t}"},{"line_number":1175,"context_line":"\tchar serial_number[256 + 1];"},{"line_number":1176,"context_line":"\tif (libusb_get_string_descriptor_ascii(ch347_handle, ch347_device_descriptor.iSerialNumber,"},{"line_number":1177,"context_line":"\t\t(unsigned char *)serial_number, sizeof(serial_number) - 1) \u003c 0)\t{"},{"line_number":1178,"context_line":"\t\tstrcpy(serial_number, \"(unknown)\");"},{"line_number":1179,"context_line":"\t}"},{"line_number":1180,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":22,"id":"897e2d30_dfe6d6ef","line":1177,"in_reply_to":"75a7ec5b_4ceed389","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1329,"context_line":" */"},{"line_number":1330,"context_line":"COMMAND_HANDLER(ch347_handle_vid_pid_command)"},{"line_number":1331,"context_line":"{"},{"line_number":1332,"context_line":"\tif (CMD_ARGC !\u003d 2) {"},{"line_number":1333,"context_line":"\t\tcommand_print(CMD, \"incomplete ch347 vid_pid configuration directive\");"},{"line_number":1334,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1335,"context_line":"\t}"},{"line_number":1336,"context_line":""},{"line_number":1337,"context_line":"\tCOMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], ch347_vids[0]);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"ea52d0b8_2a5b369e","line":1334,"range":{"start_line":1332,"start_character":1,"end_line":1334,"end_character":36},"updated":"2023-10-27 14:34:29.000000000","message":"Simply use:\nif (CMD_ARGC !\u003d 2)\nreturn ERROR_COMMAND_SYNTAX_ERROR;\n\nThe message with command_print will be ignored and the syntax described below in struct command_registration will be printed","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1329,"context_line":" */"},{"line_number":1330,"context_line":"COMMAND_HANDLER(ch347_handle_vid_pid_command)"},{"line_number":1331,"context_line":"{"},{"line_number":1332,"context_line":"\tif (CMD_ARGC !\u003d 2) {"},{"line_number":1333,"context_line":"\t\tcommand_print(CMD, \"incomplete ch347 vid_pid configuration directive\");"},{"line_number":1334,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1335,"context_line":"\t}"},{"line_number":1336,"context_line":""},{"line_number":1337,"context_line":"\tCOMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], ch347_vids[0]);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"97229629_95b492f2","line":1334,"range":{"start_line":1332,"start_character":1,"end_line":1334,"end_character":36},"in_reply_to":"ea52d0b8_2a5b369e","updated":"2023-10-27 23:40:00.000000000","message":"I didn\u0027t know this. Erhan told me that I should use command_print instead of LOG_ERROR. I\u0027ve removed these command_print calls.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1346,"context_line":" * @return Always ERROR_OK"},{"line_number":1347,"context_line":" */"},{"line_number":1348,"context_line":"COMMAND_HANDLER(ch347_trst)"},{"line_number":1349,"context_line":"{"},{"line_number":1350,"context_line":"\tch347_trst_set(false);"},{"line_number":1351,"context_line":"\tjtag_sleep(atoi(CMD_ARGV[0]) * 1000);"},{"line_number":1352,"context_line":"\tch347_trst_set(true);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"9e83abb2_d22e4877","line":1349,"updated":"2023-10-27 14:34:29.000000000","message":"if (CMD_ARGC \u003e 1)\nreturn ERROR_COMMAND_SYNTAX_ERROR;","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1346,"context_line":" * @return Always ERROR_OK"},{"line_number":1347,"context_line":" */"},{"line_number":1348,"context_line":"COMMAND_HANDLER(ch347_trst)"},{"line_number":1349,"context_line":"{"},{"line_number":1350,"context_line":"\tch347_trst_set(false);"},{"line_number":1351,"context_line":"\tjtag_sleep(atoi(CMD_ARGV[0]) * 1000);"},{"line_number":1352,"context_line":"\tch347_trst_set(true);"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"30ec7676_cc485935","line":1349,"in_reply_to":"9e83abb2_d22e4877","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1348,"context_line":"COMMAND_HANDLER(ch347_trst)"},{"line_number":1349,"context_line":"{"},{"line_number":1350,"context_line":"\tch347_trst_set(false);"},{"line_number":1351,"context_line":"\tjtag_sleep(atoi(CMD_ARGV[0]) * 1000);"},{"line_number":1352,"context_line":"\tch347_trst_set(true);"},{"line_number":1353,"context_line":"\treturn ERROR_OK;"},{"line_number":1354,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"00b0b186_a2b1b090","line":1351,"updated":"2023-10-27 14:34:29.000000000","message":"possible access to invalid pointer. Use:\nif (CMD_ARGC \u003d\u003d 1)\njtag_sleep(atoi(CMD_ARGV[0]) * 1000);","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1348,"context_line":"COMMAND_HANDLER(ch347_trst)"},{"line_number":1349,"context_line":"{"},{"line_number":1350,"context_line":"\tch347_trst_set(false);"},{"line_number":1351,"context_line":"\tjtag_sleep(atoi(CMD_ARGV[0]) * 1000);"},{"line_number":1352,"context_line":"\tch347_trst_set(true);"},{"line_number":1353,"context_line":"\treturn ERROR_OK;"},{"line_number":1354,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"3e309204_bc895399","line":1351,"in_reply_to":"00b0b186_a2b1b090","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1360,"context_line":" */"},{"line_number":1361,"context_line":"COMMAND_HANDLER(ch347_handle_device_desc_command)"},{"line_number":1362,"context_line":"{"},{"line_number":1363,"context_line":"\tif (CMD_ARGC \u003d\u003d 1) {"},{"line_number":1364,"context_line":"\t\tfree(ch347_device_desc);"},{"line_number":1365,"context_line":"\t\tch347_device_desc \u003d strdup(CMD_ARGV[0]);"},{"line_number":1366,"context_line":"\t} else {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"cd2c935a_745fd992","line":1363,"updated":"2023-10-27 14:34:29.000000000","message":"also here:\nif (CMD_ARGC !\u003d 1)\nreturn ERROR_COMMAND_SYNTAX_ERROR;","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1360,"context_line":" */"},{"line_number":1361,"context_line":"COMMAND_HANDLER(ch347_handle_device_desc_command)"},{"line_number":1362,"context_line":"{"},{"line_number":1363,"context_line":"\tif (CMD_ARGC \u003d\u003d 1) {"},{"line_number":1364,"context_line":"\t\tfree(ch347_device_desc);"},{"line_number":1365,"context_line":"\t\tch347_device_desc \u003d strdup(CMD_ARGV[0]);"},{"line_number":1366,"context_line":"\t} else {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"dbbcbfe1_f62be446","line":1363,"in_reply_to":"cd2c935a_745fd992","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1383,"context_line":""},{"line_number":1384,"context_line":"\tuint8_t gpio;"},{"line_number":1385,"context_line":"\tif (CMD_ARGV[0][0] \u003d\u003d \u0027n\u0027) {"},{"line_number":1386,"context_line":"\t\tCOMMAND_PARSE_NUMBER(u8, ++CMD_ARGV[0], gpio);"},{"line_number":1387,"context_line":"\t\tch347_activity_led_active_high \u003d false;"},{"line_number":1388,"context_line":"\t\tCMD_ARGV[0]--;"},{"line_number":1389,"context_line":"\t} else {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"885b27db_230cc502","line":1386,"updated":"2023-10-27 14:34:29.000000000","message":"In theory the array CMD_ARGV should be const.\nInstead of incrementing CMD_ARGV[0] and then decrementing it two lines below, use\nCOMMAND_PARSE_NUMBER(u8, \u0026CMD_ARGV[0][1], gpio);","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1383,"context_line":""},{"line_number":1384,"context_line":"\tuint8_t gpio;"},{"line_number":1385,"context_line":"\tif (CMD_ARGV[0][0] \u003d\u003d \u0027n\u0027) {"},{"line_number":1386,"context_line":"\t\tCOMMAND_PARSE_NUMBER(u8, ++CMD_ARGV[0], gpio);"},{"line_number":1387,"context_line":"\t\tch347_activity_led_active_high \u003d false;"},{"line_number":1388,"context_line":"\t\tCMD_ARGV[0]--;"},{"line_number":1389,"context_line":"\t} else {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"e5fdef1f_06e44689","line":1386,"in_reply_to":"885b27db_230cc502","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1393,"context_line":""},{"line_number":1394,"context_line":"\tif (gpio \u003e\u003d GPIO_CNT) {"},{"line_number":1395,"context_line":"\t\tcommand_print(CMD, \"activity_led out of range\");"},{"line_number":1396,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1397,"context_line":"\t} else if (((1 \u003c\u003c gpio) \u0026 USEABLE_GPIOS) \u003d\u003d 0) {"},{"line_number":1398,"context_line":"\t\tcommand_print(CMD, \"activity_led pin not in usable list\");"},{"line_number":1399,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"7963a39d_e91a5f90","line":1396,"updated":"2023-10-27 14:34:29.000000000","message":"here you cannot use ERROR_COMMAND_SYNTAX_ERROR because it will drop the message in command_print().\nreturn ERROR_COMMAND_ARGUMENT_INVALID;\nAlso below at line 1399","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1393,"context_line":""},{"line_number":1394,"context_line":"\tif (gpio \u003e\u003d GPIO_CNT) {"},{"line_number":1395,"context_line":"\t\tcommand_print(CMD, \"activity_led out of range\");"},{"line_number":1396,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1397,"context_line":"\t} else if (((1 \u003c\u003c gpio) \u0026 USEABLE_GPIOS) \u003d\u003d 0) {"},{"line_number":1398,"context_line":"\t\tcommand_print(CMD, \"activity_led pin not in usable list\");"},{"line_number":1399,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"4163c026_d241c03b","line":1396,"in_reply_to":"7963a39d_e91a5f90","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1431,"context_line":"\t\t.handler \u003d \u0026ch347_handle_activity_led_command,"},{"line_number":1432,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":1433,"context_line":"\t\t.help \u003d \"if set this CH347 GPIO pin is the JTAG activity LED; start with n for active low output\","},{"line_number":1434,"context_line":"\t\t.usage \u003d \"n4 or 4\","},{"line_number":1435,"context_line":"\t},"},{"line_number":1436,"context_line":""},{"line_number":1437,"context_line":"\tCOMMAND_REGISTRATION_DONE};"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"1277d32a_eb63ca71","line":1434,"updated":"2023-10-27 14:34:29.000000000","message":"only GPIO 4? This is not an example but the syntax of the command. Maybe:\n.usage \u003d \"[n]gpio_number\",","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":true,"context_lines":[{"line_number":1431,"context_line":"\t\t.handler \u003d \u0026ch347_handle_activity_led_command,"},{"line_number":1432,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":1433,"context_line":"\t\t.help \u003d \"if set this CH347 GPIO pin is the JTAG activity LED; start with n for active low output\","},{"line_number":1434,"context_line":"\t\t.usage \u003d \"n4 or 4\","},{"line_number":1435,"context_line":"\t},"},{"line_number":1436,"context_line":""},{"line_number":1437,"context_line":"\tCOMMAND_REGISTRATION_DONE};"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"286a38d3_c770fda2","line":1434,"in_reply_to":"1277d32a_eb63ca71","updated":"2023-10-27 23:40:00.000000000","message":"I\u0027ve changed this.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"cce68c61b67b50a72b84b7004d4759a0cc2586a2","unresolved":false,"context_lines":[{"line_number":1431,"context_line":"\t\t.handler \u003d \u0026ch347_handle_activity_led_command,"},{"line_number":1432,"context_line":"\t\t.mode \u003d COMMAND_CONFIG,"},{"line_number":1433,"context_line":"\t\t.help \u003d \"if set this CH347 GPIO pin is the JTAG activity LED; start with n for active low output\","},{"line_number":1434,"context_line":"\t\t.usage \u003d \"n4 or 4\","},{"line_number":1435,"context_line":"\t},"},{"line_number":1436,"context_line":""},{"line_number":1437,"context_line":"\tCOMMAND_REGISTRATION_DONE};"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"df332ae4_d908dd41","line":1434,"in_reply_to":"286a38d3_c770fda2","updated":"2023-10-27 23:49:27.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":1515,"context_line":"\tstruct ch347_swd_io *pswd_io \u003d ch347_swd_context.ch347_cmd_buf;"},{"line_number":1516,"context_line":"\tfor (int i \u003d 0; i \u003c CH347_MAX_CMD_BUF; i++, pswd_io++) {"},{"line_number":1517,"context_line":"\t\tINIT_LIST_HEAD(\u0026pswd_io-\u003elist_entry);"},{"line_number":1518,"context_line":"\t\tlist_add_tail(\u0026pswd_io-\u003elist_entry,\t\u0026ch347_swd_context.free_cmd_head);"},{"line_number":1519,"context_line":"\t}"},{"line_number":1520,"context_line":"\treturn ERROR_OK;"},{"line_number":1521,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"367d6da6_f7c8f6c0","line":1518,"updated":"2023-10-27 14:34:29.000000000","message":"TAB between \",\" and \"\u0026\"; use space","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":1515,"context_line":"\tstruct ch347_swd_io *pswd_io \u003d ch347_swd_context.ch347_cmd_buf;"},{"line_number":1516,"context_line":"\tfor (int i \u003d 0; i \u003c CH347_MAX_CMD_BUF; i++, pswd_io++) {"},{"line_number":1517,"context_line":"\t\tINIT_LIST_HEAD(\u0026pswd_io-\u003elist_entry);"},{"line_number":1518,"context_line":"\t\tlist_add_tail(\u0026pswd_io-\u003elist_entry,\t\u0026ch347_swd_context.free_cmd_head);"},{"line_number":1519,"context_line":"\t}"},{"line_number":1520,"context_line":"\treturn ERROR_OK;"},{"line_number":1521,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"d131ec07_57d2643c","line":1518,"in_reply_to":"367d6da6_f7c8f6c0","updated":"2023-10-27 23:40:00.000000000","message":"Done","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"12190b8a9545e273f697d8e76f19ce9340533c43","unresolved":true,"context_lines":[{"line_number":111,"context_line":"#define CH347_CMD_SWD_REG_W\t\t\t\t0xA0 // SWD Interface write reg"},{"line_number":112,"context_line":"#define CH347_CMD_SWD_SEQ_W\t\t\t\t0xA1 // SWD Interface write spec seq"},{"line_number":113,"context_line":"#define CH347_CMD_SWD_REG_R\t\t\t\t0xA2 // SWD Interface read  reg"},{"line_number":114,"context_line":"#define CH347_MAX_SEND_CMD\t\t\t\t0X20 // max send cmd number"},{"line_number":115,"context_line":"#define CH347_MAX_SEND_BUF\t\t\t\t0X200"},{"line_number":116,"context_line":"#define CH347_MAX_RECV_BUF\t\t\t\t0X200"},{"line_number":117,"context_line":"#define CH347_MAX_CMD_BUF\t\t\t\t128"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"a8124894_787ba65f","line":114,"range":{"start_line":114,"start_character":30,"end_line":114,"end_character":34},"updated":"2023-11-03 19:41:11.000000000","message":"Strange: I found by trial and error the maximum should be 19 (decimal). Otherwise CH347 fails badly:\n```\nError: libusb_bulk_write error: LIBUSB_ERROR_NO_DEVICE\n```","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":111,"context_line":"#define CH347_CMD_SWD_REG_W\t\t\t\t0xA0 // SWD Interface write reg"},{"line_number":112,"context_line":"#define CH347_CMD_SWD_SEQ_W\t\t\t\t0xA1 // SWD Interface write spec seq"},{"line_number":113,"context_line":"#define CH347_CMD_SWD_REG_R\t\t\t\t0xA2 // SWD Interface read  reg"},{"line_number":114,"context_line":"#define CH347_MAX_SEND_CMD\t\t\t\t0X20 // max send cmd number"},{"line_number":115,"context_line":"#define CH347_MAX_SEND_BUF\t\t\t\t0X200"},{"line_number":116,"context_line":"#define CH347_MAX_RECV_BUF\t\t\t\t0X200"},{"line_number":117,"context_line":"#define CH347_MAX_CMD_BUF\t\t\t\t128"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"3c8f6ccb_4f884341","line":114,"range":{"start_line":114,"start_character":30,"end_line":114,"end_character":34},"in_reply_to":"a8124894_787ba65f","updated":"2023-11-03 21:33:30.000000000","message":"I\u0027ve changed this to decimal 19. But currently I can\u0027t test the SWD part.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"10e97ec5b6518105504abdd3d01237373045418e","unresolved":true,"context_lines":[{"line_number":769,"context_line":"\t\tch347.scratchpad_idx +\u003d count;"},{"line_number":770,"context_line":"\t\tch347_scratchpad_check_full();"},{"line_number":771,"context_line":"\t} else {"},{"line_number":772,"context_line":"\t\t// make two chunks and recursivly call this function again"},{"line_number":773,"context_line":"\t\tint bytes_to_store \u003d UCMDPKT_DATA_MAX_BYTES_USBHS - ch347.scratchpad_idx;"},{"line_number":774,"context_line":"\t\tint bytes_remaining \u003d count - bytes_to_store;"},{"line_number":775,"context_line":"\t\tch347_scratchpad_add_bytes(bytes, bytes_to_store);"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"7482cf07_3e805e12","line":772,"updated":"2023-11-03 10:34:01.000000000","message":"Use a cycle instead of recursion","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":769,"context_line":"\t\tch347.scratchpad_idx +\u003d count;"},{"line_number":770,"context_line":"\t\tch347_scratchpad_check_full();"},{"line_number":771,"context_line":"\t} else {"},{"line_number":772,"context_line":"\t\t// make two chunks and recursivly call this function again"},{"line_number":773,"context_line":"\t\tint bytes_to_store \u003d UCMDPKT_DATA_MAX_BYTES_USBHS - ch347.scratchpad_idx;"},{"line_number":774,"context_line":"\t\tint bytes_remaining \u003d count - bytes_to_store;"},{"line_number":775,"context_line":"\t\tch347_scratchpad_add_bytes(bytes, bytes_to_store);"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"de500fb2_529db528","line":772,"in_reply_to":"7482cf07_3e805e12","updated":"2023-11-03 21:33:30.000000000","message":"OK, I\u0027ve changed this. This makes the code less complicated.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"10e97ec5b6518105504abdd3d01237373045418e","unresolved":true,"context_lines":[{"line_number":833,"context_line":"\t\tif (tap_state_transition(tap_get_state(), false) \u003d\u003d cmd-\u003epath[i])"},{"line_number":834,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(0);"},{"line_number":835,"context_line":"\t\tif (tap_state_transition(tap_get_state(), true) \u003d\u003d cmd-\u003epath[i])"},{"line_number":836,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(1);"},{"line_number":837,"context_line":"\t\ttap_set_state(cmd-\u003epath[i]);"},{"line_number":838,"context_line":"\t}"},{"line_number":839,"context_line":"\tch347_scratchpad_add_idle_clock();"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"dbc464ca_02c7b4db","line":836,"updated":"2023-11-03 10:34:01.000000000","message":"If no transition possible, at least log error","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":833,"context_line":"\t\tif (tap_state_transition(tap_get_state(), false) \u003d\u003d cmd-\u003epath[i])"},{"line_number":834,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(0);"},{"line_number":835,"context_line":"\t\tif (tap_state_transition(tap_get_state(), true) \u003d\u003d cmd-\u003epath[i])"},{"line_number":836,"context_line":"\t\t\tch347_scratchpad_add_clock_tms(1);"},{"line_number":837,"context_line":"\t\ttap_set_state(cmd-\u003epath[i]);"},{"line_number":838,"context_line":"\t}"},{"line_number":839,"context_line":"\tch347_scratchpad_add_idle_clock();"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"7aa096ce_7333be29","line":836,"in_reply_to":"dbc464ca_02c7b4db","updated":"2023-11-03 21:33:30.000000000","message":"Good idea. I\u0027ve also made it to an if/else if/else clause.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"da2e2a6f353661f57026c20c734d3e4ad5cf863d","unresolved":true,"context_lines":[{"line_number":945,"context_line":"\t\tch347_scratchpad_add_move_state(TAP_IDLE, 0);"},{"line_number":946,"context_line":""},{"line_number":947,"context_line":"\tuint8_t tms_value \u003d 0;"},{"line_number":948,"context_line":"\tch347_scratchpad_add_tms_change(\u0026tms_value, cycles, 1);"},{"line_number":949,"context_line":""},{"line_number":950,"context_line":"\tch347_scratchpad_add_write_read(NULL, NULL, cycles, SCAN_OUT);"},{"line_number":951,"context_line":"\tch347_scratchpad_add_move_state(state, 0);"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"abcc2b4c_378cfecc","line":948,"range":{"start_line":948,"start_character":45,"end_line":948,"end_character":51},"updated":"2023-11-02 22:30:36.000000000","message":"Broken for cycles \u003e 8","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":945,"context_line":"\t\tch347_scratchpad_add_move_state(TAP_IDLE, 0);"},{"line_number":946,"context_line":""},{"line_number":947,"context_line":"\tuint8_t tms_value \u003d 0;"},{"line_number":948,"context_line":"\tch347_scratchpad_add_tms_change(\u0026tms_value, cycles, 1);"},{"line_number":949,"context_line":""},{"line_number":950,"context_line":"\tch347_scratchpad_add_write_read(NULL, NULL, cycles, SCAN_OUT);"},{"line_number":951,"context_line":"\tch347_scratchpad_add_move_state(state, 0);"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"aca2f39e_307844dd","line":948,"range":{"start_line":948,"start_character":45,"end_line":948,"end_character":51},"in_reply_to":"abcc2b4c_378cfecc","updated":"2023-11-03 21:33:30.000000000","message":"You are right. I\u0027ve changed this to a call to the new ch347_scratchpad_add_stableclocks function. But currently I can\u0027t test this because the ESP32 doesn\u0027t use it.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"da2e2a6f353661f57026c20c734d3e4ad5cf863d","unresolved":true,"context_lines":[{"line_number":947,"context_line":"\tuint8_t tms_value \u003d 0;"},{"line_number":948,"context_line":"\tch347_scratchpad_add_tms_change(\u0026tms_value, cycles, 1);"},{"line_number":949,"context_line":""},{"line_number":950,"context_line":"\tch347_scratchpad_add_write_read(NULL, NULL, cycles, SCAN_OUT);"},{"line_number":951,"context_line":"\tch347_scratchpad_add_move_state(state, 0);"},{"line_number":952,"context_line":"}"},{"line_number":953,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":24,"id":"181c431a_dd62c5bb","line":950,"range":{"start_line":950,"start_character":1,"end_line":950,"end_character":32},"updated":"2023-11-02 22:30:36.000000000","message":"Cannot be used here as it sets TMS to move from the shift state to exit state.\n\nI recommend to implement ch347_scratchpad_add_stableclocks()\nand call it instead of lines 947-950.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":947,"context_line":"\tuint8_t tms_value \u003d 0;"},{"line_number":948,"context_line":"\tch347_scratchpad_add_tms_change(\u0026tms_value, cycles, 1);"},{"line_number":949,"context_line":""},{"line_number":950,"context_line":"\tch347_scratchpad_add_write_read(NULL, NULL, cycles, SCAN_OUT);"},{"line_number":951,"context_line":"\tch347_scratchpad_add_move_state(state, 0);"},{"line_number":952,"context_line":"}"},{"line_number":953,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":24,"id":"66a1093c_60f0c9fe","line":950,"range":{"start_line":950,"start_character":1,"end_line":950,"end_character":32},"in_reply_to":"181c431a_dd62c5bb","updated":"2023-11-03 21:33:30.000000000","message":"I\u0027ve implemented this.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"da2e2a6f353661f57026c20c734d3e4ad5cf863d","unresolved":true,"context_lines":[{"line_number":1098,"context_line":"\t\t\t\t\t  cmd-\u003ecmd.runtest-\u003eend_state);"},{"line_number":1099,"context_line":"\t\t\tbreak;"},{"line_number":1100,"context_line":"\t\tcase JTAG_STABLECLOCKS:"},{"line_number":1101,"context_line":"\t\t\tch347_scratchpad_add_write_read(NULL, NULL, cmd-\u003ecmd.stableclocks-\u003enum_cycles, SCAN_OUT);"},{"line_number":1102,"context_line":"\t\t\tbreak;"},{"line_number":1103,"context_line":"\t\tcase JTAG_TLR_RESET:"},{"line_number":1104,"context_line":"\t\t\tch347_scratchpad_add_move_state(cmd-\u003ecmd.statemove-\u003eend_state, 0);"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"06a85d83_0bb1fb64","line":1101,"range":{"start_line":1101,"start_character":3,"end_line":1101,"end_character":34},"updated":"2023-11-02 22:30:36.000000000","message":"Cannot be used for STABLECLOCKS as it sets TMS at the last bit to move from the shift state to exit state.\nMoreover we should keep TMS_H if state is TAP_RESET","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":1098,"context_line":"\t\t\t\t\t  cmd-\u003ecmd.runtest-\u003eend_state);"},{"line_number":1099,"context_line":"\t\t\tbreak;"},{"line_number":1100,"context_line":"\t\tcase JTAG_STABLECLOCKS:"},{"line_number":1101,"context_line":"\t\t\tch347_scratchpad_add_write_read(NULL, NULL, cmd-\u003ecmd.stableclocks-\u003enum_cycles, SCAN_OUT);"},{"line_number":1102,"context_line":"\t\t\tbreak;"},{"line_number":1103,"context_line":"\t\tcase JTAG_TLR_RESET:"},{"line_number":1104,"context_line":"\t\t\tch347_scratchpad_add_move_state(cmd-\u003ecmd.statemove-\u003eend_state, 0);"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"7b1f3227_8314c3f9","line":1101,"range":{"start_line":1101,"start_character":3,"end_line":1101,"end_character":34},"in_reply_to":"06a85d83_0bb1fb64","updated":"2023-11-03 21:33:30.000000000","message":"Here I call also the new ch347_scratchpad_add_stableclocks function.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"880ddbfa62e4500e960b049512524426cc807178","unresolved":true,"context_lines":[{"line_number":1483,"context_line":"\t\tch347.tdi_pin \u003d TDI_L;"},{"line_number":1484,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.cmd_queue);"},{"line_number":1487,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.scan_queue);"},{"line_number":1488,"context_line":""},{"line_number":1489,"context_line":"\t\tch347.pack_size \u003d UNSET;"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"1460d8af_29d66313","line":1486,"range":{"start_line":1486,"start_character":2,"end_line":1486,"end_character":35},"updated":"2023-11-02 17:28:58.000000000","message":"Initialized in JTAG mode only but tested in\nch347_cmd_transmit_queue() called by ch347_cmd_start_next() called by ch347_swd_init_cmd()","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":1483,"context_line":"\t\tch347.tdi_pin \u003d TDI_L;"},{"line_number":1484,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.cmd_queue);"},{"line_number":1487,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.scan_queue);"},{"line_number":1488,"context_line":""},{"line_number":1489,"context_line":"\t\tch347.pack_size \u003d UNSET;"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"62a2e2bf_07e6a493","line":1486,"range":{"start_line":1486,"start_character":2,"end_line":1486,"end_character":35},"in_reply_to":"1460d8af_29d66313","updated":"2023-11-03 21:33:30.000000000","message":"I do this now in both (JTAG and SWD) cases.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"12190b8a9545e273f697d8e76f19ce9340533c43","unresolved":true,"context_lines":[{"line_number":1484,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.cmd_queue);"},{"line_number":1487,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.scan_queue);"},{"line_number":1488,"context_line":""},{"line_number":1489,"context_line":"\t\tch347.pack_size \u003d UNSET;"},{"line_number":1490,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":24,"id":"a6fe46fa_a8e44efb","line":1487,"range":{"start_line":1487,"start_character":2,"end_line":1487,"end_character":36},"updated":"2023-11-03 19:41:11.000000000","message":"This is tested in SWD as well. Please recheck if it\u0027s necessary","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":1484,"context_line":"\t\tch347.trst_pin \u003d TRST_H;"},{"line_number":1485,"context_line":""},{"line_number":1486,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.cmd_queue);"},{"line_number":1487,"context_line":"\t\tINIT_LIST_HEAD(\u0026ch347.scan_queue);"},{"line_number":1488,"context_line":""},{"line_number":1489,"context_line":"\t\tch347.pack_size \u003d UNSET;"},{"line_number":1490,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":24,"id":"ee611acf_7ecf851d","line":1487,"range":{"start_line":1487,"start_character":2,"end_line":1487,"end_character":36},"in_reply_to":"a6fe46fa_a8e44efb","updated":"2023-11-03 21:33:30.000000000","message":"Now I\u0027ve do this in both (JTAG and SWD) cases.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"12190b8a9545e273f697d8e76f19ce9340533c43","unresolved":true,"context_lines":[{"line_number":1549,"context_line":"\t\treturn;"},{"line_number":1550,"context_line":"\t}"},{"line_number":1551,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":1552,"context_line":"\tdo {"},{"line_number":1553,"context_line":"\t\tlength \u003d CH347_MAX_RECV_BUF - ch347_swd_context.recv_len;"},{"line_number":1554,"context_line":"\t\tif (ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length) !\u003d ERROR_OK) {"},{"line_number":1555,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":1556,"context_line":"\t\t\tLOG_DEBUG(\"CH347ReadData error\");"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"e0a1f3b6_ebee137b","line":1553,"range":{"start_line":1552,"start_character":1,"end_line":1553,"end_character":59},"updated":"2023-11-03 19:41:11.000000000","message":"I removed the loop and set the length to read to ch347_swd_context.need_recv_len\nI\u0027m not sure if it\u0027s correct, at least SWD works...","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"c4c7cd77f26d7cd2da76b0454babc0a3679f1462","unresolved":false,"context_lines":[{"line_number":1549,"context_line":"\t\treturn;"},{"line_number":1550,"context_line":"\t}"},{"line_number":1551,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":1552,"context_line":"\tdo {"},{"line_number":1553,"context_line":"\t\tlength \u003d CH347_MAX_RECV_BUF - ch347_swd_context.recv_len;"},{"line_number":1554,"context_line":"\t\tif (ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length) !\u003d ERROR_OK) {"},{"line_number":1555,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":1556,"context_line":"\t\t\tLOG_DEBUG(\"CH347ReadData error\");"}],"source_content_type":"text/x-csrc","patch_set":24,"id":"8ae412a1_e0fb0459","line":1553,"range":{"start_line":1552,"start_character":1,"end_line":1553,"end_character":59},"in_reply_to":"e0a1f3b6_ebee137b","updated":"2023-11-03 21:33:30.000000000","message":"In ch347_read_data there is already such a loop. No need for a second one. I\u0027ve changed this as you suggested.","commit_id":"0015003e227c575386cef55026d9addf1839a974"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"286b8c6deeaf0a71db09e5dc9ce1270285e0be97","unresolved":true,"context_lines":[{"line_number":1227,"context_line":" */"},{"line_number":1228,"context_line":"static int ch347_quit(void)"},{"line_number":1229,"context_line":"{"},{"line_number":1230,"context_line":"\tif (dev_is_opened) {"},{"line_number":1231,"context_line":"\t\t// on close set the LED on, because the state without JTAG is on"},{"line_number":1232,"context_line":"\t\tch347_activity_led_set(LED_ON);"},{"line_number":1233,"context_line":"\t\tch347_cmd_transmit_queue();"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"e4dd19fa_f41ed39e","line":1230,"updated":"2023-11-04 14:35:00.000000000","message":"adapter_driver::quit() is only called if adapter_driver::init() returns ERROR_OK.\nIt means you can drop the variable dev_is_opened and the test here","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89d04719406dd2b6361d630a2a2ab4c4eebdbe7c","unresolved":false,"context_lines":[{"line_number":1227,"context_line":" */"},{"line_number":1228,"context_line":"static int ch347_quit(void)"},{"line_number":1229,"context_line":"{"},{"line_number":1230,"context_line":"\tif (dev_is_opened) {"},{"line_number":1231,"context_line":"\t\t// on close set the LED on, because the state without JTAG is on"},{"line_number":1232,"context_line":"\t\tch347_activity_led_set(LED_ON);"},{"line_number":1233,"context_line":"\t\tch347_cmd_transmit_queue();"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"18cfcb6f_b774f66d","line":1230,"in_reply_to":"e4dd19fa_f41ed39e","updated":"2023-11-06 00:07:27.000000000","message":"I\u0027ve removed this variable and the check.","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"286b8c6deeaf0a71db09e5dc9ce1270285e0be97","unresolved":true,"context_lines":[{"line_number":1448,"context_line":"\t\t.usage \u003d \"[n]gpio_number\","},{"line_number":1449,"context_line":"\t},"},{"line_number":1450,"context_line":""},{"line_number":1451,"context_line":"\tCOMMAND_REGISTRATION_DONE};"},{"line_number":1452,"context_line":""},{"line_number":1453,"context_line":"static const struct command_registration ch347_command_handlers[] \u003d {"},{"line_number":1454,"context_line":"\t{"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"8ab6de66_d12c7a28","line":1451,"updated":"2023-11-04 14:35:00.000000000","message":"please move the \"};\" at new line without indentation TAB\nand remove the empty line before COMMAND_REGISTRATION_DONE","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89d04719406dd2b6361d630a2a2ab4c4eebdbe7c","unresolved":false,"context_lines":[{"line_number":1448,"context_line":"\t\t.usage \u003d \"[n]gpio_number\","},{"line_number":1449,"context_line":"\t},"},{"line_number":1450,"context_line":""},{"line_number":1451,"context_line":"\tCOMMAND_REGISTRATION_DONE};"},{"line_number":1452,"context_line":""},{"line_number":1453,"context_line":"static const struct command_registration ch347_command_handlers[] \u003d {"},{"line_number":1454,"context_line":"\t{"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"46e77036_23f087e2","line":1451,"in_reply_to":"8ab6de66_d12c7a28","updated":"2023-11-06 00:07:27.000000000","message":"Done","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"286b8c6deeaf0a71db09e5dc9ce1270285e0be97","unresolved":true,"context_lines":[{"line_number":1458,"context_line":"\t\t.chain \u003d ch347_subcommand_handlers,"},{"line_number":1459,"context_line":"\t\t.usage \u003d \"\","},{"line_number":1460,"context_line":"\t},"},{"line_number":1461,"context_line":"\tCOMMAND_REGISTRATION_DONE};"},{"line_number":1462,"context_line":""},{"line_number":1463,"context_line":"/**"},{"line_number":1464,"context_line":" * @brief swd init function"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"376bf3de_245bd3fa","line":1461,"updated":"2023-11-04 14:35:00.000000000","message":"same here","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89d04719406dd2b6361d630a2a2ab4c4eebdbe7c","unresolved":false,"context_lines":[{"line_number":1458,"context_line":"\t\t.chain \u003d ch347_subcommand_handlers,"},{"line_number":1459,"context_line":"\t\t.usage \u003d \"\","},{"line_number":1460,"context_line":"\t},"},{"line_number":1461,"context_line":"\tCOMMAND_REGISTRATION_DONE};"},{"line_number":1462,"context_line":""},{"line_number":1463,"context_line":"/**"},{"line_number":1464,"context_line":" * @brief swd init function"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"8b18990b_ae048ebd","line":1461,"in_reply_to":"376bf3de_245bd3fa","updated":"2023-11-06 00:07:27.000000000","message":"Done","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"286b8c6deeaf0a71db09e5dc9ce1270285e0be97","unresolved":true,"context_lines":[{"line_number":1481,"context_line":"\tint err_code \u003d ch347_open_device();"},{"line_number":1482,"context_line":"\tdev_is_opened \u003d err_code \u003d\u003d ERROR_OK;"},{"line_number":1483,"context_line":""},{"line_number":1484,"context_line":"\tif (!dev_is_opened) {"},{"line_number":1485,"context_line":"\t\tLOG_ERROR(\"CH347 open error\");"},{"line_number":1486,"context_line":"\t\treturn err_code;"},{"line_number":1487,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"5a859bb3_5207912e","line":1484,"updated":"2023-11-04 14:35:00.000000000","message":"With dev_is_opened not needed anymore, here simply\nint retval \u003d ch347_open_device();\nif (retval !\u003d ERROR_OK) {\nLOG_ERROR(\"CH347 open error\");\nreturn retval;\n}","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89d04719406dd2b6361d630a2a2ab4c4eebdbe7c","unresolved":false,"context_lines":[{"line_number":1481,"context_line":"\tint err_code \u003d ch347_open_device();"},{"line_number":1482,"context_line":"\tdev_is_opened \u003d err_code \u003d\u003d ERROR_OK;"},{"line_number":1483,"context_line":""},{"line_number":1484,"context_line":"\tif (!dev_is_opened) {"},{"line_number":1485,"context_line":"\t\tLOG_ERROR(\"CH347 open error\");"},{"line_number":1486,"context_line":"\t\treturn err_code;"},{"line_number":1487,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"e3eed8f0_3655f123","line":1484,"in_reply_to":"5a859bb3_5207912e","updated":"2023-11-06 00:07:27.000000000","message":"Done","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"286b8c6deeaf0a71db09e5dc9ce1270285e0be97","unresolved":true,"context_lines":[{"line_number":1502,"context_line":"\tif (!swd_mode)"},{"line_number":1503,"context_line":"\t\ttap_set_state(TAP_RESET);"},{"line_number":1504,"context_line":"\telse"},{"line_number":1505,"context_line":"\t\tch347_swd_init_cmd();"},{"line_number":1506,"context_line":""},{"line_number":1507,"context_line":"\treturn ERROR_OK;"},{"line_number":1508,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"2c5b71e0_3561f874","line":1505,"updated":"2023-11-04 14:35:00.000000000","message":"The code does not propagate the errors. This is a general comment valid almost everywhere in this file.\nHere we should receive an error when SWD initialization fails and return the error code to the caller.","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"89d04719406dd2b6361d630a2a2ab4c4eebdbe7c","unresolved":false,"context_lines":[{"line_number":1502,"context_line":"\tif (!swd_mode)"},{"line_number":1503,"context_line":"\t\ttap_set_state(TAP_RESET);"},{"line_number":1504,"context_line":"\telse"},{"line_number":1505,"context_line":"\t\tch347_swd_init_cmd();"},{"line_number":1506,"context_line":""},{"line_number":1507,"context_line":"\treturn ERROR_OK;"},{"line_number":1508,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":26,"id":"c5d5b4e0_35cd9975","line":1505,"in_reply_to":"2c5b71e0_3561f874","updated":"2023-11-06 00:07:27.000000000","message":"I\u0027ve changed this here and added also in other (not all) places a error code return value. Should I also propagate malloc errors?\nch347_swd_init_cmd returns now always ERROR_OK, because I don\u0027t know how to check it SWD init was successful.","commit_id":"218767764ee3f2c052f19eeafa1eccf55af090ac"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"5cff61ec1e58b361d0e3ba75209a17f63d4eff80","unresolved":true,"context_lines":[{"line_number":111,"context_line":"#define CH347_CMD_SWD_REG_W\t\t\t\t0xA0 // SWD Interface write reg"},{"line_number":112,"context_line":"#define CH347_CMD_SWD_SEQ_W\t\t\t\t0xA1 // SWD Interface write spec seq"},{"line_number":113,"context_line":"#define CH347_CMD_SWD_REG_R\t\t\t\t0xA2 // SWD Interface read  reg"},{"line_number":114,"context_line":"#define CH347_MAX_SEND_CMD\t\t\t\t19 // max send cmd number"},{"line_number":115,"context_line":"#define CH347_MAX_SEND_BUF\t\t\t\t0X200"},{"line_number":116,"context_line":"#define CH347_MAX_RECV_BUF\t\t\t\t0X200"},{"line_number":117,"context_line":"#define CH347_MAX_CMD_BUF\t\t\t\t128"}],"source_content_type":"text/x-csrc","patch_set":27,"id":"1319a20f_087118e1","line":114,"range":{"start_line":114,"start_character":8,"end_line":114,"end_character":32},"updated":"2023-11-06 17:51:52.000000000","message":"This parameter is much more peculiar then it looked.\n\nIn fact this is a stupid workaround of the adapter firmware problem:\nthe adapter doesn\u0027t respond to USB requests when processing SWD communication.\nUSB OUT gets acked correctly and the adapter starts interpreting the packet. Concurrently USB hosts sends USB IN poll/request. The adapter reply is delayed until the packet processing is finished. If the delay is longer than 8 ms, the USB host (in my setup a PC with Ubuntu) regards it as USB device disconnect. I have no idea if this timeout is dictated by the USB specs or is configurable somehow.\n\nActually there is no fixed limit of number of commands, the limit heavily depends on time their processing consumes. The only working solution is to keep track of expected time needed for SWD processing on SWD clock basis and run the queue before we exceed the time limit.\n\nWith implemented SWD processing time limit SWD finally works reliably\nfor adapter speeds 20 - 1000 kHz and dap memaccess delay values 2 - 255\n\nBTW the SWD load/dump speeds increased to ~60 KiB/s @ adapter speed 1 MHz due to longer packets, we are at 90% of the theoretical SWD speed at this clock.\n\nI made lot of changes in SWD code. I\u0027ll send them as a separate patch.","commit_id":"8c1ec6ae4c730cc42f924fe849c4c4e19983c680"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"487df34aca21fc72ef414f1b420bc2ab4aae3113","unresolved":false,"context_lines":[{"line_number":111,"context_line":"#define CH347_CMD_SWD_REG_W\t\t\t\t0xA0 // SWD Interface write reg"},{"line_number":112,"context_line":"#define CH347_CMD_SWD_SEQ_W\t\t\t\t0xA1 // SWD Interface write spec seq"},{"line_number":113,"context_line":"#define CH347_CMD_SWD_REG_R\t\t\t\t0xA2 // SWD Interface read  reg"},{"line_number":114,"context_line":"#define CH347_MAX_SEND_CMD\t\t\t\t19 // max send cmd number"},{"line_number":115,"context_line":"#define CH347_MAX_SEND_BUF\t\t\t\t0X200"},{"line_number":116,"context_line":"#define CH347_MAX_RECV_BUF\t\t\t\t0X200"},{"line_number":117,"context_line":"#define CH347_MAX_CMD_BUF\t\t\t\t128"}],"source_content_type":"text/x-csrc","patch_set":27,"id":"3480dea9_dcf7755c","line":114,"range":{"start_line":114,"start_character":8,"end_line":114,"end_character":32},"in_reply_to":"1319a20f_087118e1","updated":"2023-11-06 21:13:28.000000000","message":"Good to hear, that you can enhance the SWD part of the driver. I\u0027m looking forward to your patch.","commit_id":"8c1ec6ae4c730cc42f924fe849c4c4e19983c680"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7aead640f11c9b4c5051007c513b4a2d798b1d50","unresolved":true,"context_lines":[{"line_number":1569,"context_line":"\t}"},{"line_number":1570,"context_line":""},{"line_number":1571,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":1572,"context_line":"\tlength \u003d ch347_swd_context.recv_len;"},{"line_number":1573,"context_line":"\tif (ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length) !\u003d ERROR_OK) {"},{"line_number":1574,"context_line":"\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":1575,"context_line":"\t\tLOG_DEBUG(\"CH347ReadData error\");"}],"source_content_type":"text/x-csrc","patch_set":27,"id":"96443e60_d0b03e38","line":1572,"range":{"start_line":1572,"start_character":28,"end_line":1572,"end_character":36},"updated":"2023-11-08 13:42:51.000000000","message":"need_recv_len","commit_id":"8c1ec6ae4c730cc42f924fe849c4c4e19983c680"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"bd0132230eb80357f30ff7f6a55a8e3f624071e2","unresolved":false,"context_lines":[{"line_number":1569,"context_line":"\t}"},{"line_number":1570,"context_line":""},{"line_number":1571,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":1572,"context_line":"\tlength \u003d ch347_swd_context.recv_len;"},{"line_number":1573,"context_line":"\tif (ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length) !\u003d ERROR_OK) {"},{"line_number":1574,"context_line":"\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":1575,"context_line":"\t\tLOG_DEBUG(\"CH347ReadData error\");"}],"source_content_type":"text/x-csrc","patch_set":27,"id":"df1a8191_a1665464","line":1572,"range":{"start_line":1572,"start_character":28,"end_line":1572,"end_character":36},"in_reply_to":"96443e60_d0b03e38","updated":"2023-11-09 21:53:45.000000000","message":"Changed.","commit_id":"8c1ec6ae4c730cc42f924fe849c4c4e19983c680"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"799aa3cb01c6133a84ab7a373aecb7e337ceb158","unresolved":true,"context_lines":[{"line_number":19,"context_line":" *                                                                         *"},{"line_number":20,"context_line":" *            _____________                                                *"},{"line_number":21,"context_line":" *           |             |____JTAG/SWD (TDO,TDI,TMS,TCK,TRST)            *"},{"line_number":22,"context_line":" *      USB__|   CH347T/F  |                                               *"},{"line_number":23,"context_line":" *           |_____________|____UART(TXD1,RXD1,RTS1,CTS1,DTR1)             *"},{"line_number":24,"context_line":" *            ______|______                                                *"},{"line_number":25,"context_line":" *           |             |                                               *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"62d32b7b_6f8b6e28","line":22,"range":{"start_line":22,"start_character":17,"end_line":22,"end_character":25},"updated":"2023-12-08 08:49:46.000000000","message":"Far as I Know, the CH347F has made some updates to the packaging of the CH347T. The CH347F chip does not require additional mode selection, and it supports all interface functions by default.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"551f064889eb557272b04c7a97ded18ed6d33db6","unresolved":false,"context_lines":[{"line_number":19,"context_line":" *                                                                         *"},{"line_number":20,"context_line":" *            _____________                                                *"},{"line_number":21,"context_line":" *           |             |____JTAG/SWD (TDO,TDI,TMS,TCK,TRST)            *"},{"line_number":22,"context_line":" *      USB__|   CH347T/F  |                                               *"},{"line_number":23,"context_line":" *           |_____________|____UART(TXD1,RXD1,RTS1,CTS1,DTR1)             *"},{"line_number":24,"context_line":" *            ______|______                                                *"},{"line_number":25,"context_line":" *           |             |                                               *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"ea79d82e_649716a5","line":22,"range":{"start_line":22,"start_character":17,"end_line":22,"end_character":25},"in_reply_to":"4fde32c8_b0605e1b","updated":"2023-12-13 06:40:47.000000000","message":"Done","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a57ace5ecfe92c788b6d43529aa45072da632a25","unresolved":true,"context_lines":[{"line_number":19,"context_line":" *                                                                         *"},{"line_number":20,"context_line":" *            _____________                                                *"},{"line_number":21,"context_line":" *           |             |____JTAG/SWD (TDO,TDI,TMS,TCK,TRST)            *"},{"line_number":22,"context_line":" *      USB__|   CH347T/F  |                                               *"},{"line_number":23,"context_line":" *           |_____________|____UART(TXD1,RXD1,RTS1,CTS1,DTR1)             *"},{"line_number":24,"context_line":" *            ______|______                                                *"},{"line_number":25,"context_line":" *           |             |                                               *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"4fde32c8_b0605e1b","line":22,"range":{"start_line":22,"start_character":17,"end_line":22,"end_character":25},"in_reply_to":"62d32b7b_6f8b6e28","updated":"2023-12-08 09:14:46.000000000","message":"Good to know.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"799aa3cb01c6133a84ab7a373aecb7e337ceb158","unresolved":true,"context_lines":[{"line_number":26,"context_line":" *           | 8 MHz XTAL  |                                               *"},{"line_number":27,"context_line":" *           |_____________|                                               *"},{"line_number":28,"context_line":" *                                                                         *"},{"line_number":29,"context_line":" *   This CH347 driver is only tested for the CH347T chip in mode 3.       *"},{"line_number":30,"context_line":" *   The CH347 datasheet mention another chip the CH347F which was not     *"},{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"130ae87f_7a8c7f97","line":29,"range":{"start_line":29,"start_character":5,"end_line":29,"end_character":68},"updated":"2023-12-08 08:49:46.000000000","message":"Same as above. According to some of my tests on the 347F, the driver works fine.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a57ace5ecfe92c788b6d43529aa45072da632a25","unresolved":true,"context_lines":[{"line_number":26,"context_line":" *           | 8 MHz XTAL  |                                               *"},{"line_number":27,"context_line":" *           |_____________|                                               *"},{"line_number":28,"context_line":" *                                                                         *"},{"line_number":29,"context_line":" *   This CH347 driver is only tested for the CH347T chip in mode 3.       *"},{"line_number":30,"context_line":" *   The CH347 datasheet mention another chip the CH347F which was not     *"},{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"b742ab0e_20381160","line":29,"range":{"start_line":29,"start_character":5,"end_line":29,"end_character":68},"in_reply_to":"130ae87f_7a8c7f97","updated":"2023-12-08 09:14:46.000000000","message":"Can I buy the CH347F somewhere? Or can you provide samples of this chip?","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b8eb0dbfc679870ac3b10592485ea9246407440e","unresolved":true,"context_lines":[{"line_number":26,"context_line":" *           | 8 MHz XTAL  |                                               *"},{"line_number":27,"context_line":" *           |_____________|                                               *"},{"line_number":28,"context_line":" *                                                                         *"},{"line_number":29,"context_line":" *   This CH347 driver is only tested for the CH347T chip in mode 3.       *"},{"line_number":30,"context_line":" *   The CH347 datasheet mention another chip the CH347F which was not     *"},{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"fbea7d69_241c9fd0","line":29,"range":{"start_line":29,"start_character":5,"end_line":29,"end_character":68},"in_reply_to":"98aa8ebf_aabad97a","updated":"2023-12-11 08:09:11.000000000","message":"Matthias, if you contact them, as a customer you could also ask for extra documentation. Even in Chinese language; Google translator is good enough for techinal cods","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"46c3afbb0e11bfa42e0d3a067ef5cac0c862d0f3","unresolved":true,"context_lines":[{"line_number":26,"context_line":" *           | 8 MHz XTAL  |                                               *"},{"line_number":27,"context_line":" *           |_____________|                                               *"},{"line_number":28,"context_line":" *                                                                         *"},{"line_number":29,"context_line":" *   This CH347 driver is only tested for the CH347T chip in mode 3.       *"},{"line_number":30,"context_line":" *   The CH347 datasheet mention another chip the CH347F which was not     *"},{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"98aa8ebf_aabad97a","line":29,"range":{"start_line":29,"start_character":5,"end_line":29,"end_character":68},"in_reply_to":"b742ab0e_20381160","updated":"2023-12-11 05:25:03.000000000","message":"I think contact the sales company via email(sales@wch.cn).","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"551f064889eb557272b04c7a97ded18ed6d33db6","unresolved":false,"context_lines":[{"line_number":26,"context_line":" *           | 8 MHz XTAL  |                                               *"},{"line_number":27,"context_line":" *           |_____________|                                               *"},{"line_number":28,"context_line":" *                                                                         *"},{"line_number":29,"context_line":" *   This CH347 driver is only tested for the CH347T chip in mode 3.       *"},{"line_number":30,"context_line":" *   The CH347 datasheet mention another chip the CH347F which was not     *"},{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"7dbc58fa_ff4e9b69","line":29,"range":{"start_line":29,"start_character":5,"end_line":29,"end_character":68},"in_reply_to":"fbea7d69_241c9fd0","updated":"2023-12-13 06:40:47.000000000","message":"Done","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"5dcee1c3a08510cb6342e08c2a38a4059f32874b","unresolved":true,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"#define CH347_EPOUT\t\t\t\t\t\t0x06u // the usb endpoint number for writing"},{"line_number":120,"context_line":"#define CH347_EPIN\t\t\t\t\t\t0x86u // the usb endpoint number for reading"},{"line_number":121,"context_line":"#define CH347_MPHSI_INTERFACE\t\t\t2 // the JTAG interface is number 2"},{"line_number":122,"context_line":"#define USB_WRITE_TIMEOUT\t\t\t\t500\t// write timeout in milliseconds"},{"line_number":123,"context_line":"#define USB_READ_TIMEOUT\t\t\t\t500 // read timeout in milliseconds"},{"line_number":124,"context_line":"#define BYTEWISE_MODE_VERSION\t\t\t0x241 /* BCD version for devices that can use bytewise mode"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"f9c07612_fe24b639","line":121,"range":{"start_line":121,"start_character":0,"end_line":121,"end_character":67},"updated":"2024-04-11 02:00:50.000000000","message":"The CH347T jtag interface is number 2,and CH347F interface is 4,so it is necessary to make a judgment based on PID in the device opening function.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"1c5222f3eb7545e1523d682df91eb5f9dcf067ba","unresolved":true,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"#define CH347_EPOUT\t\t\t\t\t\t0x06u // the usb endpoint number for writing"},{"line_number":120,"context_line":"#define CH347_EPIN\t\t\t\t\t\t0x86u // the usb endpoint number for reading"},{"line_number":121,"context_line":"#define CH347_MPHSI_INTERFACE\t\t\t2 // the JTAG interface is number 2"},{"line_number":122,"context_line":"#define USB_WRITE_TIMEOUT\t\t\t\t500\t// write timeout in milliseconds"},{"line_number":123,"context_line":"#define USB_READ_TIMEOUT\t\t\t\t500 // read timeout in milliseconds"},{"line_number":124,"context_line":"#define BYTEWISE_MODE_VERSION\t\t\t0x241 /* BCD version for devices that can use bytewise mode"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"e14dcf7e_f5850ac6","line":121,"range":{"start_line":121,"start_character":0,"end_line":121,"end_character":67},"in_reply_to":"7afed35e_eb610c1e","updated":"2024-04-13 01:55:00.000000000","message":"Both CH347T and CH347F have interface 2,and the functions are different. So even if the PID may change, it may only be judged based on the WCH default PID.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"#define CH347_EPOUT\t\t\t\t\t\t0x06u // the usb endpoint number for writing"},{"line_number":120,"context_line":"#define CH347_EPIN\t\t\t\t\t\t0x86u // the usb endpoint number for reading"},{"line_number":121,"context_line":"#define CH347_MPHSI_INTERFACE\t\t\t2 // the JTAG interface is number 2"},{"line_number":122,"context_line":"#define USB_WRITE_TIMEOUT\t\t\t\t500\t// write timeout in milliseconds"},{"line_number":123,"context_line":"#define USB_READ_TIMEOUT\t\t\t\t500 // read timeout in milliseconds"},{"line_number":124,"context_line":"#define BYTEWISE_MODE_VERSION\t\t\t0x241 /* BCD version for devices that can use bytewise mode"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"dd2a8022_4c91139c","line":121,"range":{"start_line":121,"start_character":0,"end_line":121,"end_character":67},"in_reply_to":"e14dcf7e_f5850ac6","updated":"2024-04-28 19:43:15.000000000","message":"Now I claim interface 4 first which can only be claimed for CH347F. And if it\u0027s not possible I claim interface 2. Then I found the CH347T.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1683f048b741552a59300d10666cf5a9dda98c21","unresolved":true,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"#define CH347_EPOUT\t\t\t\t\t\t0x06u // the usb endpoint number for writing"},{"line_number":120,"context_line":"#define CH347_EPIN\t\t\t\t\t\t0x86u // the usb endpoint number for reading"},{"line_number":121,"context_line":"#define CH347_MPHSI_INTERFACE\t\t\t2 // the JTAG interface is number 2"},{"line_number":122,"context_line":"#define USB_WRITE_TIMEOUT\t\t\t\t500\t// write timeout in milliseconds"},{"line_number":123,"context_line":"#define USB_READ_TIMEOUT\t\t\t\t500 // read timeout in milliseconds"},{"line_number":124,"context_line":"#define BYTEWISE_MODE_VERSION\t\t\t0x241 /* BCD version for devices that can use bytewise mode"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"7afed35e_eb610c1e","line":121,"range":{"start_line":121,"start_character":0,"end_line":121,"end_character":67},"in_reply_to":"f9c07612_fe24b639","updated":"2024-04-12 21:25:00.000000000","message":"I\u0027ve solved this by first claiming interface 2 and if this is not possible I claim interface 4. Is this also a solution? I wouldn\u0027t judge based on PID because the PID is changeable. Or is there another good way to find out if it\u0027s a T of F chip?","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"5dcee1c3a08510cb6342e08c2a38a4059f32874b","unresolved":true,"context_lines":[{"line_number":1198,"context_line":"\t\tch347_device_descriptor.bcdDevice \u0026 0xFF,"},{"line_number":1199,"context_line":"\t\tfirmware_version);"},{"line_number":1200,"context_line":""},{"line_number":1201,"context_line":"\tif (ch347_device_descriptor.bcdDevice \u003c BYTEWISE_MODE_VERSION) {"},{"line_number":1202,"context_line":"\t\tLOG_INFO(\"CH347 old version of the chip, JTAG only working in bitwise mode. For bytewise mode at least version %X.%X is needed.\","},{"line_number":1203,"context_line":"\t\t\t(BYTEWISE_MODE_VERSION \u003e\u003e 8) \u0026 0xFF,"},{"line_number":1204,"context_line":"\t\t\tBYTEWISE_MODE_VERSION \u0026 0xFF);"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"5c871739_d265700b","line":1201,"range":{"start_line":1201,"start_character":1,"end_line":1201,"end_character":63},"updated":"2024-04-11 02:00:50.000000000","message":"ch347F as the new version, had no need make this judgment, can using no bitwise_mode the mode directly.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1683f048b741552a59300d10666cf5a9dda98c21","unresolved":false,"context_lines":[{"line_number":1198,"context_line":"\t\tch347_device_descriptor.bcdDevice \u0026 0xFF,"},{"line_number":1199,"context_line":"\t\tfirmware_version);"},{"line_number":1200,"context_line":""},{"line_number":1201,"context_line":"\tif (ch347_device_descriptor.bcdDevice \u003c BYTEWISE_MODE_VERSION) {"},{"line_number":1202,"context_line":"\t\tLOG_INFO(\"CH347 old version of the chip, JTAG only working in bitwise mode. For bytewise mode at least version %X.%X is needed.\","},{"line_number":1203,"context_line":"\t\t\t(BYTEWISE_MODE_VERSION \u003e\u003e 8) \u0026 0xFF,"},{"line_number":1204,"context_line":"\t\t\tBYTEWISE_MODE_VERSION \u0026 0xFF);"}],"source_content_type":"text/x-csrc","patch_set":31,"id":"a07e7671_e08d3ed7","line":1201,"range":{"start_line":1201,"start_character":1,"end_line":1201,"end_character":63},"in_reply_to":"5c871739_d265700b","updated":"2024-04-12 21:25:00.000000000","message":"If I could claim interface 4 it\u0027s a CH347F chip. And then I skip this check.","commit_id":"480304cfc1a0f47752d2867ffd07e889c6195dca"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":38,"context_line":""},{"line_number":39,"context_line":"#if IS_CYGWIN \u003d\u003d 1"},{"line_number":40,"context_line":"#include \"windows.h\""},{"line_number":41,"context_line":"#undef LOG_ERROR"},{"line_number":42,"context_line":"#endif"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"// project specific includes"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"112d84fc_eb315f49","line":41,"updated":"2024-04-26 09:41:17.000000000","message":"I\u0027m not CYGWIN user. Are errors so bad on in case of cagwin? It would be good to have a comment on why errors are disabled.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":38,"context_line":""},{"line_number":39,"context_line":"#if IS_CYGWIN \u003d\u003d 1"},{"line_number":40,"context_line":"#include \"windows.h\""},{"line_number":41,"context_line":"#undef LOG_ERROR"},{"line_number":42,"context_line":"#endif"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"// project specific includes"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"57403791_3d013985","line":41,"in_reply_to":"112d84fc_eb315f49","updated":"2024-04-28 19:43:15.000000000","message":"That comes from the original source: https://github.com/WCHSoftGroup/ch347/blob/main/OpenOCD_SourceCode_CH347/src/jtag/drivers/ch347.c I also don\u0027t know why we would undef LOG_ERROR.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":41,"context_line":"#undef LOG_ERROR"},{"line_number":42,"context_line":"#endif"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"// project specific includes"},{"line_number":45,"context_line":"#include \u003cjtag/interface.h\u003e"},{"line_number":46,"context_line":"#include \u003cjtag/commands.h\u003e"},{"line_number":47,"context_line":"#include \u003cjtag/swd.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"4aa3756f_eaaa7def","line":44,"updated":"2024-04-26 09:41:17.000000000","message":"Please avoid C++ style comments. Instead of // please use /* */. This apply for all comments.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":41,"context_line":"#undef LOG_ERROR"},{"line_number":42,"context_line":"#endif"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"// project specific includes"},{"line_number":45,"context_line":"#include \u003cjtag/interface.h\u003e"},{"line_number":46,"context_line":"#include \u003cjtag/commands.h\u003e"},{"line_number":47,"context_line":"#include \u003cjtag/swd.h\u003e"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"80df9998_e7153e80","line":44,"in_reply_to":"4aa3756f_eaaa7def","updated":"2024-04-28 19:43:15.000000000","message":"In the style guide I\u0027ve found \"C99 Rules ... // comments – in new code, prefer these for single-line comments\"\n\nhttps://openocd.org/doc/doxygen/html/stylec.html\n\nDid I misunderstood this rule?","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":69,"context_line":"#define LED_ON\t\t\t\t\t\t\t1"},{"line_number":70,"context_line":"#define LED_OFF\t\t\t\t\t\t\t0"},{"line_number":71,"context_line":"#define GPIO_CNT\t\t\t\t\t\t8 // the CH347 has 8 GPIO\u0027s"},{"line_number":72,"context_line":"#define USEABLE_GPIOS\t\t\t\t\t0x78 /* mask which GPIO\u0027s are available in mode 3 of CH347T"},{"line_number":73,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tonly GPIO3 (Pin11 / SCL), GPIO4 (Pin15 / ACT),"},{"line_number":74,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tGPIO5 (Pin9 / TRST) and GPIO6 (Pin2 / CTS1) are possible"},{"line_number":75,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tTested only with CH347T not CH347F chip"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"8cea6cfe_88bed5f8","line":72,"updated":"2024-04-26 09:41:17.000000000","message":"Please put most of this comments on the line before the code which is commented. Otherwise it looks broken and unreadable on gerrit and any other editor with settings where one tab is equal to 4 spaces.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":69,"context_line":"#define LED_ON\t\t\t\t\t\t\t1"},{"line_number":70,"context_line":"#define LED_OFF\t\t\t\t\t\t\t0"},{"line_number":71,"context_line":"#define GPIO_CNT\t\t\t\t\t\t8 // the CH347 has 8 GPIO\u0027s"},{"line_number":72,"context_line":"#define USEABLE_GPIOS\t\t\t\t\t0x78 /* mask which GPIO\u0027s are available in mode 3 of CH347T"},{"line_number":73,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tonly GPIO3 (Pin11 / SCL), GPIO4 (Pin15 / ACT),"},{"line_number":74,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tGPIO5 (Pin9 / TRST) and GPIO6 (Pin2 / CTS1) are possible"},{"line_number":75,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tTested only with CH347T not CH347F chip"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"4ce5ef26_170ae75f","line":72,"in_reply_to":"8cea6cfe_88bed5f8","updated":"2024-04-28 19:43:15.000000000","message":"Done","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":126,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tbelow this version only bitwise mode can be used */"},{"line_number":127,"context_line":"#define DEFAULT_VENDOR_ID\t\t\t\t0x1a86 // if no vendor id is set use this CH347 default"},{"line_number":128,"context_line":"#define DEFAULT_CH347T_PRODUCT_ID 0x55dd // if no product id is set use this CH347T default"},{"line_number":129,"context_line":"#define DEFAULT_CH347F_PRODUCT_ID 0x55de // if no product id is set use this CH347F default"},{"line_number":130,"context_line":"#define DEFAULT_OTHER_PRODUCT_ID 0x55e7\t // other product id found in https://github.com/WCHSoftGroup/ch347"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"// for STANDARD_PACK mode: these are the 6 possible speeds; values in kHz"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"c20d3787_afbaea64","line":129,"updated":"2024-04-26 09:41:17.000000000","message":"Every define block has here different style, different amount of tabs between define and value, different comment styles, etc. Please align  it.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":126,"context_line":"\t\t\t\t\t\t\t\t\t\t\t\tbelow this version only bitwise mode can be used */"},{"line_number":127,"context_line":"#define DEFAULT_VENDOR_ID\t\t\t\t0x1a86 // if no vendor id is set use this CH347 default"},{"line_number":128,"context_line":"#define DEFAULT_CH347T_PRODUCT_ID 0x55dd // if no product id is set use this CH347T default"},{"line_number":129,"context_line":"#define DEFAULT_CH347F_PRODUCT_ID 0x55de // if no product id is set use this CH347F default"},{"line_number":130,"context_line":"#define DEFAULT_OTHER_PRODUCT_ID 0x55e7\t // other product id found in https://github.com/WCHSoftGroup/ch347"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"// for STANDARD_PACK mode: these are the 6 possible speeds; values in kHz"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"fa6388a1_1e4587d3","line":129,"in_reply_to":"c20d3787_afbaea64","updated":"2024-04-28 19:43:15.000000000","message":"OK, now I use one tab between define and value and one space between value and comment.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":129,"context_line":"#define DEFAULT_CH347F_PRODUCT_ID 0x55de // if no product id is set use this CH347F default"},{"line_number":130,"context_line":"#define DEFAULT_OTHER_PRODUCT_ID 0x55e7\t // other product id found in https://github.com/WCHSoftGroup/ch347"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"// for STANDARD_PACK mode: these are the 6 possible speeds; values in kHz"},{"line_number":133,"context_line":"static const int ch347_standard_pack_clock_speeds[] \u003d {"},{"line_number":134,"context_line":"\t1875,\t// 1.875 MHz (60000 : 32)"},{"line_number":135,"context_line":"\t3750,\t// 3.75 MHz (60000 : 16)"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"3d66be7b_123ea3dc","line":132,"updated":"2024-04-26 09:41:17.000000000","message":"Please add some comment about the difference between STANDART_PACK and LARGE_PACK. What is it.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":129,"context_line":"#define DEFAULT_CH347F_PRODUCT_ID 0x55de // if no product id is set use this CH347F default"},{"line_number":130,"context_line":"#define DEFAULT_OTHER_PRODUCT_ID 0x55e7\t // other product id found in https://github.com/WCHSoftGroup/ch347"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"// for STANDARD_PACK mode: these are the 6 possible speeds; values in kHz"},{"line_number":133,"context_line":"static const int ch347_standard_pack_clock_speeds[] \u003d {"},{"line_number":134,"context_line":"\t1875,\t// 1.875 MHz (60000 : 32)"},{"line_number":135,"context_line":"\t3750,\t// 3.75 MHz (60000 : 16)"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"031b9ac6_6cbea6f0","line":132,"in_reply_to":"3d66be7b_123ea3dc","updated":"2024-04-28 19:43:15.000000000","message":"Done","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":139,"context_line":"\t60000\t// 60 MHz"},{"line_number":140,"context_line":"};"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"// for LARGER_PACK mode: these are the 8 possible speeds; values in Hertz"},{"line_number":143,"context_line":"static const int ch347_larger_pack_clock_speeds[] \u003d {"},{"line_number":144,"context_line":"\t469,\t// 468.75 kHz (60000 : 128)"},{"line_number":145,"context_line":"\t938,\t// 937.5 kHz (60000 : 64)"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"d79f7221_24c6969c","line":142,"updated":"2024-04-26 09:41:17.000000000","message":"Herz or kilo Herz?","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":139,"context_line":"\t60000\t// 60 MHz"},{"line_number":140,"context_line":"};"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"// for LARGER_PACK mode: these are the 8 possible speeds; values in Hertz"},{"line_number":143,"context_line":"static const int ch347_larger_pack_clock_speeds[] \u003d {"},{"line_number":144,"context_line":"\t469,\t// 468.75 kHz (60000 : 128)"},{"line_number":145,"context_line":"\t938,\t// 937.5 kHz (60000 : 64)"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"2200b5c6_a97f6e75","line":142,"in_reply_to":"d79f7221_24c6969c","updated":"2024-04-28 19:43:15.000000000","message":"Done","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":155,"context_line":"and then read data back. LARGER_PACK means, we can send packets as large as"},{"line_number":156,"context_line":"LARGER_PACK_MAX_SIZE. libusb splits there large packets into smaller USB packets and"},{"line_number":157,"context_line":"transmit the data. Then we read back the data in a bigger packet."},{"line_number":158,"context_line":"*/"},{"line_number":159,"context_line":"enum pack_size {"},{"line_number":160,"context_line":"\tUNSET \u003d -1,"},{"line_number":161,"context_line":"\tSTANDARD_PACK \u003d 0,"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"4c050776_1dd797b4","line":158,"updated":"2024-04-26 09:41:17.000000000","message":"Ah, here is the comment about STANDARD vs LARGER :) Please put this enum with explanation about the frequency arrays-","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":155,"context_line":"and then read data back. LARGER_PACK means, we can send packets as large as"},{"line_number":156,"context_line":"LARGER_PACK_MAX_SIZE. libusb splits there large packets into smaller USB packets and"},{"line_number":157,"context_line":"transmit the data. Then we read back the data in a bigger packet."},{"line_number":158,"context_line":"*/"},{"line_number":159,"context_line":"enum pack_size {"},{"line_number":160,"context_line":"\tUNSET \u003d -1,"},{"line_number":161,"context_line":"\tSTANDARD_PACK \u003d 0,"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"e1718f25_5b93c2a0","line":158,"in_reply_to":"4c050776_1dd797b4","updated":"2024-04-28 19:43:15.000000000","message":"Done","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"d31214e0102bea664af68e2799dc03d03c33c840","unresolved":true,"context_lines":[{"line_number":184,"context_line":"\tint tck_pin;"},{"line_number":185,"context_line":"\tint trst_pin;"},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"\tbool is_ch347f_chip; // true if we found the CH347F chip"},{"line_number":188,"context_line":"\tbool use_bitwise_mode; /* if true then we can\u0027t us the bytewise commands"},{"line_number":189,"context_line":"\t\t\t\t\t\t\t\tdue to a bug of the chip; depends on BYTEWISE_MODE_VERSION */"},{"line_number":190,"context_line":"\tenum pack_size pack_size; // see: pack_size for explanation"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"4d8f477c_9d267dce","line":187,"updated":"2024-04-26 09:41:17.000000000","message":"There is already 3 different variants supported by this driver. Please use \"enum ch347_variant\" instead.","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"a9b8aa08092053c4f3a4fd463d940882572a60c6","unresolved":false,"context_lines":[{"line_number":184,"context_line":"\tint tck_pin;"},{"line_number":185,"context_line":"\tint trst_pin;"},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"\tbool is_ch347f_chip; // true if we found the CH347F chip"},{"line_number":188,"context_line":"\tbool use_bitwise_mode; /* if true then we can\u0027t us the bytewise commands"},{"line_number":189,"context_line":"\t\t\t\t\t\t\t\tdue to a bug of the chip; depends on BYTEWISE_MODE_VERSION */"},{"line_number":190,"context_line":"\tenum pack_size pack_size; // see: pack_size for explanation"}],"source_content_type":"text/x-csrc","patch_set":33,"id":"acd58f7a_56f68413","line":187,"in_reply_to":"4d8f477c_9d267dce","updated":"2024-04-28 19:43:15.000000000","message":"Done","commit_id":"fa17f1debf3ff63fec4bb2bcce71344c1bf33ef8"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"dc160707617c352fb7d31f1c953c258ff1f77ce1","unresolved":true,"context_lines":[{"line_number":243,"context_line":"static uint16_t custom_ch347_vids[] \u003d {0, 0};"},{"line_number":244,"context_line":"static uint16_t custom_ch347_pids[] \u003d {0, 0};"},{"line_number":245,"context_line":"static char *ch347_device_desc;"},{"line_number":246,"context_line":"static uint8_t ch347_activity_led_gpio_pin \u003d 0xFF;"},{"line_number":247,"context_line":"static bool ch347_activity_led_active_high;"},{"line_number":248,"context_line":"static struct ch347_info ch347;"},{"line_number":249,"context_line":"static struct libusb_device_handle *ch347_handle;"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"aeb7b580_56911b29","line":246,"updated":"2024-05-07 10:32:13.000000000","message":"ch347_activity_led_gpio_pin is never changed. Please add needed code or drop LED support for now","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[{"line_number":243,"context_line":"static uint16_t custom_ch347_vids[] \u003d {0, 0};"},{"line_number":244,"context_line":"static uint16_t custom_ch347_pids[] \u003d {0, 0};"},{"line_number":245,"context_line":"static char *ch347_device_desc;"},{"line_number":246,"context_line":"static uint8_t ch347_activity_led_gpio_pin \u003d 0xFF;"},{"line_number":247,"context_line":"static bool ch347_activity_led_active_high;"},{"line_number":248,"context_line":"static struct ch347_info ch347;"},{"line_number":249,"context_line":"static struct libusb_device_handle *ch347_handle;"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"406cf7ba_8a7c0bf1","line":246,"in_reply_to":"aeb7b580_56911b29","updated":"2025-01-24 01:13:03.000000000","message":"I\u0027ve added the code for activity LED configuration.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"dc160707617c352fb7d31f1c953c258ff1f77ce1","unresolved":true,"context_lines":[{"line_number":538,"context_line":" * @brief Sends the write buffer via libusb"},{"line_number":539,"context_line":" * and if LARGER_PACK mode is active read also data back"},{"line_number":540,"context_line":" */"},{"line_number":541,"context_line":"static void ch347_cmd_transmit_queue(void)"},{"line_number":542,"context_line":"{"},{"line_number":543,"context_line":"\t// queue last command"},{"line_number":544,"context_line":"\tch347_cmd_from_scratchpad();"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"6cff2f04_81827a4f","line":541,"updated":"2024-05-07 10:32:13.000000000","message":"There are multiple error exit points in this function. All of this error values are dropped. Please, make sure all functions which able to return error are actually do it and this error values are passed in the call chain.\n\nThis comment apply to all functions in this driver.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[{"line_number":538,"context_line":" * @brief Sends the write buffer via libusb"},{"line_number":539,"context_line":" * and if LARGER_PACK mode is active read also data back"},{"line_number":540,"context_line":" */"},{"line_number":541,"context_line":"static void ch347_cmd_transmit_queue(void)"},{"line_number":542,"context_line":"{"},{"line_number":543,"context_line":"\t// queue last command"},{"line_number":544,"context_line":"\tch347_cmd_from_scratchpad();"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"5b4ac630_3f916194","line":541,"in_reply_to":"6cff2f04_81827a4f","updated":"2025-01-24 01:13:03.000000000","message":"OK, that changes many lines, but it\u0027s good to do that also. Now it\u0027s fixed in all the functions of this driver.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002339,"name":"swk","username":"123swk123"},"change_message_id":"193fe0f95ea4519598013cbc25c33674adf8ca22","unresolved":true,"context_lines":[{"line_number":571,"context_line":"\t\tint total_tdo_count \u003d 0;"},{"line_number":572,"context_line":"\t\tint bytes_to_write \u003d 0;"},{"line_number":573,"context_line":"\t\t// in STANDARD_PACK or bitwise mode we can send only one USBC_PACKET_USBHS sized package"},{"line_number":574,"context_line":"\t\tint max_len \u003d ch347.pack_size \u003d\u003d STANDARD_PACK || ch347.use_bitwise_mode ?"},{"line_number":575,"context_line":"\t\t\tUSBC_PACKET_USBHS : LARGER_PACK_MAX_SIZE;"},{"line_number":576,"context_line":"\t\tlist_for_each_entry(cmd, \u0026ch347.cmd_queue, queue) {"},{"line_number":577,"context_line":"\t\t\ttotal_len +\u003d CH347_CMD_HEADER + cmd-\u003ewrite_data_len;"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"90641e5a_870204fa","line":574,"range":{"start_line":574,"start_character":0,"end_line":574,"end_character":1},"updated":"2024-11-19 17:14:45.000000000","message":"max_len variable can be optimized as const and intialized outside this cmd_queue loop probably @567","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[{"line_number":571,"context_line":"\t\tint total_tdo_count \u003d 0;"},{"line_number":572,"context_line":"\t\tint bytes_to_write \u003d 0;"},{"line_number":573,"context_line":"\t\t// in STANDARD_PACK or bitwise mode we can send only one USBC_PACKET_USBHS sized package"},{"line_number":574,"context_line":"\t\tint max_len \u003d ch347.pack_size \u003d\u003d STANDARD_PACK || ch347.use_bitwise_mode ?"},{"line_number":575,"context_line":"\t\t\tUSBC_PACKET_USBHS : LARGER_PACK_MAX_SIZE;"},{"line_number":576,"context_line":"\t\tlist_for_each_entry(cmd, \u0026ch347.cmd_queue, queue) {"},{"line_number":577,"context_line":"\t\t\ttotal_len +\u003d CH347_CMD_HEADER + cmd-\u003ewrite_data_len;"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"cefb3b57_78a5b120","line":574,"range":{"start_line":574,"start_character":0,"end_line":574,"end_character":1},"in_reply_to":"90641e5a_870204fa","updated":"2025-01-24 01:13:03.000000000","message":"I made it a member of the ch347 struct and calculate this only one time.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"dc160707617c352fb7d31f1c953c258ff1f77ce1","unresolved":true,"context_lines":[{"line_number":1023,"context_line":"\treturn ERROR_OK;"},{"line_number":1024,"context_line":"}"},{"line_number":1025,"context_line":""},{"line_number":1026,"context_line":"/**"},{"line_number":1027,"context_line":" * @brief Sets a GPIO bit"},{"line_number":1028,"context_line":" *"},{"line_number":1029,"context_line":" * @param gpio GPIO bit number 0-7"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"f0b75507_3aa34b05","line":1026,"updated":"2024-05-07 10:32:13.000000000","message":"LEDs are currently not configured, LED and GPIO code can be dropped for now","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[{"line_number":1023,"context_line":"\treturn ERROR_OK;"},{"line_number":1024,"context_line":"}"},{"line_number":1025,"context_line":""},{"line_number":1026,"context_line":"/**"},{"line_number":1027,"context_line":" * @brief Sets a GPIO bit"},{"line_number":1028,"context_line":" *"},{"line_number":1029,"context_line":" * @param gpio GPIO bit number 0-7"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"3ed7e44e_e98be209","line":1026,"in_reply_to":"f0b75507_3aa34b05","updated":"2025-01-24 01:13:03.000000000","message":"I\u0027ve added the code to configure the GPIO for the LED.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002339,"name":"swk","username":"123swk123"},"change_message_id":"193fe0f95ea4519598013cbc25c33674adf8ca22","unresolved":true,"context_lines":[{"line_number":1058,"context_line":"/**"},{"line_number":1059,"context_line":" * @brief Control (assert/deassert) the signals SRST and TRST on the interface."},{"line_number":1060,"context_line":" *"},{"line_number":1061,"context_line":" * @param trst 1 to assert SRST, 0 to deassert SRST."},{"line_number":1062,"context_line":" * @param srst 1 to assert TRST, 0 to deassert TRST."},{"line_number":1063,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1064,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"1c406914_80de70d0","line":1061,"updated":"2024-11-19 17:14:45.000000000","message":"trst and srst param should be swapped to match its respective description.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[{"line_number":1058,"context_line":"/**"},{"line_number":1059,"context_line":" * @brief Control (assert/deassert) the signals SRST and TRST on the interface."},{"line_number":1060,"context_line":" *"},{"line_number":1061,"context_line":" * @param trst 1 to assert SRST, 0 to deassert SRST."},{"line_number":1062,"context_line":" * @param srst 1 to assert TRST, 0 to deassert TRST."},{"line_number":1063,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1064,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"050a1236_771f54bb","line":1061,"in_reply_to":"1c406914_80de70d0","updated":"2025-01-24 01:13:03.000000000","message":"Thanks. It\u0027s fixed now.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002339,"name":"swk","username":"123swk123"},"change_message_id":"a81c102c2427a5e07eeed7aab999254f82e61537","unresolved":true,"context_lines":[{"line_number":1078,"context_line":"\t}"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"\tch347_cmd_start_next(CH347_CMD_JTAG_BIT_OP);"},{"line_number":1081,"context_line":"\tch347.trst_pin \u003d trst ? TRST_L : TRST_H;"},{"line_number":1082,"context_line":"\tch347_scratchpad_add_pin_byte();"},{"line_number":1083,"context_line":"\tch347_scratchpad_add_idle_clock();"},{"line_number":1084,"context_line":"\tch347_cmd_transmit_queue();"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"3fd2a969_528dda99","line":1081,"updated":"2024-11-19 17:25:52.000000000","message":"CH347F uses GPIO3, while CH347T uses GPIO5\nso probaly we should set this based on the CH347 variant","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[{"line_number":1078,"context_line":"\t}"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"\tch347_cmd_start_next(CH347_CMD_JTAG_BIT_OP);"},{"line_number":1081,"context_line":"\tch347.trst_pin \u003d trst ? TRST_L : TRST_H;"},{"line_number":1082,"context_line":"\tch347_scratchpad_add_pin_byte();"},{"line_number":1083,"context_line":"\tch347_scratchpad_add_idle_clock();"},{"line_number":1084,"context_line":"\tch347_cmd_transmit_queue();"}],"source_content_type":"text/x-csrc","patch_set":34,"id":"6e67a4cd_2ae43d33","line":1081,"in_reply_to":"3fd2a969_528dda99","updated":"2025-01-24 01:13:03.000000000","message":"Thanks. I\u0027ve made the decision now in code.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1000410,"name":"Oleksij Rempel","email":"linux@rempel-privat.de","username":"olerem"},"change_message_id":"dc160707617c352fb7d31f1c953c258ff1f77ce1","unresolved":true,"context_lines":[{"line_number":1158,"context_line":""},{"line_number":1159,"context_line":"\tint retval \u003d jtag_libusb_open(ch347_vids, ch347_pids, ch347_device_desc, \u0026ch347_handle, NULL);"},{"line_number":1160,"context_line":"\tif (retval !\u003d ERROR_OK) {"},{"line_number":1161,"context_line":"\t\tLOG_ERROR(\"CH347 not found: vid\u003d%04x, pid\u003d%04x\",  ch347_vids[0], ch347_pids[0]);"},{"line_number":1162,"context_line":"\t\treturn retval;"},{"line_number":1163,"context_line":"\t}"},{"line_number":1164,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":34,"id":"74853265_8abaf302","line":1161,"updated":"2024-05-07 10:32:13.000000000","message":"This error message will be confusing. we have list of vids and pids and all of them failed.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"b09c52528c7429e290feb40b9ac1a8d7dfb13bef","unresolved":false,"context_lines":[{"line_number":1158,"context_line":""},{"line_number":1159,"context_line":"\tint retval \u003d jtag_libusb_open(ch347_vids, ch347_pids, ch347_device_desc, \u0026ch347_handle, NULL);"},{"line_number":1160,"context_line":"\tif (retval !\u003d ERROR_OK) {"},{"line_number":1161,"context_line":"\t\tLOG_ERROR(\"CH347 not found: vid\u003d%04x, pid\u003d%04x\",  ch347_vids[0], ch347_pids[0]);"},{"line_number":1162,"context_line":"\t\treturn retval;"},{"line_number":1163,"context_line":"\t}"},{"line_number":1164,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":34,"id":"13e1a529_d9be06e9","line":1161,"in_reply_to":"74853265_8abaf302","updated":"2025-01-24 01:13:03.000000000","message":"Thanks for pointing that out. I\u0027ve made a better error message.","commit_id":"8b8a98bc7263f2f0dc189bcdd17d9ac0441135e3"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":11,"context_line":" *   CH347 is a high-speed USB bus converter chip that provides UART, I2C  *"},{"line_number":12,"context_line":" *   and SPI synchronous serial ports and JTAG interface through USB bus.  *"},{"line_number":13,"context_line":" *                                                                         *"},{"line_number":14,"context_line":" *   The Jtag interface by CH347 can supports transmission frequency       *"},{"line_number":15,"context_line":" *   configuration up to 60MHz.                                            *"},{"line_number":16,"context_line":" *                                                                         *"},{"line_number":17,"context_line":" *   The USB2.0 to JTAG scheme based on CH347 can be used to build         *"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"2023fc44_eae986a8","line":14,"updated":"2025-01-25 17:47:58.000000000","message":"Use JTAG uppercase","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":11,"context_line":" *   CH347 is a high-speed USB bus converter chip that provides UART, I2C  *"},{"line_number":12,"context_line":" *   and SPI synchronous serial ports and JTAG interface through USB bus.  *"},{"line_number":13,"context_line":" *                                                                         *"},{"line_number":14,"context_line":" *   The Jtag interface by CH347 can supports transmission frequency       *"},{"line_number":15,"context_line":" *   configuration up to 60MHz.                                            *"},{"line_number":16,"context_line":" *                                                                         *"},{"line_number":17,"context_line":" *   The USB2.0 to JTAG scheme based on CH347 can be used to build         *"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"650d05f3_4ce790e0","line":14,"in_reply_to":"2023fc44_eae986a8","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve used JTAG now here and at other places.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":417,"context_line":" * @param decoded_buf Point to a buffer to place the data to be decoded; need to be sized"},{"line_number":418,"context_line":" * to the decoded size length; not the raw_read_len"},{"line_number":419,"context_line":" * @param decoded_buf_len length of the decoded_buf"},{"line_number":420,"context_line":" * @param raw_read_len Data length in bytes that should be read via libusb; the decoded length can be shorther"},{"line_number":421,"context_line":" * @return ERROR_OK at success"},{"line_number":422,"context_line":" */"},{"line_number":423,"context_line":"static int ch347_read_scan(uint8_t *decoded_buf, int decoded_buf_len, int raw_read_len)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"4e668c03_4a25636a","line":420,"updated":"2025-01-25 17:47:58.000000000","message":"s/shorther/shorter/","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":417,"context_line":" * @param decoded_buf Point to a buffer to place the data to be decoded; need to be sized"},{"line_number":418,"context_line":" * to the decoded size length; not the raw_read_len"},{"line_number":419,"context_line":" * @param decoded_buf_len length of the decoded_buf"},{"line_number":420,"context_line":" * @param raw_read_len Data length in bytes that should be read via libusb; the decoded length can be shorther"},{"line_number":421,"context_line":" * @return ERROR_OK at success"},{"line_number":422,"context_line":" */"},{"line_number":423,"context_line":"static int ch347_read_scan(uint8_t *decoded_buf, int decoded_buf_len, int raw_read_len)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"264b97fc_361a18b7","line":420,"in_reply_to":"4e668c03_4a25636a","updated":"2025-01-27 19:55:58.000000000","message":"Thanks for finding this.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1074,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1075,"context_line":"\t\treturn retval;"},{"line_number":1076,"context_line":""},{"line_number":1077,"context_line":"\t// if read is involed we need to queue the scan fields"},{"line_number":1078,"context_line":"\tif (is_read)"},{"line_number":1079,"context_line":"\t\treturn ch347_scan_queue_fields(cmd-\u003efields, cmd-\u003enum_fields);"},{"line_number":1080,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":42,"id":"d2e6cf52_bdd835fa","line":1077,"updated":"2025-01-25 17:47:58.000000000","message":"typo? s/involed/involved/ ?","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1074,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1075,"context_line":"\t\treturn retval;"},{"line_number":1076,"context_line":""},{"line_number":1077,"context_line":"\t// if read is involed we need to queue the scan fields"},{"line_number":1078,"context_line":"\tif (is_read)"},{"line_number":1079,"context_line":"\t\treturn ch347_scan_queue_fields(cmd-\u003efields, cmd-\u003enum_fields);"},{"line_number":1080,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":42,"id":"c82f2cc8_8fec365b","line":1077,"in_reply_to":"d2e6cf52_bdd835fa","updated":"2025-01-27 19:55:58.000000000","message":"Thanks for finding this.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1206,"context_line":" *"},{"line_number":1207,"context_line":" * @param trst 1 to assert TRST, 0 to deassert TRST."},{"line_number":1208,"context_line":" * @param srst 1 to assert SRST, 0 to deassert SRST."},{"line_number":1209,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1210,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"},{"line_number":1211,"context_line":" */"},{"line_number":1212,"context_line":"static int ch347_reset_assert(int trst, int srst)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"eb788180_60438026","line":1209,"updated":"2025-01-25 17:47:58.000000000","message":"Actually we do not really need TRST pin because the same effect can be achieved with a TLR sequence.\nIt would be more interesting using the pin TRST as a SRST for both JTAG and SWD.\nMaybe in a future improvement we could check if user has defined:\n`reset_config trst_only`\nor\n`reset_config srst_only`\nand then use this same extra pin either as TRST or as SRST.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1206,"context_line":" *"},{"line_number":1207,"context_line":" * @param trst 1 to assert TRST, 0 to deassert TRST."},{"line_number":1208,"context_line":" * @param srst 1 to assert SRST, 0 to deassert SRST."},{"line_number":1209,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1210,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"},{"line_number":1211,"context_line":" */"},{"line_number":1212,"context_line":"static int ch347_reset_assert(int trst, int srst)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"cd9ad5d9_8043cf9c","line":1209,"updated":"2025-01-25 17:47:58.000000000","message":"typo s/SWDW/SWD/","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1206,"context_line":" *"},{"line_number":1207,"context_line":" * @param trst 1 to assert TRST, 0 to deassert TRST."},{"line_number":1208,"context_line":" * @param srst 1 to assert SRST, 0 to deassert SRST."},{"line_number":1209,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1210,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"},{"line_number":1211,"context_line":" */"},{"line_number":1212,"context_line":"static int ch347_reset_assert(int trst, int srst)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"8dd0dd9e_984a4a75","line":1209,"in_reply_to":"cd9ad5d9_8043cf9c","updated":"2025-01-27 19:55:58.000000000","message":"Thanks for finding this.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1206,"context_line":" *"},{"line_number":1207,"context_line":" * @param trst 1 to assert TRST, 0 to deassert TRST."},{"line_number":1208,"context_line":" * @param srst 1 to assert SRST, 0 to deassert SRST."},{"line_number":1209,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1210,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"},{"line_number":1211,"context_line":" */"},{"line_number":1212,"context_line":"static int ch347_reset_assert(int trst, int srst)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"505ecda0_dd818081","line":1209,"in_reply_to":"eb788180_60438026","updated":"2025-01-27 19:55:58.000000000","message":"Good idea. I put it at my TODO list for this driver.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[{"line_number":1209,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1210,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"},{"line_number":1211,"context_line":" */"},{"line_number":1212,"context_line":"static int ch347_reset_assert(int trst, int srst)"},{"line_number":1213,"context_line":"{"},{"line_number":1214,"context_line":"\tLOG_DEBUG_IO(\"reset trst: %i srst %i\", trst, srst);"},{"line_number":1215,"context_line":"\tif (srst) {"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"87be77aa_f42575d3","line":1212,"range":{"start_line":1212,"start_character":22,"end_line":1212,"end_character":29},"updated":"2025-01-26 12:43:29.000000000","message":"Please rename to `ch347_reset()` Assert is misleading as the function do both assert and deassert","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1209,"context_line":" * @return Always ERROR_FAIL for asserting via SRST and TRST in SWDW mode."},{"line_number":1210,"context_line":" * ERROR_OK for assert/deassert in JTAG mode for TRST"},{"line_number":1211,"context_line":" */"},{"line_number":1212,"context_line":"static int ch347_reset_assert(int trst, int srst)"},{"line_number":1213,"context_line":"{"},{"line_number":1214,"context_line":"\tLOG_DEBUG_IO(\"reset trst: %i srst %i\", trst, srst);"},{"line_number":1215,"context_line":"\tif (srst) {"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"68aaf369_8c795d1f","line":1212,"range":{"start_line":1212,"start_character":22,"end_line":1212,"end_character":29},"in_reply_to":"87be77aa_f42575d3","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve renamed this function.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[{"line_number":1213,"context_line":"{"},{"line_number":1214,"context_line":"\tLOG_DEBUG_IO(\"reset trst: %i srst %i\", trst, srst);"},{"line_number":1215,"context_line":"\tif (srst) {"},{"line_number":1216,"context_line":"\t\tLOG_INFO(\"Asserting SRST not supported!\");"},{"line_number":1217,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1218,"context_line":"\t}"},{"line_number":1219,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":42,"id":"8618f0dd_02d670a4","line":1216,"range":{"start_line":1216,"start_character":2,"end_line":1216,"end_character":10},"updated":"2025-01-26 12:43:29.000000000","message":"LOG_ERROR","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1213,"context_line":"{"},{"line_number":1214,"context_line":"\tLOG_DEBUG_IO(\"reset trst: %i srst %i\", trst, srst);"},{"line_number":1215,"context_line":"\tif (srst) {"},{"line_number":1216,"context_line":"\t\tLOG_INFO(\"Asserting SRST not supported!\");"},{"line_number":1217,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1218,"context_line":"\t}"},{"line_number":1219,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":42,"id":"41ffd34d_c191aa2c","line":1216,"range":{"start_line":1216,"start_character":2,"end_line":1216,"end_character":10},"in_reply_to":"8618f0dd_02d670a4","updated":"2025-01-27 19:55:58.000000000","message":"Now I do a LOG_ERROR.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[{"line_number":1220,"context_line":"\tif (swd_mode) {"},{"line_number":1221,"context_line":"\t\tif (trst)"},{"line_number":1222,"context_line":"\t\t\tLOG_INFO(\"Asserting TRST not supported in SWD mode!\");"},{"line_number":1223,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1224,"context_line":"\t}"},{"line_number":1225,"context_line":""},{"line_number":1226,"context_line":"\tint retval \u003d ch347_cmd_start_next(CH347_CMD_JTAG_BIT_OP);"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"96bde84f_653a7cb8","line":1223,"updated":"2025-01-26 12:43:29.000000000","message":"This generates annoying\n`Error: 335 4167 core.c:636 adapter_system_reset(): SRST error`\nevery time the reset is used in SWD mode even if `reset_config none`\n\nchange LOG_INFO to LOG_WARNING and return ERROR_OK","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1220,"context_line":"\tif (swd_mode) {"},{"line_number":1221,"context_line":"\t\tif (trst)"},{"line_number":1222,"context_line":"\t\t\tLOG_INFO(\"Asserting TRST not supported in SWD mode!\");"},{"line_number":1223,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1224,"context_line":"\t}"},{"line_number":1225,"context_line":""},{"line_number":1226,"context_line":"\tint retval \u003d ch347_cmd_start_next(CH347_CMD_JTAG_BIT_OP);"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"2fbc5ae5_c048840b","line":1223,"in_reply_to":"96bde84f_653a7cb8","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve changed this into a warning and return now ERROR_OK.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1244,"context_line":"}"},{"line_number":1245,"context_line":""},{"line_number":1246,"context_line":"/**"},{"line_number":1247,"context_line":" * @brief Flushes the command buffer and sleeps for a specific timspan"},{"line_number":1248,"context_line":" *"},{"line_number":1249,"context_line":" * @param us Sleep time in microseconds"},{"line_number":1250,"context_line":" * @return ERROR_OK at success"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"04735301_254a4a96","line":1247,"updated":"2025-01-25 17:47:58.000000000","message":"s/timspan/timespan/ ?","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1244,"context_line":"}"},{"line_number":1245,"context_line":""},{"line_number":1246,"context_line":"/**"},{"line_number":1247,"context_line":" * @brief Flushes the command buffer and sleeps for a specific timspan"},{"line_number":1248,"context_line":" *"},{"line_number":1249,"context_line":" * @param us Sleep time in microseconds"},{"line_number":1250,"context_line":" * @return ERROR_OK at success"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"f4af392a_41fcf5f1","line":1247,"in_reply_to":"04735301_254a4a96","updated":"2025-01-27 19:55:58.000000000","message":"Thanks for finding this.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1258,"context_line":"}"},{"line_number":1259,"context_line":""},{"line_number":1260,"context_line":"/**"},{"line_number":1261,"context_line":" * @brief Executes the command quene"},{"line_number":1262,"context_line":" *"},{"line_number":1263,"context_line":" * @return Success returns ERROR_OK"},{"line_number":1264,"context_line":" */"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"6f6f0859_8eed814c","line":1261,"updated":"2025-01-25 17:47:58.000000000","message":"s/quene/queue/","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1258,"context_line":"}"},{"line_number":1259,"context_line":""},{"line_number":1260,"context_line":"/**"},{"line_number":1261,"context_line":" * @brief Executes the command quene"},{"line_number":1262,"context_line":" *"},{"line_number":1263,"context_line":" * @return Success returns ERROR_OK"},{"line_number":1264,"context_line":" */"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"f4f96159_72ad2a25","line":1261,"in_reply_to":"6f6f0859_8eed814c","updated":"2025-01-27 19:55:58.000000000","message":"Thanks for finding this.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1806,"context_line":"static int ch347_swd_queue_flush(void)"},{"line_number":1807,"context_line":"{"},{"line_number":1808,"context_line":"\tint length \u003d ch347_swd_context.send_len;"},{"line_number":1809,"context_line":"\tch347_swd_context.send_buf[0] \u003d (uint8_t)CH347_CMD_SWD;"},{"line_number":1810,"context_line":"\tch347_swd_context.send_buf[1] \u003d (uint8_t)(ch347_swd_context.send_len - CH347_CMD_HEADER);"},{"line_number":1811,"context_line":"\tch347_swd_context.send_buf[2] \u003d (uint8_t)((ch347_swd_context.send_len - CH347_CMD_HEADER) \u003e\u003e 8);"},{"line_number":1812,"context_line":"\tint retval \u003d ch347_write_data(ch347_swd_context.send_buf, \u0026length);"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"4e8de497_f58e02ca","line":1809,"updated":"2025-01-25 17:47:58.000000000","message":"No need for cast `(uint8_t)`","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1806,"context_line":"static int ch347_swd_queue_flush(void)"},{"line_number":1807,"context_line":"{"},{"line_number":1808,"context_line":"\tint length \u003d ch347_swd_context.send_len;"},{"line_number":1809,"context_line":"\tch347_swd_context.send_buf[0] \u003d (uint8_t)CH347_CMD_SWD;"},{"line_number":1810,"context_line":"\tch347_swd_context.send_buf[1] \u003d (uint8_t)(ch347_swd_context.send_len - CH347_CMD_HEADER);"},{"line_number":1811,"context_line":"\tch347_swd_context.send_buf[2] \u003d (uint8_t)((ch347_swd_context.send_len - CH347_CMD_HEADER) \u003e\u003e 8);"},{"line_number":1812,"context_line":"\tint retval \u003d ch347_write_data(ch347_swd_context.send_buf, \u0026length);"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"1b94b9a9_a4c0bff5","line":1809,"in_reply_to":"4e8de497_f58e02ca","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve removed the cast.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1807,"context_line":"{"},{"line_number":1808,"context_line":"\tint length \u003d ch347_swd_context.send_len;"},{"line_number":1809,"context_line":"\tch347_swd_context.send_buf[0] \u003d (uint8_t)CH347_CMD_SWD;"},{"line_number":1810,"context_line":"\tch347_swd_context.send_buf[1] \u003d (uint8_t)(ch347_swd_context.send_len - CH347_CMD_HEADER);"},{"line_number":1811,"context_line":"\tch347_swd_context.send_buf[2] \u003d (uint8_t)((ch347_swd_context.send_len - CH347_CMD_HEADER) \u003e\u003e 8);"},{"line_number":1812,"context_line":"\tint retval \u003d ch347_write_data(ch347_swd_context.send_buf, \u0026length);"},{"line_number":1813,"context_line":"\tif (retval !\u003d ERROR_OK) {"},{"line_number":1814,"context_line":"\t\tch347_swd_context.queued_retval \u003d retval;"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"1e0f2c3e_23107bc6","line":1811,"range":{"start_line":1810,"start_character":1,"end_line":1811,"end_character":96},"updated":"2025-01-25 17:47:58.000000000","message":"Consider using the helper:\n`h_u16_to_le(\u0026ch347_swd_context.send_buf[1], length - CH347_CMD_HEADER);`","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1807,"context_line":"{"},{"line_number":1808,"context_line":"\tint length \u003d ch347_swd_context.send_len;"},{"line_number":1809,"context_line":"\tch347_swd_context.send_buf[0] \u003d (uint8_t)CH347_CMD_SWD;"},{"line_number":1810,"context_line":"\tch347_swd_context.send_buf[1] \u003d (uint8_t)(ch347_swd_context.send_len - CH347_CMD_HEADER);"},{"line_number":1811,"context_line":"\tch347_swd_context.send_buf[2] \u003d (uint8_t)((ch347_swd_context.send_len - CH347_CMD_HEADER) \u003e\u003e 8);"},{"line_number":1812,"context_line":"\tint retval \u003d ch347_write_data(ch347_swd_context.send_buf, \u0026length);"},{"line_number":1813,"context_line":"\tif (retval !\u003d ERROR_OK) {"},{"line_number":1814,"context_line":"\t\tch347_swd_context.queued_retval \u003d retval;"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"d5028c7e_0fb57986","line":1811,"range":{"start_line":1810,"start_character":1,"end_line":1811,"end_character":96},"in_reply_to":"1e0f2c3e_23107bc6","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve changed this.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[{"line_number":1817,"context_line":"\t}"},{"line_number":1818,"context_line":""},{"line_number":1819,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":1820,"context_line":"\tdo {"},{"line_number":1821,"context_line":"\t\tlength \u003d ch347_swd_context.need_recv_len;"},{"line_number":1822,"context_line":"\t\tretval \u003d ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length);"},{"line_number":1823,"context_line":"\t\tif (retval !\u003d ERROR_OK)\t{"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"0b0c237e_cbc42ae3","line":1820,"updated":"2025-01-26 12:43:29.000000000","message":"SWD works again if I remove this `do while` loop, added @ patchset 40\nThe code diverged from the vendor version, please don\u0027t backport parts of it without knowing good reason.\n\nAnyway the way of reading the data of length not divisible by packet size from USB could easily fail when an unexpectedly larger response is returned and error recovery could be imposible. See https://libusb.sourceforge.io/api-1.0/libusb_packetoverflow.html","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1817,"context_line":"\t}"},{"line_number":1818,"context_line":""},{"line_number":1819,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":1820,"context_line":"\tdo {"},{"line_number":1821,"context_line":"\t\tlength \u003d ch347_swd_context.need_recv_len;"},{"line_number":1822,"context_line":"\t\tretval \u003d ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length);"},{"line_number":1823,"context_line":"\t\tif (retval !\u003d ERROR_OK)\t{"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"7f9c91d9_3a06d0c6","line":1820,"in_reply_to":"0b0c237e_cbc42ae3","updated":"2025-01-27 19:55:58.000000000","message":"OK, I didn\u0027t put much effort into the SWD part. But I\u0027ve removed the do/while loop.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1820,"context_line":"\tdo {"},{"line_number":1821,"context_line":"\t\tlength \u003d ch347_swd_context.need_recv_len;"},{"line_number":1822,"context_line":"\t\tretval \u003d ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length);"},{"line_number":1823,"context_line":"\t\tif (retval !\u003d ERROR_OK)\t{"},{"line_number":1824,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d retval;"},{"line_number":1825,"context_line":"\t\t\tLOG_DEBUG(\"CH347ReadData error\");"},{"line_number":1826,"context_line":"\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"f49dad74_dc03a606","line":1823,"updated":"2025-01-25 17:47:58.000000000","message":"Use space, not tab, between `)` and `{`","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1820,"context_line":"\tdo {"},{"line_number":1821,"context_line":"\t\tlength \u003d ch347_swd_context.need_recv_len;"},{"line_number":1822,"context_line":"\t\tretval \u003d ch347_read_data(\u0026ch347_swd_context.recv_buf[ch347_swd_context.recv_len], \u0026length);"},{"line_number":1823,"context_line":"\t\tif (retval !\u003d ERROR_OK)\t{"},{"line_number":1824,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d retval;"},{"line_number":1825,"context_line":"\t\t\tLOG_DEBUG(\"CH347ReadData error\");"},{"line_number":1826,"context_line":"\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"62bb0dc5_bcf10955","line":1823,"in_reply_to":"f49dad74_dc03a606","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve put a space between.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b98a01b7f4454d39a342eef832c8b6f063ff4d7d","unresolved":true,"context_lines":[{"line_number":1936,"context_line":"\treturn flush;"},{"line_number":1937,"context_line":"}"},{"line_number":1938,"context_line":""},{"line_number":1939,"context_line":"// foreward declarations"},{"line_number":1940,"context_line":"static int ch347_swd_run_queue(void);"},{"line_number":1941,"context_line":""},{"line_number":1942,"context_line":"static int ch347_swd_send_idle(uint32_t ap_delay_clk)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"5c1a0198_b973c5cd","line":1939,"updated":"2025-01-25 17:47:58.000000000","message":"s/foreward/forward/\nActually there is no need for this comment, you can drop it","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1936,"context_line":"\treturn flush;"},{"line_number":1937,"context_line":"}"},{"line_number":1938,"context_line":""},{"line_number":1939,"context_line":"// foreward declarations"},{"line_number":1940,"context_line":"static int ch347_swd_run_queue(void);"},{"line_number":1941,"context_line":""},{"line_number":1942,"context_line":"static int ch347_swd_send_idle(uint32_t ap_delay_clk)"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"8ee12815_1f4988ad","line":1939,"in_reply_to":"5c1a0198_b973c5cd","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve removed the comment.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[{"line_number":1949,"context_line":""},{"line_number":1950,"context_line":"\t\tpswd_io \u003d ch347_get_one_swd_io();"},{"line_number":1951,"context_line":"\t\tif (!pswd_io) {"},{"line_number":1952,"context_line":"\t\t\tLOG_DEBUG(\"ch347_swd_queue_cmd error\");"},{"line_number":1953,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":1954,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1955,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"2013ef7d_631d7b69","line":1952,"range":{"start_line":1952,"start_character":7,"end_line":1952,"end_character":12},"updated":"2025-01-26 12:43:29.000000000","message":"LOG_ERROR and use meaningful text","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":1949,"context_line":""},{"line_number":1950,"context_line":"\t\tpswd_io \u003d ch347_get_one_swd_io();"},{"line_number":1951,"context_line":"\t\tif (!pswd_io) {"},{"line_number":1952,"context_line":"\t\t\tLOG_DEBUG(\"ch347_swd_queue_cmd error\");"},{"line_number":1953,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":1954,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":1955,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"0d11cca3_522602b2","line":1952,"range":{"start_line":1952,"start_character":7,"end_line":1952,"end_character":12},"in_reply_to":"2013ef7d_631d7b69","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve changed this into LOG_ERROR with a better text.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[{"line_number":2105,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":2106,"context_line":"\tch347_swd_context.sent_cmd_count \u003d 0;"},{"line_number":2107,"context_line":"\tretval \u003d ch347_swd_context.queued_retval;"},{"line_number":2108,"context_line":"\tch347_swd_context.queued_retval \u003d ERROR_OK;"},{"line_number":2109,"context_line":""},{"line_number":2110,"context_line":"\treturn retval;"},{"line_number":2111,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"aa41fd8c_6954d725","line":2108,"range":{"start_line":2108,"start_character":1,"end_line":2108,"end_character":44},"updated":"2025-01-26 12:43:29.000000000","message":"This breaks queued_retval concept, as `swd_run_queue()` could be called `swd_read/write_reg()` which doesn\u0027t propagate the error.\n\nI admit the queued_retval concept is stupid and getting rid of it is on my TODO list.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6274312748b870eef050863a75a6a033a847cf96","unresolved":false,"context_lines":[{"line_number":2105,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":2106,"context_line":"\tch347_swd_context.sent_cmd_count \u003d 0;"},{"line_number":2107,"context_line":"\tretval \u003d ch347_swd_context.queued_retval;"},{"line_number":2108,"context_line":"\tch347_swd_context.queued_retval \u003d ERROR_OK;"},{"line_number":2109,"context_line":""},{"line_number":2110,"context_line":"\treturn retval;"},{"line_number":2111,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"e75474db_31886375","line":2108,"range":{"start_line":2108,"start_character":1,"end_line":2108,"end_character":44},"in_reply_to":"372a319e_b81fe325","updated":"2025-02-08 22:55:50.000000000","message":"Fixed in\n8745: drivers/ch347: don\u0027t loose swd_read/write_reg errors | https://review.openocd.org/c/openocd/+/8745","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e4d557755ac864d37475ff9f83a5107613c61222","unresolved":true,"context_lines":[{"line_number":2105,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":2106,"context_line":"\tch347_swd_context.sent_cmd_count \u003d 0;"},{"line_number":2107,"context_line":"\tretval \u003d ch347_swd_context.queued_retval;"},{"line_number":2108,"context_line":"\tch347_swd_context.queued_retval \u003d ERROR_OK;"},{"line_number":2109,"context_line":""},{"line_number":2110,"context_line":"\treturn retval;"},{"line_number":2111,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"372a319e_b81fe325","line":2108,"range":{"start_line":2108,"start_character":1,"end_line":2108,"end_character":44},"in_reply_to":"879f9d59_af0023c0","updated":"2025-01-27 21:13:43.000000000","message":"Ok, I\u0027ll take care in a separate patch. SWD part needs it. Please keep unresolved to prevent me to forget.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":2105,"context_line":"\tch347_swd_context.recv_len \u003d 0;"},{"line_number":2106,"context_line":"\tch347_swd_context.sent_cmd_count \u003d 0;"},{"line_number":2107,"context_line":"\tretval \u003d ch347_swd_context.queued_retval;"},{"line_number":2108,"context_line":"\tch347_swd_context.queued_retval \u003d ERROR_OK;"},{"line_number":2109,"context_line":""},{"line_number":2110,"context_line":"\treturn retval;"},{"line_number":2111,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"879f9d59_af0023c0","line":2108,"range":{"start_line":2108,"start_character":1,"end_line":2108,"end_character":44},"in_reply_to":"aa41fd8c_6954d725","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve no idea how to change this. But maybe you can guide me.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9240c391d2a1fd8be690d0e8de9a141e5b79c434","unresolved":true,"context_lines":[{"line_number":2136,"context_line":""},{"line_number":2137,"context_line":"\t\tpswd_io \u003d ch347_get_one_swd_io();"},{"line_number":2138,"context_line":"\t\tif (!pswd_io) {"},{"line_number":2139,"context_line":"\t\t\tLOG_DEBUG(\"Error\");"},{"line_number":2140,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":2141,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":2142,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"6ed353a3_af044507","line":2139,"range":{"start_line":2139,"start_character":3,"end_line":2139,"end_character":22},"updated":"2025-01-26 12:43:29.000000000","message":"???","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"8bdba3b9786b1a8268bc85e123afc7a2e987f27d","unresolved":false,"context_lines":[{"line_number":2136,"context_line":""},{"line_number":2137,"context_line":"\t\tpswd_io \u003d ch347_get_one_swd_io();"},{"line_number":2138,"context_line":"\t\tif (!pswd_io) {"},{"line_number":2139,"context_line":"\t\t\tLOG_DEBUG(\"Error\");"},{"line_number":2140,"context_line":"\t\t\tch347_swd_context.queued_retval \u003d ERROR_FAIL;"},{"line_number":2141,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":2142,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":42,"id":"ae9a7a80_696bad0c","line":2139,"range":{"start_line":2139,"start_character":3,"end_line":2139,"end_character":22},"in_reply_to":"6ed353a3_af044507","updated":"2025-01-27 19:55:58.000000000","message":"I\u0027ve changed that into LOG_ERROR with a better text.","commit_id":"01ef6acee915c5be6bedf526620335a753be0fa5"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"b353fc60208e6b78b0a0707e747ea2913adb998a","unresolved":true,"context_lines":[{"line_number":881,"context_line":"{"},{"line_number":882,"context_line":"\tbool tms \u003d ch347.tms_pin \u003d\u003d TMS_H;"},{"line_number":883,"context_line":"\tint retval \u003d ERROR_OK;"},{"line_number":884,"context_line":"\tfor (int i \u003d 0; i \u003c count; i++) {"},{"line_number":885,"context_line":"\t\tretval \u003d ch347_scratchpad_add_clock_tms(tms);"},{"line_number":886,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":887,"context_line":"\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":43,"id":"887e2baf_a53145e3","line":884,"updated":"2025-03-05 21:32:31.000000000","message":"A command initialization is missing here - for both call from `ch347_scratchpad_add_run_test` and from queue dispatch `ch347_execute_queue`.","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"4b999261e31130223ee04e287ee365541b12941e","unresolved":false,"context_lines":[{"line_number":881,"context_line":"{"},{"line_number":882,"context_line":"\tbool tms \u003d ch347.tms_pin \u003d\u003d TMS_H;"},{"line_number":883,"context_line":"\tint retval \u003d ERROR_OK;"},{"line_number":884,"context_line":"\tfor (int i \u003d 0; i \u003c count; i++) {"},{"line_number":885,"context_line":"\t\tretval \u003d ch347_scratchpad_add_clock_tms(tms);"},{"line_number":886,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":887,"context_line":"\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":43,"id":"be7b1db1_50538bd5","line":884,"in_reply_to":"887e2baf_a53145e3","updated":"2025-08-04 00:10:17.000000000","message":"Solved with patchset 47","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"834f0df9cc2bee555cabef14e22ac496b906caf4","unresolved":true,"context_lines":[{"line_number":1581,"context_line":"\tint idx \u003d -1;"},{"line_number":1582,"context_line":"\tint lower_bound \u003d 0;"},{"line_number":1583,"context_line":""},{"line_number":1584,"context_line":"\t// find the suitable speed index"},{"line_number":1585,"context_line":"\tfor (int i \u003d 0; i \u003c length; i++) {"},{"line_number":1586,"context_line":"\t\tif (khz \u003e\u003d lower_bound \u0026\u0026 khz \u003c\u003d speeds[i]) {"},{"line_number":1587,"context_line":"\t\t\tidx \u003d i;"}],"source_content_type":"text/x-csrc","patch_set":43,"id":"3fad1093_f2fe98cd","line":1584,"updated":"2025-02-09 00:21:06.000000000","message":"Test on 2.41\n`Requested speed of 1500 kHz is not possible. Using the next higher speed of 1875 kHz!`\nThis is okay as 1875 kHz is the lowest available speed.\nBut\n`Requested speed of 1900 kHz is not possible. Using the next higher speed of 3750 kHz!`\nSeems me broken.\nShould select requested or next lower speed if such exists, not the next higher! If the selected speed is lower than requested, do not print annoying LOG_INFO message - this is quite usual that the adapter shrinks down the speed - and `adapter speed` command output indicates the real speed.\n\n```\nint idx \u003d length - 1;\nwhile (idx \u003e 0 \u0026\u0026 khz \u003c speeds[idx])\n    idx--;\n```","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"4b999261e31130223ee04e287ee365541b12941e","unresolved":false,"context_lines":[{"line_number":1581,"context_line":"\tint idx \u003d -1;"},{"line_number":1582,"context_line":"\tint lower_bound \u003d 0;"},{"line_number":1583,"context_line":""},{"line_number":1584,"context_line":"\t// find the suitable speed index"},{"line_number":1585,"context_line":"\tfor (int i \u003d 0; i \u003c length; i++) {"},{"line_number":1586,"context_line":"\t\tif (khz \u003e\u003d lower_bound \u0026\u0026 khz \u003c\u003d speeds[i]) {"},{"line_number":1587,"context_line":"\t\t\tidx \u003d i;"}],"source_content_type":"text/x-csrc","patch_set":43,"id":"76f69e8d_1a50e2f7","line":1584,"in_reply_to":"3fad1093_f2fe98cd","updated":"2025-08-04 00:10:17.000000000","message":"Solved with patchset 47","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002364,"name":"Deomid Ryabkov","username":"rojer"},"change_message_id":"77fc3bf3b58537b4a7e013167f198ca0ace4b888","unresolved":true,"context_lines":[{"line_number":1614,"context_line":"\tif (CMD_ARGC !\u003d 2)"},{"line_number":1615,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1616,"context_line":""},{"line_number":1617,"context_line":"\tCOMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], custom_ch347_vids[0]);"},{"line_number":1618,"context_line":"\tCOMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], custom_ch347_pids[0]);"},{"line_number":1619,"context_line":""},{"line_number":1620,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":43,"id":"8dbaeb65_a2c27fba","line":1617,"updated":"2025-04-09 13:50:03.000000000","message":"if it\u0027s not too late, i\u0027d like to request multiple vid/pid pairs support, a-la stlink: https://github.com/openocd-org/openocd/blob/6834f022b96fb1c7f5829166578e01a0ac223cb0/src/jtag/drivers/stlink_usb.c#L5001-L5004\n\ni have already ran into two (0x1a86:0x55dd and 0x1a86:0x55de)","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"4b999261e31130223ee04e287ee365541b12941e","unresolved":false,"context_lines":[{"line_number":1614,"context_line":"\tif (CMD_ARGC !\u003d 2)"},{"line_number":1615,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":1616,"context_line":""},{"line_number":1617,"context_line":"\tCOMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], custom_ch347_vids[0]);"},{"line_number":1618,"context_line":"\tCOMMAND_PARSE_NUMBER(u16, CMD_ARGV[1], custom_ch347_pids[0]);"},{"line_number":1619,"context_line":""},{"line_number":1620,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":43,"id":"b9d0a57c_b39b8dd1","line":1617,"in_reply_to":"8dbaeb65_a2c27fba","updated":"2025-08-04 00:10:17.000000000","message":"Solved with patchset 47","commit_id":"717005cb829f2e2c568a85a7388ab8db42c8b825"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8a563140e4be2ecbba2f6a077b7b015735e19906","unresolved":true,"context_lines":[{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"},{"line_number":33,"context_line":" *   The datasheet for the wch-ic.com\u0027s CH347 part is here:\t           *"},{"line_number":34,"context_line":" *   https://www.wch-ic.com/downloads/CH347DS1_PDF.html                    *"},{"line_number":35,"context_line":" *                                                                         *"},{"line_number":36,"context_line":" ***************************************************************************/"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":47,"id":"cd320a86_73da2cb6","line":34,"range":{"start_line":34,"start_character":5,"end_line":34,"end_character":55},"updated":"2025-08-04 07:35:51.000000000","message":"Dead link for me","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3d000e1844195bbdd984e6462c33dfec558521f3","unresolved":false,"context_lines":[{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"},{"line_number":33,"context_line":" *   The datasheet for the wch-ic.com\u0027s CH347 part is here:\t           *"},{"line_number":34,"context_line":" *   https://www.wch-ic.com/downloads/CH347DS1_PDF.html                    *"},{"line_number":35,"context_line":" *                                                                         *"},{"line_number":36,"context_line":" ***************************************************************************/"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":47,"id":"c01156c2_5a91e9d8","line":34,"range":{"start_line":34,"start_character":5,"end_line":34,"end_character":55},"in_reply_to":"8bdd14e5_ba2075d5","updated":"2025-08-04 09:30:04.000000000","message":"It\u0027s working fine for me too.\nUpdated to version v1.4 on 2025-06-26","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6952199bd2b9f830bf801d1e19d9370f2d48ed62","unresolved":false,"context_lines":[{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"},{"line_number":33,"context_line":" *   The datasheet for the wch-ic.com\u0027s CH347 part is here:\t           *"},{"line_number":34,"context_line":" *   https://www.wch-ic.com/downloads/CH347DS1_PDF.html                    *"},{"line_number":35,"context_line":" *                                                                         *"},{"line_number":36,"context_line":" ***************************************************************************/"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":47,"id":"108e6882_2681b949","line":34,"range":{"start_line":34,"start_character":5,"end_line":34,"end_character":55},"in_reply_to":"c01156c2_5a91e9d8","updated":"2025-08-04 10:12:55.000000000","message":"Ahh, not the direct download and their web page is not compatible with Mozilla Firefox","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"f352aabe7cf169d83f3d73e68299569d00d730b3","unresolved":true,"context_lines":[{"line_number":31,"context_line":" *   available for testing.                                                *"},{"line_number":32,"context_line":" *                                                                         *"},{"line_number":33,"context_line":" *   The datasheet for the wch-ic.com\u0027s CH347 part is here:\t           *"},{"line_number":34,"context_line":" *   https://www.wch-ic.com/downloads/CH347DS1_PDF.html                    *"},{"line_number":35,"context_line":" *                                                                         *"},{"line_number":36,"context_line":" ***************************************************************************/"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":47,"id":"8bdd14e5_ba2075d5","line":34,"range":{"start_line":34,"start_character":5,"end_line":34,"end_character":55},"in_reply_to":"cd320a86_73da2cb6","updated":"2025-08-04 08:13:25.000000000","message":"Hi, this link is valid for me, may be caused by network issues","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8a563140e4be2ecbba2f6a077b7b015735e19906","unresolved":true,"context_lines":[{"line_number":178,"context_line":"\t60000 // 60 MHz"},{"line_number":179,"context_line":"};"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"static const int ch347_swd_clock_speeds[] \u003d {"},{"line_number":182,"context_line":"\t5000, //5 MHz"},{"line_number":183,"context_line":"\t1000, //1 MHz"},{"line_number":184,"context_line":"\t500 //500 kHz"}],"source_content_type":"text/x-csrc","patch_set":47,"id":"567eb3bd_4f9fc097","line":181,"updated":"2025-08-04 07:35:51.000000000","message":"Where you fond this?\nNot saying there is no version it works on, however at least on CH347T 4.41 the 5 MHz speed is broken - it actually uses 1000 / 256 ~\u003d 4 kHz\n\nThis change is in conflict with\n8743: drivers/ch347: add SWD speed settings | https://review.openocd.org/c/openocd/+/8743\n\nI recommend you to drop the change here and add it as a follow-up patch after my follow ups and make it dependent on chip version.\n\nAlso do not block slower speeds, they are needed in specific cases.","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1cae66fb988fd51620097c322c6d4ceb99c0d489","unresolved":false,"context_lines":[{"line_number":178,"context_line":"\t60000 // 60 MHz"},{"line_number":179,"context_line":"};"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"static const int ch347_swd_clock_speeds[] \u003d {"},{"line_number":182,"context_line":"\t5000, //5 MHz"},{"line_number":183,"context_line":"\t1000, //1 MHz"},{"line_number":184,"context_line":"\t500 //500 kHz"}],"source_content_type":"text/x-csrc","patch_set":47,"id":"3bf2b6fd_fc51bc81","line":181,"in_reply_to":"567eb3bd_4f9fc097","updated":"2025-08-04 20:27:45.000000000","message":"Removed","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8a563140e4be2ecbba2f6a077b7b015735e19906","unresolved":true,"context_lines":[{"line_number":1239,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1240,"context_line":"\t\treturn retval;"},{"line_number":1241,"context_line":""},{"line_number":1242,"context_line":"\tch347.trst_pin \u003d trst ? TRST_L : TRST_H;"},{"line_number":1243,"context_line":"\tretval \u003d ch347_scratchpad_add_pin_byte();"},{"line_number":1244,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1245,"context_line":"\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":47,"id":"1efd3c44_812a18f6","line":1242,"updated":"2025-08-04 07:35:51.000000000","message":"The different TRST bit for CH347F is gone. Was is error? Did you test it on CH347F?","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6952199bd2b9f830bf801d1e19d9370f2d48ed62","unresolved":false,"context_lines":[{"line_number":1239,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1240,"context_line":"\t\treturn retval;"},{"line_number":1241,"context_line":""},{"line_number":1242,"context_line":"\tch347.trst_pin \u003d trst ? TRST_L : TRST_H;"},{"line_number":1243,"context_line":"\tretval \u003d ch347_scratchpad_add_pin_byte();"},{"line_number":1244,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1245,"context_line":"\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":47,"id":"0f58398f_d50e34c9","line":1242,"in_reply_to":"1ef0f391_f0dc4233","updated":"2025-08-04 10:12:55.000000000","message":"Ok then","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1002199,"name":"ZhiYuanNJ","display_name":" ZhiYuanNJ","email":"871238103@qq.com","username":"ZhiYuanNJ"},"change_message_id":"f352aabe7cf169d83f3d73e68299569d00d730b3","unresolved":true,"context_lines":[{"line_number":1239,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1240,"context_line":"\t\treturn retval;"},{"line_number":1241,"context_line":""},{"line_number":1242,"context_line":"\tch347.trst_pin \u003d trst ? TRST_L : TRST_H;"},{"line_number":1243,"context_line":"\tretval \u003d ch347_scratchpad_add_pin_byte();"},{"line_number":1244,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":1245,"context_line":"\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":47,"id":"1ef0f391_f0dc4233","line":1242,"in_reply_to":"1efd3c44_812a18f6","updated":"2025-08-04 08:13:25.000000000","message":"I have CH347F hardware here, and setting BIT(5) can take effect.","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"8a563140e4be2ecbba2f6a077b7b015735e19906","unresolved":true,"context_lines":[{"line_number":1416,"context_line":"\t\tch347.use_bitwise_mode \u003d false;"},{"line_number":1417,"context_line":"\t}"},{"line_number":1418,"context_line":""},{"line_number":1419,"context_line":"\tif (swd_mode) {"},{"line_number":1420,"context_line":"\t\tif (ch347.chip_variant \u003d\u003d CH347T \u0026\u0026 ch347_device_descriptor.bcdDevice \u003c 0x441)"},{"line_number":1421,"context_line":"\t\t\tLOG_WARNING(\"CH347T version older than 4.41 probably does not support SWD transport\");"},{"line_number":1422,"context_line":""},{"line_number":1423,"context_line":"\t\tif (ch347_device_descriptor.bcdDevice \u003d\u003d 0x441)"},{"line_number":1424,"context_line":"\t\t\tLOG_WARNING(\"If CH347 version 4.41 cannot connect or SWD fails often, insert a resistor to SWDIO circuit\");"},{"line_number":1425,"context_line":""},{"line_number":1426,"context_line":"\t} else if (ch347.chip_variant \u003d\u003d CH347T \u0026\u0026 ch347_device_descriptor.bcdDevice \u003d\u003d 0x241) {"},{"line_number":1427,"context_line":"\t\tLOG_WARNING(\"CH347T version 2.41 has very weird clock timing, may not work with a slower JTAG device\");"},{"line_number":1428,"context_line":"\t}"},{"line_number":1429,"context_line":""},{"line_number":1430,"context_line":"\treturn ERROR_OK;"},{"line_number":1431,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":47,"id":"c32b38af_4a4cb830","line":1428,"range":{"start_line":1419,"start_character":1,"end_line":1428,"end_character":1},"updated":"2025-08-04 07:35:51.000000000","message":"This is my code, not yours.\nIf you ever want to merge this driver do not cheat from follow-up patches.\nDrop it in favour of 8741: drivers/ch347, doc: warn about CH347(T) problems | https://review.openocd.org/c/openocd/+/8741","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1cae66fb988fd51620097c322c6d4ceb99c0d489","unresolved":false,"context_lines":[{"line_number":1416,"context_line":"\t\tch347.use_bitwise_mode \u003d false;"},{"line_number":1417,"context_line":"\t}"},{"line_number":1418,"context_line":""},{"line_number":1419,"context_line":"\tif (swd_mode) {"},{"line_number":1420,"context_line":"\t\tif (ch347.chip_variant \u003d\u003d CH347T \u0026\u0026 ch347_device_descriptor.bcdDevice \u003c 0x441)"},{"line_number":1421,"context_line":"\t\t\tLOG_WARNING(\"CH347T version older than 4.41 probably does not support SWD transport\");"},{"line_number":1422,"context_line":""},{"line_number":1423,"context_line":"\t\tif (ch347_device_descriptor.bcdDevice \u003d\u003d 0x441)"},{"line_number":1424,"context_line":"\t\t\tLOG_WARNING(\"If CH347 version 4.41 cannot connect or SWD fails often, insert a resistor to SWDIO circuit\");"},{"line_number":1425,"context_line":""},{"line_number":1426,"context_line":"\t} else if (ch347.chip_variant \u003d\u003d CH347T \u0026\u0026 ch347_device_descriptor.bcdDevice \u003d\u003d 0x241) {"},{"line_number":1427,"context_line":"\t\tLOG_WARNING(\"CH347T version 2.41 has very weird clock timing, may not work with a slower JTAG device\");"},{"line_number":1428,"context_line":"\t}"},{"line_number":1429,"context_line":""},{"line_number":1430,"context_line":"\treturn ERROR_OK;"},{"line_number":1431,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":47,"id":"bbdaffe3_80c161ac","line":1428,"range":{"start_line":1419,"start_character":1,"end_line":1428,"end_character":1},"in_reply_to":"c32b38af_4a4cb830","updated":"2025-08-04 20:27:45.000000000","message":"Sorry, I\u0027ve removed this.","commit_id":"1bbf0d26b5bbfde3c2a38eb2726b1a31383f61d7"}],"src/jtag/interface.h":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e86a8e7d462948bba067be135e24f2cb04b165eb","unresolved":true,"context_lines":[{"line_number":401,"context_line":"extern struct adapter_driver vsllink_adapter_driver;"},{"line_number":402,"context_line":"extern struct adapter_driver xds110_adapter_driver;"},{"line_number":403,"context_line":"extern struct adapter_driver xlnx_pcie_xvc_adapter_driver;"},{"line_number":404,"context_line":"extern struct adapter_driver ch347_adapter_driver;"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"#endif /* OPENOCD_JTAG_INTERFACE_H */"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"b81e19e0_72abe476","line":404,"updated":"2023-10-27 14:34:29.000000000","message":"please keep this list sorted alphabetically. This line should be added after buspirate_adapter_driver","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"909c5f1b03ee7d42edd718180de3ff03bcd6d376","unresolved":false,"context_lines":[{"line_number":401,"context_line":"extern struct adapter_driver vsllink_adapter_driver;"},{"line_number":402,"context_line":"extern struct adapter_driver xds110_adapter_driver;"},{"line_number":403,"context_line":"extern struct adapter_driver xlnx_pcie_xvc_adapter_driver;"},{"line_number":404,"context_line":"extern struct adapter_driver ch347_adapter_driver;"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"#endif /* OPENOCD_JTAG_INTERFACE_H */"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"a350c39a_7ffb66a7","line":404,"in_reply_to":"b81e19e0_72abe476","updated":"2023-10-27 23:40:00.000000000","message":"I\u0027ve not seen that it\u0027s sorted. Now it\u0027s in the right order.","commit_id":"a9826e56d5a9dfa5931926aa178d0b982f5caf56"},{"author":{"_account_id":1000859,"name":"Karl Palsson","email":"karlp@tweak.au","username":"karlp"},"change_message_id":"74f499253db93fee04b1e7065502e1a998f1b9d1","unresolved":true,"context_lines":[{"line_number":403,"context_line":"extern struct adapter_driver xds110_adapter_driver;"},{"line_number":404,"context_line":"extern struct adapter_driver xlnx_pcie_xvc_adapter_driver;"},{"line_number":405,"context_line":"extern struct adapter_driver esp_remote_adapter_driver;"},{"line_number":406,"context_line":"extern struct adapter_driver esp_gpio_adapter_driver;"},{"line_number":407,"context_line":"#endif /* OPENOCD_JTAG_INTERFACE_H */"}],"source_content_type":"text/x-csrc","patch_set":28,"id":"5a2b351f_49556288","line":406,"updated":"2023-11-10 10:50:48.000000000","message":"This is out of scope of this changeset and should be dropped from here.","commit_id":"e44b0b5c6b37c589194efaa9263e18ebc3b85c1d"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1389e226808f4918e1295b2ce404d0af571ed789","unresolved":true,"context_lines":[{"line_number":403,"context_line":"extern struct adapter_driver xds110_adapter_driver;"},{"line_number":404,"context_line":"extern struct adapter_driver xlnx_pcie_xvc_adapter_driver;"},{"line_number":405,"context_line":"extern struct adapter_driver esp_remote_adapter_driver;"},{"line_number":406,"context_line":"extern struct adapter_driver esp_gpio_adapter_driver;"},{"line_number":407,"context_line":"#endif /* OPENOCD_JTAG_INTERFACE_H */"}],"source_content_type":"text/x-csrc","patch_set":28,"id":"f7b9a7de_2b6b4b96","line":406,"in_reply_to":"3c3aa1f3_9ba8670c","updated":"2023-11-11 22:18:14.000000000","message":"Karl, thanks for noticing!\n\nMatthias, you unintentionally included some other changes (from esp32 fork?) to your patch (from patch set 23 on). Please drop unrelated changes.","commit_id":"e44b0b5c6b37c589194efaa9263e18ebc3b85c1d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"0b8ed2f31cf233563d083cbd6a9bbe691d17ac25","unresolved":false,"context_lines":[{"line_number":403,"context_line":"extern struct adapter_driver xds110_adapter_driver;"},{"line_number":404,"context_line":"extern struct adapter_driver xlnx_pcie_xvc_adapter_driver;"},{"line_number":405,"context_line":"extern struct adapter_driver esp_remote_adapter_driver;"},{"line_number":406,"context_line":"extern struct adapter_driver esp_gpio_adapter_driver;"},{"line_number":407,"context_line":"#endif /* OPENOCD_JTAG_INTERFACE_H */"}],"source_content_type":"text/x-csrc","patch_set":28,"id":"3c3aa1f3_9ba8670c","line":406,"in_reply_to":"5a2b351f_49556288","updated":"2023-11-10 20:08:35.000000000","message":"Then I think we should not mix it into this patch and should make another patch for this.","commit_id":"e44b0b5c6b37c589194efaa9263e18ebc3b85c1d"},{"author":{"_account_id":1002195,"name":"Matthias Jentsch","display_name":"EasyDevKits","email":"info@easydevkits.com","username":"EasyDevKits"},"change_message_id":"1bf204030a03a406be1cb245d6653dc8aab98e3f","unresolved":false,"context_lines":[{"line_number":403,"context_line":"extern struct adapter_driver xds110_adapter_driver;"},{"line_number":404,"context_line":"extern struct adapter_driver xlnx_pcie_xvc_adapter_driver;"},{"line_number":405,"context_line":"extern struct adapter_driver esp_remote_adapter_driver;"},{"line_number":406,"context_line":"extern struct adapter_driver esp_gpio_adapter_driver;"},{"line_number":407,"context_line":"#endif /* OPENOCD_JTAG_INTERFACE_H */"}],"source_content_type":"text/x-csrc","patch_set":28,"id":"0a9c6a0e_e0686597","line":406,"in_reply_to":"f7b9a7de_2b6b4b96","updated":"2023-11-11 22:50:46.000000000","message":"Sorry, that was my mistake. I\u0027ve removed this.","commit_id":"e44b0b5c6b37c589194efaa9263e18ebc3b85c1d"}]}
