diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 3e06662c..535f803d 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,8 @@ +2008-09-03 Arnim Laeuger + + * src/tap/usbconn/libftd2xx.c, src/tap/usbconn/libftdi.c: + use puts() and printf() instead of perror() + 2008-09-03 Mike Frysinger * src/tap/parport/ppdev.c, src/tap/cable/wiggler.c, diff --git a/jtag/src/tap/usbconn/libftd2xx.c b/jtag/src/tap/usbconn/libftd2xx.c index 30bab9a8..10c2cf8e 100644 --- a/jtag/src/tap/usbconn/libftd2xx.c +++ b/jtag/src/tap/usbconn/libftd2xx.c @@ -94,11 +94,11 @@ usbconn_ftd2xx_flush( ftd2xx_param_t *p ) return 0; if ((status = FT_Write( p->fc, p->send_buf, p->send_buffered, &xferred )) != FT_OK) - perror( _("usbconn_ftd2xx_flush(): FT_Write() failed.\n") ); + printf( _("usbconn_ftd2xx_flush(): FT_Write() failed.\n") ); if (xferred < p->send_buffered) { - perror( _("usbconn_ftd2xx_flush(): Written fewer bytes than requested.\n") ); + printf( _("usbconn_ftd2xx_flush(): Written fewer bytes than requested.\n") ); return -1; } @@ -117,7 +117,7 @@ usbconn_ftd2xx_flush( ftd2xx_param_t *p ) if (!p->recv_buf) { - perror( _("usbconn_ftd2xx_flush(): Receive buffer does not exist.\n") ); + printf( _("usbconn_ftd2xx_flush(): Receive buffer does not exist.\n") ); return -1; } @@ -248,7 +248,7 @@ usbconn_ftd2xx_write( usbconn_t *conn, uint8_t *buf, int len, int recv ) } else { - perror( _("usbconn_ftd2xx_write(): Send buffer does not exist.\n") ); + printf( _("usbconn_ftd2xx_write(): Send buffer does not exist.\n") ); return -1; } } @@ -330,7 +330,7 @@ usbconn_ftd2xx_common_open( usbconn_t *conn ) if ((status = FT_Open( 0, &(p->fc) )) != FT_OK) { - perror( "Unable to open FTDI device.\n" ); + printf( "Unable to open FTDI device.\n" ); /* mark ftd2xx layer as not initialized */ p->fc = NULL; return -1; @@ -354,18 +354,18 @@ usbconn_ftd2xx_open( usbconn_t *conn ) fc = p->fc; if ((status = FT_ResetDevice( fc )) != FT_OK) - perror( _("Can't reset device.\n") ); + printf( _("Can't reset device.\n") ); if (status == FT_OK) if ((status = FT_Purge( fc, FT_PURGE_RX )) != FT_OK) - perror( _("Can't purge RX buffer.\n") ); + printf( _("Can't purge RX buffer.\n") ); if (status == FT_OK) if ((status = FT_SetBitMode( fc, 0x00, 0x00 )) != FT_OK) - perror( _("Can't disable bitmode.\n") ); + printf( _("Can't disable bitmode.\n") ); if (status == FT_OK) if ((status = FT_SetLatencyTimer(fc, 2)) != FT_OK) - perror( _("Can't set latency timer.\n") ); + printf( _("Can't set latency timer.\n") ); if (status == FT_OK) if ((status = FT_SetBaudRate(fc, 3E6)) != FT_OK) - perror( _("Can't set baudrate.\n") ); + printf( _("Can't set baudrate.\n") ); if (status != FT_OK) { @@ -396,28 +396,28 @@ usbconn_ftd2xx_mpsse_open( usbconn_t *conn ) Ref. FTCJTAGPG10.pdf Intermittent problems will occur when certain steps are skipped. */ if ((status = FT_ResetDevice( fc )) != FT_OK) - perror( _("Can't reset device.\n") ); + printf( _("Can't reset device.\n") ); if (status == FT_OK) if ((status = FT_Purge( fc, FT_PURGE_RX )) != FT_OK) - perror( _("Can't purge RX buffer.\n") ); + printf( _("Can't purge RX buffer.\n") ); if (status == FT_OK) if ((status = FT_SetChars( fc, 0, 0, 0, 0 )) != FT_OK) - perror( _("Can't set special characters.\n") ); + printf( _("Can't set special characters.\n") ); /* set a reasonable latency timer value if this value is too low then the chip will send intermediate result data in short packets (suboptimal performance) */ if (status == FT_OK) if ((status = FT_SetLatencyTimer( fc, 16 )) != FT_OK) - perror( _("Can't set target latency timer.\n") ); + printf( _("Can't set target latency timer.\n") ); if (status == FT_OK) if ((status = FT_SetBitMode( fc, 0x00, 0x00 )) != FT_OK) - perror( _("Can't disable bitmode.\n") ); + printf( _("Can't disable bitmode.\n") ); if (status == FT_OK) if ((status = FT_SetBitMode( fc, 0x0b, 0x02 /* BITMODE_MPSSE */ )) != FT_OK) - perror( _("Can't set MPSSE bitmode.\n") ); + printf( _("Can't set MPSSE bitmode.\n") ); if (status == FT_OK) if ((status = FT_ResetDevice( fc )) != FT_OK) - perror( _("Can't reset device.\n") ); + printf( _("Can't reset device.\n") ); if (status == FT_OK) if ((status = FT_Purge( fc, FT_PURGE_RX )) != FT_OK) - perror( _("Can't purge RX buffer.\n") ); + printf( _("Can't purge RX buffer.\n") ); /* set TCK Divisor */ if (status == FT_OK) @@ -438,9 +438,9 @@ usbconn_ftd2xx_mpsse_open( usbconn_t *conn ) status = FT_OTHER_ERROR; if (status == FT_OK) if ((status = FT_ResetDevice( fc )) != FT_OK) - perror( _("Can't reset device.\n") ); + printf( _("Can't reset device.\n") ); if (status == FT_OK) if ((status = FT_Purge( fc, FT_PURGE_RX )) != FT_OK) - perror( _("Can't purge RX buffer.\n") ); + printf( _("Can't purge RX buffer.\n") ); if (status != FT_OK) { diff --git a/jtag/src/tap/usbconn/libftdi.c b/jtag/src/tap/usbconn/libftdi.c index cc12a15a..b19ac729 100644 --- a/jtag/src/tap/usbconn/libftdi.c +++ b/jtag/src/tap/usbconn/libftdi.c @@ -78,11 +78,11 @@ usbconn_ftdi_flush( ftdi_param_t *p ) return 0; if ((xferred = ftdi_write_data( p->fc, p->send_buf, p->send_buffered )) < 0) - perror( ftdi_get_error_string( p->fc ) ); + puts( ftdi_get_error_string( p->fc ) ); if (xferred < p->send_buffered) { - perror( _("usbconn_ftdi_flush(): Written fewer bytes than requested.\n") ); + printf( _("usbconn_ftdi_flush(): Written fewer bytes than requested.\n") ); return -1; } @@ -101,7 +101,7 @@ usbconn_ftdi_flush( ftdi_param_t *p ) if (!p->recv_buf) { - perror( _("usbconn_ftdi_flush(): Receive buffer does not exist.\n") ); + printf( _("usbconn_ftdi_flush(): Receive buffer does not exist.\n") ); return -1; } @@ -216,7 +216,7 @@ usbconn_ftdi_write( usbconn_t *conn, uint8_t *buf, int len, int recv ) } else { - perror( _("usbconn_ftdi_write(): Send buffer does not exist.\n") ); + printf( _("usbconn_ftdi_write(): Send buffer does not exist.\n") ); return -1; } } @@ -296,7 +296,7 @@ usbconn_ftdi_common_open( usbconn_t *conn ) if (ftdi_usb_open_desc( fc, p->vid, p->pid, NULL, p->serial ) < 0) { - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); ftdi_deinit( fc ); /* mark ftdi layer as not initialized */ p->fc = NULL; @@ -320,9 +320,9 @@ seq_purge( struct ftdi_context *fc, int purge_rx, int purge_tx ) #ifndef LIBFTDI_UNIMPLEMENTED if ((r = ftdi_usb_purge_buffers( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) if ((r = ftdi_read_data( fc, &buf, 1 )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); #else /* not yet available */ { int rx_loop; @@ -330,13 +330,13 @@ seq_purge( struct ftdi_context *fc, int purge_rx, int purge_tx ) if (purge_rx) for (rx_loop = 0; (rx_loop < 6) && (r >= 0); rx_loop++) if ((r = ftdi_usb_purge_rx_buffer( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (purge_tx) if (r >= 0) if ((r = ftdi_usb_purge_tx_buffer( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) if ((r = ftdi_read_data( fc, &buf, 1 )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); } #endif @@ -352,11 +352,11 @@ seq_reset( struct ftdi_context *fc ) { unsigned short status; if ((r = ftdi_poll_status( fc, &status )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); } #endif if ((r = ftdi_usb_reset( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) r = seq_purge( fc, 1, 1 ); return r < 0 ? -1 : 0; @@ -378,22 +378,22 @@ usbconn_ftdi_open( usbconn_t *conn ) if (r >= 0) r = seq_purge( fc, 1, 0 ); if (r >= 0) if ((r = ftdi_disable_bitbang( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) if ((r = ftdi_set_latency_timer( fc, 2 )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); #if 0 /* libftdi 0.6 doesn't allow high baudrates, so we send the control message outselves */ if (r >= 0) if (usb_control_msg( fc->usb_dev, 0x40, 3, 1, 0, NULL, 0, fc->usb_write_timeout ) != 0) { - perror( "Can't set max baud rate.\n" ); + printf( "Can't set max baud rate.\n" ); r = -1; } #else if (r >= 0) if ((r = ftdi_set_baudrate( fc, 3E6 )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); #endif if (r < 0) @@ -428,25 +428,25 @@ usbconn_ftdi_mpsse_open( usbconn_t *conn ) #ifdef LIBFTDI_UNIMPLEMENTED if (r >= 0) if ((r = ftdi_set_event_char( fc, 0, 0 )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) if ((r = ftdi_set_error_char( fc, 0, 0 )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); #endif /* set a reasonable latency timer value if this value is too low then the chip will send intermediate result data in short packets (suboptimal performance) */ if (r >= 0) if ((r = ftdi_set_latency_timer( fc, 16 )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) if ((r = ftdi_disable_bitbang( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) if ((r = ftdi_set_bitmode( fc, 0x0b, BITMODE_MPSSE )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) if ((r = ftdi_usb_reset( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) r = seq_purge( fc, 1, 0 ); /* set TCK Divisor */ @@ -464,7 +464,7 @@ usbconn_ftdi_mpsse_open( usbconn_t *conn ) if (r >= 0) r = usbconn_ftdi_read( conn, NULL, 0 ); if (r >= 0) if ((r = ftdi_usb_reset( fc )) < 0) - perror( ftdi_get_error_string( fc ) ); + puts( ftdi_get_error_string( fc ) ); if (r >= 0) r = seq_purge( fc, 1, 0 ); if (r < 0)