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

Fork of USBDevice_STM32F103 by Devan Lai

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WebUSB.h Source File

WebUSB.h

00001 /*
00002 * Copyright 2016 Devan Lai
00003 *
00004 * Licensed under the Apache License, Version 2.0 (the "License");
00005 * you may not use this file except in compliance with the License.
00006 * You may obtain a copy of the License at
00007 *
00008 *    http://www.apache.org/licenses/LICENSE-2.0
00009 *
00010 * Unless required by applicable law or agreed to in writing, software
00011 * distributed under the License is distributed on an "AS IS" BASIS,
00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 * See the License for the specific language governing permissions and
00014 * limitations under the License.
00015 */
00016 
00017 #ifndef WEB_USB_H
00018 #define WEB_USB_H
00019 
00020 /* USB 2.1 Standard descriptor types */
00021 #define BINARY_OBJECT_STORE_DESCRIPTOR (15)
00022 #define DEVICE_CAPABILITY_DESCRIPTOR (16)
00023 
00024 /* WebUSB descriptor types */
00025 #define WEBUSB_DESCRIPTOR_SET_HEADER       0
00026 #define WEBUSB_CONFIGURATION_SUBSET_HEADER 1
00027 #define WEBUSB_FUNCTION_SUBSET_HEADER      2
00028 #define WEBUSB_URL                         3
00029 
00030 /* WebUSB URL schemes */
00031 #define WEBUSB_URL_SCHEME_HTTP 0
00032 #define WEBUSB_URL_SCHEME_HTTPS 1
00033 
00034 /* WebUSB descriptor lengths */
00035 #define BINARY_OBJECT_STORE_DESCRIPTOR_LENGTH 0x05
00036 #define WEBUSB_PLATFORM_DESCRIPTOR_LENGTH  0x18
00037 #define WEBUSB_DESCRIPTOR_SET_LENGTH       5
00038 #define WEBUSB_CONFIGURATION_SUBSET_LENGTH 4
00039 #define WEBUSB_FUNCTION_SUBSET_LENGTH      3
00040 
00041 /* WebUSB URL offsets */
00042 #define URL_OFFSET_ALLOWED_ORIGIN          1
00043 #define URL_OFFSET_LANDING_PAGE            2
00044 
00045 /* USB Specification Release Number */
00046 #define USB_VERSION_2_1 (0x0210)
00047 #define WEBUSB_VERSION_1_0 (0x0100)
00048 
00049 /* bDevCapabilityTypes in device capability descriptors*/
00050 #define USB_DC_WIRELESS_USB                1
00051 #define USB_DC_USB_2_0_EXTENSION           2
00052 #define USB_DC_SUPERSPEED_USB              3
00053 #define USB_DC_CONTAINER_ID                4
00054 #define USB_DC_PLATFORM                    5
00055 #define USB_DC_POWER_DELIVERY_CAPABILITY   6
00056 #define USB_DC_BATTERY_INFO_CAPABILITY     7
00057 #define USB_DC_PD_CONSUMER_PORT_CAPABILITY 8
00058 #define USB_DC_PD_PROVIDER_PORT_CAPABILITY 9
00059 #define USB_DC_SUPERSPEED_PLUS             10
00060 #define USB_DC_PRECISION_TIME_MEASUREMENT  11
00061 #define USB_DC_WIRELESS_USB_EXT            12
00062 
00063 /* WebUSB Vendor code */
00064 #define WEBUSB_VENDOR_CODE                 0x57
00065 
00066 /* WebUSB requests */
00067 #define WEBUSB_GET_ALLOWED_ORIGINS         0x01
00068 #define WEBUSB_GET_URL                     0x02
00069 
00070 #endif