jtag/core, target: unregister JTAG events
[openocd.git] / src / target / nds32_aice.c
blobe494a3e1cd42cc055eed10ea6abeb917d83b4163
1 /***************************************************************************
2 * Copyright (C) 2013 Andes technology. *
3 * Hsiangkai Wang <hkwang@andestech.com> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
22 #include <helper/log.h>
23 #include "nds32_aice.h"
25 int aice_read_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t *val)
27 if (aice->port->api->read_reg_64 == NULL) {
28 LOG_WARNING("Not implemented: %s", __func__);
29 return ERROR_FAIL;
32 return aice->port->api->read_reg_64(aice->coreid, num, val);
35 int aice_write_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t val)
37 if (aice->port->api->write_reg_64 == NULL) {
38 LOG_WARNING("Not implemented: %s", __func__);
39 return ERROR_FAIL;
42 return aice->port->api->write_reg_64(aice->coreid, num, val);
45 int aice_read_tlb(struct aice_port_s *aice, target_addr_t virtual_address,
46 target_addr_t *physical_address)
48 if (aice->port->api->read_tlb == NULL) {
49 LOG_WARNING("Not implemented: %s", __func__);
50 return ERROR_FAIL;
53 return aice->port->api->read_tlb(aice->coreid, virtual_address, physical_address);
56 int aice_cache_ctl(struct aice_port_s *aice, uint32_t subtype, uint32_t address)
58 if (aice->port->api->cache_ctl == NULL) {
59 LOG_WARNING("Not implemented: %s", __func__);
60 return ERROR_FAIL;
63 return aice->port->api->cache_ctl(aice->coreid, subtype, address);
66 int aice_set_retry_times(struct aice_port_s *aice, uint32_t a_retry_times)
68 if (aice->port->api->set_retry_times == NULL) {
69 LOG_WARNING("Not implemented: %s", __func__);
70 return ERROR_FAIL;
73 return aice->port->api->set_retry_times(a_retry_times);
76 int aice_program_edm(struct aice_port_s *aice, char *command_sequence)
78 if (aice->port->api->program_edm == NULL) {
79 LOG_WARNING("Not implemented: %s", __func__);
80 return ERROR_FAIL;
83 return aice->port->api->program_edm(aice->coreid, command_sequence);
86 int aice_set_command_mode(struct aice_port_s *aice,
87 enum aice_command_mode command_mode)
89 if (aice->port->api->set_command_mode == NULL) {
90 LOG_WARNING("Not implemented: %s", __func__);
91 return ERROR_FAIL;
94 return aice->port->api->set_command_mode(command_mode);
97 int aice_execute(struct aice_port_s *aice, uint32_t *instructions,
98 uint32_t instruction_num)
100 if (aice->port->api->execute == NULL) {
101 LOG_WARNING("Not implemented: %s", __func__);
102 return ERROR_FAIL;
105 return aice->port->api->execute(aice->coreid, instructions, instruction_num);
108 int aice_set_custom_srst_script(struct aice_port_s *aice, const char *script)
110 if (aice->port->api->set_custom_srst_script == NULL) {
111 LOG_WARNING("Not implemented: %s", __func__);
112 return ERROR_FAIL;
115 return aice->port->api->set_custom_srst_script(script);
118 int aice_set_custom_trst_script(struct aice_port_s *aice, const char *script)
120 if (aice->port->api->set_custom_trst_script == NULL) {
121 LOG_WARNING("Not implemented: %s", __func__);
122 return ERROR_FAIL;
125 return aice->port->api->set_custom_trst_script(script);
128 int aice_set_custom_restart_script(struct aice_port_s *aice, const char *script)
130 if (aice->port->api->set_custom_restart_script == NULL) {
131 LOG_WARNING("Not implemented: %s", __func__);
132 return ERROR_FAIL;
135 return aice->port->api->set_custom_restart_script(script);
138 int aice_set_count_to_check_dbger(struct aice_port_s *aice, uint32_t count_to_check)
140 if (aice->port->api->set_count_to_check_dbger == NULL) {
141 LOG_WARNING("Not implemented: %s", __func__);
142 return ERROR_FAIL;
145 return aice->port->api->set_count_to_check_dbger(count_to_check);
148 int aice_profiling(struct aice_port_s *aice, uint32_t interval, uint32_t iteration,
149 uint32_t reg_no, uint32_t *samples, uint32_t *num_samples)
151 if (aice->port->api->profiling == NULL) {
152 LOG_WARNING("Not implemented: %s", __func__);
153 return ERROR_FAIL;
156 return aice->port->api->profiling(aice->coreid, interval, iteration,
157 reg_no, samples, num_samples);