jtag/drivers: remove useless checks causing build failure with clang 3.5.0
[openocd.git] / src / jtag / drivers / ulink.c
index 94f6c31534df78c39f1c332ab8d9935e65a9a98a..cfd693a60ebbb3551854c4bfbe0d4ad64f781735 100644 (file)
@@ -26,7 +26,7 @@
 #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
@@ -123,14 +123,14 @@ enum ulink_delay_type {
  * 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;
@@ -141,7 +141,7 @@ struct ulink_cmd {
        /** 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 */
@@ -150,15 +150,15 @@ struct ulink {
        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 *****************************/
@@ -169,9 +169,9 @@ int ulink_usb_close(struct ulink **device);
 
 /* 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);
 
@@ -362,7 +362,7 @@ int ulink_cpu_reset(struct ulink *device, unsigned char reset_bit)
  * @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;
 
@@ -397,7 +397,7 @@ int ulink_load_firmware_and_renumerate(struct ulink **device,
  * @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;
@@ -461,9 +461,6 @@ int ulink_write_firmware_section(struct ulink *device,
        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);
@@ -517,8 +514,8 @@ void ulink_print_signal_states(uint8_t input_signals, uint8_t output_signals)
                (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 ***************/
@@ -2284,7 +2281,7 @@ COMMAND_HANDLER(ulink_download_firmware_handler)
        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;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)