* 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 <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <jtag/interface.h>
#include <jtag/commands.h>
#include <target/image.h>
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
#include "OpenULINK/include/msgtypes.h"
/** USB Vendor ID of ULINK device in unconfigured state (no firmware loaded
/* ULINK MCU (Cypress EZ-USB) specific functions */
int ulink_cpu_reset(struct ulink *device, unsigned char reset_bit);
-int ulink_load_firmware_and_renumerate(struct ulink **device, char *filename,
+int ulink_load_firmware_and_renumerate(struct ulink **device, const char *filename,
uint32_t delay);
-int ulink_load_firmware(struct ulink *device, char *filename);
+int ulink_load_firmware(struct ulink *device, const char *filename);
int ulink_write_firmware_section(struct ulink *device,
struct image *firmware_image, int section_index);
const char *ulink_cmd_id_string(uint8_t id);
void ulink_print_command(struct ulink_cmd *ulink_cmd);
void ulink_print_queue(struct ulink *device);
+static int ulink_calculate_frequency(enum ulink_delay_type type, int delay, long *f);
#endif
int ulink_append_scan_cmd(struct ulink *device,
/* OpenULINK TCK frequency helper functions */
int ulink_calculate_delay(enum ulink_delay_type type, long f, int *delay);
-int ulink_calculate_frequency(enum ulink_delay_type type, int delay, long *f);
/* Interface between OpenULINK and OpenOCD */
static void ulink_set_end_state(tap_state_t endstate);
* @return on failure: ERROR_FAIL
*/
int ulink_load_firmware_and_renumerate(struct ulink **device,
- char *filename, uint32_t delay)
+ const char *filename, uint32_t delay)
{
int ret;
* @return on success: ERROR_OK
* @return on failure: ERROR_FAIL
*/
-int ulink_load_firmware(struct ulink *device, char *filename)
+int ulink_load_firmware(struct ulink *device, const char *filename)
{
struct image ulink_firmware_image;
int ret, i;
LOG_DEBUG("section %02i at addr 0x%04x (size 0x%04x)", section_index, addr,
size);
- if (data == NULL)
- return ERROR_FAIL;
-
/* Copy section contents to local buffer */
ret = image_read_section(firmware_image, section_index, 0, size, data,
&size_read);
return ERROR_OK;
}
+#ifdef _DEBUG_JTAG_IO_
/**
* Calculate frequency for a given delay value.
*
* @return on success: ERROR_OK
* @return on failure: ERROR_FAIL
*/
-int ulink_calculate_frequency(enum ulink_delay_type type, int delay, long *f)
+static int ulink_calculate_frequency(enum ulink_delay_type type, int delay, long *f)
{
float t, f_float, f_rounded;
return ERROR_OK;
}
+#endif
/******************* Interface between OpenULINK and OpenOCD ******************/
LOG_INFO("Downloading ULINK firmware image %s", CMD_ARGV[0]);
/* Download firmware image in CMD_ARGV[0] */
- ret = ulink_load_firmware_and_renumerate(&ulink_handle, (char *)CMD_ARGV[0],
+ ret = ulink_load_firmware_and_renumerate(&ulink_handle, CMD_ARGV[0],
ULINK_RENUMERATION_DELAY);
return ret;