#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
* The last command sets #needs_postprocessing to true.
*/
struct ulink_cmd {
- uint8_t id; /* /< ULINK command ID */
+ uint8_t id; /**< ULINK command ID */
- uint8_t *payload_out; /* /< OUT direction payload data */
- uint8_t payload_out_size; /* /< OUT direction payload size for this command */
+ uint8_t *payload_out; /**< OUT direction payload data */
+ uint8_t payload_out_size; /**< OUT direction payload size for this command */
- uint8_t *payload_in_start; /* /< Pointer to first element of IN payload array */
- uint8_t *payload_in; /* /< Pointer where IN payload shall be stored */
- uint8_t payload_in_size;/* /< IN direction payload size for this command */
+ uint8_t *payload_in_start; /**< Pointer to first element of IN payload array */
+ uint8_t *payload_in; /**< Pointer where IN payload shall be stored */
+ uint8_t payload_in_size; /**< IN direction payload size for this command */
/** Indicates if this command needs post-processing */
bool needs_postprocessing;
/** Pointer to corresponding OpenOCD command for post-processing */
struct jtag_command *cmd_origin;
- struct ulink_cmd *next; /* /< Pointer to next command (linked list) */
+ struct ulink_cmd *next; /**< Pointer to next command (linked list) */
};
/** Describes one driver instance */
struct libusb_device_handle *usb_device_handle;
enum ulink_type type;
- int delay_scan_in; /* /< Delay value for SCAN_IN commands */
- int delay_scan_out; /* /< Delay value for SCAN_OUT commands */
- int delay_scan_io; /* /< Delay value for SCAN_IO commands */
- int delay_clock_tck; /* /< Delay value for CLOCK_TMS commands */
- int delay_clock_tms; /* /< Delay value for CLOCK_TCK commands */
+ int delay_scan_in; /**< Delay value for SCAN_IN commands */
+ int delay_scan_out; /**< Delay value for SCAN_OUT commands */
+ int delay_scan_io; /**< Delay value for SCAN_IO commands */
+ int delay_clock_tck; /**< Delay value for CLOCK_TMS commands */
+ int delay_clock_tms; /**< Delay value for CLOCK_TCK commands */
- int commands_in_queue; /* /< Number of commands in queue */
- struct ulink_cmd *queue_start; /* /< Pointer to first command in queue */
- struct ulink_cmd *queue_end; /* /< Pointer to last command in queue */
+ int commands_in_queue; /**< Number of commands in queue */
+ struct ulink_cmd *queue_start; /**< Pointer to first command in queue */
+ struct ulink_cmd *queue_end; /**< Pointer to last command in queue */
};
/**************************** Function Prototypes *****************************/
/* 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);
* @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;
(input_signals & SIGNAL_TDO ? 1 : 0),
(output_signals & SIGNAL_TMS ? 1 : 0),
(output_signals & SIGNAL_TCK ? 1 : 0),
- (output_signals & SIGNAL_TRST ? 0 : 1),/* TRST and RESET are inverted */
- (output_signals & SIGNAL_RESET ? 0 : 1)); /* by hardware */
+ (output_signals & SIGNAL_TRST ? 0 : 1), /* Inverted by hardware */
+ (output_signals & SIGNAL_RESET ? 0 : 1)); /* Inverted by hardware */
}
/**************** OpenULINK command generation helper functions ***************/
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;