Add board/board-blue-pill-g.h.
This commit is contained in:
@@ -6,7 +6,12 @@ extern int chx_allow_sleep;
|
||||
|
||||
#define STM32_PLLSRC STM32_PLLSRC_HSE
|
||||
#define STM32_PLLMUL ((STM32_PLLMUL_VALUE - 2) << 18)
|
||||
|
||||
#ifndef STM32_ADCPRE
|
||||
#define STM32_ADCPRE STM32_ADCPRE_DIV6
|
||||
#endif
|
||||
#ifndef STM32_USBPRE
|
||||
#define STM32_USBPRE STM32_USBPRE_DIV1P5
|
||||
#endif
|
||||
|
||||
static void
|
||||
configure_clock (int high)
|
||||
@@ -16,16 +21,16 @@ configure_clock (int high)
|
||||
|
||||
if (high)
|
||||
{
|
||||
cfg = STM32_MCO_NOCLOCK | STM32_USBPRE_DIV1P5
|
||||
cfg = STM32_MCO_NOCLOCK | STM32_USBPRE
|
||||
| STM32_PLLMUL | STM32_PLLXTPRE | STM32_PLLSRC
|
||||
| STM32_ADCPRE_DIV6 | STM32_PPRE2_DIV1
|
||||
| STM32_ADCPRE | STM32_PPRE2_DIV1
|
||||
| STM32_PPRE1_DIV2 | STM32_HPRE_DIV1;
|
||||
|
||||
cfg_sw = RCC_CFGR_SW_PLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
cfg = STM32_MCO_NOCLOCK | STM32_USBPRE_DIV1P5
|
||||
cfg = STM32_MCO_NOCLOCK | STM32_USBPRE
|
||||
| STM32_PLLMUL | STM32_PLLXTPRE | STM32_PLLSRC
|
||||
| STM32_ADCPRE_DIV8 | STM32_PPRE2_DIV16
|
||||
| STM32_PPRE1_DIV16 | STM32_HPRE_DIV8;
|
||||
|
||||
@@ -43,9 +43,13 @@
|
||||
#define STM32_SW STM32_SW_PLL
|
||||
#define STM32_HPRE STM32_HPRE_DIV1
|
||||
#define STM32_PPRE2 STM32_PPRE2_DIV1
|
||||
#ifndef STM32_ADCPRE
|
||||
#define STM32_ADCPRE STM32_ADCPRE_DIV6
|
||||
#endif
|
||||
#define STM32_MCOSEL STM32_MCO_NOCLOCK
|
||||
#define STM32_USBPRE STM32_USBPRE_DIV1P5
|
||||
#ifndef STM32_USBPRE
|
||||
#define STM32_USBPRE STM32_USBPRE_DIV1P5
|
||||
#endif
|
||||
|
||||
#define STM32_PLLMUL ((STM32_PLLMUL_VALUE - 2) << 18)
|
||||
#define STM32_PLLCLKOUT (STM32_PLLCLKIN * STM32_PLLMUL_VALUE)
|
||||
|
||||
@@ -127,6 +127,7 @@ static struct RCC *const RCC = (struct RCC *)RCC_BASE;
|
||||
#define STM32_ADCPRE_DIV8 (3 << 14)
|
||||
|
||||
#define STM32_USBPRE_DIV1P5 (0 << 22)
|
||||
#define STM32_USBPRE_DIV2 (3 << 22) /* Not for STM32, but GD32F103 */
|
||||
|
||||
#define STM32_MCO_NOCLOCK (0 << 24)
|
||||
|
||||
|
||||
@@ -339,6 +339,9 @@ void usb_lld_init (struct usb_dev *dev, uint8_t feature)
|
||||
|
||||
/* Clear Interrupt Status Register, and enable interrupt for USB */
|
||||
st103_set_istr (0);
|
||||
|
||||
st103_set_btable ();
|
||||
|
||||
st103_set_cntr (CNTR_CTRM | CNTR_OVRM | CNTR_ERRM
|
||||
| CNTR_WKUPM | CNTR_SUSPM | CNTR_RESETM);
|
||||
|
||||
@@ -906,7 +909,6 @@ void usb_lld_reset (struct usb_dev *dev, uint8_t feature)
|
||||
{
|
||||
usb_lld_set_configuration (dev, 0);
|
||||
dev->feature = feature;
|
||||
st103_set_btable ();
|
||||
st103_set_daddr (0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user