X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjtag%2Fpresto.c;h=125658be5b8a6977656399c8b521215c91b961a9;hb=b8034bd9ee022e694358e67bb6b14c7673df42da;hp=ea57a36ec8b925a6ebb9ba23d891f8d9f79f0e62;hpb=d2d75efb3929b0067f7dcb6f9973ec8c47948135;p=openocd diff --git a/src/jtag/presto.c b/src/jtag/presto.c index ea57a36e..125658be 100644 --- a/src/jtag/presto.c +++ b/src/jtag/presto.c @@ -25,20 +25,10 @@ #include "windows.h" #endif -#include "replacements.h" - -/* project specific includes */ -#include "log.h" -#include "types.h" -#include "jtag.h" -#include "configuration.h" +#include "interface.h" #include "time_support.h" #include "bitq.h" -/* system includes */ -#include -#include -#include /* PRESTO access library includes */ #if BUILD_PRESTO_FTD2XX == 1 @@ -127,7 +117,7 @@ typedef struct presto_s int jtag_tdi_count; int jtag_speed; - + } presto_t; static presto_t presto_state; @@ -430,7 +420,7 @@ static int presto_open(char *req_serial) presto->jtag_tdi_count=0; presto->jtag_speed=0; - + #if BUILD_PRESTO_FTD2XX == 1 return presto_open_ftd2xx(req_serial); #elif BUILD_PRESTO_LIBFTDI == 1 @@ -585,7 +575,7 @@ static int presto_tdi_flush(void) presto_sendbyte(presto->jtag_tdi_data); presto->jtag_tdi_count = 0; presto->jtag_tdi_data = 0; - + return 0; } @@ -596,7 +586,7 @@ static int presto_tck_idle(void) presto_sendbyte(0xCA); presto->jtag_tck = 0; } - + return 0; } @@ -721,7 +711,7 @@ static int presto_jtag_khz(int khz, int *jtag_speed) if (khz >= 3000) *jtag_speed = 0; else *jtag_speed = (1000+khz-1)/khz; - + return 0; } @@ -735,26 +725,26 @@ static int presto_jtag_speed_div(int speed, int *khz) if (speed == 0) *khz = 3000; else *khz = 1000/speed; - + return 0; } static int presto_jtag_speed(int speed) { int khz; - + if (presto_jtag_speed_div(speed, &khz)) { return ERROR_INVALID_ARGUMENTS; } presto->jtag_speed = speed; - + if (khz%1000 == 0) LOG_INFO("setting speed to %d, max. TCK freq. is %d MHz", speed, khz/1000); else LOG_INFO("setting speed to %d, max. TCK freq. is %d kHz", speed, khz); - + return 0; } @@ -797,7 +787,7 @@ static int presto_jtag_init(void) LOG_INFO("PRESTO open, serial number '%s'", presto->serial); /* use JTAG speed setting from configuration file */ - presto_jtag_speed(jtag_speed); + presto_jtag_speed(jtag_get_speed()); bitq_interface = &presto_bitq; return ERROR_OK;