Added support for the new ATMEGA32U2, ATMEGA16U2 and ATMEGA8U2 AVR models.
[pub/USBasp.git] / LUFA / Drivers / USB / HighLevel / USBMode.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 __USBMODE_H__
32 #define __USBMODE_H__
33
34 /* Private Interface - For use in library only: */
35 #if !defined(__DOXYGEN__)
36 /* Macros: */
37 #if ((defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
38 defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
39 defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || \
40 defined(__AVR_ATmega32U6__)) && !defined(USB_DEVICE_ONLY))
41 #define USB_DEVICE_ONLY
42 #endif
43
44 #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
45 defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
46 #define USB_SERIES_2_AVR
47 #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
48 #define USB_SERIES_4_AVR
49 #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
50 #define USB_SERIES_6_AVR
51 #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
52 #define USB_SERIES_7_AVR
53 #endif
54
55 #if (!defined(USB_DEVICE_ONLY) && !defined(USB_HOST_ONLY))
56 #define USB_CAN_BE_BOTH
57 #define USB_CAN_BE_HOST
58 #define USB_CAN_BE_DEVICE
59 #elif defined(USB_HOST_ONLY)
60 #define USB_CAN_BE_HOST
61
62 #define USB_CurrentMode USB_MODE_HOST
63 #elif defined(USB_DEVICE_ONLY)
64 #define USB_CAN_BE_DEVICE
65
66 #define USB_CurrentMode USB_MODE_DEVICE
67 #endif
68
69 #if (!defined(USB_SERIES_7_AVR) && defined(USB_HOST_ONLY))
70 #error USB_HOST_ONLY is not available for the currently selected USB AVR model.
71 #endif
72
73 #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
74 #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
75 #endif
76
77 #if defined(USE_STATIC_OPTIONS)
78 #define USB_Options USE_STATIC_OPTIONS
79 #endif
80 #endif
81
82 #endif