Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
cascoda_usb.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Cascoda Ltd.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
33 #ifndef CASCODA_USB_H
34 #define CASCODA_USB_H
35 
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /******************************************************************************/
43 /****** USB Descriptor Types ******/
44 /******************************************************************************/
45 #define USB_DT_DEVICE (1)
46 #define USB_DT_CONFIGURATION (2)
47 #define USB_DT_STRING (3)
48 #define USB_DT_INTERFACE (4)
49 #define USB_DT_ENDPOINT (5)
50 
51 #define USB_DT_BOS (15)
52 #define USB_DT_DEVICE_CAPABILITY (16)
53 
54 #define USB_DT_HID (33)
55 #define USB_DT_HID_RPT (34)
56 
57 /******************************************************************************/
58 /****** USB Device Capability Types ******/
59 /******************************************************************************/
60 #define USB_DCT_WIRELESS (1)
61 #define USB_DCT_2_0_EXTENSION (2)
62 
64 typedef struct UsbDeviceDescriptor
65 {
68  u8_t bcdUSB[2];
81 
88 typedef struct UsbBOSDescriptor
89 {
95 
98 {
103 
106 {
116 
119 {
130 
132 typedef struct UsbEndpointDescriptor
133 {
141 
143 typedef struct UsbStringDescriptor
144 {
148 
149 /******************************************************************************/
150 /****** String indexes ******/
151 /******************************************************************************/
152 #define USB_ILANGUAGE (0)
153 #define USB_IMANUFACTURER (1)
154 #define USB_IPRODUCT (2)
155 #define USB_ISERIAL (3)
156 #define USB_ILAST (3)
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif // CASCODA_USB_H
Type definitions used by Cascoda baremetal drivers.
unsigned char u8_t
Definition: cascoda_types.h:46
struct UsbInterfaceDescriptor UsbInterfaceDescriptor_t
Interface descriptor.
struct UsbDeviceCapabilityDescriptor UsbDeviceCapabilityDescriptor_t
Device Capability descriptor.
struct UsbStringDescriptor UsbStringDescriptor_t
String descriptor.
struct UsbEndpointDescriptor UsbEndpointDescriptor_t
Endpoint descriptor.
struct UsbConfigurationDescriptor UsbConfigurationDescriptor_t
Configuration descriptor.
struct UsbDeviceDescriptor UsbDeviceDescriptor_t
Device descriptor.
struct UsbBOSDescriptor UsbBOSDescriptor_t
BOS descriptor.
BOS descriptor.
Definition: cascoda_usb.h:89
u8_t bDescriptorType
USB_DT_BOS.
Definition: cascoda_usb.h:91
u8_t bNumDeviceCaps
No of capability descs following.
Definition: cascoda_usb.h:93
u8_t bLength
Length in bytes ( of this )
Definition: cascoda_usb.h:90
u8_t wTotalLength[2]
Length of this plus concatenated descs.
Definition: cascoda_usb.h:92
Configuration descriptor.
Definition: cascoda_usb.h:106
u8_t iConfiguration
index of string desc for this config
Definition: cascoda_usb.h:112
u8_t bDescriptorType
USB_DT_CONFIGURATION.
Definition: cascoda_usb.h:108
u8_t bLength
Length in bytes ( of this )
Definition: cascoda_usb.h:107
u8_t wTotalLength[2]
Total length of concatenated descriptors.
Definition: cascoda_usb.h:109
u8_t bNumInterfaces
Number of interfaces this config.
Definition: cascoda_usb.h:110
u8_t bConfigurationValue
Value to select this config.
Definition: cascoda_usb.h:111
u8_t bMaxPower
in 2ma units
Definition: cascoda_usb.h:114
u8_t bmAttributes
attribute bitmap
Definition: cascoda_usb.h:113
Device Capability descriptor.
Definition: cascoda_usb.h:98
u8_t bLength
Length in bytes ( of this )
Definition: cascoda_usb.h:99
u8_t bDescriptorType
USB_DT_CAPABILITY.
Definition: cascoda_usb.h:100
u8_t bDevCapabilityType
See values above.
Definition: cascoda_usb.h:101
Device descriptor.
Definition: cascoda_usb.h:65
u8_t bDeviceClass
Class code (from USB-IF)
Definition: cascoda_usb.h:69
u8_t bMaxPacketSize0
Max size for EP0 as exponent of 2.
Definition: cascoda_usb.h:72
u8_t bLength
Length in bytes.
Definition: cascoda_usb.h:66
u8_t iManufacturer
Index of string desc for manufacturer.
Definition: cascoda_usb.h:76
u8_t iProduct
Index of string desc for product.
Definition: cascoda_usb.h:77
u8_t idProduct[2]
Product id.
Definition: cascoda_usb.h:74
u8_t bcdDevice[2]
Device release number in bcd.
Definition: cascoda_usb.h:75
u8_t bDescriptorType
USB_DT_DEVICE.
Definition: cascoda_usb.h:67
u8_t bDeviceSubClass
Subclass code (from USB-IF)
Definition: cascoda_usb.h:70
u8_t bNumConfigurations
Number of configurations.
Definition: cascoda_usb.h:79
u8_t idVendor[2]
Vendor id.
Definition: cascoda_usb.h:73
u8_t iSerialNumber
Index of string desc for serialnumber.
Definition: cascoda_usb.h:78
u8_t bcdUSB[2]
usb spec release number in bcd
Definition: cascoda_usb.h:68
u8_t bDeviceProtocol
Protocol code ( from USB-IF )
Definition: cascoda_usb.h:71
Endpoint descriptor.
Definition: cascoda_usb.h:133
u8_t wMaxPacketSize[2]
Endpoint max transfer Size.
Definition: cascoda_usb.h:138
u8_t bDescriptorType
USB_DT_ENDPOINT.
Definition: cascoda_usb.h:135
u8_t bEndpointAddress
Endpoint address.
Definition: cascoda_usb.h:136
u8_t bLength
Length in bytes ( of this )
Definition: cascoda_usb.h:134
u8_t bmAttributes
Transfer Type.
Definition: cascoda_usb.h:137
u8_t bInterval
Polling Interval.
Definition: cascoda_usb.h:139
Interface descriptor.
Definition: cascoda_usb.h:119
u8_t iInterface
String index.
Definition: cascoda_usb.h:128
u8_t bDescriptorType
USB_DT_INTERFACE.
Definition: cascoda_usb.h:121
u8_t bInterfaceNumber
Interface Number.
Definition: cascoda_usb.h:122
u8_t bAlternateSetting
Alternate setting for this interface.
Definition: cascoda_usb.h:123
u8_t bLength
Length in bytes ( of this )
Definition: cascoda_usb.h:120
u8_t bNumEndpoints
Number of endpoints in this interface excluding endpoint 0.
Definition: cascoda_usb.h:124
u8_t iInterfaceClass
Class Code: HID.
Definition: cascoda_usb.h:125
u8_t iInterfaceSubClass
SubClass Code.
Definition: cascoda_usb.h:126
u8_t bInterfaceProtocol
Protocol Code.
Definition: cascoda_usb.h:127
String descriptor.
Definition: cascoda_usb.h:144
u8_t * pu8String
String as ASCII.
Definition: cascoda_usb.h:145
u8_t * pu8UniCodeString
String as Unicode.
Definition: cascoda_usb.h:146