5cfdb0071662574d2784145bbc724ba867cbdd0d
[fw/openocd] / src / target / quark_x10xx.c
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /*
4  * Copyright(c) 2013-2016 Intel Corporation.
5  *
6  * Adrian Burns (adrian.burns@intel.com)
7  * Thomas Faust (thomas.faust@intel.com)
8  * Ivan De Cesaris (ivan.de.cesaris@intel.com)
9  * Julien Carreno (julien.carreno@intel.com)
10  * Jeffrey Maxwell (jeffrey.r.maxwell@intel.com)
11  *
12  * Contact Information:
13  * Intel Corporation
14  */
15
16 /*
17  * @file
18  * Debugger for Intel Quark SoC X1000
19  * Intel Quark X10xx is the first product in the Quark family of SoCs.
20  * It is an IA-32 (Pentium x86 ISA) compatible SoC. The core CPU in the
21  * X10xx is codenamed Lakemont. Lakemont version 1 (LMT1) is used in X10xx.
22  * The CPU TAP (Lakemont TAP) is used for software debug and the CLTAP is
23  * used for SoC level operations.
24  * Useful docs are here: https://communities.intel.com/community/makers/documentation
25  * Intel Quark SoC X1000 OpenOCD/GDB/Eclipse App Note (web search for doc num 330015)
26  * Intel Quark SoC X1000 Debug Operations User Guide (web search for doc num 329866)
27  * Intel Quark SoC X1000 Datasheet (web search for doc num 329676)
28  *
29  * This file implements any Quark SoC specific features such as resetbreak (TODO)
30  */
31
32 #ifdef HAVE_CONFIG_H
33 #include "config.h"
34 #endif
35
36 #include <helper/log.h>
37
38 #include "target.h"
39 #include "target_type.h"
40 #include "lakemont.h"
41 #include "x86_32_common.h"
42
43 static int quark_x10xx_target_create(struct target *t, Jim_Interp *interp)
44 {
45         struct x86_32_common *x86_32 = calloc(1, sizeof(*x86_32));
46
47         if (!x86_32)
48                 return ERROR_FAIL;
49
50         x86_32_common_init_arch_info(t, x86_32);
51         lakemont_init_arch_info(t, x86_32);
52         x86_32->core_type = LMT1;
53
54         return ERROR_OK;
55 }
56
57 struct target_type quark_x10xx_target = {
58         .name                   = "quark_x10xx",
59
60         /* Quark X1000 SoC */
61         .target_create          = quark_x10xx_target_create,
62
63         /* lakemont probemode specific code */
64         .arch_state             = lakemont_arch_state,
65         .assert_reset           = lakemont_reset_assert,
66         .deassert_reset         = lakemont_reset_deassert,
67         .halt                   = lakemont_halt,
68         .init_target            = lakemont_init_target,
69         .poll                   = lakemont_poll,
70         .resume                 = lakemont_resume,
71         .step                   = lakemont_step,
72
73         /* common x86 code */
74         .add_breakpoint         = x86_32_common_add_breakpoint,
75         .add_watchpoint         = x86_32_common_add_watchpoint,
76         .commands               = x86_32_command_handlers,
77         .get_gdb_reg_list       = x86_32_get_gdb_reg_list,
78         .mmu                    = x86_32_common_mmu,
79         .read_memory            = x86_32_common_read_memory,
80         .read_phys_memory       = x86_32_common_read_phys_mem,
81         .remove_breakpoint      = x86_32_common_remove_breakpoint,
82         .remove_watchpoint      = x86_32_common_remove_watchpoint,
83         .virt2phys              = x86_32_common_virt2phys,
84         .write_memory           = x86_32_common_write_memory,
85         .write_phys_memory      = x86_32_common_write_phys_mem,
86 };