Added new USE_INTERNAL_SERIAL define for using the unique serial numbers in some...
[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 #include <stdlib.h>
40 #include <ctype.h>
41
42 #include "../HighLevel/StdDescriptors.h"
43 #include "../HighLevel/Events.h"
44 #include "../HighLevel/StdRequestType.h"
45 #include "../HighLevel/USBTask.h"
46 #include "LowLevel.h"
47
48 /* Enable C linkage for C++ Compilers: */
49 #if defined(__cplusplus)
50 extern "C" {
51 #endif
52
53 /* Public Interface - May be used in end-application: */
54 /* Global Variables: */
55 /** Indicates the currently set configuration number of the device. USB devices may have several
56 * different configurations which the host can select between; this indicates the currently selected
57 * value, or 0 if no configuration has been selected.
58 *
59 * If a device has only one single configuration, the token USE_SINGLE_DEVICE_CONFIGURATION may be
60 * defined in the project makefile and passed to the compiler using the -D switch. This optimize for
61 * a single configuration, saving a small amount of space in the resulting compiled binary.
62 *
63 * \note This variable should be treated as read-only in the user application, and never manually
64 * changed in value.
65 *
66 * \ingroup Group_Device
67 */
68 extern uint8_t USB_ConfigurationNumber;
69
70 /** Indicates if the host is currently allowing the device to issue remote wakeup events. If this
71 * flag is cleared, the device should not issue remote wakeup events to the host.
72 *
73 * \note This variable should be treated as read-only in the user application, and never manually
74 * changed in value.
75 *
76 * \ingroup Group_Device
77 */
78 extern bool USB_RemoteWakeupEnabled;
79
80 /** Indicates if the device is currently being powered by its own power supply, rather than being
81 * powered by the host's USB supply. This flag should remain cleared if the device does not
82 * support self powered mode, as indicated in the device descriptors.
83 *
84 * \ingroup Group_Device
85 */
86 extern bool USB_CurrentlySelfPowered;
87
88 /* Private Interface - For use in library only: */
89 #if !defined(__DOXYGEN__)
90 #if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
91 #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
92 #endif
93
94 /* Function Prototypes: */
95 void USB_Device_ProcessControlPacket(void);
96
97 #if defined(INCLUDE_FROM_DEVCHAPTER9_C)
98 static void USB_Device_SetAddress(void);
99 static void USB_Device_SetConfiguration(void);
100 static void USB_Device_GetConfiguration(void);
101 static void USB_Device_GetDescriptor(void);
102 static void USB_Device_GetStatus(void);
103 static void USB_Device_ClearSetFeature(void);
104 #endif
105 #endif
106
107 /* Disable C linkage for C++ Compilers: */
108 #if defined(__cplusplus)
109 }
110 #endif
111
112 #endif