aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-05-03 06:40:43 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-05-03 06:40:43 +0000
commitcdf9aaf51c61ed0cd83509f734410ed915ff5114 (patch)
tree633ab0d2818e9d1d24453702d1f6443f96a70ee1
parenteb28cc7c13def28fb504bd77bd44d905fcfee1d3 (diff)
downloadChibiOS-cdf9aaf51c61ed0cd83509f734410ed915ff5114.tar.gz
ChibiOS-cdf9aaf51c61ed0cd83509f734410ed915ff5114.tar.bz2
ChibiOS-cdf9aaf51c61ed0cd83509f734410ed915ff5114.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5658 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARMCM4-STM32F407-DISCOVERY-MEMS/main.c2
-rw-r--r--demos/ARMCM4-STM32F407-DISCOVERY-MEMS/usbcfg.c26
-rw-r--r--os/hal/platforms/STM32/USBv1/usb_lld.h5
-rw-r--r--testhal/STM32F1xx/RTC_FATTIME/main.c14
4 files changed, 31 insertions, 16 deletions
diff --git a/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/main.c b/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/main.c
index fb947cb7e..77bf7196b 100644
--- a/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/main.c
+++ b/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/main.c
@@ -25,7 +25,7 @@
#include "usbcfg.h"
/* Virtual serial port over USB.*/
-static SerialUSBDriver SDU1;
+SerialUSBDriver SDU1;
/*===========================================================================*/
/* Command line related. */
diff --git a/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/usbcfg.c b/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/usbcfg.c
index 35b6d8e16..24955b881 100644
--- a/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/usbcfg.c
+++ b/demos/ARMCM4-STM32F407-DISCOVERY-MEMS/usbcfg.c
@@ -16,7 +16,13 @@
#include "ch.h"
#include "hal.h"
-#include "usb_cdc.h"
+
+/*
+ * Endpoints to be used for USBD1.
+ */
+#define USBD1_DATA_REQUEST_EP 1
+#define USBD1_DATA_AVAILABLE_EP 1
+#define USBD1_INTERRUPT_REQUEST_EP 2
/*
* USB Device Descriptor.
@@ -94,7 +100,7 @@ static const uint8_t vcom_configuration_descriptor_data[67] = {
USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class
Interface). */
/* Endpoint 2 Descriptor.*/
- USB_DESC_ENDPOINT (USB_CDC_INTERRUPT_REQUEST_EP|0x80,
+ USB_DESC_ENDPOINT (USBD1_INTERRUPT_REQUEST_EP|0x80,
0x03, /* bmAttributes (Interrupt). */
0x0008, /* wMaxPacketSize. */
0xFF), /* bInterval. */
@@ -110,12 +116,12 @@ static const uint8_t vcom_configuration_descriptor_data[67] = {
4.7). */
0x00), /* iInterface. */
/* Endpoint 3 Descriptor.*/
- USB_DESC_ENDPOINT (USB_CDC_DATA_AVAILABLE_EP, /* bEndpointAddress.*/
+ USB_DESC_ENDPOINT (USBD1_DATA_AVAILABLE_EP, /* bEndpointAddress.*/
0x02, /* bmAttributes (Bulk). */
0x0040, /* wMaxPacketSize. */
0x00), /* bInterval. */
/* Endpoint 1 Descriptor.*/
- USB_DESC_ENDPOINT (USB_CDC_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/
+ USB_DESC_ENDPOINT (USBD1_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/
0x02, /* bmAttributes (Bulk). */
0x0040, /* wMaxPacketSize. */
0x00) /* bInterval. */
@@ -256,6 +262,7 @@ static const USBEndpointConfig ep2config = {
* Handles the USB driver global events.
*/
static void usb_event(USBDriver *usbp, usbevent_t event) {
+ extern SerialUSBDriver SDU1;
switch (event) {
case USB_EVENT_RESET:
@@ -268,11 +275,11 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
/* Enables the endpoints specified into the configuration.
Note, this callback is invoked from an ISR so I-Class functions
must be used.*/
- usbInitEndpointI(usbp, USB_CDC_DATA_REQUEST_EP, &ep1config);
- usbInitEndpointI(usbp, USB_CDC_INTERRUPT_REQUEST_EP, &ep2config);
+ usbInitEndpointI(usbp, USBD1_DATA_REQUEST_EP, &ep1config);
+ usbInitEndpointI(usbp, USBD1_INTERRUPT_REQUEST_EP, &ep2config);
/* Resetting the state of the CDC subsystem.*/
- sduConfigureHookI(usbp);
+ sduConfigureHookI(&SDU1);
chSysUnlockFromIsr();
return;
@@ -300,5 +307,8 @@ const USBConfig usbcfg = {
* Serial over USB driver configuration.
*/
const SerialUSBConfig serusbcfg = {
- &USBD1
+ &USBD1,
+ USBD1_DATA_REQUEST_EP,
+ USBD1_DATA_AVAILABLE_EP,
+ USBD1_INTERRUPT_REQUEST_EP
};
diff --git a/os/hal/platforms/STM32/USBv1/usb_lld.h b/os/hal/platforms/STM32/USBv1/usb_lld.h
index d4602f65f..a0092a334 100644
--- a/os/hal/platforms/STM32/USBv1/usb_lld.h
+++ b/os/hal/platforms/STM32/USBv1/usb_lld.h
@@ -285,11 +285,6 @@ struct USBDriver {
*/
const USBConfig *config;
/**
- * @brief Field available to user, it can be used to associate an
- * application-defined handler to the USB driver.
- */
- void *param;
- /**
* @brief Bit map of the transmitting IN endpoints.
*/
uint16_t transmitting;
diff --git a/testhal/STM32F1xx/RTC_FATTIME/main.c b/testhal/STM32F1xx/RTC_FATTIME/main.c
index 31a276310..c229830d0 100644
--- a/testhal/STM32F1xx/RTC_FATTIME/main.c
+++ b/testhal/STM32F1xx/RTC_FATTIME/main.c
@@ -32,6 +32,13 @@
/*===========================================================================*/
/*
+ * Endpoints to be used for USBD1.
+ */
+#define USBD1_DATA_REQUEST_EP 1
+#define USBD1_DATA_AVAILABLE_EP 1
+#define USBD1_INTERRUPT_REQUEST_EP 2
+
+/*
* Serial over USB Driver structure.
*/
static SerialUSBDriver SDU1;
@@ -290,7 +297,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
usbInitEndpointI(usbp, USB_CDC_INTERRUPT_REQUEST_EP, &ep2config);
/* Resetting the state of the CDC subsystem.*/
- sduConfigureHookI(usbp);
+ sduConfigureHookI(&SDU1);
chSysUnlockFromIsr();
return;
@@ -318,7 +325,10 @@ static const USBConfig usbcfg = {
* Serial over USB driver configuration.
*/
static const SerialUSBConfig serusbcfg = {
- &USBD1
+ &USBD1,
+ USBD1_DATA_REQUEST_EP,
+ USBD1_DATA_AVAILABLE_EP,
+ USBD1_INTERRUPT_REQUEST_EP
};
/**