3      Copyright (C) Dean Camera, 2011. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this 
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in 
  15   all 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. 
  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 
  32  *  \brief USB mode and feature support definitions. 
  33  *  \copydetails Group_USBMode 
  35  *  \note This file should not be included directly. It is automatically included as needed by the USB driver 
  36  *        dispatch header located in LUFA/Drivers/USB/USB.h. 
  39 /** \ingroup Group_USB 
  40  *  \defgroup Group_USBMode USB Mode Tokens 
  41  *  \brief USB mode and feature support definitions. 
  43  *  This file defines macros indicating the type of USB controller the library is being compiled for, and its 
  44  *  capabilities. These macros may then be referenced in the user application to selectively enable or disable 
  45  *  code sections depending on if they are defined or not. 
  47  *  After the inclusion of the master USB driver header, one or more of the following tokens may be defined, to 
  48  *  allow the user code to conditionally enable or disable code based on the USB controller family and allowable 
  49  *  USB modes. These tokens may be tested against to eliminate code relating to a USB mode which is not enabled for 
  50  *  the given compilation. 
  58         /* Preprocessor Checks: */ 
  59                 #if !defined(__INCLUDE_FROM_USB_DRIVER) 
  60                         #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. 
  63         /* Public Interface - May be used in end-application: */ 
  64         #if defined(__DOXYGEN__) 
  65                 /** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller 
  66                  *  (i.e. AT90USBxxx2 or ATMEGAxxU2) when defined. 
  68                 #define USB_SERIES_2_AVR 
  70                 /** Indicates that the target AVR microcontroller belongs to the Series 4 USB controller 
  71                  *  (i.e. ATMEGAxxU4) when defined. 
  73                 #define USB_SERIES_4_AVR 
  75                 /** Indicates that the target AVR microcontroller belongs to the Series 6 USB controller 
  76                  *  (i.e. AT90USBxxx6) when defined. 
  78                 #define USB_SERIES_6_AVR 
  80                 /** Indicates that the target AVR microcontroller belongs to the Series 7 USB controller 
  81                  *  (i.e. AT90USBxxx7) when defined. 
  83                 #define USB_SERIES_7_AVR 
  85                 /** Indicates that the target AVR microcontroller belongs to the UC3B Series USB controller 
  86                  *  (i.e. AT32UC3B*) when defined. 
  88                 #define USB_SERIES_UC3B_AVR 
  90                 /** Indicates that the target microcontroller and compilation settings allow for the 
  91                  *  target to be configured in USB Device mode when defined. 
  93                 #define USB_CAN_BE_DEVICE 
  95                 /** Indicates that the target microcontroller and compilation settings allow for the 
  96                  *  target to be configured in USB Host mode when defined. 
  98                 #define USB_CAN_BE_HOST 
 100                 /** Indicates that the target microcontroller and compilation settings allow for the 
 101                  *  target to be configured in either USB Device or Host mode when defined. 
 103                 #define USB_CAN_BE_BOTH 
 106                         #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__)  || \ 
 107                              defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)) 
 108                                 #define USB_SERIES_2_AVR 
 109                                 #define USB_CAN_BE_DEVICE 
 110                         #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)) 
 111                                 #define USB_SERIES_4_AVR 
 112                                 #define USB_CAN_BE_DEVICE 
 113                         #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) 
 114                                 #define USB_SERIES_6_AVR 
 115                                 #define USB_CAN_BE_DEVICE 
 116                         #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__)) 
 117                                 #define USB_SERIES_7_AVR 
 118                                 #define USB_CAN_BE_DEVICE 
 119                                 #define USB_CAN_BE_HOST 
 120                         #elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B1512__) || \ 
 121                                defined(__AVR32_UC3B0256__) || defined(__AVR32_UC3B1256__) || \ 
 122                                defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B1128__) || \ 
 123                                defined(__AVR32_UC3B064__) || defined(__AVR32_UC3B164__)) 
 124                                 #define USB_SERIES_UC3B_AVR 
 125                                 #define USB_CAN_BE_DEVICE 
 126                                 #define USB_CAN_BE_HOST 
 129                         #if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST)) 
 130                                 #define USB_CAN_BE_BOTH 
 133                         #if defined(USB_HOST_ONLY) 
 134                                 #if !defined(USB_CAN_BE_HOST) 
 135                                         #error USB_HOST_ONLY is not available for the currently selected microcontroller model. 
 137                                         #undef USB_CAN_BE_DEVICE 
 138                                         #undef USB_CAN_BE_BOTH 
 142                         #if defined(USB_DEVICE_ONLY) 
 143                                 #if !defined(USB_CAN_BE_DEVICE) 
 144                                         #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model. 
 146                                         #undef USB_CAN_BE_HOST 
 147                                         #undef USB_CAN_BE_BOTH 
 151                         #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY)) 
 152                                 #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive. 
 155                         #if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST)) 
 156                                 #error The currently selected architecture is not supported under the USB component of the library.