aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorNicolas Reinecke <nr@das-labor.org>2016-11-08 18:14:13 +0100
committerNicolas Reinecke <nr@das-labor.org>2016-11-08 21:07:11 +0100
commit3407abe5af32fd051795d7e0f58458179d703cee (patch)
tree2b9e71d391630b43f62eca8bdbfe484cbb40e809 /demos
parenta52e98875024ada52b9f1e912c12f0bbec231bb2 (diff)
downloadChibiOS-Contrib-3407abe5af32fd051795d7e0f58458179d703cee.tar.gz
ChibiOS-Contrib-3407abe5af32fd051795d7e0f58458179d703cee.tar.bz2
ChibiOS-Contrib-3407abe5af32fd051795d7e0f58458179d703cee.zip
fix stm32f429-dma2d demo build
Diffstat (limited to 'demos')
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/Makefile2
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/halconf.h4
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c13
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/mcuconf.h6
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.c41
-rw-r--r--demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.h9
6 files changed, 51 insertions, 24 deletions
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/Makefile b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/Makefile
index 894fe9d..f399710 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/Makefile
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/Makefile
@@ -119,7 +119,7 @@ CSRC = $(STARTUPSRC) \
$(STREAMSSRC) \
$(SHELLSRC) \
$(CHIBIOS_CONTRIB)/os/various/devices_lib/lcd/ili9341.c \
- main.c \
+ main.c usbcfg.c \
wolf3d_palette.c \
res/wolf3d_vgagraph_chunk87.c
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/halconf.h b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/halconf.h
index e9b1a23..545e595 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/halconf.h
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/halconf.h
@@ -139,7 +139,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
/**
@@ -160,7 +160,7 @@
* @brief Enables the USB subsystem.
*/
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
-#define HAL_USE_USB FALSE
+#define HAL_USE_USB TRUE
#endif
/**
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c
index aa7ac10..2d8d356 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c
@@ -288,6 +288,7 @@ const SPIConfig spi_cfg5 = {
GPIOC,
GPIOC_SPI5_LCD_CS,
(((1 << 3) & SPI_CR1_BR) | SPI_CR1_SSM | SPI_CR1_SSI | SPI_CR1_MSTR),
+ 0
};
extern SPIDriver SPID5;
@@ -473,10 +474,6 @@ static void dma2d_test(void) {
/* Command line related. */
/*===========================================================================*/
-#if (HAL_USE_SERIAL_USB == TRUE)
-/* Virtual serial port over USB.*/
-SerialUSBDriver SDU1;
-#endif
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256)
@@ -500,7 +497,7 @@ static const ShellCommand commands[] = {
static const ShellConfig shell_cfg1 = {
#if (HAL_USE_SERIAL_USB == TRUE)
- (BaseSequentialStream *)&SDU1,
+ (BaseSequentialStream *)&SDU2,
#else
(BaseSequentialStream *)&SD1,
#endif
@@ -536,8 +533,8 @@ int main(void) {
/*
* Initializes a serial-over-USB CDC driver.
*/
- sduObjectInit(&SDU1);
- sduStart(&SDU1, &serusbcfg);
+ sduObjectInit(&SDU2);
+ sduStart(&SDU2, &serusbcfg);
/*
* Activates the USB driver and then the USB bus pull-up on D+.
@@ -594,7 +591,7 @@ int main(void) {
while (true) {
if (!shelltp) {
#if (HAL_USE_SERIAL_USB == TRUE)
- if (SDU1.config->usbp->state == USB_ACTIVE) {
+ if (SDU2.config->usbp->state == USB_ACTIVE) {
/* Spawns a new shell.*/
shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, "shell", NORMALPRIO, shellThread, (void *) &shell_cfg1);
}
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/mcuconf.h b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/mcuconf.h
index 817ed59..ba13652 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/mcuconf.h
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/mcuconf.h
@@ -243,8 +243,8 @@
*/
#define STM32_SDC_SDIO_DMA_PRIORITY 3
#define STM32_SDC_SDIO_IRQ_PRIORITY 9
-#define STM32_SDC_WRITE_TIMEOUT_MS 250
-#define STM32_SDC_READ_TIMEOUT_MS 25
+#define STM32_SDC_WRITE_TIMEOUT_MS 1000
+#define STM32_SDC_READ_TIMEOUT_MS 1000
#define STM32_SDC_CLOCK_ACTIVATION_DELAY 10
#define STM32_SDC_SDIO_UNALIGNED_SUPPORT TRUE
#define STM32_SDC_SDIO_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
@@ -345,7 +345,7 @@
* USB driver system settings.
*/
#define STM32_USB_USE_OTG1 FALSE
-#define STM32_USB_USE_OTG2 FALSE
+#define STM32_USB_USE_OTG2 TRUE
#define STM32_USB_OTG1_IRQ_PRIORITY 14
#define STM32_USB_OTG2_IRQ_PRIORITY 14
#define STM32_USB_OTG1_RX_FIFO_SIZE 512
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.c b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.c
index 9f95a2a..b03209b 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.c
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.c
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,6 +17,9 @@
#include "ch.h"
#include "hal.h"
+/* Virtual serial port over USB.*/
+SerialUSBDriver SDU2;
+
/*
* Endpoints to be used for USBD2.
*/
@@ -262,11 +265,9 @@ static const USBEndpointConfig ep2config = {
* Handles the USB driver global events.
*/
static void usb_event(USBDriver *usbp, usbevent_t event) {
- extern SerialUSBDriver SDU1;
+ extern SerialUSBDriver SDU2;
switch (event) {
- case USB_EVENT_RESET:
- return;
case USB_EVENT_ADDRESS:
return;
case USB_EVENT_CONFIGURED:
@@ -279,13 +280,29 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
usbInitEndpointI(usbp, USBD2_INTERRUPT_REQUEST_EP, &ep2config);
/* Resetting the state of the CDC subsystem.*/
- sduConfigureHookI(&SDU1);
+ sduConfigureHookI(&SDU2);
chSysUnlockFromISR();
return;
+ case USB_EVENT_RESET:
+ /* Falls into.*/
+ case USB_EVENT_UNCONFIGURED:
+ /* Falls into.*/
case USB_EVENT_SUSPEND:
+ chSysLockFromISR();
+
+ /* Disconnection event on suspend.*/
+ sduSuspendHookI(&SDU2);
+
+ chSysUnlockFromISR();
return;
case USB_EVENT_WAKEUP:
+ chSysLockFromISR();
+
+ /* Disconnection event on suspend.*/
+ sduWakeupHookI(&SDU2);
+
+ chSysUnlockFromISR();
return;
case USB_EVENT_STALLED:
return;
@@ -294,13 +311,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(&SDU2);
+ osalSysUnlockFromISR();
+}
+
+/*
* USB driver configuration.
*/
const USBConfig usbcfg = {
usb_event,
get_descriptor,
sduRequestsHook,
- NULL
+ sof_handler
};
/*
diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.h b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.h
index 2ffaa17..d23b83c 100644
--- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.h
+++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/usbcfg.h
@@ -1,5 +1,5 @@
/*
- ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,12 +14,13 @@
limitations under the License.
*/
-#ifndef _USBCFG_H_
-#define _USBCFG_H_
+#ifndef USBCFG_H
+#define USBCFG_H
extern const USBConfig usbcfg;
extern SerialUSBConfig serusbcfg;
+extern SerialUSBDriver SDU2;
-#endif /* _USBCFG_H_ */
+#endif /* USBCFG_H */
/** @} */