Fast copy working in STM32 USBv2.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15082 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-11-14 16:19:11 +00:00
parent 4f3719663c
commit 850f56b1f1
5 changed files with 37 additions and 21 deletions

View File

@ -58,7 +58,7 @@
#define STM32_PWR_PDCRF (0U)
#define STM32_HSIDIV_VALUE 1
#define STM32_HSI16_ENABLED TRUE
#define STM32_HSI48_ENABLED FALSE
#define STM32_HSI48_ENABLED TRUE
#define STM32_HSE_ENABLED FALSE
#define STM32_LSI_ENABLED TRUE
#define STM32_LSE_ENABLED FALSE
@ -78,7 +78,7 @@
/*
* Peripherals clocks and sources.
*/
#define STM32_FDCANSEL STM32_FDCANSEL_PCLK
#define STM32_FDCANSEL STM32_USBSEL_HSI48
#define STM32_USBSEL STM32_USBSEL_HSI48
#define STM32_USART1SEL STM32_USART1SEL_SYSCLK
#define STM32_USART2SEL STM32_USART2SEL_SYSCLK
@ -87,7 +87,7 @@
#define STM32_LPUART2SEL STM32_LPUART2SEL_SYSCLK
#define STM32_CECSEL STM32_CECSEL_HSI16DIV
#define STM32_I2C1SEL STM32_I2C1SEL_PCLK
#define STM32_I2C2SEL STM32_I2C2SEL_PCLK
#define STM32_I2C2SEL STM32_I2C1SEL_PCLK
#define STM32_I2S1SEL STM32_I2S1SEL_SYSCLK
#define STM32_I2S2SEL STM32_I2S2SEL_SYSCLK
#define STM32_LPTIM1SEL STM32_LPTIM1SEL_PCLK
@ -298,6 +298,10 @@
#define STM32_USB_USE_USB1 FALSE
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
#define STM32_USB_USB1_LP_IRQ_PRIORITY 3
#define STM32_USB_USE_ISOCHRONOUS FALSE
#define STM32_USB_USE_FAST_COPY FALSE
#define STM32_USB_HOST_WAKEUP_DURATION 2
#define STM32_USB_48MHZ_DELTA 0
/*
* WDG driver system settings.

View File

@ -365,30 +365,30 @@ static void usb_packet_write_from_buffer(USBDriver *usbp,
while (i >= 16) {
uint32_t w;
w = *(buf + 0);
w |= *(buf + 1) << 8;
w = *(buf + 2) << 16;
w |= *(buf + 3) << 24;
w = (uint32_t)*(buf + 0);
w |= (uint32_t)*(buf + 1) << 8;
w |= (uint32_t)*(buf + 2) << 16;
w |= (uint32_t)*(buf + 3) << 24;
*(pmap + 0) = w;
w = *(buf + 4);
w |= *(buf + 5) << 8;
w = *(buf + 6) << 16;
w |= *(buf + 7) << 24;
w = (uint32_t)*(buf + 4);
w |= (uint32_t)*(buf + 5) << 8;
w |= (uint32_t)*(buf + 6) << 16;
w |= (uint32_t)*(buf + 7) << 24;
*(pmap + 1) = w;
w = *(buf + 8);
w |= *(buf + 9) << 8;
w = *(buf + 10) << 16;
w |= *(buf + 11) << 24;
w = (uint32_t)*(buf + 8);
w |= (uint32_t)*(buf + 9) << 8;
w |= (uint32_t)*(buf + 10) << 16;
w |= (uint32_t)*(buf + 11) << 24;
*(pmap + 2) = w;
w = *(buf + 12);
w |= *(buf + 13) << 8;
w = *(buf + 14) << 16;
w |= *(buf + 15) << 24;
w = (uint32_t)*(buf + 12);
w |= (uint32_t)*(buf + 13) << 8;
w |= (uint32_t)*(buf + 14) << 16;
w |= (uint32_t)*(buf + 15) << 24;
*(pmap + 3) = w;
i -= 16;
buf += 16;
pmap += 8;
pmap += 4;
}
#endif /* STM32_USB_USE_FAST_COPY */

View File

@ -74,6 +74,7 @@
*****************************************************************************
*** Next ***
- NEW: STM32G0B1 USBv2 driver.
- NEW: USBv1 driver optimization and removal of a potential race condition
(not demonstrated).
- NEW: Added elfAcquireBus()/eflReleaseBus() functions to EFL driver.

