USB device stack
Dependents: blinky_max32630fthr FTHR_USB_serial FTHR_OLED HSP_RPC_GUI_3_0_1 ... more
Fork of USBDevice by
USBDevice_Types.h
00001 /* Copyright (c) 2010-2011 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #ifndef USBDEVICE_TYPES_H 00020 #define USBDEVICE_TYPES_H 00021 00022 #include <stdint.h> 00023 00024 /* Standard requests */ 00025 #define GET_STATUS (0) 00026 #define CLEAR_FEATURE (1) 00027 #define SET_FEATURE (3) 00028 #define SET_ADDRESS (5) 00029 #define GET_DESCRIPTOR (6) 00030 #define SET_DESCRIPTOR (7) 00031 #define GET_CONFIGURATION (8) 00032 #define SET_CONFIGURATION (9) 00033 #define GET_INTERFACE (10) 00034 #define SET_INTERFACE (11) 00035 00036 /* bmRequestType.dataTransferDirection */ 00037 #define HOST_TO_DEVICE (0) 00038 #define DEVICE_TO_HOST (1) 00039 00040 /* bmRequestType.Type*/ 00041 #define STANDARD_TYPE (0) 00042 #define CLASS_TYPE (1) 00043 #define VENDOR_TYPE (2) 00044 #define RESERVED_TYPE (3) 00045 00046 /* bmRequestType.Recipient */ 00047 #define DEVICE_RECIPIENT (0) 00048 #define INTERFACE_RECIPIENT (1) 00049 #define ENDPOINT_RECIPIENT (2) 00050 #define OTHER_RECIPIENT (3) 00051 00052 /* Descriptors */ 00053 #define DESCRIPTOR_TYPE(wValue) (wValue >> 8) 00054 #define DESCRIPTOR_INDEX(wValue) (wValue & 0xff) 00055 00056 typedef struct { 00057 struct { 00058 uint8_t dataTransferDirection; 00059 uint8_t Type; 00060 uint8_t Recipient; 00061 } bmRequestType; 00062 uint8_t bRequest; 00063 uint16_t wValue; 00064 uint16_t wIndex; 00065 uint16_t wLength; 00066 } SETUP_PACKET; 00067 00068 typedef struct { 00069 SETUP_PACKET setup; 00070 uint8_t *ptr; 00071 uint32_t remaining; 00072 uint8_t direction; 00073 bool zlp; 00074 bool notify; 00075 } CONTROL_TRANSFER; 00076 00077 typedef enum {ATTACHED, POWERED, DEFAULT, ADDRESS, CONFIGURED} DEVICE_STATE; 00078 00079 typedef struct { 00080 volatile DEVICE_STATE state; 00081 uint8_t configuration; 00082 bool suspended; 00083 } USB_DEVICE; 00084 00085 #endif
Generated on Wed Jul 13 2022 12:44:03 by 1.7.2