X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fjtag%2Fjtag.c;h=f777ebb8cbeb34fb8e7b2d5732c7dc38c1b03521;hb=fe1f475e64aeb737ac43509a339dd6c810b27eea;hp=aae147252952ac57de7d12ebb9373d28091388d4;hpb=65b4c4117de2f07d5daaf46cffb97a6dd4d70ffc;p=openocd.git diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index aae1472529..f777ebb8cb 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -2,6 +2,9 @@ * Copyright (C) 2005 by Dominic Rath * * Dominic.Rath@gmx.de * * * + * Copyright (C) 2007,2008 Øyvind Harboe * + * oyvind.harboe@zylin.com * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -398,7 +401,7 @@ void* cmd_queue_alloc(size_t size) return t + offset; } -void cmd_queue_free() +void cmd_queue_free(void) { cmd_queue_page_t *page = cmd_queue_pages; @@ -413,7 +416,7 @@ void cmd_queue_free() cmd_queue_pages = NULL; } -static void jtag_prelude1() +static void jtag_prelude1(void) { if (jtag_trst == 1) { @@ -851,6 +854,11 @@ void jtag_add_pathmove(int num_states, enum tap_state *path) for (i=0; iidcode = idcode; - device = device->next; - } - device_count++; - manufacturer = (idcode & 0xffe) >> 1; part = (idcode & 0xffff000) >> 12; version = (idcode & 0xf0000000) >> 28; @@ -1388,6 +1411,12 @@ int jtag_examine_chain() bit_count += 32; } + if (device) + { + device->idcode = idcode; + device = device->next; + } + device_count++; } /* see if number of discovered devices matches configuration */ @@ -1402,7 +1431,7 @@ int jtag_examine_chain() return ERROR_OK; } -int jtag_validate_chain() +int jtag_validate_chain(void) { jtag_device_t *device = jtag_devices; int total_ir_length = 0; @@ -1525,7 +1554,6 @@ int jtag_interface_init(struct command_context_s *cmd_ctx) static int jtag_init_inner(struct command_context_s *cmd_ctx) { - int validate_tries = 0; jtag_device_t *device; int retval; @@ -1551,16 +1579,9 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx) LOG_ERROR("trying to validate configured JTAG chain anyway..."); } - while (jtag_validate_chain() != ERROR_OK) + if (jtag_validate_chain() != ERROR_OK) { - validate_tries++; - - if (validate_tries > 5) - { - LOG_ERROR("Could not validate JTAG chain, exit"); - return ERROR_JTAG_INVALID_INTERFACE; - } - usleep(10000); + LOG_ERROR("Could not validate JTAG chain, continuing anyway..."); } return ERROR_OK; @@ -1631,6 +1652,7 @@ static int default_khz(int khz, int *jtag_speed) static int default_speed_div(int speed, int *khz) { + LOG_ERROR("Translation from jtag_speed to khz not implemented"); return ERROR_FAIL; } @@ -1866,7 +1888,7 @@ int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char { } else { - retval=ERROR_COMMAND_SYNTAX_ERROR; + return ERROR_COMMAND_SYNTAX_ERROR; } command_print(cmd_ctx, "jtag_speed: %d", jtag_speed); @@ -1903,8 +1925,15 @@ int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char * { } else { - retval=ERROR_COMMAND_SYNTAX_ERROR; + return ERROR_COMMAND_SYNTAX_ERROR; + } + + if (jtag!=NULL) + { + if ((retval=jtag->speed_div(jtag_speed, &speed_khz))!=ERROR_OK) + return retval; } + command_print(cmd_ctx, "jtag_khz: %d", speed_khz); return retval;