aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-06 13:51:08 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-06 13:51:08 +0000
commit100573d2c30750a50c3dfd9f3e7a051dcc987724 (patch)
tree39b8c04ed673e00350150dbfb2dbbb0f8f4f1ba9 /testhal/STM32
parent18853dba2210eadd2d919da2f17a9b5b553245fd (diff)
downloadChibiOS-100573d2c30750a50c3dfd9f3e7a051dcc987724.tar.gz
ChibiOS-100573d2c30750a50c3dfd9f3e7a051dcc987724.tar.bz2
ChibiOS-100573d2c30750a50c3dfd9f3e7a051dcc987724.zip
Serial over USB changes, work in progress, the USB demo is not buildable.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2717 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32')
-rw-r--r--testhal/STM32/USB_CDC/halconf.h2
-rw-r--r--testhal/STM32/USB_CDC/main.c40
2 files changed, 11 insertions, 31 deletions
diff --git a/testhal/STM32/USB_CDC/halconf.h b/testhal/STM32/USB_CDC/halconf.h
index 6700bcad5..0a957f0b9 100644
--- a/testhal/STM32/USB_CDC/halconf.h
+++ b/testhal/STM32/USB_CDC/halconf.h
@@ -93,7 +93,7 @@
* @brief Enables the SERIAL over USB subsystem.
*/
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL_USB FALSE
+#define HAL_USE_SERIAL_USB TRUE
#endif
/**
diff --git a/testhal/STM32/USB_CDC/main.c b/testhal/STM32/USB_CDC/main.c
index 697740526..b55b24892 100644
--- a/testhal/STM32/USB_CDC/main.c
+++ b/testhal/STM32/USB_CDC/main.c
@@ -32,7 +32,7 @@
/*
* USB driver structure.
*/
-//static SerialUSBDriver SDU1;
+static SerialUSBDriver SDU1;
/*
* USB Device Descriptor.
@@ -247,29 +247,11 @@ USBEndpointState ep2state;
*/
USBEndpointState ep3state;
-void sduDataRequest(USBDriver *usbp, usbep_t ep) {
-
- (void)usbp;
- (void)ep;
-}
-
-void sduInterruptRequest(USBDriver *usbp, usbep_t ep) {
-
- (void)usbp;
- (void)ep;
-}
-
-void sduDataAvailable(USBDriver *usbp, usbep_t ep) {
-
- (void)usbp;
- (void)ep;
-}
-
/**
* @brief EP1 initialization structure (IN only).
*/
static const USBEndpointConfig ep1config = {
- sduDataRequest,
+ sduDataTransmitted,
NULL,
0x0040,
0x0000,
@@ -282,7 +264,7 @@ static const USBEndpointConfig ep1config = {
* @brief EP2 initialization structure (IN only).
*/
static const USBEndpointConfig ep2config = {
- sduInterruptRequest,
+ sduInterruptTransmitted,
NULL,
0x0010,
0x0000,
@@ -296,7 +278,7 @@ static const USBEndpointConfig ep2config = {
*/
static const USBEndpointConfig ep3config = {
NULL,
- sduDataAvailable,
+ sduDataReceived,
0x0000,
0x0040,
EPR_EP_TYPE_BULK | EPR_STAT_TX_DIS | EPR_STAT_RX_VALID,
@@ -335,7 +317,6 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
/*
* Serial over USB driver configuration.
*/
-#if 0
static const SerialUSBConfig serusbcfg = {
&USBD1,
{
@@ -348,8 +329,8 @@ static const SerialUSBConfig serusbcfg = {
DATA_AVAILABLE_EP,
INTERRUPT_REQUEST_EP
};
-#endif
+#if 0
#include "usb_cdc.h"
static cdc_linecoding_t linecoding = {
{0x00, 0x96, 0x00, 0x00}, /* 38400. */
@@ -375,6 +356,7 @@ bool_t sduRequestsHook(USBDriver *usbp) {
}
return FALSE;
}
+#endif
USBConfig usbconfig = {
usb_event,
@@ -405,7 +387,6 @@ static msg_t Thread1(void *arg) {
/*
* USB CDC loopback thread.
*/
-#if 0
static WORKING_AREA(waThread2, 256);
static msg_t Thread2(void *arg) {
SerialUSBDriver *sdup = arg;
@@ -422,7 +403,6 @@ static msg_t Thread2(void *arg) {
}
}
}
-#endif
/*
* Application entry point.
@@ -442,10 +422,10 @@ int main(void) {
/*
* Activates the USB driver and then the USB bus pull-up on D+.
*/
- usbStart(&USBD1, &usbconfig);
+// usbStart(&USBD1, &usbconfig);
+ sduObjectInit(&SDU1);
+ sduStart(&SDU1, &serusbcfg);
palClearPad(GPIOC, GPIOC_USB_DISC);
-// sduObjectInit(&SDU1);
-// sduStart(&SDU1, &serusbcfg);
/*
* Activates the serial driver 2 using the driver default configuration.
@@ -460,7 +440,7 @@ int main(void) {
/*
* Creates the USB CDC loopback thread.
*/
-// chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, &SDU1);
+ chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, &SDU1);
/*
* Normal main() thread activity, in this demo it does nothing except