unleashed-firmware/applications/external/dap_link/usb/usb_winusb.h
hedger 53435579b3
[FL-3097] fbt, faploader: minimal app module implementation (#2420)
* fbt, faploader: minimal app module implementation
* faploader, libs: moved API hashtable core to flipper_application
* example: compound api
* lib: flipper_application: naming fixes, doxygen comments
* fbt: changed `requires` manifest field behavior for app extensions
* examples: refactored plugin apps; faploader: changed new API naming; fbt: changed PLUGIN app type meaning
* loader: dropped support for debug apps & plugin menus
* moved applications/plugins -> applications/external
* Restored x bit on chiplist_convert.py
* git: fixed free-dap submodule path
* pvs: updated submodule paths
* examples: example_advanced_plugins.c: removed potential memory leak on errors
* examples: example_plugins: refined requires
* fbt: not deploying app modules for debug/sample apps; extra validation for .PLUGIN-type apps
* apps: removed cdefines for external apps
* fbt: moved ext app path definition
* fbt: reworked fap_dist handling; f18: synced api_symbols.csv
* fbt: removed resources_paths for extapps
* scripts: reworked storage
* scripts: reworked runfap.py & selfupdate.py to use new api
* wip: fal runner
* fbt: moved file packaging into separate module
* scripts: storage: fixes
* scripts: storage: minor fixes for new api
* fbt: changed internal artifact storage details for external apps
* scripts: storage: additional fixes and better error reporting; examples: using APP_DATA_PATH()
* fbt, scripts: reworked launch_app to deploy plugins; moved old runfap.py to distfap.py
* fbt: extra check for plugins descriptors
* fbt: additional checks in emitter
* fbt: better info message on SDK rebuild
* scripts: removed requirements.txt
* loader: removed remnants of plugins & debug menus
* post-review fixes
2023-03-14 23:29:28 +09:00

143 lines
No EOL
4.1 KiB
C

#pragma once
#include <stdint.h>
/*- Definitions -------------------------------------------------------------*/
#define USB_PACK __attribute__((packed))
#define USB_WINUSB_VENDOR_CODE 0x20
#define USB_WINUSB_WINDOWS_VERSION 0x06030000 // Windows 8.1
#define USB_WINUSB_PLATFORM_CAPABILITY_ID \
{ \
0xdf, 0x60, 0xdd, 0xd8, 0x89, 0x45, 0xc7, 0x4c, 0x9c, 0xd2, 0x65, 0x9d, 0x9e, 0x64, 0x8a, \
0x9f \
}
enum // WinUSB Microsoft OS 2.0 descriptor request codes
{
USB_WINUSB_DESCRIPTOR_INDEX = 0x07,
USB_WINUSB_SET_ALT_ENUMERATION = 0x08,
};
enum // wDescriptorType
{
USB_WINUSB_SET_HEADER_DESCRIPTOR = 0x00,
USB_WINUSB_SUBSET_HEADER_CONFIGURATION = 0x01,
USB_WINUSB_SUBSET_HEADER_FUNCTION = 0x02,
USB_WINUSB_FEATURE_COMPATBLE_ID = 0x03,
USB_WINUSB_FEATURE_REG_PROPERTY = 0x04,
USB_WINUSB_FEATURE_MIN_RESUME_TIME = 0x05,
USB_WINUSB_FEATURE_MODEL_ID = 0x06,
USB_WINUSB_FEATURE_CCGP_DEVICE = 0x07,
USB_WINUSB_FEATURE_VENDOR_REVISION = 0x08,
};
enum // wPropertyDataType
{
USB_WINUSB_PROPERTY_DATA_TYPE_SZ = 1,
USB_WINUSB_PROPERTY_DATA_TYPE_EXPAND_SZ = 2,
USB_WINUSB_PROPERTY_DATA_TYPE_BINARY = 3,
USB_WINUSB_PROPERTY_DATA_TYPE_DWORD_LITTLE_ENDIAN = 4,
USB_WINUSB_PROPERTY_DATA_TYPE_DWORD_BIG_ENDIAN = 5,
USB_WINUSB_PROPERTY_DATA_TYPE_LINK = 6,
USB_WINUSB_PROPERTY_DATA_TYPE_MULTI_SZ = 7,
};
/*- Types BOS -------------------------------------------------------------------*/
typedef struct USB_PACK {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wTotalLength;
uint8_t bNumDeviceCaps;
} usb_binary_object_store_descriptor_t;
/*- Types WinUSB -------------------------------------------------------------------*/
typedef struct USB_PACK {
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t bDevCapabilityType;
uint8_t bReserved;
uint8_t PlatformCapabilityUUID[16];
uint32_t dwWindowsVersion;
uint16_t wMSOSDescriptorSetTotalLength;
uint8_t bMS_VendorCode;
uint8_t bAltEnumCode;
} usb_winusb_capability_descriptor_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint32_t dwWindowsVersion;
uint16_t wDescriptorSetTotalLength;
} usb_winusb_set_header_descriptor_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint8_t bConfigurationValue;
uint8_t bReserved;
uint16_t wTotalLength;
} usb_winusb_subset_header_configuration_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint8_t bFirstInterface;
uint8_t bReserved;
uint16_t wSubsetLength;
} usb_winusb_subset_header_function_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint8_t CompatibleID[8];
uint8_t SubCompatibleID[8];
} usb_winusb_feature_compatble_id_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint16_t wPropertyDataType;
//uint16_t wPropertyNameLength;
//uint8_t PropertyName[...];
//uint16_t wPropertyDataLength
//uint8_t PropertyData[...];
} usb_winusb_feature_reg_property_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint16_t wPropertyDataType;
uint16_t wPropertyNameLength;
uint8_t PropertyName[42];
uint16_t wPropertyDataLength;
uint8_t PropertyData[80];
} usb_winusb_feature_reg_property_guids_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint8_t bResumeRecoveryTime;
uint8_t bResumeSignalingTime;
} usb_winusb_feature_min_resume_time_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint8_t ModelID[16];
} usb_winusb_feature_model_id_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
} usb_winusb_feature_ccgp_device_t;
typedef struct USB_PACK {
uint16_t wLength;
uint16_t wDescriptorType;
uint16_t VendorRevision;
} usb_winusb_feature_vendor_revision_t;