3      Copyright (C) Dean Camera, 2009. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  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. 
  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 
  31 #ifndef __USBINTERRUPT_H__ 
  32 #define __USBINTERRUPT_H__ 
  38                 #include "../../../Common/Common.h" 
  39                 #include "../LowLevel/LowLevel.h" 
  43         /* Enable C linkage for C++ Compilers: */ 
  44                 #if defined(__cplusplus) 
  48         /* Private Interface - For use in library only: */ 
  49         #if !defined(__DOXYGEN__) 
  51                         #define USB_INT_Enable(int)              MACROS{ USB_INT_GET_EN_REG(int)   |=   USB_INT_GET_EN_MASK(int);   }MACROE 
  52                         #define USB_INT_Disable(int)             MACROS{ USB_INT_GET_EN_REG(int)   &= ~(USB_INT_GET_EN_MASK(int));  }MACROE 
  53                         #define USB_INT_Clear(int)               MACROS{ USB_INT_GET_INT_REG(int)  &= ~(USB_INT_GET_INT_MASK(int)); }MACROE 
  54                         #define USB_INT_IsEnabled(int)                 ((USB_INT_GET_EN_REG(int)   &    USB_INT_GET_EN_MASK(int)) ? true : false) 
  55                         #define USB_INT_HasOccurred(int)               ((USB_INT_GET_INT_REG(int)  &    USB_INT_GET_INT_MASK(int)) ? true : false) 
  57                         #define USB_INT_GET_EN_REG(a, b, c, d)           a 
  58                         #define USB_INT_GET_EN_MASK(a, b, c, d)          b 
  59                         #define USB_INT_GET_INT_REG(a, b, c, d)          c 
  60                         #define USB_INT_GET_INT_MASK(a, b, c, d)         d 
  62                         #define USB_INT_VBUS                             USBCON, (1 << VBUSTE) , USBINT, (1 << VBUSTI) 
  63                         #define USB_INT_IDTI                             USBCON, (1 << IDTE)   , USBINT, (1 << IDTI) 
  64                         #define USB_INT_WAKEUP                           UDIEN , (1 << WAKEUPE), UDINT , (1 << WAKEUPI) 
  65                         #define USB_INT_SUSPEND                          UDIEN , (1 << SUSPE)  , UDINT , (1 << SUSPI) 
  66                         #define USB_INT_EORSTI                           UDIEN , (1 << EORSTE) , UDINT , (1 << EORSTI) 
  67                         #define USB_INT_DCONNI                           UHIEN , (1 << DCONNE) , UHINT , (1 << DCONNI) 
  68                         #define USB_INT_DDISCI                           UHIEN , (1 << DDISCE) , UHINT , (1 << DDISCI) 
  69                         #define USB_INT_BCERRI                           OTGIEN, (1 << BCERRE) , OTGINT, (1 << BCERRI) 
  70                         #define USB_INT_VBERRI                           OTGIEN, (1 << VBERRE) , OTGINT, (1 << VBERRI) 
  71                         #define USB_INT_SOFI                             UDIEN,  (1 << SOFE)   , UDINT , (1 << SOFI) 
  72                         #define USB_INT_HSOFI                            UHIEN,  (1 << HSOFE)  , UHINT , (1 << HSOFI) 
  73                         #define USB_INT_RSTI                             UHIEN , (1 << RSTE)   , UHINT , (1 << RSTI) 
  74                         #define USB_INT_SRPI                             OTGIEN, (1 << SRPE)   , OTGINT, (1 << SRPI) 
  75                         #define USB_INT_RXSTPI                           UEIENX, (1 << RXSTPE) , UEINTX, (1 << RXSTPI) 
  77                 /* Function Prototypes: */ 
  78                         void USB_INT_ClearAllInterrupts(void); 
  79                         void USB_INT_DisableAllInterrupts(void); 
  82         /* Disable C linkage for C++ Compilers: */ 
  83                 #if defined(__cplusplus)