aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jtag/core.c14
-rw-r--r--src/jtag/driver.c16
-rw-r--r--src/jtag/jtag.h18
-rw-r--r--src/jtag/minidriver.h4
-rw-r--r--src/pld/virtex2.c5
-rw-r--r--src/target/arm720t.c2
-rw-r--r--src/target/arm7tdmi.c7
-rw-r--r--src/target/arm920t.c2
-rw-r--r--src/target/arm926ejs.c2
-rw-r--r--src/target/arm966e.c2
-rw-r--r--src/target/arm9tdmi.c9
-rw-r--r--src/target/arm_adi_v5.c2
-rw-r--r--src/target/arm_jtag.h10
-rw-r--r--src/target/embeddedice.c2
-rw-r--r--src/target/etb.c5
-rw-r--r--src/target/xscale.c5
16 files changed, 56 insertions, 49 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c
index c111334..ed16bdb 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -353,23 +353,23 @@ void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields,
jtag_set_error(retval);
}
-void jtag_add_callback(jtag_callback1_t f, uint8_t *in)
+void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
{
- interface_jtag_add_callback(f, in);
+ interface_jtag_add_callback(f, data0);
}
-void jtag_add_callback4(jtag_callback_t f, uint8_t *in,
+void jtag_add_callback4(jtag_callback_t f, jtag_callback_data_t data0,
jtag_callback_data_t data1, jtag_callback_data_t data2,
jtag_callback_data_t data3)
{
- interface_jtag_add_callback4(f, in, data1, data2, data3);
+ interface_jtag_add_callback4(f, data0, data1, data2, data3);
}
int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value, uint8_t *in_check_mask, int num_bits);
-static int jtag_check_value_mask_callback(uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
+static int jtag_check_value_mask_callback(jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
{
- return jtag_check_value_inner(in, (uint8_t *)data1, (uint8_t *)data2, (int)data3);
+ return jtag_check_value_inner((uint8_t *)data0, (uint8_t *)data1, (uint8_t *)data2, (int)data3);
}
static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
@@ -393,7 +393,7 @@ static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const s
if ((in_fields[i].check_value != NULL) && (in_fields[i].in_value != NULL))
{
/* this is synchronous for a minidriver */
- jtag_add_callback4(jtag_check_value_mask_callback, in_fields[i].in_value,
+ jtag_add_callback4(jtag_check_value_mask_callback, (jtag_callback_data_t)in_fields[i].in_value,
(jtag_callback_data_t)in_fields[i].check_value,
(jtag_callback_data_t)in_fields[i].check_mask,
(jtag_callback_data_t)in_fields[i].num_bits);
diff --git a/src/jtag/driver.c b/src/jtag/driver.c
index d14a1c2..0e352b0 100644
--- a/src/jtag/driver.c
+++ b/src/jtag/driver.c
@@ -40,7 +40,7 @@ struct jtag_callback_entry
struct jtag_callback_entry *next;
jtag_callback_t callback;
- uint8_t *in;
+ jtag_callback_data_t data0;
jtag_callback_data_t data1;
jtag_callback_data_t data2;
jtag_callback_data_t data3;
@@ -465,13 +465,13 @@ int interface_jtag_add_sleep(uint32_t us)
}
/* add callback to end of queue */
-void interface_jtag_add_callback4(jtag_callback_t callback, uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
+void interface_jtag_add_callback4(jtag_callback_t callback, jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
{
struct jtag_callback_entry *entry=cmd_queue_alloc(sizeof(struct jtag_callback_entry));
entry->next=NULL;
entry->callback=callback;
- entry->in=in;
+ entry->data0=data0;
entry->data1=data1;
entry->data2=data2;
entry->data3=data3;
@@ -495,7 +495,7 @@ int interface_jtag_execute_queue(void)
struct jtag_callback_entry *entry;
for (entry=jtag_callback_queue_head; entry!=NULL; entry=entry->next)
{
- retval=entry->callback(entry->in, entry->data1, entry->data2, entry->data3);
+ retval=entry->callback(entry->data0, entry->data1, entry->data2, entry->data3);
if (retval!=ERROR_OK)
break;
}
@@ -507,14 +507,14 @@ int interface_jtag_execute_queue(void)
return retval;
}
-static int jtag_convert_to_callback4(uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
+static int jtag_convert_to_callback4(jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
{
- ((jtag_callback1_t)data1)(in);
+ ((jtag_callback1_t)data1)(data0);
return ERROR_OK;
}
-void interface_jtag_add_callback(jtag_callback1_t callback, uint8_t *in)
+void interface_jtag_add_callback(jtag_callback1_t callback, jtag_callback_data_t data0)
{
- jtag_add_callback4(jtag_convert_to_callback4, in, (jtag_callback_data_t)callback, 0, 0);
+ jtag_add_callback4(jtag_convert_to_callback4, data0, (jtag_callback_data_t)callback, 0, 0);
}
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 368cd72..951a25d 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -384,6 +384,11 @@ extern void jtag_add_dr_scan_check(int num_fields, scan_field_t* fields, tap_sta
*/
extern void jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+/**
+ * Defines the type of data passed to the jtag_callback_t interface.
+ * The underlying type must allow storing an @c int or pointer type.
+ */
+typedef intptr_t jtag_callback_data_t;
/**
* Defines a simple JTAG callback that can allow conversions on data
@@ -393,17 +398,12 @@ extern void jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, t
* For conversion types or checks that can fail, use the more complete
* variant: jtag_callback_t.
*/
-typedef void (*jtag_callback1_t)(uint8_t *in);
+typedef void (*jtag_callback1_t)(jtag_callback_data_t data0);
/// A simpler version of jtag_add_callback4().
-extern void jtag_add_callback(jtag_callback1_t, uint8_t *in);
+extern void jtag_add_callback(jtag_callback1_t, jtag_callback_data_t data0);
-/**
- * Defines the type of data passed to the jtag_callback_t interface.
- * The underlying type must allow storing an @c int or pointer type.
- */
-typedef intptr_t jtag_callback_data_t;
/**
* Defines the interface of the JTAG callback mechanism.
@@ -414,7 +414,7 @@ typedef intptr_t jtag_callback_data_t;
* @param data3 An integer big enough to use as an @c int or a pointer.
* @returns an error code
*/
-typedef int (*jtag_callback_t)(uint8_t *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3);
+typedef int (*jtag_callback_t)(jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3);
/**
@@ -445,7 +445,7 @@ typedef int (*jtag_callback_t)(uint8_t *in, jtag_callback_data_t data1, jtag_cal
* @param data3 An integer big enough to use as an @c int or a pointer.
*
*/
-extern void jtag_add_callback4(jtag_callback_t f, uint8_t *in,
+extern void jtag_add_callback4(jtag_callback_t f, jtag_callback_data_t data0,
jtag_callback_data_t data1, jtag_callback_data_t data2,
jtag_callback_data_t data3);
diff --git a/src/jtag/minidriver.h b/src/jtag/minidriver.h
index 6440429..46bd002 100644
--- a/src/jtag/minidriver.h
+++ b/src/jtag/minidriver.h
@@ -85,9 +85,9 @@ extern void interface_jtag_add_dr_out(jtag_tap_t* tap,
int num_fields, const int* num_bits, const uint32_t* value,
tap_state_t end_state);
-extern void interface_jtag_add_callback(jtag_callback1_t f, uint8_t *in);
+extern void interface_jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0);
-extern void interface_jtag_add_callback4(jtag_callback_t f, uint8_t *in,
+extern void interface_jtag_add_callback4(jtag_callback_t f, jtag_callback_data_t data0,
jtag_callback_data_t data1, jtag_callback_data_t data2,
jtag_callback_data_t data3);
diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c
index 6e06622..1f063a0 100644
--- a/src/pld/virtex2.c
+++ b/src/pld/virtex2.c
@@ -88,8 +88,9 @@ static int virtex2_send_32(struct pld_device_s *pld_device,
return ERROR_OK;
}
-static __inline__ void virtexflip32(uint8_t *in)
+static __inline__ void virtexflip32(jtag_callback_data_t arg)
{
+ uint8_t *in=(uint8_t *)arg;
*((uint32_t *)in) = flip_u32(le_to_h_u32(in), 32);
}
@@ -112,7 +113,7 @@ static int virtex2_receive_32(struct pld_device_s *pld_device,
jtag_add_dr_scan(1, &scan_field, jtag_set_end_state(TAP_DRPAUSE));
- jtag_add_callback(virtexflip32, (uint8_t *)words);
+ jtag_add_callback(virtexflip32, (jtag_callback_data_t)words);
words++;;
}
diff --git a/src/target/arm720t.c b/src/target/arm720t.c
index 72a20df..f160c9d 100644
--- a/src/target/arm720t.c
+++ b/src/target/arm720t.c
@@ -120,7 +120,7 @@ int arm720t_scan_cp15(target_t *target, uint32_t out, uint32_t *in, int instruct
{
fields[1].in_value = (uint8_t *)in;
jtag_add_dr_scan(2, fields, jtag_get_end_state());
- jtag_add_callback(arm7flip32, (uint8_t *)in);
+ jtag_add_callback(arm7flip32, (jtag_callback_data_t)in);
} else
{
jtag_add_dr_scan(2, fields, jtag_get_end_state());
diff --git a/src/target/arm7tdmi.c b/src/target/arm7tdmi.c
index dead4bc..febe0e3 100644
--- a/src/target/arm7tdmi.c
+++ b/src/target/arm7tdmi.c
@@ -189,7 +189,7 @@ int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in)
jtag_add_dr_scan(2, fields, jtag_get_end_state());
- jtag_add_callback(arm7flip32, (uint8_t *)in);
+ jtag_add_callback(arm7flip32, (jtag_callback_data_t)in);
jtag_add_runtest(0, jtag_get_end_state());
@@ -245,8 +245,9 @@ void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip)
}
}
-static int arm7endianness(uint8_t *in, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured)
+static int arm7endianness(jtag_callback_data_t arg, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured)
{
+ uint8_t *in=(uint8_t *)arg;
arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 1);
return ERROR_OK;
}
@@ -279,7 +280,7 @@ int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size,
jtag_add_dr_scan(2, fields, jtag_get_end_state());
- jtag_add_callback4(arm7endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[1].in_value);
+ jtag_add_callback4(arm7endianness, (jtag_callback_data_t)in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[1].in_value);
jtag_add_runtest(0, jtag_get_end_state());
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index 6e4e076..80e0d99 100644
--- a/src/target/arm920t.c
+++ b/src/target/arm920t.c
@@ -133,7 +133,7 @@ int arm920t_read_cp15_physical(target_t *target, int reg_addr, uint32_t *value)
jtag_add_dr_scan(4, fields, jtag_get_end_state());
- jtag_add_callback(arm_le_to_h_u32, (uint8_t *)value);
+ jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)value);
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
jtag_execute_queue();
diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c
index 26e7f19..e48b1bd 100644
--- a/src/target/arm926ejs.c
+++ b/src/target/arm926ejs.c
@@ -167,7 +167,7 @@ int arm926ejs_cp15_read(target_t *target, uint32_t op1, uint32_t op2, uint32_t C
nr_w_buf = 0;
jtag_add_dr_scan(4, fields, jtag_get_end_state());
- jtag_add_callback(arm_le_to_h_u32, (uint8_t *)value);
+ jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)value);
if ((retval = jtag_execute_queue()) != ERROR_OK)
{
diff --git a/src/target/arm966e.c b/src/target/arm966e.c
index f648968..2ad0ab1 100644
--- a/src/target/arm966e.c
+++ b/src/target/arm966e.c
@@ -195,7 +195,7 @@ int arm966e_read_cp15(target_t *target, int reg_addr, uint32_t *value)
jtag_add_dr_scan(3, fields, jtag_get_end_state());
- jtag_add_callback(arm_le_to_h_u32, (uint8_t *)value);
+ jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)value);
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c
index 8edcdcb..922fb08 100644
--- a/src/target/arm9tdmi.c
+++ b/src/target/arm9tdmi.c
@@ -206,7 +206,7 @@ int arm9tdmi_clock_out(arm_jtag_t *jtag_info, uint32_t instr, uint32_t out, uint
fields[0].in_value=(uint8_t *)in;
jtag_add_dr_scan(3, fields, jtag_get_end_state());
- jtag_add_callback(arm_le_to_h_u32, (uint8_t *)in);
+ jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)in);
}
else
{
@@ -265,7 +265,7 @@ int arm9tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in)
jtag_add_dr_scan(3, fields, jtag_get_end_state());
- jtag_add_callback(arm_le_to_h_u32, (uint8_t *)in);
+ jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)in);
jtag_add_runtest(0, jtag_get_end_state());
@@ -292,8 +292,9 @@ int arm9tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in)
extern void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip);
-static int arm9endianness(uint8_t *in, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured)
+static int arm9endianness(jtag_callback_data_t arg, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured)
{
+ uint8_t *in=(uint8_t *)arg;
arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 0);
return ERROR_OK;
}
@@ -332,7 +333,7 @@ int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size,
jtag_add_dr_scan(3, fields, jtag_get_end_state());
- jtag_add_callback4(arm9endianness, in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[0].in_value);
+ jtag_add_callback4(arm9endianness, (jtag_callback_data_t)in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[0].in_value);
jtag_add_runtest(0, jtag_get_end_state());
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 7d6ae81..9ac6669 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -132,7 +132,7 @@ int adi_jtag_dp_scan_u32(swjdp_common_t *swjdp, uint8_t instr, uint8_t reg_addr,
fields[1].in_value = (uint8_t *)invalue;
jtag_add_dr_scan(2, fields, jtag_get_end_state());
- jtag_add_callback(arm_le_to_h_u32, (uint8_t *)invalue);
+ jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t) invalue);
} else
{
diff --git a/src/target/arm_jtag.h b/src/target/arm_jtag.h
index 2d3d073..e562ac1 100644
--- a/src/target/arm_jtag.h
+++ b/src/target/arm_jtag.h
@@ -58,14 +58,16 @@ int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field_s *field);
/* use this as a static so we can inline it in -O3 and refer to it via a pointer */
-static __inline__ void arm7flip32(uint8_t *in)
+static __inline__ void arm7flip32(jtag_callback_data_t arg)
{
- *((uint32_t *)in)=flip_u32(le_to_h_u32(in), 32);
+ uint8_t *in=(uint8_t *)arg;
+ *((uint32_t *)in)=flip_u32(le_to_h_u32(in), 32);
}
-static __inline__ void arm_le_to_h_u32(uint8_t *in)
+static __inline__ void arm_le_to_h_u32(jtag_callback_data_t arg)
{
- *((uint32_t *)in)=le_to_h_u32(in);
+ uint8_t *in=(uint8_t *)arg;
+ *((uint32_t *)in)=le_to_h_u32(in);
}
diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c
index 3c4dacb..28fe40e 100644
--- a/src/target/embeddedice.c
+++ b/src/target/embeddedice.c
@@ -326,7 +326,7 @@ int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size)
fields[0].in_value = (uint8_t *)data;
jtag_add_dr_scan(3, fields, jtag_get_end_state());
- jtag_add_callback(arm_le_to_h_u32, (uint8_t *)data);
+ jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)data);
data++;
size--;
diff --git a/src/target/etb.c b/src/target/etb.c
index 633c5aa..fe3afe4 100644
--- a/src/target/etb.c
+++ b/src/target/etb.c
@@ -158,8 +158,9 @@ static int etb_get_reg(reg_t *reg)
}
-static void etb_getbuf(uint8_t *in)
+static void etb_getbuf(jtag_callback_data_t arg)
{
+ uint8_t *in=(uint8_t *)arg;
*((uint32_t *)in)=buf_get_u32(in, 0, 32);
}
@@ -206,7 +207,7 @@ static int etb_read_ram(etb_t *etb, uint32_t *data, int num_frames)
fields[0].in_value = (uint8_t *)(data+i);
jtag_add_dr_scan(3, fields, jtag_get_end_state());
- jtag_add_callback(etb_getbuf, (uint8_t *)(data+i));
+ jtag_add_callback(etb_getbuf, (jtag_callback_data_t)(data+i));
}
jtag_execute_queue();
diff --git a/src/target/xscale.c b/src/target/xscale.c
index d92dde1..58679bb 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -293,8 +293,9 @@ int xscale_read_dcsr(target_t *target)
}
-static void xscale_getbuf(uint8_t *in)
+static void xscale_getbuf(jtag_callback_data_t arg)
{
+ uint8_t *in=(uint8_t *)arg;
*((uint32_t *)in)=buf_get_u32(in, 0, 32);
}
@@ -365,7 +366,7 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
jtag_add_dr_scan_check(3, fields, jtag_set_end_state(TAP_IDLE));
- jtag_add_callback(xscale_getbuf, (uint8_t *)(field1+i));
+ jtag_add_callback(xscale_getbuf, (jtag_callback_data_t)(field1+i));
words_scheduled++;
}