diff options
Diffstat (limited to 'testhal/STM32F1xx')
-rw-r--r-- | testhal/STM32F1xx/USB_CDC/main.c | 23 | ||||
-rw-r--r-- | testhal/STM32F1xx/USB_CDC_F107/main.c | 23 |
2 files changed, 32 insertions, 14 deletions
diff --git a/testhal/STM32F1xx/USB_CDC/main.c b/testhal/STM32F1xx/USB_CDC/main.c index 11685e3cd..1bcba05fb 100644 --- a/testhal/STM32F1xx/USB_CDC/main.c +++ b/testhal/STM32F1xx/USB_CDC/main.c @@ -21,7 +21,6 @@ #include "hal.h"
#include "test.h"
-#include "usb_cdc.h"
#include "shell.h"
#include "chprintf.h"
@@ -30,6 +29,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;
@@ -110,7 +116,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. */
@@ -126,12 +132,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. */
@@ -284,8 +290,8 @@ 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);
@@ -316,7 +322,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
};
/*===========================================================================*/
diff --git a/testhal/STM32F1xx/USB_CDC_F107/main.c b/testhal/STM32F1xx/USB_CDC_F107/main.c index 9d3844607..9e4399983 100644 --- a/testhal/STM32F1xx/USB_CDC_F107/main.c +++ b/testhal/STM32F1xx/USB_CDC_F107/main.c @@ -21,7 +21,6 @@ #include "hal.h"
#include "test.h"
-#include "usb_cdc.h"
#include "shell.h"
#include "chprintf.h"
@@ -30,6 +29,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;
@@ -110,7 +116,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. */
@@ -126,12 +132,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. */
@@ -284,8 +290,8 @@ 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);
@@ -316,7 +322,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
};
/*===========================================================================*/
|