From 2fdca55f58f29aa01be6a0b90728c902c20098ef Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 25 Dec 2015 12:45:23 +0000 Subject: Updated all USB demos. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8644 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c | 3 --- .../usbcfg.c | 22 ++++++++++++++++++---- .../usbcfg.h | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB') diff --git a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c index 3885ec198..6cad8655d 100644 --- a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c +++ b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/main.c @@ -31,9 +31,6 @@ #include "usbcfg.h" -/* Virtual serial port over USB.*/ -SerialUSBDriver SDU2; - /*===========================================================================*/ /* Card insertion monitor. */ /*===========================================================================*/ diff --git a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c index 968fd6724..c836f16c1 100644 --- a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c +++ b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.c @@ -14,9 +14,11 @@ limitations under the License. */ -#include "ch.h" #include "hal.h" +/* Virtual serial port over USB.*/ +SerialUSBDriver SDU2; + /* * Endpoints to be used for USBD2. */ @@ -28,7 +30,7 @@ * USB Device Descriptor. */ static const uint8_t vcom_device_descriptor_data[18] = { - USB_DESC_DEVICE (0x0110, /* bcdUSB (1.1). */ + USB_DESC_DEVICE (0x0200, /* bcdUSB (2.0). */ 0x02, /* bDeviceClass (CDC). */ 0x00, /* bDeviceSubClass. */ 0x00, /* bDeviceProtocol. */ @@ -233,7 +235,7 @@ static const USBEndpointConfig ep1config = { 0x0040, &ep1instate, &ep1outstate, - 2, + 4, NULL }; @@ -299,6 +301,18 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { return; } +/* + * Handles the USB driver global events. + */ +static void sof_handler(USBDriver *usbp) { + + (void)usbp; + + osalSysLockFromISR(); + sduSOFHookI(&SDU2); + osalSysUnlockFromISR(); +} + /* * USB driver configuration. */ @@ -306,7 +320,7 @@ const USBConfig usbcfg = { usb_event, get_descriptor, sduRequestsHook, - NULL + sof_handler }; /* diff --git a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.h b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.h index 2ffaa17f9..333a5f9d3 100644 --- a/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.h +++ b/demos/STM32/RT-STM32F746G-DISCOVERY-LWIP-FATFS-USB/usbcfg.h @@ -19,6 +19,7 @@ extern const USBConfig usbcfg; extern SerialUSBConfig serusbcfg; +extern SerialUSBDriver SDU2; #endif /* _USBCFG_H_ */ -- cgit v1.2.3