This fork re-enables FRDM boards and adds WebUSB CDC functionality

Fork of USBDevice_STM32F103 by Devan Lai

Committer:
Lars Knudsen
Date:
Tue Jul 11 21:02:39 2017 +0200
Revision:
72:1d8a6665d607
Parent:
67:39396cc073f2
Adding MS OS 2.0 support

Who changed what in which revision?

UserRevisionLine numberNew contents of line
devanlai 67:39396cc073f2 1 /*
devanlai 67:39396cc073f2 2 * Copyright 2016 Devan Lai
devanlai 67:39396cc073f2 3 *
devanlai 67:39396cc073f2 4 * Licensed under the Apache License, Version 2.0 (the "License");
devanlai 67:39396cc073f2 5 * you may not use this file except in compliance with the License.
devanlai 67:39396cc073f2 6 * You may obtain a copy of the License at
devanlai 67:39396cc073f2 7 *
devanlai 67:39396cc073f2 8 * http://www.apache.org/licenses/LICENSE-2.0
devanlai 67:39396cc073f2 9 *
devanlai 67:39396cc073f2 10 * Unless required by applicable law or agreed to in writing, software
devanlai 67:39396cc073f2 11 * distributed under the License is distributed on an "AS IS" BASIS,
devanlai 67:39396cc073f2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
devanlai 67:39396cc073f2 13 * See the License for the specific language governing permissions and
devanlai 67:39396cc073f2 14 * limitations under the License.
devanlai 67:39396cc073f2 15 */
devanlai 67:39396cc073f2 16
devanlai 67:39396cc073f2 17 #ifndef WEB_USB_H
devanlai 67:39396cc073f2 18 #define WEB_USB_H
devanlai 67:39396cc073f2 19
devanlai 67:39396cc073f2 20 /* USB 2.1 Standard descriptor types */
devanlai 67:39396cc073f2 21 #define BINARY_OBJECT_STORE_DESCRIPTOR (15)
devanlai 67:39396cc073f2 22 #define DEVICE_CAPABILITY_DESCRIPTOR (16)
devanlai 67:39396cc073f2 23
devanlai 67:39396cc073f2 24 /* WebUSB descriptor types */
devanlai 67:39396cc073f2 25 #define WEBUSB_DESCRIPTOR_SET_HEADER 0
devanlai 67:39396cc073f2 26 #define WEBUSB_CONFIGURATION_SUBSET_HEADER 1
devanlai 67:39396cc073f2 27 #define WEBUSB_FUNCTION_SUBSET_HEADER 2
devanlai 67:39396cc073f2 28 #define WEBUSB_URL 3
devanlai 67:39396cc073f2 29
devanlai 67:39396cc073f2 30 /* WebUSB URL schemes */
devanlai 67:39396cc073f2 31 #define WEBUSB_URL_SCHEME_HTTP 0
devanlai 67:39396cc073f2 32 #define WEBUSB_URL_SCHEME_HTTPS 1
devanlai 67:39396cc073f2 33
devanlai 67:39396cc073f2 34 /* WebUSB descriptor lengths */
devanlai 67:39396cc073f2 35 #define BINARY_OBJECT_STORE_DESCRIPTOR_LENGTH 0x05
devanlai 67:39396cc073f2 36 #define WEBUSB_PLATFORM_DESCRIPTOR_LENGTH 0x18
devanlai 67:39396cc073f2 37 #define WEBUSB_DESCRIPTOR_SET_LENGTH 5
devanlai 67:39396cc073f2 38 #define WEBUSB_CONFIGURATION_SUBSET_LENGTH 4
devanlai 67:39396cc073f2 39 #define WEBUSB_FUNCTION_SUBSET_LENGTH 3
devanlai 67:39396cc073f2 40
devanlai 67:39396cc073f2 41 /* WebUSB URL offsets */
devanlai 67:39396cc073f2 42 #define URL_OFFSET_ALLOWED_ORIGIN 1
devanlai 67:39396cc073f2 43 #define URL_OFFSET_LANDING_PAGE 2
devanlai 67:39396cc073f2 44
devanlai 67:39396cc073f2 45 /* USB Specification Release Number */
devanlai 67:39396cc073f2 46 #define USB_VERSION_2_1 (0x0210)
devanlai 67:39396cc073f2 47 #define WEBUSB_VERSION_1_0 (0x0100)
devanlai 67:39396cc073f2 48
devanlai 67:39396cc073f2 49 /* bDevCapabilityTypes in device capability descriptors*/
devanlai 67:39396cc073f2 50 #define USB_DC_WIRELESS_USB 1
devanlai 67:39396cc073f2 51 #define USB_DC_USB_2_0_EXTENSION 2
devanlai 67:39396cc073f2 52 #define USB_DC_SUPERSPEED_USB 3
devanlai 67:39396cc073f2 53 #define USB_DC_CONTAINER_ID 4
devanlai 67:39396cc073f2 54 #define USB_DC_PLATFORM 5
devanlai 67:39396cc073f2 55 #define USB_DC_POWER_DELIVERY_CAPABILITY 6
devanlai 67:39396cc073f2 56 #define USB_DC_BATTERY_INFO_CAPABILITY 7
devanlai 67:39396cc073f2 57 #define USB_DC_PD_CONSUMER_PORT_CAPABILITY 8
devanlai 67:39396cc073f2 58 #define USB_DC_PD_PROVIDER_PORT_CAPABILITY 9
devanlai 67:39396cc073f2 59 #define USB_DC_SUPERSPEED_PLUS 10
devanlai 67:39396cc073f2 60 #define USB_DC_PRECISION_TIME_MEASUREMENT 11
devanlai 67:39396cc073f2 61 #define USB_DC_WIRELESS_USB_EXT 12
devanlai 67:39396cc073f2 62
devanlai 67:39396cc073f2 63 /* WebUSB Vendor code */
devanlai 67:39396cc073f2 64 #define WEBUSB_VENDOR_CODE 0x57
devanlai 67:39396cc073f2 65
devanlai 67:39396cc073f2 66 /* WebUSB requests */
devanlai 67:39396cc073f2 67 #define WEBUSB_GET_ALLOWED_ORIGINS 0x01
devanlai 67:39396cc073f2 68 #define WEBUSB_GET_URL 0x02
devanlai 67:39396cc073f2 69
devanlai 67:39396cc073f2 70 #endif