View File

@ -298,6 +298,10 @@
#define STM32_USB_USE_USB1 TRUE
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
#define STM32_USB_USB1_LP_IRQ_PRIORITY 3
#define STM32_USB_USE_ISOCHRONOUS FALSE
#define STM32_USB_USE_FAST_COPY TRUE
#define STM32_USB_HOST_WAKEUP_DURATION 2
#define STM32_USB_48MHZ_DELTA 0
/*
* WDG driver system settings.

View File

@ -69,6 +69,7 @@
#define STM32_PWR_PDCRF ${doc.STM32_PWR_PDCRF!"(0U)"}
#define STM32_HSIDIV_VALUE ${doc.STM32_HSIDIV_VALUE!"1"}
#define STM32_HSI16_ENABLED ${doc.STM32_HSI16_ENABLED!"TRUE"}
#define STM32_HSI48_ENABLED ${doc.STM32_HSI16_ENABLED!"TRUE"}
#define STM32_HSE_ENABLED ${doc.STM32_HSE_ENABLED!"FALSE"}
#define STM32_LSI_ENABLED ${doc.STM32_LSI_ENABLED!"FALSE"}
#define STM32_LSE_ENABLED ${doc.STM32_LSE_ENABLED!"FALSE"}
@ -88,6 +89,7 @@
/*
* Peripherals clocks and sources.
*/
#define STM32_FDCANSEL ${doc.STM32_FDCANSEL!"STM32_FDCANSEL_PCLK"}
#define STM32_USBSEL ${doc.STM32_USBSEL!"STM32_USBSEL_PLLQCLK"}
#define STM32_USART1SEL ${doc.STM32_USART1SEL!"STM32_USART1SEL_SYSCLK"}
#define STM32_USART2SEL ${doc.STM32_USART2SEL!"STM32_USART2SEL_SYSCLK"}
@ -96,7 +98,9 @@
#define STM32_LPUART2SEL ${doc.STM32_LPUART2SEL!"STM32_LPUART2SEL_SYSCLK"}
#define STM32_CECSEL ${doc.STM32_CECSEL!"STM32_CECSEL_HSI16DIV"}
#define STM32_I2C1SEL ${doc.STM32_I2C1SEL!"STM32_I2C1SEL_PCLK"}
#define STM32_I2C2SEL ${doc.STM32_I2C2SEL!"STM32_I2C2SEL_PCLK"}
#define STM32_I2S1SEL ${doc.STM32_I2S1SEL!"STM32_I2S1SEL_SYSCLK"}
#define STM32_I2S2SEL ${doc.STM32_I2S22SEL!"STM32_I2S2SEL_SYSCLK"}
#define STM32_LPTIM1SEL ${doc.STM32_LPTIM1SEL!"STM32_LPTIM1SEL_PCLK"}
#define STM32_LPTIM2SEL ${doc.STM32_LPTIM2SEL!"STM32_LPTIM2SEL_PCLK"}
#define STM32_TIM1SEL ${doc.STM32_TIM1SEL!"STM32_TIM1SEL_TIMPCLK"}
@ -304,8 +308,11 @@
*/
#define STM32_USB_USE_USB1 ${doc.STM32_USB_USE_USB1!"FALSE"}
#define STM32_USB_LOW_POWER_ON_SUSPEND ${doc.STM32_USB_LOW_POWER_ON_SUSPEND!"FALSE"}
#define STM32_USB_USB1_HP_IRQ_PRIORITY ${doc.STM32_USB_USB1_HP_IRQ_PRIORITY!"13"}
#define STM32_USB_USB1_LP_IRQ_PRIORITY ${doc.STM32_USB_USB1_LP_IRQ_PRIORITY!"14"}
#define STM32_USB_USE_ISOCHRONOUS ${doc.STM32_USB_USE_ISOCHRONOUS!"FALSE"}
#define STM32_USB_USE_FAST_COPY ${doc.STM32_USB_USE_FAST_COPY!"FALSE"}
#define STM32_USB_HOST_WAKEUP_DURATION ${doc.STM32_USB_HOST_WAKEUP_DURATION!"2"}
#define STM32_USB_48MHZ_DELTA ${doc.STM32_USB_48MHZ_DELTA!"0"}
/*
* WDG driver system settings.