2
0
mirror of git://git.code.sf.net/p/openocd/code synced 2025-08-05 22:39:22 +10:00
openocd/src/target/quark_d20xx.c
Antonio Borneo 382148e4dd openocd: fix SPDX tag format for files .c
With the old checkpatch we cannot use the correct format for the
SPDX tags in the file .c, in fact the C99 comments are not allowed
and we had to use the block comment.

With the new checkpatch, let's switch to the correct SPDX format.

Change created automatically through the command:
	sed -i \
	's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \
	$(find src/ contrib/ -name \*.c)

Change-Id: I6da16506baa7af718947562505dd49606d124171
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7153
Tested-by: jenkins
2022-09-18 08:22:01 +00:00

105 lines
2.8 KiB
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright(c) 2015-2016 Intel Corporation.
*
* Jessica Gomez (jessica.gomez.hernandez@intel.com)
* Ivan De Cesaris (ivan.de.cesaris@intel.com)
*
* Contact Information:
* Intel Corporation
*/
/*
* @file
* Debugger for Intel Quark D20xx
* The CPU TAP (Lakemont TAP) is used for software debug and the CLTAP is
* used for SoC level operations.
*
* Reference document:
* Intel Quark microcontroller D2000 Debug Operations (web search for doc num 333241)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <helper/log.h>
#include "target.h"
#include "target_type.h"
#include "breakpoints.h"
#include "lakemont.h"
#include "x86_32_common.h"
static int quark_d20xx_target_create(struct target *t, Jim_Interp *interp)
{
struct x86_32_common *x86_32 = calloc(1, sizeof(struct x86_32_common));
if (!x86_32) {
LOG_ERROR("%s out of memory", __func__);
return ERROR_FAIL;
}
x86_32_common_init_arch_info(t, x86_32);
lakemont_init_arch_info(t, x86_32);
x86_32->core_type = LMT3_5;
return ERROR_OK;
}
static int quark_d20xx_init_target(struct command_context *cmd_ctx, struct target *t)
{
return lakemont_init_target(cmd_ctx, t);
}
static int quark_d20xx_reset_deassert(struct target *t)
{
int retval;
/* Can't detect if a warm reset happened while halted but we can make the
* openocd and target state consistent here if in probe mode already
*/
if (!check_not_halted(t)) {
retval = lakemont_update_after_probemode_entry(t);
if (retval != ERROR_OK) {
LOG_ERROR("%s core state update fail", __func__);
return retval;
}
/* resume target if reset mode is run */
if (!t->reset_halt) {
retval = lakemont_resume(t, 1, 0, 0, 0);
if (retval != ERROR_OK) {
LOG_ERROR("%s could not resume target", __func__);
return retval;
}
}
}
return ERROR_OK;
}
struct target_type quark_d20xx_target = {
.name = "quark_d20xx",
.target_create = quark_d20xx_target_create,
.init_target = quark_d20xx_init_target,
/* lakemont probemode specific code */
.poll = lakemont_poll,
.arch_state = lakemont_arch_state,
.halt = lakemont_halt,
.resume = lakemont_resume,
.step = lakemont_step,
.assert_reset = lakemont_reset_assert,
.deassert_reset = quark_d20xx_reset_deassert,
/* common x86 code */
.commands = x86_32_command_handlers,
.get_gdb_reg_list = x86_32_get_gdb_reg_list,
.read_memory = x86_32_common_read_memory,
.write_memory = x86_32_common_write_memory,
.add_breakpoint = x86_32_common_add_breakpoint,
.remove_breakpoint = x86_32_common_remove_breakpoint,
.add_watchpoint = x86_32_common_add_watchpoint,
.remove_watchpoint = x86_32_common_remove_watchpoint,
.virt2phys = x86_32_common_virt2phys,
.read_phys_memory = x86_32_common_read_phys_mem,
.write_phys_memory = x86_32_common_write_phys_mem,
.mmu = x86_32_common_mmu,
};