stlink: fix speed setting in dap mode

stlink accepts a set of values for "adapter speed".
Fix the api khz() to return one of the allowed speed values.

Change-Id: Iac640b6f76935891ca25ac168cab3809707f19d9
Signed-off-by: Laurent LEMELE <laurent.lemele@st.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5464
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
This commit is contained in:
Laurent LEMELE 2020-02-12 22:22:54 +01:00 committed by Antonio Borneo
parent 4ce4aa752b
commit 56ff1ecddb
1 changed files with 6 additions and 1 deletions

View File

@ -3705,7 +3705,12 @@ static int stlink_dap_speed(int speed)
/** */
static int stlink_dap_khz(int khz, int *jtag_speed)
{
*jtag_speed = khz;
if (khz == 0) {
LOG_ERROR("RCLK not supported");
return ERROR_FAIL;
}
*jtag_speed = stlink_speed(stlink_dap_handle, khz, true);
return ERROR_OK;
}