Changeset 971fbfde in mainline


Ignore:
Timestamp:
2012-12-22T21:52:10Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6326155b
Parents:
f8d43aa
Message:

usb: Move request format structure to its own header in libusb.

Location:
uspace/lib
Files:
1 added
1 edited

Legend:

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

    rf8d43aa r971fbfde  
    4141#include <usb/dev/pipes.h>
    4242#include <usb/descriptor.h>
     43#include <usb/request.h>
    4344
    4445/** USB device status - device is self powered (opposed to bus powered). */
     
    5758#define USB_FEATURE_SELECTOR_REMOTE_WAKEUP (1)
    5859
    59 /** Standard device request. */
    60 typedef enum {
    61         USB_DEVREQ_GET_STATUS = 0,
    62         USB_DEVREQ_CLEAR_FEATURE = 1,
    63         USB_DEVREQ_SET_FEATURE = 3,
    64         USB_DEVREQ_SET_ADDRESS = 5,
    65         USB_DEVREQ_GET_DESCRIPTOR = 6,
    66         USB_DEVREQ_SET_DESCRIPTOR = 7,
    67         USB_DEVREQ_GET_CONFIGURATION = 8,
    68         USB_DEVREQ_SET_CONFIGURATION = 9,
    69         USB_DEVREQ_GET_INTERFACE = 10,
    70         USB_DEVREQ_SET_INTERFACE = 11,
    71         USB_DEVREQ_SYNCH_FRAME = 12,
    72         USB_DEVREQ_LAST_STD
    73 } usb_stddevreq_t;
    74 
    75 /** Device request setup packet.
    76  * The setup packet describes the request.
    77  */
    78 typedef struct {
    79         /** Request type.
    80          * The type combines transfer direction, request type and
    81          * intended recipient.
    82          */
    83         uint8_t request_type;
    84 #define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7)
    85 #define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3)
    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))
    91 
    92         /** Request identification. */
    93         uint8_t request;
    94         /** Main parameter to the request. */
    95         union __attribute__ ((packed)) {
    96                 uint16_t value;
    97                 /* FIXME: add #ifdefs according to host endianness */
    98                 struct __attribute__ ((packed)) {
    99                         uint8_t value_low;
    100                         uint8_t value_high;
    101                 };
    102         };
    103         /** Auxiliary parameter to the request.
    104          * Typically, it is offset to something.
    105          */
    106         uint16_t index;
    107         /** Length of extra data. */
    108         uint16_t length;
    109 } __attribute__ ((packed)) usb_device_request_setup_packet_t;
    110 
    111 int assert[(sizeof(usb_device_request_setup_packet_t) == 8) ? 1: -1];
    11260
    11361int usb_control_request_set(usb_pipe_t *,
Note: See TracChangeset for help on using the changeset viewer.