NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc;\r
USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1));\r
\r
+ if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH)\r
+ USB.INTCTRLA = (3 << USB_INTLVL_gp);\r
+ else if ((USB_Options & USB_OPT_BUSEVENT_PRIMED) == USB_OPT_BUSEVENT_PRIMED)\r
+ USB.INTCTRLA = (2 << USB_INTLVL_gp);\r
+ else\r
+ USB.INTCTRLA = (1 << USB_INTLVL_gp);\r
+\r
SetGlobalInterruptMask(CurrentGlobalInt);\r
\r
USB_ResetInterface(); \r
USB_INT_DisableAllInterrupts();\r
USB_INT_ClearAllInterrupts();\r
\r
- // TODO: Config define for priority\r
- USB.INTCTRLA = (2 << USB_INTLVL_gp);\r
- PMIC.CTRL |= (1 << PMIC_MEDLVLEX_bp);\r
-\r
USB_Controller_Reset();\r
USB_Init_Device();\r
}\r
#endif\r
\r
/* Public Interface - May be used in end-application: */\r
- /* Macros: */ \r
+ /* Macros: */\r
+ /** \name USB Controller Option Masks */\r
+ //@{\r
+ /** Sets the USB bus interrupt priority level to be low priority. The USB bus interrupt is used for Start of Frame events, bus suspend\r
+ * and resume events, bus reset events and other events related to the management of the USB bus.\r
+ */\r
+ #define USB_OPT_BUSEVENT_PRILOW ((0 << 1) | (0 << 1))\r
+\r
+ /** Sets the USB bus interrupt priority level to be medium priority. The USB bus interrupt is used for Start of Frame events, bus suspend\r
+ * and resume events, bus reset events and other events related to the management of the USB bus.\r
+ */\r
+ #define USB_OPT_BUSEVENT_PRIMED ((0 << 1) | (1 << 1))\r
+\r
+ /** Sets the USB bus interrupt priority level to be high priority. The USB bus interrupt is used for Start of Frame events, bus suspend\r
+ * and resume events, bus reset events and other events related to the management of the USB bus.\r
+ */\r
+ #define USB_OPT_BUSEVENT_PRIHIGH ((1 << 1) | (0 << 1))\r
+ //@}\r
+\r
/** \name Endpoint/Pipe Type Masks */\r
//@{\r
/** Mask for a CONTROL type endpoint or pipe.\r