From 9a54de1513340c7f2b2376fc91ac311516dde634 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 19 Oct 2010 21:10:14 +0000 Subject: [PATCH] Drop useless params cast and useless parenthesis around addresses. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1863 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 7 ++ urjtag/src/tap/cable.c | 42 ++++---- urjtag/src/tap/cable/ft2232.c | 152 ++++++++++++++--------------- urjtag/src/tap/cable/generic.c | 24 ++--- urjtag/src/tap/cable/jim.c | 8 +- urjtag/src/tap/cable/usbblaster.c | 54 +++++----- urjtag/src/tap/detect.c | 2 +- urjtag/src/tap/usbconn/libftd2xx.c | 14 +-- 8 files changed, 155 insertions(+), 148 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index e2714635..f91b8a27 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,10 @@ +2010-10-19 Mike Frysinger + + * src/tap/cable.c, src/tap/detect.c, src/tap/cable/ft2232.c, + src/tap/cable/generic.c, src/tap/cable/jim.c, src/tap/cable/usbblaster.c, + src/tap/usbconn/libftd2xx.c: Drop useless params cast and useless + parenthesis around addresses. + 2010-10-09 Mike Frysinger * configure.ac: Check for pread availability and disable gpio cable driver diff --git a/urjtag/src/tap/cable.c b/urjtag/src/tap/cable.c index 99986d49..282a3d2b 100644 --- a/urjtag/src/tap/cable.c +++ b/urjtag/src/tap/cable.c @@ -161,7 +161,7 @@ urj_tap_cable_add_queue_item (urj_cable_t *cable, urj_cable_queue_info_t *q) urj_log (URJ_LOG_LEVEL_DETAIL, "Resize: Move %d items towards end of queue memory (%d > %d)\n", num_to_move, q->next_item, dest); - memmove (&(q->data[dest]), &(q->data[q->next_item]), + memmove (&q->data[dest], &q->data[q->next_item], num_to_move * sizeof (urj_cable_queue_t)); q->next_item = dest; @@ -177,7 +177,7 @@ urj_tap_cable_add_queue_item (urj_cable_t *cable, urj_cable_queue_info_t *q) urj_log (URJ_LOG_LEVEL_DETAIL, "Resize: Move %d items from start to end\n", q->next_free); - memcpy (&(q->data[q->max_items]), &(q->data[0]), + memcpy (&q->data[q->max_items], &q->data[0], q->next_free * sizeof (urj_cable_queue_t)); } @@ -192,7 +192,7 @@ urj_tap_cable_add_queue_item (urj_cable_t *cable, urj_cable_queue_info_t *q) "Resize.A: Move %d items from start to end\n", added_space); - memcpy (&(q->data[q->max_items]), &(q->data[0]), + memcpy (&q->data[q->max_items], &q->data[0], added_space * sizeof (urj_cable_queue_t)); /* Step 2: __612345 -> 6__12345 */ @@ -201,7 +201,7 @@ urj_tap_cable_add_queue_item (urj_cable_t *cable, urj_cable_queue_info_t *q) "Resize.B: Move %d items towards start (offset %d)\n", (q->next_free - added_space), added_space); - memmove (&(q->data[0]), &(q->data[added_space]), + memmove (&q->data[0], &q->data[added_space], (q->next_free - added_space) * sizeof (urj_cable_queue_t)); } @@ -292,7 +292,7 @@ urj_tap_cable_clock (urj_cable_t *cable, int tms, int tdi, int n) int urj_tap_cable_defer_clock (urj_cable_t *cable, int tms, int tdi, int n) { - int i = urj_tap_cable_add_queue_item (cable, &(cable->todo)); + int i = urj_tap_cable_add_queue_item (cable, &cable->todo); if (i < 0) return URJ_STATUS_FAIL; /* report failure */ cable->todo.data[i].action = URJ_TAP_CABLE_CLOCK; @@ -315,15 +315,15 @@ urj_tap_cable_get_tdo_late (urj_cable_t *cable) { int i; urj_tap_cable_flush (cable, URJ_TAP_CABLE_TO_OUTPUT); - i = urj_tap_cable_get_queue_item (cable, &(cable->done)); + i = urj_tap_cable_get_queue_item (cable, &cable->done); if (i >= 0) { if (cable->done.data[i].action != URJ_TAP_CABLE_GET_TDO) { urj_warning ( _("Internal error: Got wrong type of result from queue (%d? %p.%d)\n"), - cable->done.data[i].action, &(cable->done), i); - urj_tap_cable_purge_queue (&(cable->done), 1); + cable->done.data[i].action, &cable->done, i); + urj_tap_cable_purge_queue (&cable->done, 1); } else { @@ -336,7 +336,7 @@ urj_tap_cable_get_tdo_late (urj_cable_t *cable) int urj_tap_cable_defer_get_tdo (urj_cable_t *cable) { - int i = urj_tap_cable_add_queue_item (cable, &(cable->todo)); + int i = urj_tap_cable_add_queue_item (cable, &cable->todo); if (i < 0) return URJ_STATUS_FAIL; /* report failure */ cable->todo.data[i].action = URJ_TAP_CABLE_GET_TDO; @@ -354,7 +354,7 @@ urj_tap_cable_set_signal (urj_cable_t *cable, int mask, int val) int urj_tap_cable_defer_set_signal (urj_cable_t *cable, int mask, int val) { - int i = urj_tap_cable_add_queue_item (cable, &(cable->todo)); + int i = urj_tap_cable_add_queue_item (cable, &cable->todo); if (i < 0) return URJ_STATUS_FAIL; /* report failure */ cable->todo.data[i].action = URJ_TAP_CABLE_SET_SIGNAL; @@ -376,22 +376,22 @@ urj_tap_cable_get_signal_late (urj_cable_t *cable, urj_pod_sigsel_t sig) { int i; urj_tap_cable_flush (cable, URJ_TAP_CABLE_TO_OUTPUT); - i = urj_tap_cable_get_queue_item (cable, &(cable->done)); + i = urj_tap_cable_get_queue_item (cable, &cable->done); if (i >= 0) { if (cable->done.data[i].action != URJ_TAP_CABLE_GET_SIGNAL) { urj_warning ( _("Internal error: Got wrong type of result from queue (%d? %p.%d)\n"), - cable->done.data[i].action, &(cable->done), i); - urj_tap_cable_purge_queue (&(cable->done), 1); + cable->done.data[i].action, &cable->done, i); + urj_tap_cable_purge_queue (&cable->done, 1); } else if (cable->done.data[i].arg.value.sig != sig) { urj_warning ( _("Internal error: Got wrong signal's value from queue (%d? %p.%d)\n"), - cable->done.data[i].action, &(cable->done), i); - urj_tap_cable_purge_queue (&(cable->done), 1); + cable->done.data[i].action, &cable->done, i); + urj_tap_cable_purge_queue (&cable->done, 1); } else { @@ -404,7 +404,7 @@ urj_tap_cable_get_signal_late (urj_cable_t *cable, urj_pod_sigsel_t sig) int urj_tap_cable_defer_get_signal (urj_cable_t *cable, urj_pod_sigsel_t sig) { - int i = urj_tap_cable_add_queue_item (cable, &(cable->todo)); + int i = urj_tap_cable_add_queue_item (cable, &cable->todo); if (i < 0) return URJ_STATUS_FAIL; /* report failure */ cable->todo.data[i].action = URJ_TAP_CABLE_GET_SIGNAL; @@ -425,13 +425,13 @@ urj_tap_cable_transfer_late (urj_cable_t *cable, char *out) { int i; urj_tap_cable_flush (cable, URJ_TAP_CABLE_TO_OUTPUT); - i = urj_tap_cable_get_queue_item (cable, &(cable->done)); + i = urj_tap_cable_get_queue_item (cable, &cable->done); if (i >= 0 && cable->done.data[i].action == URJ_TAP_CABLE_TRANSFER) { #if 0 urj_log (URJ_LOG_LEVEL_DEBUG, "Got queue item (%p.%d) len=%d out=%p\n", - &(cable->done), i, + &cable->done, i, cable->done.data[i].arg.xferred.len, cable->done.data[i].arg.xferred.out); #endif @@ -447,8 +447,8 @@ urj_tap_cable_transfer_late (urj_cable_t *cable, char *out) { urj_warning ( _("Internal error: Got wrong type of result from queue (#%d %p.%d)\n"), - cable->done.data[i].action, &(cable->done), i); - urj_tap_cable_purge_queue (&(cable->done), 1); + cable->done.data[i].action, &cable->done, i); + urj_tap_cable_purge_queue (&cable->done, 1); } else { @@ -485,7 +485,7 @@ urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in, } } - i = urj_tap_cable_add_queue_item (cable, &(cable->todo)); + i = urj_tap_cable_add_queue_item (cable, &cable->todo); if (i < 0) { free (ibuf); diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index f2c0caca..16316d4d 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -237,8 +237,8 @@ static const urj_tap_cable_cx_cmd_t imm_cmd = static void ft2232h_disable_clockdiv_by5 (urj_cable_t *cable) { - params_t *params = (params_t *)cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; urj_tap_cable_cx_cmd_queue( cmd_root, 0 ); urj_tap_cable_cx_cmd_push( cmd_root, DISABLE_CLOCKDIV ); @@ -247,8 +247,8 @@ ft2232h_disable_clockdiv_by5 (urj_cable_t *cable) static void ft2232_set_frequency_common (urj_cable_t *cable, uint32_t new_frequency, uint32_t max_frequency) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (!new_frequency || new_frequency > max_frequency) new_frequency = max_frequency; @@ -303,8 +303,8 @@ ft2232h_set_frequency (urj_cable_t *cable, uint32_t new_frequency) static int ft2232_generic_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -345,8 +345,8 @@ ft2232_generic_init (urj_cable_t *cable) static int ft2232_jtagkey_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -399,8 +399,8 @@ ft2232_jtagkey_init (urj_cable_t *cable) static int ft2232_armusbocd_init_common (urj_cable_t *cable, int is_ft2232h) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -468,8 +468,8 @@ ft2232_armusbtiny_h_init (urj_cable_t *cable) static int ft2232_gnice_init_common (urj_cable_t *cable, int is_ft2232h) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -529,8 +529,8 @@ ft2232_gniceplus_init (urj_cable_t *cable) static int ft2232_oocdlinks_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -582,8 +582,8 @@ ft2232_oocdlinks_init (urj_cable_t *cable) static int ft2232_turtelizer2_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -631,8 +631,8 @@ ft2232_turtelizer2_init (urj_cable_t *cable) static int ft2232_usbtojtagif_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -684,8 +684,8 @@ ft2232_usbtojtagif_init (urj_cable_t *cable) static int ft2232_signalyzer_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -729,8 +729,8 @@ ft2232_signalyzer_init (urj_cable_t *cable) static int ft2232_flyswatter_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -775,8 +775,8 @@ ft2232_flyswatter_init (urj_cable_t *cable) static int ft2232_usbscarab2_init (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -784,7 +784,7 @@ ft2232_usbscarab2_init (urj_cable_t *cable) /* Check if cable is connected to the target and the target is powered on */ urj_tap_cable_cx_cmd_queue (cmd_root, 1); urj_tap_cable_cx_cmd_push (cmd_root, GET_BITS_LOW); - urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY); if ((urj_tap_cable_cx_xfer_recv (cable) & BITMASK_USBSCARAB2_nCONNECTED) != 0) @@ -834,8 +834,8 @@ ft2232_usbscarab2_init (urj_cable_t *cable) static void ft2232_generic_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte set all to input */ @@ -859,8 +859,8 @@ ft2232_generic_done (urj_cable_t *cable) static void ft2232_jtagkey_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte disable output drivers */ @@ -908,8 +908,8 @@ ft2232_jtagkey_done (urj_cable_t *cable) static void ft2232_armusbocd_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte disable output drivers */ @@ -954,8 +954,8 @@ ft2232_armusbocd_done (urj_cable_t *cable) static void ft2232_gnice_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte disable output drivers */ @@ -986,8 +986,8 @@ ft2232_gnice_done (urj_cable_t *cable) static void ft2232_oocdlinks_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte set all to input */ @@ -1029,8 +1029,8 @@ ft2232_oocdlinks_done (urj_cable_t *cable) static void ft2232_turtelizer2_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte disable output drivers */ @@ -1070,8 +1070,8 @@ ft2232_turtelizer2_done (urj_cable_t *cable) static void ft2232_usbtojtagif_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte set all to input */ @@ -1109,8 +1109,8 @@ ft2232_usbtojtagif_done (urj_cable_t *cable) static void ft2232_signalyzer_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte set all to input */ @@ -1146,8 +1146,8 @@ ft2232_signalyzer_done (urj_cable_t *cable) static void ft2232_flyswatter_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte disable output drivers */ @@ -1182,8 +1182,8 @@ ft2232_flyswatter_done (urj_cable_t *cable) static void ft2232_usbscarab2_done (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Set Data Bits Low Byte set all to input */ @@ -1208,8 +1208,8 @@ ft2232_usbscarab2_done (urj_cable_t *cable) static void ft2232_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; tms = tms ? 0x7f : 0; tdi = tdi ? 1 << 7 : 0; @@ -1257,8 +1257,8 @@ ft2232_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n) static void ft2232_clock_compact_schedule (urj_cable_t *cable, int length, uint8_t byte) { - params_t *params = (params_t *)cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; urj_tap_cable_cx_cmd_queue (cmd_root, 0); /* Clock Data to TMS/CS Pin (no Read) */ @@ -1280,10 +1280,10 @@ ft2232_clock_compact_schedule (urj_cable_t *cable, int length, uint8_t byte) static void ft2232_clock (urj_cable_t *cable, int tms, int tdi, int n) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; ft2232_clock_schedule (cable, tms, tdi, n); - urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY); params->last_tdo_valid = 0; } @@ -1292,8 +1292,8 @@ ft2232_clock (urj_cable_t *cable, int tms, int tdi, int n) static void ft2232_get_tdo_schedule (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* Read Data Bits Low Byte */ urj_tap_cable_cx_cmd_queue (cmd_root, 1); @@ -1304,7 +1304,7 @@ ft2232_get_tdo_schedule (urj_cable_t *cable) static int ft2232_get_tdo_finish (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; int value; value = (urj_tap_cable_cx_xfer_recv (cable) & BITMASK_TDO) ? 1 : 0; @@ -1319,10 +1319,10 @@ ft2232_get_tdo_finish (urj_cable_t *cable) static int ft2232_get_tdo (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; ft2232_get_tdo_schedule (cable); - urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY); return ft2232_get_tdo_finish (cable); } @@ -1332,7 +1332,7 @@ static void ft2232_set_signal_schedule (params_t *params, int mask, int val, int set_low, int set_high) { - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; /* filter for supported signals */ mask &= @@ -1408,12 +1408,12 @@ ft2232_set_signal_schedule (params_t *params, int mask, int val, static int ft2232_set_signal (urj_cable_t *cable, int mask, int val) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; int prev_sigs = params->signals; ft2232_set_signal_schedule (params, mask, val, 1, 1); - urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY); params->last_tdo_valid = 0; @@ -1425,8 +1425,8 @@ static void ft2232_transfer_schedule (urj_cable_t *cable, int len, const char *in, char *out) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; int in_offset = 0; int bitwise_len; int chunkbytes; @@ -1561,7 +1561,7 @@ ft2232_transfer_schedule (urj_cable_t *cable, int len, const char *in, static int ft2232_transfer_finish (urj_cable_t *cable, int len, char *out) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; int bitwise_len; int chunkbytes; int out_offset = 0; @@ -1622,10 +1622,10 @@ ft2232_transfer_finish (urj_cable_t *cable, int len, char *out) static int ft2232_transfer (urj_cable_t *cable, int len, const char *in, char *out) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; ft2232_transfer_schedule (cable, len, in, out); - urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY); return ft2232_transfer_finish (cable, len, out); } @@ -1634,13 +1634,13 @@ ft2232_transfer (urj_cable_t *cable, int len, const char *in, char *out) static void ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; if (how_much == URJ_TAP_CABLE_OPTIONALLY) return; if (cable->todo.num_items == 0) - urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, &imm_cmd, cable, how_much); while (cable->todo.num_items > 0) @@ -1762,7 +1762,7 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) i = 0; } - urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, &imm_cmd, cable, how_much); while (j != i) @@ -1805,7 +1805,7 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) else tdo = ft2232_get_tdo_finish (cable); last_tdo_valid_finish = params->last_tdo_valid; - m = urj_tap_cable_add_queue_item (cable, &(cable->done)); + m = urj_tap_cable_add_queue_item (cable, &cable->done); cable->done.data[m].action = URJ_TAP_CABLE_GET_TDO; cable->done.data[m].arg.value.val = tdo; break; @@ -1813,7 +1813,7 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) case URJ_TAP_CABLE_SET_SIGNAL: { int m = - urj_tap_cable_add_queue_item (cable, &(cable->done)); + urj_tap_cable_add_queue_item (cable, &cable->done); cable->done.data[m].action = URJ_TAP_CABLE_SET_SIGNAL; cable->done.data[m].arg.value.mask = cable->todo.data[j].arg.value.mask; @@ -1830,7 +1830,7 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) case URJ_TAP_CABLE_GET_SIGNAL: { int m = - urj_tap_cable_add_queue_item (cable, &(cable->done)); + urj_tap_cable_add_queue_item (cable, &cable->done); cable->done.data[m].action = URJ_TAP_CABLE_GET_SIGNAL; cable->done.data[m].arg.value.sig = cable->todo.data[j].arg.value.sig; @@ -1851,7 +1851,7 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) if (cable->todo.data[j].arg.transfer.out) { int m = urj_tap_cable_add_queue_item (cable, - &(cable->done)); + &cable->done); if (m < 0) { // retain error state @@ -1889,11 +1889,11 @@ ft2232_connect (urj_cable_t *cable, const urj_param_t *params[]) if (urj_tap_cable_generic_usbconn_connect (cable, params) != URJ_STATUS_OK) return URJ_STATUS_FAIL; - cable_params = malloc (sizeof (params_t)); + cable_params = malloc (sizeof (*cable_params)); if (!cable_params) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, _("malloc(%zd) fails"), - sizeof (params_t)); + sizeof (*cable_params)); /* NOTE: * Call the underlying usbport driver (*free) routine directly * not urj_tap_cable_generic_usbconn_free() since it also free's cable->params @@ -1906,7 +1906,7 @@ ft2232_connect (urj_cable_t *cable, const urj_param_t *params[]) cable_params->mpsse_frequency = 0; cable_params->last_tdo_valid = 0; - urj_tap_cable_cx_cmd_init (&(cable_params->cmd_root)); + urj_tap_cable_cx_cmd_init (&cable_params->cmd_root); /* exchange generic cable parameters with our private parameter set */ free (cable->params); @@ -1919,9 +1919,9 @@ ft2232_connect (urj_cable_t *cable, const urj_param_t *params[]) static void ft2232_cable_free (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; - urj_tap_cable_cx_cmd_deinit (&(params->cmd_root)); + urj_tap_cable_cx_cmd_deinit (¶ms->cmd_root); urj_tap_cable_generic_usbconn_free (cable); } diff --git a/urjtag/src/tap/cable/generic.c b/urjtag/src/tap/cable/generic.c index f3e9afca..c8e9c854 100644 --- a/urjtag/src/tap/cable/generic.c +++ b/urjtag/src/tap/cable/generic.c @@ -90,7 +90,7 @@ do_one_queued_action (urj_cable_t *cable) urj_log (URJ_LOG_LEVEL_DETAIL, "do_one_queued\n"); - if ((i = urj_tap_cable_get_queue_item (cable, &(cable->todo))) >= 0) + if ((i = urj_tap_cable_get_queue_item (cable, &cable->todo)) >= 0) { int j; @@ -102,7 +102,7 @@ do_one_queued_action (urj_cable_t *cable) { urj_error_set (URJ_ERROR_OUT_OF_BOUNDS, _("No space in cable activity results queue")); - urj_tap_cable_purge_queue (&(cable->done), 1); + urj_tap_cable_purge_queue (&cable->done, 1); /* @@@@ RFHH shouldn't we bail out? */ } } @@ -135,10 +135,10 @@ do_one_queued_action (urj_cable_t *cable) if (cable->todo.data[i].arg.transfer.out != NULL) { /* @@@@ RFHH check result */ - j = urj_tap_cable_add_queue_item (cable, &(cable->done)); + j = urj_tap_cable_add_queue_item (cable, &cable->done); urj_log (URJ_LOG_LEVEL_DETAIL, "add result from transfer to %p.%d (out=%p)\n", - &(cable->done), j, + &cable->done, j, cable->todo.data[i].arg.transfer.out); cable->done.data[j].action = URJ_TAP_CABLE_TRANSFER; cable->done.data[j].arg.xferred.len = @@ -151,18 +151,18 @@ do_one_queued_action (urj_cable_t *cable) } case URJ_TAP_CABLE_GET_TDO: /* @@@@ RFHH check result */ - j = urj_tap_cable_add_queue_item (cable, &(cable->done)); + j = urj_tap_cable_add_queue_item (cable, &cable->done); urj_log (URJ_LOG_LEVEL_DETAIL, - "add result from get_tdo to %p.%d\n", &(cable->done), j); + "add result from get_tdo to %p.%d\n", &cable->done, j); cable->done.data[j].action = URJ_TAP_CABLE_GET_TDO; cable->done.data[j].arg.value.val = cable->driver->get_tdo (cable); break; case URJ_TAP_CABLE_GET_SIGNAL: /* @@@@ RFHH check result */ - j = urj_tap_cable_add_queue_item (cable, &(cable->done)); + j = urj_tap_cable_add_queue_item (cable, &cable->done); urj_log (URJ_LOG_LEVEL_DETAIL, - "add result from get_signal to %p.%d\n", &(cable->done), + "add result from get_signal to %p.%d\n", &cable->done, j); cable->done.data[j].action = URJ_TAP_CABLE_GET_SIGNAL; cable->done.data[j].arg.value.sig = @@ -330,10 +330,10 @@ urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, else if (cable->todo.data[i].action == URJ_TAP_CABLE_GET_TDO) { int c = urj_tap_cable_add_queue_item (cable, - &(cable->done)); + &cable->done); urj_log (URJ_LOG_LEVEL_DETAIL, "add result from transfer to %p.%d\n", - &(cable->done), c); + &cable->done, c); cable->done.data[c].action = URJ_TAP_CABLE_GET_TDO; if (bits < savbits) tdo = out[bits]; @@ -349,10 +349,10 @@ urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, if (p != NULL) { int c = urj_tap_cable_add_queue_item (cable, - &(cable->done)); + &cable->done); urj_log (URJ_LOG_LEVEL_DETAIL, "add result from transfer to %p.%d\n", - &(cable->done), c); + &cable->done, c); cable->done.data[c].action = URJ_TAP_CABLE_TRANSFER; cable->done.data[c].arg.xferred.len = len; cable->done.data[c].arg.xferred.res = r; diff --git a/urjtag/src/tap/cable/jim.c b/urjtag/src/tap/cable/jim.c index 572c96ff..268789c4 100644 --- a/urjtag/src/tap/cable/jim.c +++ b/urjtag/src/tap/cable/jim.c @@ -114,7 +114,7 @@ static void jim_cable_clock (urj_cable_t *cable, int tms, int tdi, int n) { int i; - jim_cable_params_t *jcp = (jim_cable_params_t *) (cable->params); + jim_cable_params_t *jcp = cable->params; for (i = 0; i < n; i++) { @@ -126,7 +126,7 @@ jim_cable_clock (urj_cable_t *cable, int tms, int tdi, int n) static int jim_cable_get_tdo (urj_cable_t *cable) { - jim_cable_params_t *jcp = (jim_cable_params_t *) (cable->params); + jim_cable_params_t *jcp = cable->params; return urj_jim_get_tdo (jcp->s); } @@ -134,7 +134,7 @@ jim_cable_get_tdo (urj_cable_t *cable) static int jim_cable_get_trst (urj_cable_t *cable) { - jim_cable_params_t *jcp = (jim_cable_params_t *) (cable->params); + jim_cable_params_t *jcp = cable->params; return urj_jim_get_trst (jcp->s); } @@ -142,7 +142,7 @@ jim_cable_get_trst (urj_cable_t *cable) static int jim_cable_set_trst (urj_cable_t *cable, int trst) { - jim_cable_params_t *jcp = (jim_cable_params_t *) (cable->params); + jim_cable_params_t *jcp = cable->params; urj_jim_set_trst (jcp->s, trst); return urj_jim_get_trst (jcp->s); diff --git a/urjtag/src/tap/cable/usbblaster.c b/urjtag/src/tap/cable/usbblaster.c index b77ad5e6..1e6f6bb0 100644 --- a/urjtag/src/tap/cable/usbblaster.c +++ b/urjtag/src/tap/cable/usbblaster.c @@ -73,11 +73,11 @@ usbblaster_connect (urj_cable_t *cable, const urj_param_t *params[]) if (urj_tap_cable_generic_usbconn_connect (cable, params) != URJ_STATUS_OK) return URJ_STATUS_FAIL; - cable_params = malloc (sizeof (params_t)); + cable_params = malloc (sizeof (*cable_params)); if (!cable_params) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, _("malloc(%zd) fails"), - sizeof (params_t)); + sizeof (*cable_params)); /* NOTE: * Call the underlying usbport driver (*free) routine directly * not urj_tap_cable_generic_usbconn_free() since it also free's cable->params @@ -87,7 +87,7 @@ usbblaster_connect (urj_cable_t *cable, const urj_param_t *params[]) return URJ_STATUS_FAIL; } - urj_tap_cable_cx_cmd_init (&(cable_params->cmd_root)); + urj_tap_cable_cx_cmd_init (&cable_params->cmd_root); /* exchange generic cable parameters with our private parameter set */ free (cable->params); @@ -110,8 +110,8 @@ static int usbblaster_init (urj_cable_t *cable) { int i; - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -130,9 +130,9 @@ usbblaster_init (urj_cable_t *cable) static void usbblaster_cable_free (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; - urj_tap_cable_cx_cmd_deinit (&(params->cmd_root)); + urj_tap_cable_cx_cmd_deinit (¶ms->cmd_root); urj_tap_cable_generic_usbconn_free (cable); } @@ -140,8 +140,8 @@ usbblaster_cable_free (urj_cable_t *cable) static void usbblaster_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; int i, m; tms = tms ? (1 << TMS) : 0; @@ -199,18 +199,18 @@ usbblaster_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n) static void usbblaster_clock (urj_cable_t *cable, int tms, int tdi, int n) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; usbblaster_clock_schedule (cable, tms, tdi, n); - urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, NULL, cable, URJ_TAP_CABLE_COMPLETELY); } static void usbblaster_get_tdo_schedule (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; urj_tap_cable_cx_cmd_queue (cmd_root, 1); urj_tap_cable_cx_cmd_push (cmd_root, OTHERS); /* TCK low */ @@ -232,10 +232,10 @@ usbblaster_get_tdo_finish (urj_cable_t *cable) static int usbblaster_get_tdo (urj_cable_t *cable) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; usbblaster_get_tdo_schedule (cable); - urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, NULL, cable, URJ_TAP_CABLE_COMPLETELY); return usbblaster_get_tdo_finish (cable); } @@ -250,8 +250,8 @@ static void usbblaster_transfer_schedule (urj_cable_t *cable, int len, const char *in, char *out) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; int in_offset = 0; urj_tap_cable_cx_cmd_queue (cmd_root, 0); @@ -316,8 +316,8 @@ usbblaster_transfer_schedule (urj_cable_t *cable, int len, const char *in, static int usbblaster_transfer_finish (urj_cable_t *cable, int len, char *out) { - params_t *params = (params_t *) cable->params; - urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; int out_offset = 0; if (out == NULL) @@ -369,10 +369,10 @@ usbblaster_transfer_finish (urj_cable_t *cable, int len, char *out) static int usbblaster_transfer (urj_cable_t *cable, int len, const char *in, char *out) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; usbblaster_transfer_schedule (cable, len, in, out); - urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, + urj_tap_cable_cx_xfer (¶ms->cmd_root, NULL, cable, URJ_TAP_CABLE_COMPLETELY); return usbblaster_transfer_finish (cable, len, out); } @@ -380,13 +380,13 @@ usbblaster_transfer (urj_cable_t *cable, int len, const char *in, char *out) static void usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) { - params_t *params = (params_t *) cable->params; + params_t *params = cable->params; if (how_much == URJ_TAP_CABLE_OPTIONALLY) return; if (cable->todo.num_items == 0) - urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, how_much); + urj_tap_cable_cx_xfer (¶ms->cmd_root, NULL, cable, how_much); while (cable->todo.num_items > 0) { @@ -428,7 +428,7 @@ usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) i = 0; } - urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, how_much); + urj_tap_cable_cx_xfer (¶ms->cmd_root, NULL, cable, how_much); while (j != i) { @@ -437,7 +437,7 @@ usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) case URJ_TAP_CABLE_GET_TDO: { int m; - m = urj_tap_cable_add_queue_item (cable, &(cable->done)); + m = urj_tap_cable_add_queue_item (cable, &cable->done); cable->done.data[m].action = URJ_TAP_CABLE_GET_TDO; cable->done.data[m].arg.value.val = usbblaster_get_tdo_finish (cable); @@ -446,7 +446,7 @@ usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) case URJ_TAP_CABLE_GET_SIGNAL: { int m = - urj_tap_cable_add_queue_item (cable, &(cable->done)); + urj_tap_cable_add_queue_item (cable, &cable->done); cable->done.data[m].action = URJ_TAP_CABLE_GET_SIGNAL; cable->done.data[m].arg.value.sig = cable->todo.data[j].arg.value.sig; @@ -467,7 +467,7 @@ usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much) if (cable->todo.data[j].arg.transfer.out) { int m = urj_tap_cable_add_queue_item (cable, - &(cable->done)); + &cable->done); if (m < 0) { // retain error state diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c index 6e92a291..024f2967 100644 --- a/urjtag/src/tap/detect.c +++ b/urjtag/src/tap/detect.c @@ -437,7 +437,7 @@ urj_tap_detect_parts (urj_chain_t *chain, const char *db_path) part_init_func = urj_part_find_init (part->part); if (part_init_func) { - part->params = (urj_part_params_t *) malloc (sizeof (urj_part_params_t)); + part->params = malloc (sizeof (urj_part_params_t)); (*part_init_func) (part); } else diff --git a/urjtag/src/tap/usbconn/libftd2xx.c b/urjtag/src/tap/usbconn/libftd2xx.c index 1407bed6..b79eefd6 100644 --- a/urjtag/src/tap/usbconn/libftd2xx.c +++ b/urjtag/src/tap/usbconn/libftd2xx.c @@ -154,7 +154,7 @@ usbconn_ftd2xx_flush (ftd2xx_param_t *p) } while (recvd == 0) - if ((status = FT_Read (p->fc, &(p->recv_buf[p->recv_write_idx]), + if ((status = FT_Read (p->fc, &p->recv_buf[p->recv_write_idx], p->to_recv, &recvd)) != FT_OK) urj_error_set (URJ_ERROR_FTD, _("Error from FT_Read(): %s"), ftd2xx_status_string(status)); @@ -206,7 +206,7 @@ usbconn_ftd2xx_read (urj_usbconn_t *conn, uint8_t *buf, int len) if (cpy_len > 0) { /* get data from the receive buffer */ - memcpy (buf, &(p->recv_buf[p->recv_read_idx]), cpy_len); + memcpy (buf, &p->recv_buf[p->recv_read_idx], cpy_len); p->recv_read_idx += cpy_len; if (p->recv_read_idx == p->recv_write_idx) p->recv_read_idx = p->recv_write_idx = 0; @@ -217,7 +217,7 @@ usbconn_ftd2xx_read (urj_usbconn_t *conn, uint8_t *buf, int len) /* need to get more data directly from the device */ while (recvd == 0) if ((status = - FT_Read (p->fc, &(buf[cpy_len]), len, &recvd)) != FT_OK) + FT_Read (p->fc, &buf[cpy_len], len, &recvd)) != FT_OK) urj_error_set (URJ_ERROR_FTD, _("Error from FT_Read(): %s"), ftd2xx_status_string(status)); } @@ -266,7 +266,7 @@ usbconn_ftd2xx_write (urj_usbconn_t *conn, uint8_t *buf, int len, int recv) if (p->send_buf) { - memcpy (&(p->send_buf[p->send_buffered]), buf, len); + memcpy (&p->send_buf[p->send_buffered], buf, len); p->send_buffered += len; if (recv > 0) p->to_recv += recv; @@ -387,15 +387,15 @@ usbconn_ftd2xx_common_open (urj_usbconn_t *conn, urj_log_level_t ll) /* serial number/description is specified */ /* first try to match against the serial string */ - status = FT_OpenEx (p->serial, FT_OPEN_BY_SERIAL_NUMBER, &(p->fc)); + status = FT_OpenEx (p->serial, FT_OPEN_BY_SERIAL_NUMBER, &p->fc); if (status != FT_OK) /* then try to match against the description string */ - status = FT_OpenEx (p->serial, FT_OPEN_BY_DESCRIPTION, &(p->fc)); + status = FT_OpenEx (p->serial, FT_OPEN_BY_DESCRIPTION, &p->fc); } else /* give it a plain try */ - status = FT_Open (0, &(p->fc)); + status = FT_Open (0, &p->fc); if (status != FT_OK) {