aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/vusb/vusb.h
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/vusb/vusb.h')
-rw-r--r--tmk_core/protocol/vusb/vusb.h76
1 files changed, 72 insertions, 4 deletions
diff --git a/tmk_core/protocol/vusb/vusb.h b/tmk_core/protocol/vusb/vusb.h
index cee07207a..debac67d2 100644
--- a/tmk_core/protocol/vusb/vusb.h
+++ b/tmk_core/protocol/vusb/vusb.h
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef VUSB_H 18#pragma once
19#define VUSB_H
20 19
21#include "host_driver.h" 20#include "host_driver.h"
22 21
@@ -25,14 +24,83 @@ typedef struct usbDescriptorHeader {
25 uchar bDescriptorType; 24 uchar bDescriptorType;
26} __attribute__((packed)) usbDescriptorHeader_t; 25} __attribute__((packed)) usbDescriptorHeader_t;
27 26
27typedef struct usbDeviceDescriptor {
28 usbDescriptorHeader_t header;
29 unsigned bcdUSB;
30 uchar bDeviceClass;
31 uchar bDeviceSubClass;
32 uchar bDeviceProtocol;
33 uchar bMaxPacketSize0;
34 unsigned idVendor;
35 unsigned idProduct;
36 unsigned bcdDevice;
37 uchar iManufacturer;
38 uchar iProduct;
39 uchar iSerialNumber;
40 uchar bNumConfigurations;
41} __attribute__((packed)) usbDeviceDescriptor_t;
42
43typedef struct usbConfigurationDescriptorHeader {
44 usbDescriptorHeader_t header;
45 unsigned wTotalLength;
46 uchar bNumInterfaces;
47 uchar bConfigurationValue;
48 uchar iConfiguration;
49 uchar bmAttributes;
50 uchar bMaxPower;
51} __attribute__((packed)) usbConfigurationDescriptorHeader_t;
52
28typedef struct usbStringDescriptor { 53typedef struct usbStringDescriptor {
29 usbDescriptorHeader_t header; 54 usbDescriptorHeader_t header;
30 int bString[]; 55 int bString[];
31} __attribute__((packed)) usbStringDescriptor_t; 56} __attribute__((packed)) usbStringDescriptor_t;
32 57
58typedef struct usbInterfaceDescriptor {
59 usbDescriptorHeader_t header;
60 uchar bInterfaceNumber;
61 uchar bAlternateSetting;
62 uchar bNumEndpoints;
63 uchar bInterfaceClass;
64 uchar bInterfaceSubClass;
65 uchar bInterfaceProtocol;
66 uchar iInterface;
67} __attribute__((packed)) usbInterfaceDescriptor_t;
68
69typedef struct usbEndpointDescriptor {
70 usbDescriptorHeader_t header;
71 uchar bEndpointAddress;
72 uchar bmAttributes;
73 unsigned wMaxPacketSize;
74 uchar bInterval;
75} __attribute__((packed)) usbEndpointDescriptor_t;
76
77typedef struct usbHIDDescriptor {
78 usbDescriptorHeader_t header;
79 unsigned bcdHID;
80 uchar bCountryCode;
81 uchar bNumDescriptors;
82 uchar bDescriptorType;
83 unsigned wDescriptorLength;
84} __attribute__((packed)) usbHIDDescriptor_t;
85
86typedef struct usbConfigurationDescriptor {
87 usbConfigurationDescriptorHeader_t header;
88 usbInterfaceDescriptor_t keyboardInterface;
89 usbHIDDescriptor_t keyboardHID;
90#ifdef USB_CFG_HAVE_INTRIN_ENDPOINT
91 usbEndpointDescriptor_t keyboardINEndpoint;
92#endif
93
94#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
95 usbInterfaceDescriptor_t mouseExtraInterface;
96 usbHIDDescriptor_t mouseExtraHID;
97# ifdef USB_CFG_HAVE_INTRIN_ENDPOINT3
98 usbEndpointDescriptor_t mouseExtraINEndpoint;
99# endif
100#endif
101} __attribute__((packed)) usbConfigurationDescriptor_t;
102
33#define USB_STRING_LEN(s) (sizeof(usbDescriptorHeader_t) + ((s) << 1)) 103#define USB_STRING_LEN(s) (sizeof(usbDescriptorHeader_t) + ((s) << 1))
34 104
35host_driver_t *vusb_driver(void); 105host_driver_t *vusb_driver(void);
36void vusb_transfer_keyboard(void); 106void vusb_transfer_keyboard(void);
37
38#endif