aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-03-09 11:55:46 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-03-09 11:55:46 +0000
commit348784fdf2f714f8559a528f8e5ea96522b364cd (patch)
tree432f79f795ae7b736b02828106af9de9312d6138
parentaa5e4b5e81f2f961b52e1b87a17c9c0eb71ab01b (diff)
downloadChibiOS-348784fdf2f714f8559a528f8e5ea96522b364cd.tar.gz
ChibiOS-348784fdf2f714f8559a528f8e5ea96522b364cd.tar.bz2
ChibiOS-348784fdf2f714f8559a528f8e5ea96522b364cd.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6762 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/include/hal.h1
-rw-r--r--os/hal/ports/STM32/LLD/DACv1/dac_lld.h24
-rw-r--r--testhal/STM32F4xx/DAC/mcuconf.h13
3 files changed, 35 insertions, 3 deletions
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h
index a66376f3b..bab2196d3 100644
--- a/os/hal/include/hal.h
+++ b/os/hal/include/hal.h
@@ -48,6 +48,7 @@
#include "pal.h"
#include "adc.h"
#include "can.h"
+#include "dac.h"
#include "ext.h"
#include "gpt.h"
#include "i2c.h"
diff --git a/os/hal/ports/STM32/LLD/DACv1/dac_lld.h b/os/hal/ports/STM32/LLD/DACv1/dac_lld.h
index 0df5cc8cc..a121d95b6 100644
--- a/os/hal/ports/STM32/LLD/DACv1/dac_lld.h
+++ b/os/hal/ports/STM32/LLD/DACv1/dac_lld.h
@@ -163,7 +163,7 @@
* @note This option is only available on platforms with enhanced DMA.
*/
#if !defined(STM32_DAC_CHN1_DMA_STREAM) || defined(__DOXYGEN__)
-#define STM32_DAC_CHN1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
+#define STM32_DAC_CHN1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
#endif
/**
@@ -171,7 +171,7 @@
* @note This option is only available on platforms with enhanced DMA.
*/
#if !defined(STM32_DAC_CHN2_DMA_STREAM) || defined(__DOXYGEN__)
-#define STM32_DAC_CHN2_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+#define STM32_DAC_CHN2_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
#endif
/**
@@ -179,7 +179,7 @@
* @note This option is only available on platforms with enhanced DMA.
*/
#if !defined(STM32_DAC_CHN3_DMA_STREAM) || defined(__DOXYGEN__)
-#define STM32_DAC_CHN3_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
+#define STM32_DAC_CHN3_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
#endif
/*===========================================================================*/
@@ -202,6 +202,23 @@
#error "DAC driver activated but no DAC peripheral assigned"
#endif
+/* The following checks are only required when there is a DMA able to
+ reassign streams to different channels.*/
+#if STM32_ADVANCED_DMA
+/* Check on the presence of the DMA streams settings in mcuconf.h.*/
+#if STM32_DAC_USE_CHN1 && !defined(STM32_DAC_CHN1_DMA_STREAM)
+#error "DAC1 CHN1 DMA stream not defined"
+#endif
+
+#if STM32_DAC_USE_CHN2 && !defined(STM32_DAC_CHN2_DMA_STREAM)
+#error "DAC1 CHN2 DMA stream not defined"
+#endif
+
+#if STM32_DAC_USE_CHN3 && !defined(STM32_DAC_CHN3_DMA_STREAM)
+#error "DAC1 CHN3 DMA stream not defined"
+#endif
+
+/* Check on the validity of the assigned DMA channels.*/
#if STM32_DAC_USE_CHN1 && \
!STM32_DMA_IS_VALID_ID(STM32_DAC_CHN1_DMA_STREAM, STM32_DAC_CHN1_DMA_MSK)
#error "invalid DMA stream associated to DAC CHN1"
@@ -216,6 +233,7 @@
!STM32_DMA_IS_VALID_ID(STM32_DAC_CHN3_DMA_STREAM, STM32_DAC_CHN3_DMA_MSK)
#error "invalid DMA stream associated to DAC CHN3"
#endif
+#endif /* STM32_ADVANCED_DMA */
#if !defined(STM32_DMA_REQUIRED)
#define STM32_DMA_REQUIRED
diff --git a/testhal/STM32F4xx/DAC/mcuconf.h b/testhal/STM32F4xx/DAC/mcuconf.h
index 5d2a0b735..c9c5681ac 100644
--- a/testhal/STM32F4xx/DAC/mcuconf.h
+++ b/testhal/STM32F4xx/DAC/mcuconf.h
@@ -88,6 +88,19 @@
#define STM32_CAN_CAN2_IRQ_PRIORITY 11
/*
+ * DAC driver system settings.
+ */
+#define STM32_DAC_USE_CHN1 TRUE
+#define STM32_DAC_USE_CHN2 FALSE
+#define STM32_DAC_CHN1_IRQ_PRIORITY 10
+#define STM32_DAC_CHN2_IRQ_PRIORITY 10
+#define STM32_DAC_CHN1_DMA_PRIORITY 2
+#define STM32_DAC_CHN2_DMA_PRIORITY 2
+#define STM32_DAC_DMA_ERROR_HOOK(dacp) osalSysHalt()
+#define STM32_DAC_CHN1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
+#define STM32_DAC_CHN2_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
+
+/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_IRQ_PRIORITY 6