From 0cba0d4df3fe120f08945703506f8405760325c9 Mon Sep 17 00:00:00 2001 From: ntfreak Date: Sat, 13 Dec 2008 12:44:39 +0000 Subject: - remove target specific variant and use target->variant member - fix build warning in cortex_m3 - code cleanup - remove trailing lf and convert c++ comments git-svn-id: svn://svn.berlios.de/openocd/trunk@1238 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/jtag/bitbang.c | 2 - src/jtag/bitq.c | 12 ----- src/jtag/dummy.c | 6 --- src/jtag/ep93xx.c | 4 +- src/jtag/gw16012.c | 34 +++++++------- src/jtag/jtag.c | 127 ++++++++++++++++++++--------------------------------- src/jtag/jtag.h | 40 ++++++----------- src/jtag/presto.c | 25 ----------- src/jtag/usbprog.c | 30 ++++++------- 9 files changed, 95 insertions(+), 185 deletions(-) (limited to 'src/jtag') diff --git a/src/jtag/bitbang.c b/src/jtag/bitbang.c index fbfffd36..8c4a3761 100644 --- a/src/jtag/bitbang.c +++ b/src/jtag/bitbang.c @@ -39,7 +39,6 @@ bitbang_interface_t *bitbang_interface; - /* DANGER!!!! clock absolutely *MUST* be 0 in idle or reset won't work! * * Set this to 1 and str912 reset halt will fail. @@ -316,4 +315,3 @@ int bitbang_execute_queue(void) return retval; } - diff --git a/src/jtag/bitq.c b/src/jtag/bitq.c index e18d93c6..f347f7dc 100644 --- a/src/jtag/bitq.c +++ b/src/jtag/bitq.c @@ -34,7 +34,6 @@ #include #include - bitq_interface_t *bitq_interface; /* low level bit queue interface */ bitq_state_t bitq_in_state; /* state of input queue */ @@ -42,7 +41,6 @@ bitq_state_t bitq_in_state; /* state of input queue */ u8 *bitq_in_buffer; /* buffer dynamically reallocated as needed */ unsigned long bitq_in_bufsize=32; /* min. buffer size */ - /* * input queue processing does not use jtag_read_buffer() to avoid unnecessary overhead * also the buffer for incomming data is reallocated only if necessary @@ -129,8 +127,6 @@ void bitq_in_proc(void) } } - - void bitq_io(int tms, int tdi, int tdo_req) { bitq_interface->out(tms, tdi, tdo_req); @@ -138,7 +134,6 @@ void bitq_io(int tms, int tdi, int tdo_req) if (bitq_interface->in_rdy()) bitq_in_proc(); } - void bitq_end_state(enum tap_state state) { if (state==-1) return; @@ -149,7 +144,6 @@ void bitq_end_state(enum tap_state state) end_state = state; } - void bitq_state_move(enum tap_state new_state) { int i=0; @@ -170,7 +164,6 @@ void bitq_state_move(enum tap_state new_state) cur_state = new_state; } - void bitq_path_move(pathmove_command_t *cmd) { int i; @@ -189,7 +182,6 @@ void bitq_path_move(pathmove_command_t *cmd) end_state = cur_state; } - void bitq_runtest(int num_cycles) { int i; @@ -205,7 +197,6 @@ void bitq_runtest(int num_cycles) if (cur_state != end_state) bitq_state_move(end_state); } - void bitq_scan_field(scan_field_t *field, int pause) { int bit_cnt; @@ -245,7 +236,6 @@ void bitq_scan_field(scan_field_t *field, int pause) } } - void bitq_scan(scan_command_t *cmd) { int i; @@ -258,7 +248,6 @@ void bitq_scan(scan_command_t *cmd) bitq_scan_field(&cmd->fields[i], 1); } - int bitq_execute_queue(void) { jtag_command_t *cmd = jtag_command_queue; /* currently processed command */ @@ -356,7 +345,6 @@ int bitq_execute_queue(void) return bitq_in_state.status; } - void bitq_cleanup(void) { if (bitq_in_buffer!=NULL) diff --git a/src/jtag/dummy.c b/src/jtag/dummy.c index 90c60db8..0565edaf 100644 --- a/src/jtag/dummy.c +++ b/src/jtag/dummy.c @@ -26,7 +26,6 @@ #include "jtag.h" #include "bitbang.h" - int dummy_speed(int speed); int dummy_register_commands(struct command_context_s *cmd_ctx); int dummy_init(void); @@ -65,7 +64,6 @@ int dummy_read(void) return 1; } - void dummy_write(int tck, int tms, int tdi) { } @@ -73,7 +71,6 @@ void dummy_write(int tck, int tms, int tdi) void dummy_reset(int trst, int srst) { } - int dummy_speed(int speed) { @@ -85,7 +82,6 @@ int dummy_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } - int dummy_init(void) { bitbang_interface = &dummy_bitbang; @@ -98,8 +94,6 @@ int dummy_quit(void) return ERROR_OK; } - void dummy_led(int on) { } - diff --git a/src/jtag/ep93xx.c b/src/jtag/ep93xx.c index 55550b36..03a391a0 100644 --- a/src/jtag/ep93xx.c +++ b/src/jtag/ep93xx.c @@ -64,7 +64,7 @@ struct timespec ep93xx_zzzz; jtag_interface_t ep93xx_interface = { .name = "ep93xx", - + .execute_queue = bitbang_execute_queue, .speed = ep93xx_speed, @@ -126,7 +126,7 @@ void ep93xx_reset(int trst, int srst) int ep93xx_speed(int speed) { - + return ERROR_OK; } diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index 60ad5699..e03cea93 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -438,26 +438,26 @@ int gw16012_execute_queue(void) #if PARPORT_USE_GIVEIO == 1 int gw16012_get_giveio_access() { - HANDLE h; - OSVERSIONINFO version; - - version.dwOSVersionInfoSize = sizeof version; - if (!GetVersionEx( &version )) { - errno = EINVAL; - return -1; - } - if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; + HANDLE h; + OSVERSIONINFO version; - h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; - } + version.dwOSVersionInfoSize = sizeof version; + if (!GetVersionEx( &version )) { + errno = EINVAL; + return -1; + } + if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) + return 0; - CloseHandle( h ); + h = CreateFile( "\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); + if (h == INVALID_HANDLE_VALUE) { + errno = ENODEV; + return -1; + } - return 0; + CloseHandle( h ); + + return 0; } #endif diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index 3c05592f..ca52872f 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -250,8 +250,6 @@ jtag_interface_t *jtag = NULL; jtag_interface_t *jtag_interface = NULL; int jtag_speed = 0; - - /* forward declarations */ void jtag_add_pathmove(int num_states, enum tap_state *path); void jtag_add_runtest(int num_cycles, enum tap_state endstate); @@ -279,14 +277,12 @@ int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv); int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - jtag_tap_t *jtag_AllTaps(void) { - return jtag_all_taps; + return jtag_all_taps; }; -int -jtag_NumTotalTaps(void) +int jtag_NumTotalTaps(void) { jtag_tap_t *t; int n; @@ -300,8 +296,7 @@ jtag_NumTotalTaps(void) return n; } -int -jtag_NumEnabledTaps(void) +int jtag_NumEnabledTaps(void) { jtag_tap_t *t; int n; @@ -345,8 +340,7 @@ jtag_tap_t *jtag_TapByString( const char *s ) return t; } -jtag_tap_t * -jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *o ) +jtag_tap_t * jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *o ) { jtag_tap_t *t; const char *cp; @@ -365,8 +359,7 @@ jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *o ) } /* returns a pointer to the n-th device in the scan chain */ -jtag_tap_t * -jtag_TapByAbsPosition( int n ) +jtag_tap_t * jtag_TapByAbsPosition( int n ) { int orig_n; jtag_tap_t *t; @@ -377,11 +370,10 @@ jtag_TapByAbsPosition( int n ) while( t && (n > 0)) { n--; t = t->next_tap; - } + } return t; } - int jtag_register_event_callback(int (*callback)(enum jtag_event event, void *priv), void *priv) { jtag_event_callback_t **callbacks_p = &jtag_event_callbacks; @@ -463,7 +455,6 @@ jtag_command_t** jtag_get_last_command_p(void) return last_comand_pointer; } - void* cmd_queue_alloc(size_t size) { cmd_queue_page_t **p_page = &cmd_queue_pages; @@ -491,17 +482,16 @@ void* cmd_queue_alloc(size_t size) * */ union worse_case_align { - int i; - long l; - float f; - void *v; + int i; + long l; + float f; + void *v; }; #define ALIGN_SIZE (sizeof(union worse_case_align)) - // The alignment process. + /* The alignment process. */ size = (size + ALIGN_SIZE -1) & (~(ALIGN_SIZE-1)); - // Done... - + /* Done... */ if (*p_page) { @@ -652,7 +642,6 @@ int MINIDRIVER(interface_jtag_add_ir_scan)(int num_fields, scan_field_t *fields, (*last_cmd)->cmd.scan->fields[nth_tap].out_value = buf_set_ones(cmd_queue_alloc(CEIL(scan_size, 8)), scan_size); (*last_cmd)->cmd.scan->fields[nth_tap].out_mask = NULL; tap->bypass = 1; - } /* update device information */ @@ -1023,7 +1012,6 @@ void jtag_add_pathmove(int num_states, enum tap_state *path) jtag_prelude1(); - retval=interface_jtag_add_pathmove(num_states, path); cmd_queue_cur_state = path[num_states - 1]; if (retval!=ERROR_OK) @@ -1805,8 +1793,7 @@ jtag_tap_configure_cmd( Jim_GetOptInfo *goi, return JIM_OK; } -static int -jim_newtap_cmd( Jim_GetOptInfo *goi ) +static int jim_newtap_cmd( Jim_GetOptInfo *goi ) { jtag_tap_t *pTap; jtag_tap_t **ppTap; @@ -1824,24 +1811,23 @@ jim_newtap_cmd( Jim_GetOptInfo *goi ) #define NTAP_OPT_IRCAPTURE 2 { .name = "-ircapture" , .value = NTAP_OPT_IRCAPTURE }, #define NTAP_OPT_ENABLED 3 - { .name = "-enable" , .value = NTAP_OPT_ENABLED }, + { .name = "-enable" , .value = NTAP_OPT_ENABLED }, #define NTAP_OPT_DISABLED 4 - { .name = "-disable" , .value = NTAP_OPT_DISABLED }, + { .name = "-disable" , .value = NTAP_OPT_DISABLED }, #define NTAP_OPT_EXPECTED_ID 5 - { .name = "-expected-id" , .value = NTAP_OPT_EXPECTED_ID }, - { .name = NULL , .value = -1 }, + { .name = "-expected-id" , .value = NTAP_OPT_EXPECTED_ID }, + { .name = NULL , .value = -1 }, }; - pTap = malloc( sizeof(jtag_tap_t) ); memset( pTap, 0, sizeof(*pTap) ); if( !pTap ){ Jim_SetResult_sprintf( goi->interp, "no memory"); return JIM_ERR; } - // - // we expect CHIP + TAP + OPTIONS - // + /* + * we expect CHIP + TAP + OPTIONS + * */ if( goi->argc < 3 ){ Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ...."); return JIM_ERR; @@ -1852,7 +1838,7 @@ jim_newtap_cmd( Jim_GetOptInfo *goi ) Jim_GetOpt_String( goi, &cp, NULL ); pTap->tapname = strdup(cp); - // name + dot + name + null + /* name + dot + name + null */ x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1; cp = malloc( x ); sprintf( cp, "%s.%s", pTap->chip, pTap->tapname ); @@ -1861,16 +1847,15 @@ jim_newtap_cmd( Jim_GetOptInfo *goi ) LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params", pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); - - // default is enabled + /* default is enabled */ pTap->enabled = 1; - // deal with options + /* deal with options */ #define NTREQ_IRLEN 1 #define NTREQ_IRCAPTURE 2 #define NTREQ_IRMASK 4 - // clear them as we find them + /* clear them as we find them */ reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK); while( goi->argc ){ @@ -1921,7 +1906,7 @@ jim_newtap_cmd( Jim_GetOptInfo *goi ) return e; } if( (w < 0) || (w > 0xffff) ){ - // wacky value + /* wacky value */ Jim_SetResult_sprintf( goi->interp, "option: %s - wacky value: %d (0x%x)", n->name, (int)(w), (int)(w)); return JIM_ERR; @@ -1940,17 +1925,17 @@ jim_newtap_cmd( Jim_GetOptInfo *goi ) reqbits &= (~(NTREQ_IRCAPTURE)); break; } - } // switch(n->value) - } // while( goi->argc ) + } /* switch(n->value) */ + } /* while( goi->argc ) */ - // Did we get all the options? + /* Did we get all the options? */ if( reqbits ){ // no Jim_SetResult_sprintf( goi->interp, "newtap: %s missing required parameters", pTap->dotted_name); - // fixme: Tell user what is missing :-( - // no memory leaks pelase + /* TODO: Tell user what is missing :-( */ + /* no memory leaks pelase */ free(((void *)(pTap->expected_ids))); free(((void *)(pTap->chip))); free(((void *)(pTap->tapname))); @@ -1976,7 +1961,6 @@ jim_newtap_cmd( Jim_GetOptInfo *goi ) pTap->bypass = 1; - jtag_register_event_callback(jtag_reset_callback, pTap ); ppTap = &(jtag_all_taps); @@ -1989,19 +1973,16 @@ jim_newtap_cmd( Jim_GetOptInfo *goi ) pTap->abs_chain_position = n_taps++; } LOG_DEBUG( "Created Tap: %s @ abs position %d, irlen %d, capture: 0x%x mask: 0x%x", - (*ppTap)->dotted_name, - (*ppTap)->abs_chain_position, - (*ppTap)->ir_length, - (*ppTap)->ir_capture_value, - (*ppTap)->ir_capture_mask ); - + (*ppTap)->dotted_name, + (*ppTap)->abs_chain_position, + (*ppTap)->ir_length, + (*ppTap)->ir_capture_value, + (*ppTap)->ir_capture_mask ); return ERROR_OK; } - -static int -jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) +static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) { Jim_GetOptInfo goi; int e; @@ -2034,7 +2015,7 @@ jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) }; context = Jim_GetAssocData(interp, "context"); - // go past the command + /* go past the command */ Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 ); e = Jim_GetOpt_Nvp( &goi, jtag_cmds, &n ); @@ -2045,9 +2026,9 @@ jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) Jim_SetEmptyResult( goi.interp ); switch( n->value ){ case JTAG_CMD_INTERFACE: - // return the name of the interface - // TCL code might need to know the exact type... - // FUTURE: we allow this as a means to "set" the interface. + /* return the name of the interface */ + /* TCL code might need to know the exact type... */ + /* FUTURE: we allow this as a means to "set" the interface. */ if( goi.argc != 0 ){ Jim_WrongNumArgs( goi.interp, 1, goi.argv-1, "(no params)"); return JIM_ERR; @@ -2142,7 +2123,6 @@ jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } } - return JIM_ERR; } @@ -2203,8 +2183,6 @@ int jtag_interface_init(struct command_context_s *cmd_ctx) if (jtag_interface->init() != ERROR_OK) return ERROR_JTAG_INIT_FAILED; - - jtag = jtag_interface; return ERROR_OK; } @@ -2216,7 +2194,6 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx) LOG_DEBUG("Init JTAG chain"); - tap = jtag_NextEnabledTap(NULL); if( tap == NULL ){ LOG_ERROR("There are no enabled taps?"); @@ -2390,14 +2367,14 @@ int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, cha int e; char buf[1024]; Jim_Obj *newargs[ 10 ]; - // - // CONVERT SYNTAX - // - // argv[-1] = command - // argv[ 0] = ir length - // argv[ 1] = ir capture - // argv[ 2] = ir mask - // argv[ 3] = not actually used by anything but in the docs + /* + * CONVERT SYNTAX + * argv[-1] = command + * argv[ 0] = ir length + * argv[ 1] = ir capture + * argv[ 2] = ir mask + * argv[ 3] = not actually used by anything but in the docs + */ if( argc < 4 ){ command_print( cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax"); @@ -2413,8 +2390,6 @@ int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, cha command_print( cmd_ctx, "jtag newtap stm32 boundry ....., and the tap: \"stm32.boundery\""); command_print( cmd_ctx, "And then refer to the taps by the dotted name."); - - newargs[0] = Jim_NewStringObj( interp, "jtag", -1 ); newargs[1] = Jim_NewStringObj( interp, "newtap", -1 ); sprintf( buf, "chip%d", jtag_NumTotalTaps() ); @@ -2441,8 +2416,6 @@ int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, cha Jim_GetString( newargs[8], NULL ), Jim_GetString( newargs[9], NULL ) ); - - e = jim_jtag_command( interp, 10, newargs ); if( e != JIM_OK ){ command_print( cmd_ctx, "%s", Jim_GetString( Jim_GetResult(interp), NULL ) ); @@ -2450,7 +2423,6 @@ int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, cha return e; } - int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { jtag_tap_t *tap; @@ -2835,7 +2807,6 @@ int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args) Jim_GetLong(interp, args[i], &bits); str = Jim_GetString(args[i+1], &len); - fields[field_count].tap = tap; fields[field_count].num_bits = bits; fields[field_count].out_value = malloc(CEIL(bits, 8)); @@ -2904,7 +2875,6 @@ int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd return ERROR_OK; } - int jtag_power_dropout(int *dropout) { return jtag->power_dropout(dropout); @@ -2945,4 +2915,3 @@ void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e) Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name); } } - diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index bd306aba..16eeef54 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -78,11 +78,10 @@ typedef struct scan_field_s /* in_check_value/mask, in_handler_error_handler, in_handler_priv can be used by the in handler, otherwise they contain garbage */ u8 *in_check_value; /* used to validate scan results */ u8 *in_check_mask; /* check specified bits against check_value */ - in_handler_t in_handler; /* process received buffer using this handler */ + in_handler_t in_handler;/* process received buffer using this handler */ void *in_handler_priv; /* additional information for the in_handler */ } scan_field_t; - enum scan_type { /* IN: from device to host, OUT: from host to device */ @@ -158,12 +157,12 @@ typedef struct jtag_command_s extern jtag_command_t *jtag_command_queue; -// forward declaration +/* forward declaration */ typedef struct jtag_tap_event_action_s jtag_tap_event_action_t; -// this is really: typedef jtag_tap_t -// But - the typedef is done in "types.h" -// due to "forward decloration reasons" +/* this is really: typedef jtag_tap_t */ +/* But - the typedef is done in "types.h" */ +/* due to "forward decloration reasons" */ struct jtag_tap_s { const char *chip; @@ -188,22 +187,21 @@ struct jtag_tap_s }; extern jtag_tap_t *jtag_AllTaps(void); extern jtag_tap_t *jtag_TapByPosition(int n); -extern jtag_tap_t *jtag_TapByPosition( int n ); -extern jtag_tap_t *jtag_TapByString( const char *dotted_name ); -extern jtag_tap_t *jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *obj ); -extern jtag_tap_t *jtag_TapByAbsPosition( int abs_position ); -extern int jtag_NumEnabledTaps(void); -extern int jtag_NumTotalTaps(void); - +extern jtag_tap_t *jtag_TapByPosition(int n); +extern jtag_tap_t *jtag_TapByString(const char *dotted_name); +extern jtag_tap_t *jtag_TapByJimObj(Jim_Interp *interp, Jim_Obj *obj); +extern jtag_tap_t *jtag_TapByAbsPosition(int abs_position); +extern int jtag_NumEnabledTaps(void); +extern int jtag_NumTotalTaps(void); static __inline__ jtag_tap_t * jtag_NextEnabledTap( jtag_tap_t *p ) { if( p == NULL ){ - // start at the head of list + /* start at the head of list */ p = jtag_AllTaps(); } else { - // start *after* this one + /* start *after* this one */ p = p->next_tap; } while( p ){ @@ -216,9 +214,6 @@ jtag_NextEnabledTap( jtag_tap_t *p ) return p; } - - - enum reset_line_mode { LINE_OPEN_DRAIN = 0x0, @@ -440,8 +435,6 @@ extern int interface_jtag_add_end_state(enum tap_state endstate); extern void jtag_add_sleep(u32 us); extern int interface_jtag_add_sleep(u32 us); - - /* * For software FIFO implementations, the queued commands can be executed * during this call or earlier. A sw queue might decide to push out @@ -468,7 +461,6 @@ extern int interface_jtag_execute_queue(void); extern int jtag_power_dropout(int *dropout); extern int jtag_srst_asserted(int *srst_asserted); - /* JTAG support functions */ extern void jtag_set_check_value(scan_field_t *field, u8 *value, u8 *mask, error_handler_t *in_error_handler); extern enum scan_type jtag_scan_type(scan_command_t *cmd); @@ -494,8 +486,6 @@ void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e); #define ERROR_JTAG_QUEUE_FAILED (-104) #define ERROR_JTAG_DEVICE_ERROR (-107) - - /* this allows JTAG devices to implement the entire jtag_xxx() layer in hw/sw */ #ifdef HAVE_JTAG_MINIDRIVER_H /* Here a #define MINIDRIVER() and an inline version of hw fifo interface_jtag_add_dr_out can be defined */ @@ -527,9 +517,6 @@ extern void interface_jtag_add_dr_out(jtag_tap_t *tap, enum tap_state end_state); #endif - - - static __inline__ void jtag_add_dr_out(jtag_tap_t *tap, int num_fields, const int *num_bits, @@ -542,5 +529,4 @@ static __inline__ void jtag_add_dr_out(jtag_tap_t *tap, interface_jtag_add_dr_out(tap, num_fields, num_bits, value, cmd_queue_end_state); } - #endif /* JTAG_H */ diff --git a/src/jtag/presto.c b/src/jtag/presto.c index 21f80f00..0e532817 100644 --- a/src/jtag/presto.c +++ b/src/jtag/presto.c @@ -49,7 +49,6 @@ #error "BUG: either FTD2XX and LIBFTDI has to be used" #endif - int presto_jtag_speed(int speed); int presto_jtag_khz(int khz, int *jtag_speed); int presto_jtag_speed_div(int speed, int *khz); @@ -69,7 +68,6 @@ jtag_interface_t presto_interface = .quit = presto_jtag_quit, }; - int presto_bitq_out(int tms, int tdi, int tdo_req); int presto_bitq_flush(void); int presto_bitq_sleep(unsigned long us); @@ -87,10 +85,8 @@ bitq_interface_t presto_bitq = .in = presto_bitq_in, }; - /* -------------------------------------------------------------------------- */ - #define FT_DEVICE_NAME_LEN 64 #define FT_DEVICE_SERNUM_LEN 64 @@ -486,7 +482,6 @@ int presto_close(void) return result; } - int presto_flush(void) { if (presto->buff_out_pos == 0) @@ -530,7 +525,6 @@ int presto_flush(void) return ERROR_OK; } - int presto_sendbyte(int data) { if (data == EOF) return presto_flush(); @@ -555,7 +549,6 @@ int presto_sendbyte(int data) return ERROR_OK; } - int presto_getbyte(void) { if (presto->buff_in_pos < presto->buff_in_len) @@ -573,10 +566,8 @@ int presto_getbyte(void) return -1; } - /* -------------------------------------------------------------------------- */ - int presto_tdi_flush(void) { if (presto->jtag_tdi_count == 0) @@ -596,7 +587,6 @@ int presto_tdi_flush(void) return 0; } - int presto_tck_idle(void) { if (presto->jtag_tck == 1) @@ -608,10 +598,8 @@ int presto_tck_idle(void) return 0; } - /* -------------------------------------------------------------------------- */ - int presto_bitq_out(int tms, int tdi, int tdo_req) { int i; @@ -658,7 +646,6 @@ int presto_bitq_out(int tms, int tdi, int tdo_req) return 0; } - int presto_bitq_flush(void) { presto_tdi_flush(); @@ -669,7 +656,6 @@ int presto_bitq_flush(void) return presto_flush(); } - int presto_bitq_in_rdy(void) { if (presto->buff_in_pos>=presto->buff_in_len) @@ -677,7 +663,6 @@ int presto_bitq_in_rdy(void) return presto->buff_in_len-presto->buff_in_pos; } - int presto_bitq_in(void) { if (presto->buff_in_pos>=presto->buff_in_len) @@ -686,7 +671,6 @@ int presto_bitq_in(void) return 0; } - int presto_bitq_sleep(unsigned long us) { long waits; @@ -708,7 +692,6 @@ int presto_bitq_sleep(unsigned long us) return 0; } - int presto_bitq_reset(int trst, int srst) { presto_tdi_flush(); @@ -724,10 +707,8 @@ int presto_bitq_reset(int trst, int srst) return 0; } - /* -------------------------------------------------------------------------- */ - int presto_jtag_khz(int khz, int *jtag_speed) { if (khz < 0) @@ -742,7 +723,6 @@ int presto_jtag_khz(int khz, int *jtag_speed) return 0; } - int presto_jtag_speed_div(int speed, int *khz) { if ((speed < 0) || (speed > 1000)) @@ -757,7 +737,6 @@ int presto_jtag_speed_div(int speed, int *khz) return 0; } - int presto_jtag_speed(int speed) { int khz; @@ -777,7 +756,6 @@ int presto_jtag_speed(int speed) return 0; } - char *presto_serial; int presto_handle_serial_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) @@ -796,7 +774,6 @@ int presto_handle_serial_command(struct command_context_s *cmd_ctx, char *cmd, c return ERROR_OK; } - int presto_jtag_register_commands(struct command_context_s *cmd_ctx) { register_command(cmd_ctx, NULL, "presto_serial", presto_handle_serial_command, @@ -804,7 +781,6 @@ int presto_jtag_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } - int presto_jtag_init(void) { if (presto_open(presto_serial) != ERROR_OK) @@ -825,7 +801,6 @@ int presto_jtag_init(void) return ERROR_OK; } - int presto_jtag_quit(void) { bitq_cleanup(); diff --git a/src/jtag/usbprog.c b/src/jtag/usbprog.c index 665c6070..872f7339 100644 --- a/src/jtag/usbprog.c +++ b/src/jtag/usbprog.c @@ -47,10 +47,10 @@ #define PID 0x0c63 /* Pins at usbprog */ -#define TDO_BIT 0 -#define TDI_BIT 3 -#define TCK_BIT 2 -#define TMS_BIT 1 +#define TDO_BIT 0 +#define TDI_BIT 3 +#define TCK_BIT 2 +#define TMS_BIT 1 int usbprog_execute_queue(void); int usbprog_speed(int speed); @@ -74,17 +74,17 @@ jtag_interface_t usbprog_interface = .quit = usbprog_quit }; -#define UNKOWN_COMMAND 0x00 -#define PORT_DIRECTION 0x01 -#define PORT_SET 0x02 -#define PORT_GET 0x03 -#define PORT_SETBIT 0x04 -#define PORT_GETBIT 0x05 -#define WRITE_TDI 0x06 -#define READ_TDO 0x07 -#define WRITE_AND_READ 0x08 -#define WRITE_TMS 0x09 -#define WRITE_TMS_CHAIN 0x0A +#define UNKOWN_COMMAND 0x00 +#define PORT_DIRECTION 0x01 +#define PORT_SET 0x02 +#define PORT_GET 0x03 +#define PORT_SETBIT 0x04 +#define PORT_GETBIT 0x05 +#define WRITE_TDI 0x06 +#define READ_TDO 0x07 +#define WRITE_AND_READ 0x08 +#define WRITE_TMS 0x09 +#define WRITE_TMS_CHAIN 0x0A struct usbprog_jtag { -- cgit v1.2.3