adapter speed: require init script setting and centralize activation from drivers...
[fw/openocd] / src / jtag / drivers / presto.c
index e00bac710fad77feb7fd953636b13344055a6253..2328c26b593c4eeb30087023763c864816bd5a7f 100644 (file)
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
+
+/**
+ * @file
+ * Holds driver for PRESTO programmer from ASIX.
+ * http://tools.asix.net/prg_presto.htm
+ */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -25,7 +31,7 @@
 #include "windows.h"
 #endif
 
-#include "interface.h"
+#include <jtag/interface.h>
 #include <helper/time_support.h>
 #include "bitq.h"
 
@@ -674,7 +680,7 @@ static struct bitq_interface presto_bitq = {
 
 /* -------------------------------------------------------------------------- */
 
-static int presto_jtag_khz(int khz, int *jtag_speed)
+static int presto_adapter_khz(int khz, int *jtag_speed)
 {
        if (khz < 0)
        {
@@ -742,10 +748,10 @@ COMMAND_HANDLER(presto_handle_serial_command)
 static const struct command_registration presto_command_handlers[] = {
        {
                .name = "presto_serial",
-               .handler = &presto_handle_serial_command,
+               .handler = presto_handle_serial_command,
                .mode = COMMAND_CONFIG,
-               .help = "configure serial port",
-               .usage = "<devname>",
+               .help = "Configure USB serial number of Presto device.",
+               .usage = "serial_string",
        },
        COMMAND_REGISTRATION_DONE
 };
@@ -763,9 +769,6 @@ 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_get_speed());
-
        bitq_interface = &presto_bitq;
        return ERROR_OK;
 }
@@ -786,15 +789,13 @@ static int presto_jtag_quit(void)
 }
 
 struct jtag_interface presto_interface = {
-               .name = "presto",
-
-               .commands = presto_command_handlers,
-
-               .execute_queue = &bitq_execute_queue,
-               .speed = &presto_jtag_speed,
-               .khz = &presto_jtag_khz,
-               .speed_div = &presto_jtag_speed_div,
-
-               .init = &presto_jtag_init,
-               .quit = &presto_jtag_quit,
-       };
+       .name = "presto",
+       .commands = presto_command_handlers,
+
+       .execute_queue = bitq_execute_queue,
+       .speed = presto_jtag_speed,
+       .khz = presto_adapter_khz,
+       .speed_div = presto_jtag_speed_div,
+       .init = presto_jtag_init,
+       .quit = presto_jtag_quit,
+};