diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index bc7ce93db..f0aaeaab9 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -890,9 +890,7 @@ extern int default_interface_jtag_execute_queue(void); #ifdef HAVE_JTAG_MINIDRIVER_H /* Here a #define MINIDRIVER() and an inline version of hw fifo interface_jtag_add_dr_out can be defined */ #include "jtag_minidriver.h" -#define MINIDRIVER(a) notused ## a #else -#define MINIDRIVER(a) a extern void interface_jtag_add_dr_out(jtag_tap_t* tap, int num_fields, const int* num_bits, const u32* value, tap_state_t end_state); diff --git a/src/jtag/jtag_driver.c b/src/jtag/jtag_driver.c index f22b1a8d1..813d98af2 100644 --- a/src/jtag/jtag_driver.c +++ b/src/jtag/jtag_driver.c @@ -36,6 +36,7 @@ #include "jtag.h" #include "command.h" +#ifndef HAVE_JTAG_MINIDRIVER_H struct jtag_callback_entry { struct jtag_callback_entry *next; @@ -69,11 +70,12 @@ static void cmd_queue_scan_field_clone(scan_field_t * dst, const scan_field_t * dst->in_value = src->in_value; } + /** * see jtag_add_ir_scan() * */ -int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +int interface_jtag_add_ir_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { size_t num_taps = jtag_NumEnabledTaps(); @@ -147,7 +149,7 @@ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t * see jtag_add_plain_ir_scan() * */ -int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +int interface_jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -176,7 +178,7 @@ int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_f * see jtag_add_dr_scan() * */ -int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +int interface_jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { /* count devices in bypass */ @@ -261,7 +263,7 @@ int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t * The bypass status of TAPs is set by jtag_add_ir_scan(). * */ -void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap, +void interface_jtag_add_dr_out(jtag_tap_t *target_tap, int in_num_fields, const int *num_bits, const u32 *value, @@ -344,7 +346,7 @@ void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap, * see jtag_add_plain_dr_scan() * */ -int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) +int interface_jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields, tap_state_t state) { jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t)); @@ -366,7 +368,7 @@ int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_f return ERROR_OK; } -int MINIDRIVER(interface_jtag_add_tlr)(void) +int interface_jtag_add_tlr(void) { tap_state_t state = TAP_RESET; @@ -383,7 +385,7 @@ int MINIDRIVER(interface_jtag_add_tlr)(void) return ERROR_OK; } -int MINIDRIVER(interface_jtag_add_pathmove)(int num_states, const tap_state_t *path) +int interface_jtag_add_pathmove(int num_states, const tap_state_t *path) { /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -402,7 +404,7 @@ int MINIDRIVER(interface_jtag_add_pathmove)(int num_states, const tap_state_t *p return ERROR_OK; } -int MINIDRIVER(interface_jtag_add_runtest)(int num_cycles, tap_state_t state) +int interface_jtag_add_runtest(int num_cycles, tap_state_t state) { /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -418,7 +420,7 @@ int MINIDRIVER(interface_jtag_add_runtest)(int num_cycles, tap_state_t state) return ERROR_OK; } -int MINIDRIVER(interface_jtag_add_clocks)( int num_cycles ) +int interface_jtag_add_clocks( int num_cycles ) { /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -433,7 +435,7 @@ int MINIDRIVER(interface_jtag_add_clocks)( int num_cycles ) return ERROR_OK; } -int MINIDRIVER(interface_jtag_add_reset)(int req_trst, int req_srst) +int interface_jtag_add_reset(int req_trst, int req_srst) { /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -449,7 +451,7 @@ int MINIDRIVER(interface_jtag_add_reset)(int req_trst, int req_srst) return ERROR_OK; } -int MINIDRIVER(interface_jtag_add_sleep)(u32 us) +int interface_jtag_add_sleep(u32 us) { /* allocate memory for a new list member */ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); @@ -487,18 +489,6 @@ void jtag_add_callback4(jtag_callback_t callback, u8 *in, jtag_callback_data_t d } } - -static int jtag_convert_to_callback4(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) -{ - ((jtag_callback1_t)data1)(in); - return ERROR_OK; -} - -void jtag_add_callback(jtag_callback1_t callback, u8 *in) -{ - jtag_add_callback4(jtag_convert_to_callback4, in, (jtag_callback_data_t)callback, 0, 0); -} - void interface_jtag_add_scan_check_alloc(scan_field_t *field) { unsigned num_bytes = TAP_SCAN_BYTES(field->num_bits); @@ -529,3 +519,17 @@ void jtag_alloc_in_value32(scan_field_t *field) { field->in_value=(u8 *)cmd_queue_alloc(4); } + +static int jtag_convert_to_callback4(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3) +{ + ((jtag_callback1_t)data1)(in); + return ERROR_OK; +} + +void jtag_add_callback(jtag_callback1_t callback, u8 *in) +{ + jtag_add_callback4(jtag_convert_to_callback4, in, (jtag_callback_data_t)callback, 0, 0); +} + +#endif + diff --git a/src/jtag/zy1000.c b/src/jtag/zy1000.c index 788f379d5..2c196679a 100644 --- a/src/jtag/zy1000.c +++ b/src/jtag/zy1000.c @@ -535,7 +535,7 @@ int interface_jtag_add_end_state(tap_state_t state) } -int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, tap_state_t state) +int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_state_t state) { int j; @@ -596,7 +596,7 @@ int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, tap_state_t -int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, tap_state_t state) +int interface_jtag_add_plain_ir_scan(int num_fields, const scan_field_t *fields, tap_state_t state) { scanFields(num_fields, fields, TAP_IRSHIFT, cmd_queue_end_state); @@ -605,7 +605,7 @@ int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, tap_s /*extern jtag_command_t **jtag_get_last_command_p(void);*/ -int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, tap_state_t state) +int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_state_t state) { int j; @@ -649,7 +649,7 @@ int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, tap_state_t return ERROR_OK; } -int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, tap_state_t state) +int interface_jtag_add_plain_dr_scan(int num_fields, const scan_field_t *fields, tap_state_t state) { scanFields(num_fields, fields, TAP_DRSHIFT, cmd_queue_end_state); return ERROR_OK; @@ -732,7 +732,7 @@ int interface_jtag_add_sleep(u32 us) return ERROR_OK; } -int interface_jtag_add_pathmove(int num_states, tap_state_t *path) +int interface_jtag_add_pathmove(int num_states, const tap_state_t *path) { int state_count; int tms = 0; diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index d96debd05..e01a4499c 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -489,8 +489,9 @@ int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, u32 timeout) return ERROR_TARGET_TIMEOUT; } +#ifndef HAVE_JTAG_MINIDRIVER_H /* this is the inner loop of the open loop DCC write of data to target */ -void MINIDRIVER(embeddedice_write_dcc)(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count) +void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count) { int i; for (i = 0; i < count; i++) @@ -499,3 +500,6 @@ void MINIDRIVER(embeddedice_write_dcc)(jtag_tap_t *tap, int reg_addr, u8 *buffer buffer += 4; } } +#else +/* provided by minidriver */ +#endif