Ignore:
Timestamp:
2011-12-06T21:03:34Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2963a0d
Parents:
e8d82cb
Message:

libusbdev: Add macros constructing the bitfield instead of duplicated values.

Those values are in libusb usb.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/include/usb/dev/request.h

    re8d82cb rb6bade0  
    8484#define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7)
    8585#define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3)
    86 #define SETUP_REQUEST_TYPE_STANDART 0
    87 #define SETUP_REQUEST_TYPE_CLASS    1
    88 #define SETUP_REQUEST_TYPE_VENDOR   2
    89 #define SETUP_REQUEST_TYPE_GET_RECIPIENT(rt) (rt & 0x1f)
    90 #define SETUP_REQUEST_TYPE_REC_DEVICE    0
    91 #define SETUP_REQUEST_TYPE_REC_INTERFACE 1
    92 #define SETUP_REQUEST_TYPE_REC_ENDPOINT  2
    93 #define SETUP_REQUEST_TYPE_REC_OTHER     3
     86#define SETUP_REQUEST_TYPE_GET_RECIPIENT(rec) (rec & 0x1f)
     87#define SETUP_REQUEST_TO_HOST(type, recipient) \
     88    (uint8_t)((1 << 7) | ((type & 0x3) << 5) | (recipient & 0x1f))
     89#define SETUP_REQUEST_TO_DEVICE(type, recipient) \
     90    (uint8_t)(((type & 0x3) << 5) | (recipient & 0x1f))
    9491
    9592        /** Request identification. */
Note: See TracChangeset for help on using the changeset viewer.