diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-12-22 16:12:32 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-12-22 16:12:32 +0000 |
commit | a3528b0e3edfb0667c39d61b21396fc852bd9fcd (patch) | |
tree | 2f0993f54b5403f5955004ab0bcdcae9abd9ab5b /testhal | |
parent | 2f7be482b19d34ec9bc86ce31d589430e2737e29 (diff) | |
download | ChibiOS-a3528b0e3edfb0667c39d61b21396fc852bd9fcd.tar.gz ChibiOS-a3528b0e3edfb0667c39d61b21396fc852bd9fcd.tar.bz2 ChibiOS-a3528b0e3edfb0667c39d61b21396fc852bd9fcd.zip |
Updated Serial-USB driver using the new buffering mechanism. Only the STM32F4 CDC demo updated for it. Apparently it works.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8631 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
4 files changed, 18 insertions, 6 deletions
diff --git a/testhal/STM32/STM32F4xx/USB_CDC/debug/STM32F4xx-USB_CDC (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32F4xx/USB_CDC/debug/STM32F4xx-USB_CDC (OpenOCD, Flash and Run).launch index 4a04bbd16..9f4df03ef 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/debug/STM32F4xx-USB_CDC (OpenOCD, Flash and Run).launch +++ b/testhal/STM32/STM32F4xx/USB_CDC/debug/STM32F4xx-USB_CDC (OpenOCD, Flash and Run).launch @@ -33,7 +33,7 @@ <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList/>"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="bcounter-null-obqTryFlushI-(format)" val="4"/><content id="n-sduSOFHookI-(format)" val="4"/></contentList>"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList/> "/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
diff --git a/testhal/STM32/STM32F4xx/USB_CDC/main.c b/testhal/STM32/STM32F4xx/USB_CDC/main.c index 67cfec3da..37c0cfdc1 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F4xx/USB_CDC/main.c @@ -26,9 +26,6 @@ #include "usbcfg.h"
-/* Virtual serial port over USB.*/
-SerialUSBDriver SDU1;
-
/*===========================================================================*/
/* Command line related. */
/*===========================================================================*/
diff --git a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c index cfe1a7f5c..07a492758 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c +++ b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.c @@ -14,9 +14,11 @@ limitations under the License.
*/
-#include "ch.h"
#include "hal.h"
+/* Virtual serial port over USB.*/
+SerialUSBDriver SDU1;
+
/*
* Endpoints to be used for USBD1.
*/
@@ -300,13 +302,25 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { }
/*
+ * Handles the USB driver global events.
+ */
+static void sof_handler(USBDriver *usbp) {
+
+ (void)usbp;
+
+ osalSysLockFromISR();
+ sduSOFHookI(&SDU1);
+ osalSysUnlockFromISR();
+}
+
+/*
* USB driver configuration.
*/
const USBConfig usbcfg = {
usb_event,
get_descriptor,
sduRequestsHook,
- NULL
+ sof_handler
};
/*
diff --git a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.h b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.h index 2ffaa17f9..2da1c40a4 100644 --- a/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.h +++ b/testhal/STM32/STM32F4xx/USB_CDC/usbcfg.h @@ -19,6 +19,7 @@ extern const USBConfig usbcfg;
extern SerialUSBConfig serusbcfg;
+extern SerialUSBDriver SDU1;
#endif /* _USBCFG_H_ */
|