Changeset df6ded8 in mainline for uspace/lib/usb/include/usb/request.h
- Timestamp:
- 2018-02-28T16:37:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b20da0
- Parents:
- f5e5f73 (diff), b2dca8de (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
- git-committer:
- Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/request.h
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2012 Jan Vesely 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 71 72 #define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0)) 72 73 74 /** Size of the USB setup packet */ 75 #define USB_SETUP_PACKET_SIZE 8 76 73 77 /** Device request setup packet. 74 78 * The setup packet describes the request. … … 82 86 #define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7) 83 87 #define SETUP_REQUEST_TYPE_HOST_TO_DEVICE (0 << 7) 88 #define SETUP_REQUEST_TYPE_IS_DEVICE_TO_HOST(rt) ((rt) & (1 << 7)) 84 89 #define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3) 85 90 #define SETUP_REQUEST_TYPE_GET_RECIPIENT(rec) (rec & 0x1f) … … 108 113 } __attribute__ ((packed)) usb_device_request_setup_packet_t; 109 114 110 static_assert(sizeof(usb_device_request_setup_packet_t) == 8);115 static_assert(sizeof(usb_device_request_setup_packet_t) == USB_SETUP_PACKET_SIZE); 111 116 112 int usb_request_needs_toggle_reset( 113 const usb_device_request_setup_packet_t *request); 117 #define GET_DEVICE_DESC(size) \ 118 { \ 119 .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST \ 120 | (USB_REQUEST_TYPE_STANDARD << 5) \ 121 | USB_REQUEST_RECIPIENT_DEVICE, \ 122 .request = USB_DEVREQ_GET_DESCRIPTOR, \ 123 .value = uint16_host2usb(USB_DESCTYPE_DEVICE << 8), \ 124 .index = uint16_host2usb(0), \ 125 .length = uint16_host2usb(size), \ 126 }; 127 128 #define SET_ADDRESS(address) \ 129 { \ 130 .request_type = SETUP_REQUEST_TYPE_HOST_TO_DEVICE \ 131 | (USB_REQUEST_TYPE_STANDARD << 5) \ 132 | USB_REQUEST_RECIPIENT_DEVICE, \ 133 .request = USB_DEVREQ_SET_ADDRESS, \ 134 .value = uint16_host2usb(address), \ 135 .index = uint16_host2usb(0), \ 136 .length = uint16_host2usb(0), \ 137 }; 138 139 #define CTRL_PIPE_MIN_PACKET_SIZE 8 114 140 115 141 #endif
Note:
See TracChangeset
for help on using the changeset viewer.