fix jtag_add_callback() args. The first argument is nothing special, it's just another generic argument.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2290 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
a1c14646cb
commit
333642fcff
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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++;;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue