aboutsummaryrefslogtreecommitdiffstats
path: root/libusb/libusbi.h
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2012-03-22 01:52:59 +0100
committerPeter Stuge <peter@stuge.se>2012-03-22 01:57:25 +0100
commit76af4c99bd6122c1dd7b58858b669c919d8c8806 (patch)
tree75bb226962316771d249208b3104e0fbb583876e /libusb/libusbi.h
parente3d0a4cb9e2f9872c9fdbb22d7ded169e111fc8f (diff)
downloadandroid_external_libusbx-76af4c99bd6122c1dd7b58858b669c919d8c8806.tar.gz
android_external_libusbx-76af4c99bd6122c1dd7b58858b669c919d8c8806.tar.bz2
android_external_libusbx-76af4c99bd6122c1dd7b58858b669c919d8c8806.zip
libusbi.h: Add IS_EPIN() IS_EPOUT() IS_XFERIN() and IS_XFEROUT() macros
The macros make backend code a little simpler to read, since the transfer and endpoint direction is checked in several places across the supported platforms.
Diffstat (limited to 'libusb/libusbi.h')
-rw-r--r--libusb/libusbi.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index 676b866..335df11 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -189,6 +189,11 @@ static inline void usbi_dbg(const char *format, ...)
#define ITRANSFER_CTX(transfer) \
(TRANSFER_CTX(USBI_TRANSFER_TO_LIBUSB_TRANSFER(transfer)))
+#define IS_EPIN(ep) (0 != ((ep) & LIBUSB_ENDPOINT_IN))
+#define IS_EPOUT(ep) (!IS_EPIN(ep))
+#define IS_XFERIN(xfer) (0 != ((xfer)->endpoint & LIBUSB_ENDPOINT_IN))
+#define IS_XFEROUT(xfer) (!IS_XFERIN(xfer))
+
/* Internal abstractions for thread synchronization and poll */
#if defined(THREADS_POSIX)
#include <os/threads_posix.h>