X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fjtag%2Faice%2Faice_pipe.c;h=64f126ddcf3ccac80414933cb3366a7a1e25cedd;hp=02caa3fe5663358455f4ee1cdcad6b9d44fa9315;hb=d0e763ac7ef6aa17b17bd00ccdfbccfb4eacda69;hpb=ceb402dc9e903d2f3f6bc8125dfed9d82b83d2d1 diff --git a/src/jtag/aice/aice_pipe.c b/src/jtag/aice/aice_pipe.c index 02caa3fe56..64f126ddcf 100644 --- a/src/jtag/aice/aice_pipe.c +++ b/src/jtag/aice/aice_pipe.c @@ -13,9 +13,7 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * along with this program. If not, see . * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" @@ -47,7 +45,7 @@ static int aice_pipe_write(const void *buffer, int count) success = WriteFile(aice_pipe_output[1], buffer, count, &written, NULL); if (!success) { - LOG_ERROR("(WIN32) write to pipe failed, error code: 0x%08lx", GetLastError()); + LOG_ERROR("(WIN32) write to pipe failed, error code: 0x%08l" PRIx32, GetLastError()); return -1; } @@ -61,7 +59,7 @@ static int aice_pipe_read(void *buffer, int count) success = ReadFile(aice_pipe_input[0], buffer, count, &has_read, NULL); if (!success || (has_read == 0)) { - LOG_ERROR("(WIN32) read from pipe failed, error code: 0x%08lx", GetLastError()); + LOG_ERROR("(WIN32) read from pipe failed, error code: 0x%08l" PRIx32, GetLastError()); return -1; } @@ -348,7 +346,7 @@ static int aice_pipe_idcode(uint32_t *idcode, uint8_t *num_of_idcode) return ERROR_OK; } -static int aice_pipe_state(enum aice_target_state_s *state) +static int aice_pipe_state(uint32_t coreid, enum aice_target_state_s *state) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -385,7 +383,7 @@ static int aice_pipe_reset(void) return ERROR_FAIL; } -static int aice_pipe_assert_srst(enum aice_srst_type_s srst) +static int aice_pipe_assert_srst(uint32_t coreid, enum aice_srst_type_s srst) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -405,7 +403,7 @@ static int aice_pipe_assert_srst(enum aice_srst_type_s srst) return ERROR_FAIL; } -static int aice_pipe_run(void) +static int aice_pipe_run(uint32_t coreid) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -424,7 +422,7 @@ static int aice_pipe_run(void) return ERROR_FAIL; } -static int aice_pipe_halt(void) +static int aice_pipe_halt(uint32_t coreid) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -443,7 +441,7 @@ static int aice_pipe_halt(void) return ERROR_FAIL; } -static int aice_pipe_read_reg(uint32_t num, uint32_t *val) +static int aice_pipe_read_reg(uint32_t coreid, uint32_t num, uint32_t *val) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -462,7 +460,7 @@ static int aice_pipe_read_reg(uint32_t num, uint32_t *val) return ERROR_OK; } -static int aice_pipe_write_reg(uint32_t num, uint32_t val) +static int aice_pipe_write_reg(uint32_t coreid, uint32_t num, uint32_t val) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -483,7 +481,7 @@ static int aice_pipe_write_reg(uint32_t num, uint32_t val) return ERROR_FAIL; } -static int aice_pipe_read_reg_64(uint32_t num, uint64_t *val) +static int aice_pipe_read_reg_64(uint32_t coreid, uint32_t num, uint64_t *val) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -502,7 +500,7 @@ static int aice_pipe_read_reg_64(uint32_t num, uint64_t *val) return ERROR_OK; } -static int aice_pipe_write_reg_64(uint32_t num, uint64_t val) +static int aice_pipe_write_reg_64(uint32_t coreid, uint32_t num, uint64_t val) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -524,7 +522,7 @@ static int aice_pipe_write_reg_64(uint32_t num, uint64_t val) return ERROR_FAIL; } -static int aice_pipe_step(void) +static int aice_pipe_step(uint32_t coreid) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -543,7 +541,7 @@ static int aice_pipe_step(void) return ERROR_FAIL; } -static int aice_pipe_read_mem_unit(uint32_t addr, uint32_t size, +static int aice_pipe_read_mem_unit(uint32_t coreid, uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer) { char command[AICE_PIPE_MAXLINE]; @@ -562,7 +560,7 @@ static int aice_pipe_read_mem_unit(uint32_t addr, uint32_t size, return ERROR_OK; } -static int aice_pipe_write_mem_unit(uint32_t addr, uint32_t size, +static int aice_pipe_write_mem_unit(uint32_t coreid, uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer) { char line[AICE_PIPE_MAXLINE]; @@ -590,7 +588,8 @@ static int aice_pipe_write_mem_unit(uint32_t addr, uint32_t size, return ERROR_OK; } -static int aice_pipe_read_mem_bulk(uint32_t addr, uint32_t length, uint8_t *buffer) +static int aice_pipe_read_mem_bulk(uint32_t coreid, uint32_t addr, + uint32_t length, uint8_t *buffer) { char line[AICE_PIPE_MAXLINE + 1]; char command[AICE_PIPE_MAXLINE]; @@ -636,7 +635,8 @@ static int aice_pipe_read_mem_bulk(uint32_t addr, uint32_t length, uint8_t *buff return ERROR_OK; } -static int aice_pipe_write_mem_bulk(uint32_t addr, uint32_t length, const uint8_t *buffer) +static int aice_pipe_write_mem_bulk(uint32_t coreid, uint32_t addr, + uint32_t length, const uint8_t *buffer) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE + 4]; @@ -686,7 +686,7 @@ static int aice_pipe_write_mem_bulk(uint32_t addr, uint32_t length, const uint8_ return ERROR_FAIL; } -static int aice_pipe_read_debug_reg(uint32_t addr, uint32_t *val) +static int aice_pipe_read_debug_reg(uint32_t coreid, uint32_t addr, uint32_t *val) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -705,7 +705,7 @@ static int aice_pipe_read_debug_reg(uint32_t addr, uint32_t *val) return ERROR_OK; } -static int aice_pipe_write_debug_reg(uint32_t addr, const uint32_t val) +static int aice_pipe_write_debug_reg(uint32_t coreid, uint32_t addr, const uint32_t val) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -746,27 +746,7 @@ static int aice_pipe_set_jtag_clock(uint32_t a_clock) return ERROR_FAIL; } -static int aice_pipe_select_target(uint32_t target_id) -{ - char line[AICE_PIPE_MAXLINE]; - char command[AICE_PIPE_MAXLINE]; - - command[0] = AICE_SELECT_TARGET; - set_u32(command + 1, target_id); - - if (aice_pipe_write(command, 5) != 5) - return ERROR_FAIL; - - if (aice_pipe_read(line, AICE_PIPE_MAXLINE) < 0) - return ERROR_FAIL; - - if (line[0] == AICE_OK) - return ERROR_OK; - else - return ERROR_FAIL; -} - -static int aice_pipe_memory_access(enum nds_memory_access access_channel) +static int aice_pipe_memory_access(uint32_t coreid, enum nds_memory_access access_channel) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -786,7 +766,7 @@ static int aice_pipe_memory_access(enum nds_memory_access access_channel) return ERROR_FAIL; } -static int aice_pipe_memory_mode(enum nds_memory_select mem_select) +static int aice_pipe_memory_mode(uint32_t coreid, enum nds_memory_select mem_select) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -806,7 +786,8 @@ static int aice_pipe_memory_mode(enum nds_memory_select mem_select) return ERROR_FAIL; } -static int aice_pipe_read_tlb(uint32_t virtual_address, uint32_t *physical_address) +static int aice_pipe_read_tlb(uint32_t coreid, uint32_t virtual_address, + uint32_t *physical_address) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -827,7 +808,7 @@ static int aice_pipe_read_tlb(uint32_t virtual_address, uint32_t *physical_addre return ERROR_FAIL; } -static int aice_pipe_cache_ctl(uint32_t subtype, uint32_t address) +static int aice_pipe_cache_ctl(uint32_t coreid, uint32_t subtype, uint32_t address) { char line[AICE_PIPE_MAXLINE]; char command[AICE_PIPE_MAXLINE]; @@ -862,6 +843,8 @@ struct aice_port_api_s aice_pipe = { /** */ .idcode = aice_pipe_idcode, /** */ + .set_jtag_clock = aice_pipe_set_jtag_clock, + /** */ .state = aice_pipe_state, /** */ .reset = aice_pipe_reset, @@ -894,11 +877,6 @@ struct aice_port_api_s aice_pipe = { /** */ .write_debug_reg = aice_pipe_write_debug_reg, - /** */ - .set_jtag_clock = aice_pipe_set_jtag_clock, - /** */ - .select_target = aice_pipe_select_target, - /** */ .memory_access = aice_pipe_memory_access, /** */