diff options
author | Peter Stuge <peter@stuge.se> | 2012-03-22 01:52:59 +0100 |
---|---|---|
committer | Peter Stuge <peter@stuge.se> | 2012-03-22 01:57:25 +0100 |
commit | 76af4c99bd6122c1dd7b58858b669c919d8c8806 (patch) | |
tree | 75bb226962316771d249208b3104e0fbb583876e /libusb/libusbi.h | |
parent | e3d0a4cb9e2f9872c9fdbb22d7ded169e111fc8f (diff) | |
download | android_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.h | 5 |
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> |