aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/platforms/AT91SAM7/mac_lld.h12
-rw-r--r--os/hal/platforms/STM32/adc_lld.h82
-rw-r--r--os/hal/platforms/STM32/can_lld.h8
-rw-r--r--os/hal/platforms/STM32/spi_lld.h12
-rw-r--r--os/hal/templates/adc_lld.h10
-rw-r--r--os/hal/templates/can_lld.h8
-rw-r--r--os/hal/templates/mac_lld.h12
-rw-r--r--os/hal/templates/meta/driver_lld.h4
-rw-r--r--os/hal/templates/pwm_lld.h4
-rw-r--r--os/hal/templates/serial_lld.h6
-rw-r--r--os/hal/templates/spi_lld.h8
11 files changed, 123 insertions, 43 deletions
diff --git a/os/hal/platforms/AT91SAM7/mac_lld.h b/os/hal/platforms/AT91SAM7/mac_lld.h
index 4de8dc481..23139e989 100644
--- a/os/hal/platforms/AT91SAM7/mac_lld.h
+++ b/os/hal/platforms/AT91SAM7/mac_lld.h
@@ -54,10 +54,6 @@
#define MAC_BUFFERS_SIZE 1518
#endif
-/*===========================================================================*/
-/* EMAC specific settings. */
-/*===========================================================================*/
-
/**
* @brief Interrupt priority level for the EMAC device.
*/
@@ -66,6 +62,14 @@
#endif
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS
+#error "the MAC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS"
+#endif
+
+/*===========================================================================*/
/* EMAC specific constants. */
/*===========================================================================*/
diff --git a/os/hal/platforms/STM32/adc_lld.h b/os/hal/platforms/STM32/adc_lld.h
index 5535a32c3..1d3a03991 100644
--- a/os/hal/platforms/STM32/adc_lld.h
+++ b/os/hal/platforms/STM32/adc_lld.h
@@ -30,43 +30,6 @@
#if CH_HAL_USE_ADC || defined(__DOXYGEN__)
/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @brief ADC1 driver enable switch.
- * @details If set to @p TRUE the support for ADC1 is included.
- * @note The default is @p TRUE.
- */
-#if !defined(USE_STM32_ADC1) || defined(__DOXYGEN__)
-#define USE_STM32_ADC1 TRUE
-#endif
-
-/**
- * @brief ADC1 DMA priority (0..3|lowest..highest).
- */
-#if !defined(STM32_ADC1_DMA_PRIORITY) || defined(__DOXYGEN__)
-#define STM32_ADC1_DMA_PRIORITY 1
-#endif
-
-/**
- * @brief ADC1 interrupt priority level setting.
- * @note @p BASEPRI_KERNEL >= @p STM32_ADC1_IRQ_PRIORITY > @p PRIORITY_PENDSV.
- */
-#if !defined(STM32_ADC1_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define STM32_ADC1_IRQ_PRIORITY 0x70
-#endif
-
-/**
- * @brief ADC1 DMA error hook.
- * @note The default action for DMA errors is a system halt because DMA error
- * can only happen because programming errors.
- */
-#if !defined(STM32_ADC1_DMA_ERROR_HOOK) || defined(__DOXYGEN__)
-#define STM32_ADC1_DMA_ERROR_HOOK() chSysHalt()
-#endif
-
-/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
@@ -114,6 +77,51 @@
#define ADC_SQR1_SQ16_N(n) ((n) << 15)
/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/**
+ * @brief ADC1 driver enable switch.
+ * @details If set to @p TRUE the support for ADC1 is included.
+ * @note The default is @p TRUE.
+ */
+#if !defined(USE_STM32_ADC1) || defined(__DOXYGEN__)
+#define USE_STM32_ADC1 TRUE
+#endif
+
+/**
+ * @brief ADC1 DMA priority (0..3|lowest..highest).
+ */
+#if !defined(STM32_ADC1_DMA_PRIORITY) || defined(__DOXYGEN__)
+#define STM32_ADC1_DMA_PRIORITY 1
+#endif
+
+/**
+ * @brief ADC1 interrupt priority level setting.
+ * @note @p BASEPRI_KERNEL >= @p STM32_ADC1_IRQ_PRIORITY > @p PRIORITY_PENDSV.
+ */
+#if !defined(STM32_ADC1_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define STM32_ADC1_IRQ_PRIORITY 0x70
+#endif
+
+/**
+ * @brief ADC1 DMA error hook.
+ * @note The default action for DMA errors is a system halt because DMA error
+ * can only happen because programming errors.
+ */
+#if !defined(STM32_ADC1_DMA_ERROR_HOOK) || defined(__DOXYGEN__)
+#define STM32_ADC1_DMA_ERROR_HOOK() chSysHalt()
+#endif
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_SEMAPHORES
+#error "the ADC driver requires CH_USE_SEMAPHORES"
+#endif
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/platforms/STM32/can_lld.h b/os/hal/platforms/STM32/can_lld.h
index a71d6b68d..24f88cb80 100644
--- a/os/hal/platforms/STM32/can_lld.h
+++ b/os/hal/platforms/STM32/can_lld.h
@@ -103,6 +103,14 @@
#endif /* !CAN_SUPPORTS_SLEEP */
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS
+#error "the ADC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS"
+#endif
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/platforms/STM32/spi_lld.h b/os/hal/platforms/STM32/spi_lld.h
index c18c47853..8748962f2 100644
--- a/os/hal/platforms/STM32/spi_lld.h
+++ b/os/hal/platforms/STM32/spi_lld.h
@@ -30,6 +30,10 @@
#if CH_HAL_USE_SPI || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -106,6 +110,14 @@
#endif
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if SPI_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES
+#error "SPI_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES"
+#endif
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h
index 2ebbc9cf5..701ac14cd 100644
--- a/os/hal/templates/adc_lld.h
+++ b/os/hal/templates/adc_lld.h
@@ -30,13 +30,21 @@
#if CH_HAL_USE_ADC || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
-/* Driver constants. */
+/* Derived constants and error checks. */
/*===========================================================================*/
+#if !CH_USE_SEMAPHORES
+#error "the ADC driver requires CH_USE_SEMAPHORES"
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h
index 5b41536e1..b70c839be 100644
--- a/os/hal/templates/can_lld.h
+++ b/os/hal/templates/can_lld.h
@@ -57,6 +57,14 @@
#endif /* !CAN_SUPPORTS_SLEEP */
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS
+#error "the ADC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS"
+#endif
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/templates/mac_lld.h b/os/hal/templates/mac_lld.h
index 41cef6dba..616b24512 100644
--- a/os/hal/templates/mac_lld.h
+++ b/os/hal/templates/mac_lld.h
@@ -30,6 +30,10 @@
#if CH_HAL_USE_MAC || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -55,6 +59,14 @@
#endif
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS
+#error "the MAC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS"
+#endif
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/templates/meta/driver_lld.h b/os/hal/templates/meta/driver_lld.h
index ba85041e8..e066ce1a6 100644
--- a/os/hal/templates/meta/driver_lld.h
+++ b/os/hal/templates/meta/driver_lld.h
@@ -38,6 +38,10 @@
/*===========================================================================*/
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h
index 41f8a5ac7..0ee02824e 100644
--- a/os/hal/templates/pwm_lld.h
+++ b/os/hal/templates/pwm_lld.h
@@ -43,6 +43,10 @@
#endif
/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
diff --git a/os/hal/templates/serial_lld.h b/os/hal/templates/serial_lld.h
index 43ba1bdda..6457c240a 100644
--- a/os/hal/templates/serial_lld.h
+++ b/os/hal/templates/serial_lld.h
@@ -30,11 +30,15 @@
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
-/* Driver constants. */
+/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h
index 0bdeee018..8284a871b 100644
--- a/os/hal/templates/spi_lld.h
+++ b/os/hal/templates/spi_lld.h
@@ -30,6 +30,10 @@
#if CH_HAL_USE_SPI || defined(__DOXYGEN__)
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -40,6 +44,10 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
#if SPI_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES
#error "SPI_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES"
#endif