-/*****************************************************************************
- * Copyright (C) 2016 by Matthias Welwarsky <matthias.welwarsky@sysgo.com> *
- * *
- * 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. *
- ****************************************************************************/
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/*
+ * Copyright (C) 2016 by Matthias Welwarsky <matthias.welwarsky@sysgo.com>
+ */
#ifdef HAVE_CONFIG_H
#include "config.h"
int common_magic;
struct adiv5_dap *dap;
struct adiv5_ap *ap;
- int ap_num;
+ uint64_t ap_num;
};
static int mem_ap_target_create(struct target *target, Jim_Interp *interp)
struct mem_ap *mem_ap = target->arch_info;
if (!target_was_examined(target)) {
- if (mem_ap->ap) {
- dap_put_ap(mem_ap->ap);
- mem_ap->ap = NULL;
- }
-
- mem_ap->ap = dap_get_ap(mem_ap->dap, mem_ap->ap_num);
if (!mem_ap->ap) {
- LOG_ERROR("Cannot get AP");
- return ERROR_FAIL;
+ mem_ap->ap = dap_get_ap(mem_ap->dap, mem_ap->ap_num);
+ if (!mem_ap->ap) {
+ LOG_ERROR("Cannot get AP");
+ return ERROR_FAIL;
+ }
}
target_set_examined(target);
target->state = TARGET_UNKNOWN;
.set = mem_ap_reg_set,
};
-const char *mem_ap_get_gdb_arch(struct target *target)
+static const char *mem_ap_get_gdb_arch(struct target *target)
{
return "arm";
}