mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-06-13 20:34:17 +00:00
Implemented on-demand PLL clock generation for the U4, U6 and U7 series USB AVRs when automatic PLL mode is specified.
This commit is contained in:
parent
1a130eed6c
commit
b35f93a372
@ -65,6 +65,13 @@ void USB_Init(
|
|||||||
else
|
else
|
||||||
USB_REG_Off();
|
USB_REG_Off();
|
||||||
|
|
||||||
|
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||||
|
{
|
||||||
|
#if defined(USB_SERIES_4_AVR)
|
||||||
|
PLLFRQ = ((1 << PLLUSB) | (1 << PDIV3) | (1 << PDIV1));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(USB_CAN_BE_BOTH)
|
#if defined(USB_CAN_BE_BOTH)
|
||||||
if (Mode == USB_MODE_UID)
|
if (Mode == USB_MODE_UID)
|
||||||
{
|
{
|
||||||
@ -118,22 +125,9 @@ void USB_ResetInterface(void)
|
|||||||
|
|
||||||
USB_Controller_Reset();
|
USB_Controller_Reset();
|
||||||
|
|
||||||
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
|
||||||
{
|
|
||||||
#if defined(USB_SERIES_4_AVR)
|
|
||||||
PLLFRQ = ((1 << PLLUSB) | (1 << PDIV3) | (1 << PDIV1));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
USB_PLL_On();
|
|
||||||
while (!(USB_PLL_IsReady()));
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(USB_CAN_BE_BOTH)
|
#if defined(USB_CAN_BE_BOTH)
|
||||||
if (UIDModeSelectEnabled)
|
if (UIDModeSelectEnabled)
|
||||||
{
|
USB_INT_Enable(USB_INT_IDTI);
|
||||||
UHWCON |= (1 << UIDE);
|
|
||||||
USB_INT_Enable(USB_INT_IDTI);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USB_CLK_Unfreeze();
|
USB_CLK_Unfreeze();
|
||||||
@ -145,6 +139,16 @@ void USB_ResetInterface(void)
|
|||||||
UHWCON |= (1 << UIMOD);
|
UHWCON |= (1 << UIMOD);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||||
|
{
|
||||||
|
#if defined(USB_SERIES_2_AVR)
|
||||||
|
USB_PLL_On();
|
||||||
|
while (!(USB_PLL_IsReady()));
|
||||||
|
#else
|
||||||
|
USB_PLL_Off();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
USB_Init_Device();
|
USB_Init_Device();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -153,6 +157,14 @@ void USB_ResetInterface(void)
|
|||||||
#if defined(USB_CAN_BE_HOST)
|
#if defined(USB_CAN_BE_HOST)
|
||||||
UHWCON &= ~(1 << UIMOD);
|
UHWCON &= ~(1 << UIMOD);
|
||||||
|
|
||||||
|
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||||
|
{
|
||||||
|
#if defined(USB_CAN_BE_HOST)
|
||||||
|
USB_PLL_On();
|
||||||
|
while (!(USB_PLL_IsReady()));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
USB_Init_Host();
|
USB_Init_Host();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -90,11 +90,20 @@ ISR(USB_GEN_vect, ISR_BLOCK)
|
|||||||
|
|
||||||
if (USB_VBUS_GetStatus())
|
if (USB_VBUS_GetStatus())
|
||||||
{
|
{
|
||||||
|
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||||
|
{
|
||||||
|
USB_PLL_On();
|
||||||
|
while (!(USB_PLL_IsReady()));
|
||||||
|
}
|
||||||
|
|
||||||
USB_DeviceState = DEVICE_STATE_Powered;
|
USB_DeviceState = DEVICE_STATE_Powered;
|
||||||
EVENT_USB_Device_Connect();
|
EVENT_USB_Device_Connect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!(USB_Options & USB_OPT_MANUAL_PLL))
|
||||||
|
USB_PLL_Off();
|
||||||
|
|
||||||
USB_DeviceState = DEVICE_STATE_Unattached;
|
USB_DeviceState = DEVICE_STATE_Unattached;
|
||||||
EVENT_USB_Device_Disconnect();
|
EVENT_USB_Device_Disconnect();
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
* - Reduced latency for executing the Start-Of-Frame events (if enabled in the user application)
|
* - Reduced latency for executing the Start-Of-Frame events (if enabled in the user application)
|
||||||
* - Removed Pipe_ClearErrorFlags(), pipe error flags are now automatically cleared when Pipe_ClearError() is called
|
* - Removed Pipe_ClearErrorFlags(), pipe error flags are now automatically cleared when Pipe_ClearError() is called
|
||||||
* - Endpoint_ResetFIFO() renamed to Endpoint_ResetEndpoint(), to be consistent with the Pipe_ResetPipe() function name
|
* - Endpoint_ResetFIFO() renamed to Endpoint_ResetEndpoint(), to be consistent with the Pipe_ResetPipe() function name
|
||||||
|
* - Implemented on-demand PLL clock generation for the U4, U6 and U7 series USB AVRs when automatic PLL mode is specified
|
||||||
* - Library Applications:
|
* - Library Applications:
|
||||||
* - Changed the XPLAINBridge software UART to use the regular timer CTC mode instead of the alternative CTC mode
|
* - Changed the XPLAINBridge software UART to use the regular timer CTC mode instead of the alternative CTC mode
|
||||||
* via the Input Capture register, to reduce user confusion
|
* via the Input Capture register, to reduce user confusion
|
||||||
|
Loading…
Reference in New Issue
Block a user