target: add generic Xtensa LX support
[fw/openocd] / src / target / espressif / esp_xtensa_smp.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 /***************************************************************************
4  *   ESP Xtensa SMP target for OpenOCD                                     *
5  *   Copyright (C) 2020 Espressif Systems Ltd. Co                          *
6  ***************************************************************************/
7
8 #ifndef OPENOCD_TARGET_XTENSA_ESP_SMP_H
9 #define OPENOCD_TARGET_XTENSA_ESP_SMP_H
10
11 #include "esp_xtensa.h"
12
13 struct esp_xtensa_smp_chip_ops {
14         int (*poll)(struct target *target);
15         int (*reset)(struct target *target);
16         int (*on_halt)(struct target *target);
17 };
18
19 struct esp_xtensa_smp_common {
20         struct esp_xtensa_common esp_xtensa;
21         const struct esp_xtensa_smp_chip_ops *chip_ops;
22         bool other_core_does_resume;
23         /* number of attempts to examine other SMP cores, attempts are made after reset on target poll */
24         int examine_other_cores;
25 };
26
27 int esp_xtensa_smp_poll(struct target *target);
28 int esp_xtensa_smp_resume(struct target *target,
29         int current,
30         target_addr_t address,
31         int handle_breakpoints,
32         int debug_execution);
33 int esp_xtensa_smp_step(struct target *target,
34         int current,
35         target_addr_t address,
36         int handle_breakpoints);
37 int esp_xtensa_smp_assert_reset(struct target *target);
38 int esp_xtensa_smp_deassert_reset(struct target *target);
39 int esp_xtensa_smp_soft_reset_halt(struct target *target);
40 int esp_xtensa_smp_watchpoint_add(struct target *target, struct watchpoint *watchpoint);
41 int esp_xtensa_smp_watchpoint_remove(struct target *target, struct watchpoint *watchpoint);
42 int esp_xtensa_smp_handle_target_event(struct target *target, enum target_event event, void *priv);
43 int esp_xtensa_smp_target_init(struct command_context *cmd_ctx, struct target *target);
44 int esp_xtensa_smp_init_arch_info(struct target *target,
45         struct esp_xtensa_smp_common *esp_xtensa_smp,
46         struct xtensa_debug_module_config *dm_cfg,
47         const struct esp_xtensa_smp_chip_ops *chip_ops);
48
49 extern const struct command_registration esp_xtensa_smp_command_handlers[];
50 extern const struct command_registration esp_xtensa_smp_xtensa_command_handlers[];
51 extern const struct command_registration esp_xtensa_smp_esp_command_handlers[];
52
53 #endif  /* OPENOCD_TARGET_XTENSA_ESP_SMP_H */