aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-08-14 14:24:06 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-08-14 14:24:06 +0000
commit0bae8867882af833d47fd0f09358fb13d1031570 (patch)
treeb760671008353e0b84f551f8b320bcbfe15acb08
parent452f77011dc693d39bc6358e7ab0f36a23b206c8 (diff)
downloadChibiOS-0bae8867882af833d47fd0f09358fb13d1031570.tar.gz
ChibiOS-0bae8867882af833d47fd0f09358fb13d1031570.tar.bz2
ChibiOS-0bae8867882af833d47fd0f09358fb13d1031570.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4568 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/platforms/STM32/OTGv1/usb_lld.c8
-rw-r--r--testhal/STM32F4xx/USB_CDC/main.c9
2 files changed, 13 insertions, 4 deletions
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.c b/os/hal/platforms/STM32/OTGv1/usb_lld.c
index 85b35d829..34034d7ca 100644
--- a/os/hal/platforms/STM32/OTGv1/usb_lld.c
+++ b/os/hal/platforms/STM32/OTGv1/usb_lld.c
@@ -681,8 +681,12 @@ void usb_lld_start(USBDriver *usbp) {
OTG->DIEPMSK = 0;
OTG->DOEPMSK = 0;
OTG->DAINTMSK = 0;
- OTG->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM | /*GINTMSK_USBSUSPM |
- GINTMSK_ESUSPM |*/ GINTMSK_SOFM;
+ if (usbp->config->sof_cb == NULL)
+ OTG->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM /*| GINTMSK_USBSUSPM |
+ GINTMSK_ESUSPM |*/;
+ else
+ OTG->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM /*| GINTMSK_USBSUSPM |
+ GINTMSK_ESUSPM */ | GINTMSK_SOFM;
OTG->GINTSTS = 0xFFFFFFFF; /* Clears all pending IRQs, if any. */
/* Global interrupts enable.*/
diff --git a/testhal/STM32F4xx/USB_CDC/main.c b/testhal/STM32F4xx/USB_CDC/main.c
index 266867019..027f92a81 100644
--- a/testhal/STM32F4xx/USB_CDC/main.c
+++ b/testhal/STM32F4xx/USB_CDC/main.c
@@ -421,7 +421,9 @@ static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) {
while (chnGetTimeout((BaseChannel *)chp, TIME_IMMEDIATE) == Q_TIMEOUT) {
chSequentialStreamWrite(&SDU1, buf, sizeof buf - 1);
+ palTogglePad(GPIOD, GPIOD_LED4);
}
+ palClearPad(GPIOD, GPIOD_LED4);
chprintf(chp, "\r\n\nstopped\r\n");
}
@@ -451,10 +453,13 @@ static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker");
while (TRUE) {
+ systime_t time;
+
+ time = USBD1.state == USB_ACTIVE ? 250 : 500;
palClearPad(GPIOD, GPIOD_LED6);
- chThdSleepMilliseconds(500);
+ chThdSleepMilliseconds(time);
palSetPad(GPIOD, GPIOD_LED6);
- chThdSleepMilliseconds(500);
+ chThdSleepMilliseconds(time);
}
}