- Timestamp:
- Apr 30, 2016, 11:29:25 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rtos_arduino/trunk/arduino_lib/hardware/arduino/samd/cores/arduino/USB/USBCore.h
r136 r224 1 // Copyright (c) 2010, Peter Barrett2 1 /* 3 ** Permission to use, copy, modify, and/or distribute this software for 4 ** any purpose with or without fee is hereby granted, provided that the 5 ** above copyright notice and this permission notice appear in all copies. 6 ** 7 ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 8 ** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 9 ** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 10 ** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES 11 ** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 12 ** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 13 ** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 14 ** SOFTWARE. 2 Copyright (c) 2014 Arduino LLC. All right reserved. 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 See the GNU Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with this library; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 15 17 */ 18 /* 19 **Modified 04/04/2016 by Arduino.org development team 20 */ 21 16 22 17 23 #ifndef __USBCORE_H__ … … 30 36 #define SET_INTERFACE 11 31 37 38 // bEndpointAddress in Endpoint Descriptor 39 #define USB_ENDPOINT_DIRECTION_MASK 0x80 40 #define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) 41 #define USB_ENDPOINT_IN(addr) ((addr) | 0x80) 42 43 #define USB_ENDPOINTS 7 44 45 #define USB_ENDPOINT_TYPE_MASK 0x03 46 #define USB_ENDPOINT_TYPE_CONTROL 0x00 47 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 48 #define USB_ENDPOINT_TYPE_BULK 0x02 49 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03 32 50 33 51 // bmRequestType … … 47 65 #define REQUEST_RECIPIENT 0x1F 48 66 49 #define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_CLASS + REQUEST_INTERFACE) 50 #define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE + REQUEST_CLASS + REQUEST_INTERFACE) 67 #define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST | REQUEST_CLASS | REQUEST_INTERFACE) 68 #define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE | REQUEST_CLASS | REQUEST_INTERFACE) 69 #define REQUEST_DEVICETOHOST_STANDARD_INTERFACE (REQUEST_DEVICETOHOST | REQUEST_STANDARD | REQUEST_INTERFACE) 51 70 52 71 // Class requests … … 55 74 #define CDC_GET_LINE_CODING 0x21 56 75 #define CDC_SET_CONTROL_LINE_STATE 0x22 76 #define CDC_SEND_BREAK 0x23 57 77 58 78 #define MSC_RESET 0xFF … … 108 128 #define MSC_SUBCLASS_SCSI 0x06 109 129 #define MSC_PROTOCOL_BULK_ONLY 0x50 110 111 #define HID_HID_DESCRIPTOR_TYPE 0x21112 #define HID_REPORT_DESCRIPTOR_TYPE 0x22113 #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23114 115 #define TX_RX_LED_PULSE_MS 100 //----- Tx & Rx led blinking during transmission (declaration)116 130 117 131 _Pragma("pack(1)") … … 225 239 typedef struct 226 240 { 227 #if (defined CDC_ENABLED) && defined(HID_ENABLED)228 241 // IAD 229 242 IADDescriptor iad; // Only needed on compound device 230 #endif231 243 // Control 232 244 InterfaceDescriptor cif; … … 249 261 EndpointDescriptor out; 250 262 } MSCDescriptor; 263 251 264 252 265 typedef struct … … 273 286 274 287 #define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \ 275 { 18, 1, 0x 110, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }288 { 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } 276 289 /* Table 9-8. Standard Device Descriptor 277 290 * bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0, … … 279 292 280 293 #define D_CONFIG(_totalLength,_interfaces) \ 281 { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_ SELF_POWERED, USB_CONFIG_POWER_MA(500) }294 { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED, USB_CONFIG_POWER_MA(500) } 282 295 /* Table 9-10. Standard Configuration Descriptor 283 296 * bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration 284 297 * bmAttributes, bMaxPower */ 285 298 286 299 #define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \ 287 300 { 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 } … … 289 302 * bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass, 290 303 * bInterfaceSubClass, bInterfaceProtocol, iInterface */ 291 304 292 305 #define D_ENDPOINT(_addr,_attr,_packetSize, _interval) \ 293 306 { 7, 5, _addr,_attr,_packetSize, _interval } … … 297 310 #define D_IAD(_firstInterface, _count, _class, _subClass, _protocol) \ 298 311 { 8, 11, _firstInterface, _count, _class, _subClass, _protocol, 0 } 299 /* iadclasscode_r10.pdf, Table 9 Z. Standard Interface Association Descriptor312 /* iadclasscode_r10.pdf, Table 9\96Z. Standard Interface Association Descriptor 300 313 * bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass, bFunctionProtocol, iFunction */ 301 314 #define D_HIDREPORT(_descriptorLength) \ … … 303 316 /* HID1_11.pdf E.8 HID Descriptor (Mouse) 304 317 * bLength, bDescriptorType, bcdHID, bCountryCode, bNumDescriptors, bDescriptorType, wItemLength */ 305 318 306 319 // Functional Descriptor General Format 307 320 #define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 }
Note:
See TracChangeset
for help on using the changeset viewer.