* ft245r.c: added semaphore workaround for MacOS X, added pthread_testcancel in reader thread * configure.ac: added check for TYPE_232H in libftdi (not in libftdi < 0.20) * avrftdi.c: do not use TYPE_232H if not declared git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@1101 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
0cb3966136
commit
14ba5b7666
|
@ -1,3 +1,12 @@
|
|||
2012-08-15 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #30559 Ft232 bit-bang support, see comment #30
|
||||
* ft245r.c: added semaphore workaround for MacOS X,
|
||||
added pthread_testcancel in reader thread
|
||||
|
||||
* configure.ac: added check for TYPE_232H in libftdi (not in libftdi < 0.20)
|
||||
* avrftdi.c: do not use TYPE_232H if not declared
|
||||
|
||||
2012-08-13 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdi.c: fixes pin_limit for different FTDI devices (there was a mixup
|
||||
|
|
|
@ -774,7 +774,9 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
|
|||
pdata->pin_limit = 11;
|
||||
break;
|
||||
case TYPE_2232H:
|
||||
#ifdef HAVE_LIBFTDI_TYPE_232H
|
||||
case TYPE_232H:
|
||||
#endif
|
||||
pdata->pin_limit = 15;
|
||||
break;
|
||||
case TYPE_4232H:
|
||||
|
|
|
@ -147,10 +147,16 @@ fi
|
|||
AC_SUBST(LIBUSB_1_0, $LIBUSB_1_0)
|
||||
AH_TEMPLATE([HAVE_LIBFTDI],
|
||||
[Define if FTDI support is enabled via libftdi])
|
||||
AH_TEMPLATE([HAVE_LIBFTDI_TYPE_232H],
|
||||
[Define if libftdi supports FT232H, libftdi version >= 0.20])
|
||||
AC_CHECK_LIB([ftdi], [ftdi_usb_get_strings], [have_libftdi=yes], [], [-lusb])
|
||||
if test x$have_libftdi = xyes; then
|
||||
LIBFTDI="-lftdi -lusb"
|
||||
AC_DEFINE([HAVE_LIBFTDI])
|
||||
AC_CHECK_DECL(TYPE_232H,[have_libftdi_FT232H=yes], [], [[#include <ftdi.h>]])
|
||||
if test x$have_libftdi_FT232H = xyes; then
|
||||
AC_DEFINE([HAVE_LIBFTDI_TYPE_232H])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(LIBFTDI, $LIBFTDI)
|
||||
AC_CHECK_HEADERS([pthread.h])
|
||||
|
|
|
@ -73,7 +73,19 @@
|
|||
#ifdef HAVE_PTHREAD_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Mac OS X defines sem_init but actually does not implement them */
|
||||
#include <dispatch/dispatch.h>
|
||||
|
||||
typedef dispatch_semaphore_t sem_t;
|
||||
|
||||
#define sem_init(psem,x,val) *psem = dispatch_semaphore_create(val)
|
||||
#define sem_post(psem) dispatch_semaphore_signal(*psem)
|
||||
#define sem_wait(psem) dispatch_semaphore_wait(*psem, DISPATCH_TIME_FOREVER)
|
||||
#else
|
||||
#include <semaphore.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBFTDI
|
||||
|
||||
|
@ -130,6 +142,7 @@ static void *reader (void *arg) {
|
|||
int br, i;
|
||||
|
||||
while (1) {
|
||||
pthread_testcancel();
|
||||
br = ftdi_read_data (handle, buf, sizeof(buf));
|
||||
for (i=0; i<br; i++)
|
||||
add_to_buf (buf[i]);
|
||||
|
|
Loading…
Reference in New Issue