Merge branch 'master' into port-samg55

This commit is contained in:
hathach
2019-12-21 23:53:48 +07:00
30 changed files with 146 additions and 91 deletions

View File

@@ -30,7 +30,7 @@
/**********************************************
* This driver has been tested with the following MCUs:
* - F070, F072, L053
* - F070, F072, L053, F042F6
*
* It also should work with minimal changes for any ST MCU with an "USB A"/"PCD"/"HCD" peripheral. This
* covers:
@@ -44,6 +44,9 @@
* L4x2, L4x3 1024 byte buffer
*
* To use this driver, you must:
* - If you are using a device with crystal-less USB, set up the clock recovery system (CRS)
* - Remap pins to be D+/D- on devices that they are shared (for example: F042Fx)
* - This is different to the normal "alternate function" GPIO interface, needs to go through SYSCFG->CFGRx register
* - Enable USB clock; Perhaps use __HAL_RCC_USB_CLK_ENABLE();
* - (Optionally configure GPIO HAL to tell it the USB driver is using the USB pins)
* - call tusb_init();

View File

@@ -207,12 +207,8 @@ void dcd_init (uint8_t rhport)
USB_OTG_GINTMSK_SOFM | USB_OTG_GINTMSK_RXFLVLM /* SB_OTG_GINTMSK_ESUSPM | \
USB_OTG_GINTMSK_USBSUSPM */;
// Enable VBUS hardware sensing, enable pullup, enable peripheral.
#ifdef USB_OTG_GCCFG_VBDEN
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBDEN | USB_OTG_GCCFG_PWRDWN;
#else
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBUSBSEN | USB_OTG_GCCFG_PWRDWN;
#endif
// Enable USB transceiver.
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_PWRDWN;
// Soft Connect -> Enable pullup on D+/D-.
// This step does not appear to be specified in the programmer's model.

View File

@@ -226,7 +226,7 @@ static void process_rx(void) {
test_buffer[total_read] = c;
#endif
total_read++;
if ((rx_buffer_offset[rx_ep] + current_offset) < rx_buffer_max[rx_ep]) {
if (current_offset < rx_buffer_max[rx_ep]) {
#if LOG_USB
usb_log[usb_log_offset].data[usb_log[usb_log_offset].size++] = c;
#endif