Added a new setting to STM32 USBv1 allowing for some clock deviation from 48MHz. Renamed setting USB_HOST_WAKEUP_DURATION to STM32_USB_HOST_WAKEUP_DURATION for consistency.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13726 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2020-06-26 07:51:04 +00:00
parent fb7a643342
commit 3bbc7d36ad
3 changed files with 25 additions and 9 deletions

View File

@ -108,8 +108,15 @@
/** /**
* @brief Host wake-up procedure duration. * @brief Host wake-up procedure duration.
*/ */
#if !defined(USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__) #if !defined(STM32_USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__)
#define USB_HOST_WAKEUP_DURATION 2 #define STM32_USB_HOST_WAKEUP_DURATION 2
#endif
/**
* @brief Allowed deviation for the 48MHz clock.
*/
#if !defined(STM32_USB_48MHZ_DELTA) || defined(__DOXYGEN__)
#define STM32_USB_48MHZ_DELTA 0
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -135,10 +142,6 @@
#error "Invalid IRQ priority assigned to USB LP" #error "Invalid IRQ priority assigned to USB LP"
#endif #endif
#if STM32_USBCLK != 48000000
#error "the USB driver requires a 48MHz clock"
#endif
#if !defined(STM32_USB1_HP_HANDLER) #if !defined(STM32_USB1_HP_HANDLER)
#error "STM32_USB1_HP_HANDLER not defined" #error "STM32_USB1_HP_HANDLER not defined"
#endif #endif
@ -155,8 +158,17 @@
#error "STM32_USB1_LP_NUMBER not defined" #error "STM32_USB1_LP_NUMBER not defined"
#endif #endif
#if (USB_HOST_WAKEUP_DURATION < 2) || (USB_HOST_WAKEUP_DURATION > 15) #if (STM32_USB_HOST_WAKEUP_DURATION < 2) || (STM32_USB_HOST_WAKEUP_DURATION > 15)
#error "invalid USB_HOST_WAKEUP_DURATION setting, it must be between 2 and 15" #error "invalid STM32_USB_HOST_WAKEUP_DURATION setting, it must be between 2 and 15"
#endif
#if (STM32_USB_48MHZ_DELTA < 0) || (STM32_USB_48MHZ_DELTA > 250000)
#error "invalid STM32_USB_48MHZ_DELTA setting, it must not exceed 250000"
#endif
#if (STM32_USBCLK < (48000000 - STM32_USB_48MHZ_DELTA)) || \
(STM32_USBCLK > (48000000 + STM32_USB_48MHZ_DELTA))
#error "the USB driver requires a 48MHz clock"
#endif #endif
/*===========================================================================*/ /*===========================================================================*/
@ -467,7 +479,7 @@ struct USBDriver {
#define usb_lld_wakeup_host(usbp) \ #define usb_lld_wakeup_host(usbp) \
do { \ do { \
STM32_USB->CNTR |= USB_CNTR_RESUME; \ STM32_USB->CNTR |= USB_CNTR_RESUME; \
osalThreadSleepMilliseconds(USB_HOST_WAKEUP_DURATION); \ osalThreadSleepMilliseconds(STM32_USB_HOST_WAKEUP_DURATION); \
STM32_USB->CNTR &= ~USB_CNTR_RESUME; \ STM32_USB->CNTR &= ~USB_CNTR_RESUME; \
} while (false) } while (false)

View File

@ -74,6 +74,9 @@
***************************************************************************** *****************************************************************************
*** Next *** *** Next ***
- NEW: Added a new setting to STM32 USBv1 allowing for some clock deviation
from 48MHz. Renamed setting USB_HOST_WAKEUP_DURATION to
STM32_USB_HOST_WAKEUP_DURATION for consistency.
- NEW: Added entry for STM32L475 in STM32L4 registry header, updated all - NEW: Added entry for STM32L475 in STM32L4 registry header, updated all
configuration files. configuration files.
- NEW: Updated CMSIS headers for STM32F7, G0, G4, H7, L0, L4, L4+. - NEW: Updated CMSIS headers for STM32F7, G0, G4, H7, L0, L4, L4+.

View File

@ -285,4 +285,5 @@
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
</scannerConfigBuildInfo> </scannerConfigBuildInfo>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject> </cproject>