* configure.ac: reactivate check for TYPE_232H, which does not exist in libftdi < 0.20

* avrftdi*.*: changed include check for libftdi/libusb, deactivate 232H if not available
* ft245r.c: changed include check for libftdi/libusb

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1180 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Rene Liebscher
2013-05-16 17:11:35 +00:00
parent d0625e8fec
commit 22477da39e
6 changed files with 106 additions and 125 deletions

102
ft245r.c
View File

@@ -69,7 +69,60 @@
#include "bitbang.h"
#include "ft245r.h"
#ifdef HAVE_PTHREAD_H
#if defined(_WIN32)
#include <windows.h>
#endif
#if defined(HAVE_LIBFTDI1) && defined(HAVE_LIBUSB_1_0)
# if defined(HAVE_LIBUSB_1_0_LIBUSB_H)
# include <libusb-1.0/libusb.h>
# else
# include <libusb.h>
# endif
# include <libftdi1/ftdi.h>
#elif defined(HAVE_LIBFTDI) && defined(HAVE_USB_H)
/* ftdi.h includes usb.h */
#include <ftdi.h>
#else
#warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
#define DO_NOT_BUILD_FT245R
#endif
#ifndef HAVE_PTHREAD_H
static int ft245r_nopthread_open (struct programmer_t *pgm, char * name) {
fprintf(stderr,
"%s: error: no pthread support. Please compile again with pthread installed."
#if defined(_WIN32)
" See http://sourceware.org/pthreads-win32/."
#endif
"\n",
progname);
return -1;
}
void ft245r_initpgm(PROGRAMMER * pgm) {
strcpy(pgm->type, "ftdi_syncbb");
pgm->open = ft245r_nopthread_open;
}
#elif defined(DO_NOT_BUILD_FT245R)
static int ft245r_noftdi_open (struct programmer_t *pgm, char * name) {
fprintf(stderr,
"%s: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
progname);
return -1;
}
void ft245r_initpgm(PROGRAMMER * pgm) {
strcpy(pgm->type, "ftdi_syncbb");
pgm->open = ft245r_noftdi_open;
}
#else
#include <pthread.h>
@@ -86,19 +139,6 @@ typedef dispatch_semaphore_t sem_t;
#include <semaphore.h>
#endif
#if defined(HAVE_LIBFTDI1) || defined(HAVE_LIBFTDI)
#if defined(_WIN32)
#include <windows.h>
#endif
#ifdef HAVE_LIBFTDI1
#include <libftdi1/ftdi.h>
#elif HAVE_LIBFTDI
#include <ftdi.h>
#endif
#define FT245R_CYCLES 2
#define FT245R_FRAGMENT_SIZE 512
#define REQ_OUTSTANDINGS 10
@@ -589,6 +629,7 @@ cleanup:
cleanup_no_usb:
ftdi_deinit (handle);
free(handle);
handle = NULL;
return -1;
}
@@ -899,39 +940,6 @@ void ft245r_initpgm(PROGRAMMER * pgm) {
handle = NULL;
}
#else
static int ft245r_noftdi_open (struct programmer_t *pgm, char * name) {
fprintf(stderr,
"%s: error: no ftdi support. Please compile again with libftdi installed.\n",
progname);
exit(1);
}
void ft245r_initpgm(PROGRAMMER * pgm) {
strcpy(pgm->type, "ftdi_syncbb");
pgm->open = ft245r_noftdi_open;
}
#endif
#else
static int ft245r_nopthread_open (struct programmer_t *pgm, char * name) {
fprintf(stderr,
"%s: error: no pthread support. Please compile again with pthread installed."
#if defined(_WIN32)
" See http://sourceware.org/pthreads-win32/."
#endif
"\n",
progname);
exit(1);
}
void ft245r_initpgm(PROGRAMMER * pgm) {
strcpy(pgm->type, "ftdi_syncbb");
pgm->open = ft245r_nopthread_open;
}
#endif
const char ft245r_desc[] = "FT245R/FT232R Synchronous BitBangMode Programmer";