]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/protocol/lufa/LUFA-git/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
Merge commit 'f6d56675f9f981c5464f0ca7a1fbb0162154e8c5'
[qmk_firmware.git] / tmk_core / protocol / lufa / LUFA-git / Demos / Device / ClassDriver / MassStorageKeyboard / Descriptors.h
1 /*
2              LUFA Library
3      Copyright (C) Dean Camera, 2014.
4
5   dean [at] fourwalledcubicle [dot] com
6            www.lufa-lib.org
7 */
8
9 /*
10   Copyright 2014  Dean Camera (dean [at] fourwalledcubicle [dot] com)
11   Copyright 2010  Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)
12
13   Permission to use, copy, modify, distribute, and sell this
14   software and its documentation for any purpose is hereby granted
15   without fee, provided that the above copyright notice appear in
16   all copies and that both that the copyright notice and this
17   permission notice and warranty disclaimer appear in supporting
18   documentation, and that the name of the author not be used in
19   advertising or publicity pertaining to distribution of the
20   software without specific, written prior permission.
21
22   The author disclaims all warranties with regard to this
23   software, including all implied warranties of merchantability
24   and fitness.  In no event shall the author be liable for any
25   special, indirect or consequential damages or any damages
26   whatsoever resulting from loss of use, data or profits, whether
27   in an action of contract, negligence or other tortious action,
28   arising out of or in connection with the use or performance of
29   this software.
30 */
31
32 /** \file
33  *
34  *  Header file for Descriptors.c.
35  */
36
37 #ifndef _DESCRIPTORS_H_
38 #define _DESCRIPTORS_H_
39
40         /* Includes: */
41                 #include <avr/pgmspace.h>
42
43                 #include <LUFA/Drivers/USB/USB.h>
44
45                 #include "Config/AppConfig.h"
46
47         /* Macros: */
48                 /** Endpoint address of the Keyboard HID reporting IN endpoint. */
49                 #define KEYBOARD_EPADDR              (ENDPOINT_DIR_IN  | 1)
50
51                 /** Size in bytes of the Keyboard HID reporting IN endpoint. */
52                 #define KEYBOARD_EPSIZE              8
53
54                 /** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
55                 #define MASS_STORAGE_IN_EPADDR       (ENDPOINT_DIR_IN  | 3)
56
57                 /** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
58                 #define MASS_STORAGE_OUT_EPADDR      (ENDPOINT_DIR_OUT | 4)
59
60                 /** Size in bytes of the Mass Storage data endpoints. */
61                 #define MASS_STORAGE_IO_EPSIZE       64
62
63         /* Type Defines: */
64                 /** Type define for the device configuration descriptor structure. This must be defined in the
65                  *  application code, as the configuration descriptor contains several sub-descriptors which
66                  *  vary between devices, and which describe the device's usage to the host.
67                  */
68                 typedef struct
69                 {
70                         USB_Descriptor_Configuration_Header_t Config;
71
72                         // Mass Storage Interface
73                         USB_Descriptor_Interface_t            MS_Interface;
74                         USB_Descriptor_Endpoint_t             MS_DataInEndpoint;
75                         USB_Descriptor_Endpoint_t             MS_DataOutEndpoint;
76
77                         // Generic HID Interface
78                         USB_Descriptor_Interface_t            HID_KeyboardInterface;
79                         USB_HID_Descriptor_HID_t              HID_KeyboardHID;
80                 USB_Descriptor_Endpoint_t             HID_ReportINEndpoint;
81                 } USB_Descriptor_Configuration_t;
82
83                 /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
84                  *  should have a unique ID index associated with it, which can be used to refer to the
85                  *  interface from other descriptors.
86                  */
87                 enum InterfaceDescriptors_t
88                 {
89                         INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */
90                         INTERFACE_ID_Keyboard    = 1, /**< Keyboard interface descriptor ID */
91                 };
92
93                 /** Enum for the device string descriptor IDs within the device. Each string descriptor should
94                  *  have a unique ID index associated with it, which can be used to refer to the string from
95                  *  other descriptors.
96                  */
97                 enum StringDescriptors_t
98                 {
99                         STRING_ID_Language     = 0, /**< Supported Languages string descriptor ID (must be zero) */
100                         STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
101                         STRING_ID_Product      = 2, /**< Product string ID */
102                 };
103
104         /* Function Prototypes: */
105                 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
106                                                     const uint8_t wIndex,
107                                                     const void** const DescriptorAddress)
108                                                     ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
109
110 #endif
111