Fix HID class device driver -- if a SetIDle request is issued with the LSB of wValue...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / DevChapter9.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 #ifndef __DEVCHAPTER9_H__
32 #define __DEVCHAPTER9_H__
33
34 /* Includes: */
35 #include <avr/io.h>
36 #include <avr/pgmspace.h>
37 #include <avr/eeprom.h>
38 #include <avr/boot.h>
39
40 #include "../HighLevel/StdDescriptors.h"
41 #include "../HighLevel/Events.h"
42 #include "../HighLevel/StdRequestType.h"
43 #include "../HighLevel/USBTask.h"
44 #include "LowLevel.h"
45
46 /* Enable C linkage for C++ Compilers: */
47 #if defined(__cplusplus)
48 extern "C" {
49 #endif
50
51 /* Public Interface - May be used in end-application: */
52 /* Global Variables: */
53 /** Indicates the currently set configuration number of the device. USB devices may have several
54 * different configurations which the host can select between; this indicates the currently selected
55 * value, or 0 if no configuration has been selected.
56 *
57 * If a device has only one single configuration, the token USE_SINGLE_DEVICE_CONFIGURATION may be
58 * defined in the project makefile and passed to the compiler using the -D switch. This optimize for
59 * a single configuration, saving a small amount of space in the resulting compiled binary.
60 *
61 * \note This variable should be treated as read-only in the user application, and never manually
62 * changed in value.
63 *
64 * \ingroup Group_Device
65 */
66 extern uint8_t USB_ConfigurationNumber;
67
68 /** Indicates if the host is currently allowing the device to issue remote wakeup events. If this
69 * flag is cleared, the device should not issue remote wakeup events to the host.
70 *
71 * \note This variable should be treated as read-only in the user application, and never manually
72 * changed in value.
73 *
74 * \ingroup Group_Device
75 */
76 extern bool USB_RemoteWakeupEnabled;
77
78 /** Indicates if the device is currently being powered by its own power supply, rather than being
79 * powered by the host's USB supply. This flag should remain cleared if the device does not
80 * support self powered mode, as indicated in the device descriptors.
81 *
82 * \ingroup Group_Device
83 */
84 extern bool USB_CurrentlySelfPowered;
85
86 /* Private Interface - For use in library only: */
87 #if !defined(__DOXYGEN__)
88 #if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
89 #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
90 #endif
91
92 /* Function Prototypes: */
93 void USB_Device_ProcessControlPacket(void);
94
95 #if defined(INCLUDE_FROM_DEVCHAPTER9_C)
96 static void USB_Device_SetAddress(void);
97 static void USB_Device_SetConfiguration(void);
98 static void USB_Device_GetConfiguration(void);
99 static void USB_Device_GetDescriptor(void);
100 static void USB_Device_GetStatus(void);
101 static void USB_Device_ClearSetFeature(void);
102
103 #if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
104 static void USB_Device_GetInternalSerialDescriptor(void);
105 #endif
106 #endif
107 #endif
108
109 /* Disable C linkage for C++ Compilers: */
110 #if defined(__cplusplus)
111 }
112 #endif
113
114 #endif