X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fjtag%2Fadapter.h;fp=src%2Fjtag%2Fadapter.h;h=b2405e98425127988c796a34895eea9b5f5f9ced;hb=679dcd0b52f6bafe848eb48e714764d37a101bb5;hp=fe9a6318c4c8b523388a975a194235cabf284859;hpb=ba7d0bc49148d89c27b8208120de9783a89058a7;p=openocd.git diff --git a/src/jtag/adapter.h b/src/jtag/adapter.h index fe9a6318c4..b2405e9842 100644 --- a/src/jtag/adapter.h +++ b/src/jtag/adapter.h @@ -10,6 +10,14 @@ #include #include +struct command_context; + +/** Initialize debug adapter upon startup. */ +int adapter_init(struct command_context *cmd_ctx); + +/** Shutdown the debug adapter upon program exit. */ +int adapter_quit(void); + /** @returns true if adapter has been initialized */ bool is_adapter_initialized(void); @@ -19,4 +27,28 @@ const char *adapter_usb_get_location(void); /** @returns true if USB location string is "-[.[...]]" */ bool adapter_usb_location_equal(uint8_t dev_bus, uint8_t *port_path, size_t path_len); +/** @returns The current JTAG speed setting. */ +int jtag_get_speed(int *speed); + +/** + * Given a @a speed setting, use the interface @c speed_div callback to + * adjust the setting. + * @param speed The speed setting to convert back to readable KHz. + * @returns ERROR_OK if the interface has not been initialized or on success; + * otherwise, the error code produced by the @c speed_div callback. + */ +int jtag_get_speed_readable(int *speed); + +/** Attempt to configure the interface for the specified KHz. */ +int jtag_config_khz(unsigned khz); + +/** + * Attempt to enable RTCK/RCLK. If that fails, fallback to the + * specified frequency. + */ +int jtag_config_rclk(unsigned fallback_speed_khz); + +/** Retrieves the clock speed of the JTAG interface in KHz. */ +unsigned jtag_get_speed_khz(void); + #endif /* OPENOCD_JTAG_ADAPTER_H */