+// SPDX-License-Identifier: GPL-2.0-or-later
+
/***************************************************************************
* Copyright (C) 2020 by Tarek Bochkati *
* Tarek Bochkati <tarek.bouchkati@gmail.com> *
* spen@spen-soft.co.uk *
* *
* This code is based on https://github.com/texane/stlink *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
stlink_dap_handle->reconnect_pending = false;
/* on new FW, calling mode-leave closes all the opened AP; reopen them! */
if (stlink_dap_handle->version.flags & STLINK_F_HAS_AP_INIT)
- for (int apsel = 0; apsel <= DP_APSEL_MAX; apsel++)
+ for (unsigned int apsel = 0; apsel <= DP_APSEL_MAX; apsel++)
if (test_bit(apsel, opened_ap)) {
clear_bit(apsel, opened_ap);
stlink_dap_open_ap(apsel);
uint32_t dummy;
int retval;
+ if (is_adiv6(dap)) {
+ static bool error_flagged;
+ if (!error_flagged)
+ LOG_ERROR("ADIv6 dap not supported by stlink dap-direct mode");
+ error_flagged = true;
+ return ERROR_FAIL;
+ }
+
if (reg != ADIV5_AP_REG_IDR) {
retval = stlink_dap_open_ap(ap->ap_num);
if (retval != ERROR_OK)
struct adiv5_dap *dap = ap->dap;
int retval;
+ if (is_adiv6(dap)) {
+ static bool error_flagged;
+ if (!error_flagged)
+ LOG_ERROR("ADIv6 dap not supported by stlink dap-direct mode");
+ error_flagged = true;
+ return ERROR_FAIL;
+ }
+
retval = stlink_dap_open_ap(ap->ap_num);
if (retval != ERROR_OK)
return retval;
LOG_DEBUG("Queue: %u commands in %u items", len, items);
- int ap_num = DP_APSEL_INVALID;
+ uint32_t ap_num = DP_APSEL_INVALID;
unsigned int cmd_index = 0;
unsigned int val_index = ALIGN_UP(items, 4);
for (unsigned int i = 0; i < len; i++) {
{
struct stlink_usb_handle_s *h = handle;
unsigned int i, items = 0;
- int ap_num = DP_APSEL_INVALID;
+ uint32_t ap_num = DP_APSEL_INVALID;
unsigned int misc_max_items = (h->version.stlink == 2) ? STLINK_V2_RW_MISC_SIZE : STLINK_V3_RW_MISC_SIZE;
if (!(h->version.flags & STLINK_F_HAS_RW_MISC))
q->ap_w.reg = reg;
q->ap_w.ap = ap;
q->ap_w.data = data;
- if (reg == ADIV5_MEM_AP_REG_CSW && ap->csw_default != last_csw_default[ap->ap_num]) {
+ uint8_t ap_num = ap->ap_num;
+ if (reg == ADIV5_MEM_AP_REG_CSW && ap->csw_default != last_csw_default[ap_num]) {
q->ap_w.changes_csw_default = true;
- last_csw_default[ap->ap_num] = ap->csw_default;
+ last_csw_default[ap_num] = ap->csw_default;
} else {
q->ap_w.changes_csw_default = false;
}