target/cortex_m: fix clang static analyzer warning
[openocd.git] / src / target / nds32_aice.c
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
21
22 #include <helper/log.h>
23 #include "nds32_aice.h"
24
25 int aice_read_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t *val)
26 {
27 if (aice->port->api->read_reg_64 == NULL) {
28 LOG_WARNING("Not implemented: %s", __func__);
29 return ERROR_FAIL;
30 }
31
32 return aice->port->api->read_reg_64(aice->coreid, num, val);
33 }
34
35 int aice_write_reg_64(struct aice_port_s *aice, uint32_t num, uint64_t val)
36 {
37 if (aice->port->api->write_reg_64 == NULL) {
38 LOG_WARNING("Not implemented: %s", __func__);
39 return ERROR_FAIL;
40 }
41
42 return aice->port->api->write_reg_64(aice->coreid, num, val);
43 }
44
45 int aice_read_tlb(struct aice_port_s *aice, target_addr_t virtual_address,
46 target_addr_t *physical_address)
47 {
48 if (aice->port->api->read_tlb == NULL) {
49 LOG_WARNING("Not implemented: %s", __func__);
50 return ERROR_FAIL;
51 }
52
53 return aice->port->api->read_tlb(aice->coreid, virtual_address, physical_address);
54 }
55
56 int aice_cache_ctl(struct aice_port_s *aice, uint32_t subtype, uint32_t address)
57 {
58 if (aice->port->api->cache_ctl == NULL) {
59 LOG_WARNING("Not implemented: %s", __func__);
60 return ERROR_FAIL;
61 }
62
63 return aice->port->api->cache_ctl(aice->coreid, subtype, address);
64 }
65
66 int aice_set_retry_times(struct aice_port_s *aice, uint32_t a_retry_times)
67 {
68 if (aice->port->api->set_retry_times == NULL) {
69 LOG_WARNING("Not implemented: %s", __func__);
70 return ERROR_FAIL;
71 }
72
73 return aice->port->api->set_retry_times(a_retry_times);
74 }
75
76 int aice_program_edm(struct aice_port_s *aice, char *command_sequence)
77 {
78 if (aice->port->api->program_edm == NULL) {
79 LOG_WARNING("Not implemented: %s", __func__);
80 return ERROR_FAIL;
81 }
82
83 return aice->port->api->program_edm(aice->coreid, command_sequence);
84 }
85
86 int aice_set_command_mode(struct aice_port_s *aice,
87 enum aice_command_mode command_mode)
88 {
89 if (aice->port->api->set_command_mode == NULL) {
90 LOG_WARNING("Not implemented: %s", __func__);
91 return ERROR_FAIL;
92 }
93
94 return aice->port->api->set_command_mode(command_mode);
95 }
96
97 int aice_execute(struct aice_port_s *aice, uint32_t *instructions,
98 uint32_t instruction_num)
99 {
100 if (aice->port->api->execute == NULL) {
101 LOG_WARNING("Not implemented: %s", __func__);
102 return ERROR_FAIL;
103 }
104
105 return aice->port->api->execute(aice->coreid, instructions, instruction_num);
106 }
107
108 int aice_set_custom_srst_script(struct aice_port_s *aice, const char *script)
109 {
110 if (aice->port->api->set_custom_srst_script == NULL) {
111 LOG_WARNING("Not implemented: %s", __func__);
112 return ERROR_FAIL;
113 }
114
115 return aice->port->api->set_custom_srst_script(script);
116 }
117
118 int aice_set_custom_trst_script(struct aice_port_s *aice, const char *script)
119 {
120 if (aice->port->api->set_custom_trst_script == NULL) {
121 LOG_WARNING("Not implemented: %s", __func__);
122 return ERROR_FAIL;
123 }
124
125 return aice->port->api->set_custom_trst_script(script);
126 }
127
128 int aice_set_custom_restart_script(struct aice_port_s *aice, const char *script)
129 {
130 if (aice->port->api->set_custom_restart_script == NULL) {
131 LOG_WARNING("Not implemented: %s", __func__);
132 return ERROR_FAIL;
133 }
134
135 return aice->port->api->set_custom_restart_script(script);
136 }
137
138 int aice_set_count_to_check_dbger(struct aice_port_s *aice, uint32_t count_to_check)
139 {
140 if (aice->port->api->set_count_to_check_dbger == NULL) {
141 LOG_WARNING("Not implemented: %s", __func__);
142 return ERROR_FAIL;
143 }
144
145 return aice->port->api->set_count_to_check_dbger(count_to_check);
146 }
147
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)
150 {
151 if (aice->port->api->profiling == NULL) {
152 LOG_WARNING("Not implemented: %s", __func__);
153 return ERROR_FAIL;
154 }
155
156 return aice->port->api->profiling(aice->coreid, interval, iteration,
157 reg_no, samples, num_samples);
158 }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)