aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libopencm3/stm32/common/crc_common_all.h9
-rw-r--r--include/libopencm3/stm32/common/dac_common_all.h9
-rw-r--r--include/libopencm3/stm32/common/dma_common_f13.h9
-rw-r--r--include/libopencm3/stm32/common/dma_common_f24.h8
-rw-r--r--include/libopencm3/stm32/common/gpio_common_all.h8
-rw-r--r--include/libopencm3/stm32/common/gpio_common_f24.h8
-rw-r--r--include/libopencm3/stm32/common/i2c_common_all.h8
-rw-r--r--include/libopencm3/stm32/common/i2c_common_f24.h8
-rw-r--r--include/libopencm3/stm32/common/iwdg_common_all.h8
-rw-r--r--include/libopencm3/stm32/common/pwr_common_all.h9
-rw-r--r--include/libopencm3/stm32/common/rng_common_f24.h9
-rw-r--r--include/libopencm3/stm32/common/rtc_common_bcd.h11
-rw-r--r--include/libopencm3/stm32/common/spi_common_all.h9
-rw-r--r--include/libopencm3/stm32/common/spi_common_f24.h8
-rw-r--r--include/libopencm3/stm32/common/usart_common_all.h8
-rw-r--r--include/libopencm3/stm32/common/usart_common_f24.h9
-rw-r--r--include/libopencm3/stm32/f2/rng.h4
-rw-r--r--include/libopencm3/stm32/f4/rng.h4
-rw-r--r--lib/stm32/common/gpio_common_f24.c1
-rw-r--r--lib/stm32/f1/gpio.c1
-rw-r--r--lib/stm32/f2/gpio.c2
-rw-r--r--lib/stm32/f4/gpio.c2
-rw-r--r--lib/stm32/l1/gpio.c2
23 files changed, 128 insertions, 26 deletions
diff --git a/include/libopencm3/stm32/common/crc_common_all.h b/include/libopencm3/stm32/common/crc_common_all.h
index 209f19b..ad87c66 100644
--- a/include/libopencm3/stm32/common/crc_common_all.h
+++ b/include/libopencm3/stm32/common/crc_common_all.h
@@ -23,8 +23,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA CRC.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA CRC.H
+The order of header inclusion is important. crc.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_CRC_H
#ifndef LIBOPENCM3_CRC_COMMON_ALL_H
#define LIBOPENCM3_CRC_COMMON_ALL_H
@@ -87,3 +90,7 @@ u32 crc_calculate_block(u32 *datap, int size);
END_DECLS
#endif
+#else
+#warning "crc_common_all.h should not be included explicitly, only via crc.h"
+#endif
+
diff --git a/include/libopencm3/stm32/common/dac_common_all.h b/include/libopencm3/stm32/common/dac_common_all.h
index 94bf01b..b3f7568 100644
--- a/include/libopencm3/stm32/common/dac_common_all.h
+++ b/include/libopencm3/stm32/common/dac_common_all.h
@@ -25,6 +25,11 @@
/**@{*/
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA DAC.H
+The order of header inclusion is important. dac.h includes the device
+specific memorymap.h header before including this header file.*/
+
+#ifdef LIBOPENCM3_DAC_H
#ifndef LIBOPENCM3_DAC_COMMON_ALL_H
#define LIBOPENCM3_DAC_COMMON_ALL_H
@@ -403,5 +408,9 @@ void dac_software_trigger(data_channel dac_channel);
END_DECLS
#endif
+#else
+#warning "dac_common_all.h should not be included explicitly, only via dac.h"
+#endif
+
/**@}*/
diff --git a/include/libopencm3/stm32/common/dma_common_f13.h b/include/libopencm3/stm32/common/dma_common_f13.h
index 68ade00..642ed73 100644
--- a/include/libopencm3/stm32/common/dma_common_f13.h
+++ b/include/libopencm3/stm32/common/dma_common_f13.h
@@ -27,6 +27,11 @@
/**@{*/
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA DMA.H
+The order of header inclusion is important. dma.h includes the device
+specific memorymap.h header before including this header file.*/
+
+#ifdef LIBOPENCM3_DMA_H
#ifndef LIBOPENCM3_DMA_COMMON_F13_H
#define LIBOPENCM3_DMA_COMMON_F13_H
@@ -390,5 +395,9 @@ void dma_set_number_of_data(u32 dma, u8 channel, u16 number);
END_DECLS
#endif
+#else
+#warning "dma_common_f13.h should not be included explicitly, only via dma.h"
+#endif
+
/**@}*/
diff --git a/include/libopencm3/stm32/common/dma_common_f24.h b/include/libopencm3/stm32/common/dma_common_f24.h
index ecf9fcf..c8aab3e 100644
--- a/include/libopencm3/stm32/common/dma_common_f24.h
+++ b/include/libopencm3/stm32/common/dma_common_f24.h
@@ -24,8 +24,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA DMA.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA DMA.H
+The order of header inclusion is important. dma.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_DMA_H
#ifndef LIBOPENCM3_DMA_COMMON_F24_H
#define LIBOPENCM3_DMA_COMMON_F24_H
@@ -605,4 +608,7 @@ void dma_set_number_of_data(u32 dma, u8 stream, u16 number);
END_DECLS
/**@}*/
#endif
+#else
+#warning "dma_common_f24.h should not be included explicitly, only via dma.h"
+#endif
diff --git a/include/libopencm3/stm32/common/gpio_common_all.h b/include/libopencm3/stm32/common/gpio_common_all.h
index 4d03db0..beac325 100644
--- a/include/libopencm3/stm32/common/gpio_common_all.h
+++ b/include/libopencm3/stm32/common/gpio_common_all.h
@@ -25,8 +25,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA GPIO.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA GPIO.H
+The order of header inclusion is important. gpio.h includes the device
+specific memorymap.h header before including this header file.*/
+#if defined (LIBOPENCM3_GPIO_H) || defined (LIBOPENCM3_GPIO_COMMON_F24_H)
#ifndef LIBOPENCM3_GPIO_COMMON_ALL_H
#define LIBOPENCM3_GPIO_COMMON_ALL_H
@@ -79,4 +82,7 @@ END_DECLS
/**@}*/
#endif
+#else
+#warning "gpio_common_all.h should not be included explicitly, only via gpio.h"
+#endif
diff --git a/include/libopencm3/stm32/common/gpio_common_f24.h b/include/libopencm3/stm32/common/gpio_common_f24.h
index 2ce0167..6263d51 100644
--- a/include/libopencm3/stm32/common/gpio_common_f24.h
+++ b/include/libopencm3/stm32/common/gpio_common_f24.h
@@ -24,8 +24,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA GPIO.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA GPIO.H
+The order of header inclusion is important. gpio.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_GPIO_H
#ifndef LIBOPENCM3_GPIO_COMMON_F24_H
#define LIBOPENCM3_GPIO_COMMON_F24_H
@@ -287,4 +290,7 @@ void gpio_set_af(u32 gpioport, u8 alt_func_num, u16 gpios);
END_DECLS
/**@}*/
#endif
+#else
+#warning "gpio_common_f24.h should not be included explicitly, only via gpio.h"
+#endif
diff --git a/include/libopencm3/stm32/common/i2c_common_all.h b/include/libopencm3/stm32/common/i2c_common_all.h
index 7f6d447..cd954cb 100644
--- a/include/libopencm3/stm32/common/i2c_common_all.h
+++ b/include/libopencm3/stm32/common/i2c_common_all.h
@@ -23,8 +23,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA I2C.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA I2C.H
+The order of header inclusion is important. i2c.h includes the device
+specific memorymap.h header before including this header file.*/
+#if defined (LIBOPENCM3_I2C_H) || defined (LIBOPENCM3_I2C_COMMON_F24_H)
#ifndef LIBOPENCM3_I2C_COMMON_ALL_H
#define LIBOPENCM3_I2C_COMMON_ALL_H
@@ -383,5 +386,8 @@ void i2c_clear_dma_last_transfer(u32 i2c);
END_DECLS
#endif
+#else
+#warning "i2c_common_all.h should not be included explicitly, only via i2c.h"
+#endif
/**@}*/
diff --git a/include/libopencm3/stm32/common/i2c_common_f24.h b/include/libopencm3/stm32/common/i2c_common_f24.h
index c267bd8..8cb4ae7 100644
--- a/include/libopencm3/stm32/common/i2c_common_f24.h
+++ b/include/libopencm3/stm32/common/i2c_common_f24.h
@@ -23,8 +23,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA I2C.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA I2C.H
+The order of header inclusion is important. i2c.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_I2C_H
#ifndef LIBOPENCM3_I2C_COMMON_F24_H
#define LIBOPENCM3_I2C_COMMON_F24_H
@@ -37,3 +40,6 @@
/**@}*/
#endif
+#else
+#warning "i2c_common_f24.h should not be included explicitly, only via i2c.h"
+#endif
diff --git a/include/libopencm3/stm32/common/iwdg_common_all.h b/include/libopencm3/stm32/common/iwdg_common_all.h
index b75e4d1..eed4cdb 100644
--- a/include/libopencm3/stm32/common/iwdg_common_all.h
+++ b/include/libopencm3/stm32/common/iwdg_common_all.h
@@ -22,8 +22,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA IWDG.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA IWDG.H
+The order of header inclusion is important. iwdg.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_IWDG_H
#ifndef LIBOPENCM3_IWDG_COMMON_ALL_H
#define LIBOPENCM3_IWDG_COMMON_ALL_H
@@ -109,5 +112,8 @@ void iwdg_reset(void);
END_DECLS
#endif
+#else
+#warning "iwdg_common_all.h should not be included explicitly, only via iwdg.h"
+#endif
/**@}*/
diff --git a/include/libopencm3/stm32/common/pwr_common_all.h b/include/libopencm3/stm32/common/pwr_common_all.h
index a6b38d8..fd9b422 100644
--- a/include/libopencm3/stm32/common/pwr_common_all.h
+++ b/include/libopencm3/stm32/common/pwr_common_all.h
@@ -23,8 +23,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA PWR.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA PWR.H
+The order of header inclusion is important. pwr.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_PWR_H
#ifndef LIBOPENCM3_PWR_COMMON_ALL_H
#define LIBOPENCM3_PWR_COMMON_ALL_H
@@ -121,3 +124,7 @@ END_DECLS
/**@}*/
#endif
+#else
+#warning "pwr_common_all.h should not be included explicitly, only via pwr.h"
+#endif
+
diff --git a/include/libopencm3/stm32/common/rng_common_f24.h b/include/libopencm3/stm32/common/rng_common_f24.h
index 7d98bfa..4fb3745 100644
--- a/include/libopencm3/stm32/common/rng_common_f24.h
+++ b/include/libopencm3/stm32/common/rng_common_f24.h
@@ -16,6 +16,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA RNG.H
+The order of header inclusion is important. rng.h includes the device
+specific memorymap.h header before including this header file.*/
+
+#ifdef LIBOPENCM3_RNG_H
#ifndef LIBOPENCM3_RNG_COMMON_F24_H
#define LIBOPENCM3_RNG_COMMON_F24_H
@@ -59,3 +64,7 @@
#define RNG_SR_SEIS (1 << 6)
#endif
+#else
+#warning "rng_common_f24.h should not be included explicitly, only via rng.h"
+#endif
+
diff --git a/include/libopencm3/stm32/common/rtc_common_bcd.h b/include/libopencm3/stm32/common/rtc_common_bcd.h
index 41afe3f..791af8d 100644
--- a/include/libopencm3/stm32/common/rtc_common_bcd.h
+++ b/include/libopencm3/stm32/common/rtc_common_bcd.h
@@ -22,8 +22,6 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA RTC.H */
-
/*
* This covers the "version 2" RTC peripheral. This is completely different
* to the v1 RTC periph on the F1 series devices. It has BCD counters, with
@@ -32,6 +30,11 @@
* only support a subset.
*/
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA RTC.H
+The order of header inclusion is important. rtc.h includes the device
+specific memorymap.h header before including this header file.*/
+
+#ifdef LIBOPENCM3_RTC_H
#ifndef LIBOPENCM3_RTC2_H
#define LIBOPENCM3_RTC2_H
@@ -316,4 +319,8 @@ END_DECLS
/**@}*/
#endif /* RTC2_H */
+#else
+#warning "rtc_common_bcd.h should not be included explicitly, only via rtc.h"
+#endif
+
diff --git a/include/libopencm3/stm32/common/spi_common_all.h b/include/libopencm3/stm32/common/spi_common_all.h
index a337c37..26086f7 100644
--- a/include/libopencm3/stm32/common/spi_common_all.h
+++ b/include/libopencm3/stm32/common/spi_common_all.h
@@ -23,8 +23,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA SPI.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA SPI.H
+The order of header inclusion is important. spi.h includes the device
+specific memorymap.h header before including this header file.*/
+#if defined (LIBOPENCM3_SPI_H) || defined (LIBOPENCM3_SPI_COMMON_F24_H)
#ifndef LIBOPENCM3_SPI_COMMON_ALL_H
#define LIBOPENCM3_SPI_COMMON_ALL_H
@@ -402,3 +405,7 @@ END_DECLS
/**@}*/
#endif
+#else
+#warning "spi_common_all.h should not be included explicitly, only via spi.h"
+#endif
+
diff --git a/include/libopencm3/stm32/common/spi_common_f24.h b/include/libopencm3/stm32/common/spi_common_f24.h
index 0a5873d..ad90142 100644
--- a/include/libopencm3/stm32/common/spi_common_f24.h
+++ b/include/libopencm3/stm32/common/spi_common_f24.h
@@ -22,8 +22,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA SPI.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA SPI.H
+The order of header inclusion is important. spi.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_SPI_H
#ifndef LIBOPENCM3_SPI_COMMON_F24_H
#define LIBOPENCM3_SPI_COMMON_F24_H
@@ -50,5 +53,8 @@
#define SPI_SR_TIFRFE (1 << 8)
#endif
+#else
+#warning "spi_common_f24.h should not be included explicitly, only via spi.h"
+#endif
/**@}*/
diff --git a/include/libopencm3/stm32/common/usart_common_all.h b/include/libopencm3/stm32/common/usart_common_all.h
index b7ab394..2f33942 100644
--- a/include/libopencm3/stm32/common/usart_common_all.h
+++ b/include/libopencm3/stm32/common/usart_common_all.h
@@ -25,8 +25,11 @@
/**@{*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA SPI.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA USART.H
+The order of header inclusion is important. usart.h includes the device
+specific memorymap.h header before including this header file.*/
+#if defined (LIBOPENCM3_USART_H) || defined (LIBOPENCM3_USART_COMMON_F24_H)
#ifndef LIBOPENCM3_USART_COMMON_ALL_H
#define LIBOPENCM3_USART_COMMON_ALL_H
@@ -371,5 +374,8 @@ bool usart_get_interrupt_source(u32 usart, u32 flag);
END_DECLS
#endif
+#else
+#warning "usart_common_all.h should not be included explicitly, only via usart.h"
+#endif
/**@}*/
diff --git a/include/libopencm3/stm32/common/usart_common_f24.h b/include/libopencm3/stm32/common/usart_common_f24.h
index 301eceb..22bb194 100644
--- a/include/libopencm3/stm32/common/usart_common_f24.h
+++ b/include/libopencm3/stm32/common/usart_common_f24.h
@@ -24,8 +24,11 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA SPI.H */
+/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA USART.H
+The order of header inclusion is important. usart.h includes the device
+specific memorymap.h header before including this header file.*/
+#ifdef LIBOPENCM3_USART_H
#ifndef LIBOPENCM3_USART_COMMON_F24_H
#define LIBOPENCM3_USART_COMMON_F24_H
@@ -69,3 +72,7 @@
#define USART_CR3_ONEBIT (1 << 11)
#endif
+#else
+#warning "usart_common_f24.h should not be included explicitly, only via usart.h"
+#endif
+
diff --git a/include/libopencm3/stm32/f2/rng.h b/include/libopencm3/stm32/f2/rng.h
index 403c7c7..2dbd5f1 100644
--- a/include/libopencm3/stm32/f2/rng.h
+++ b/include/libopencm3/stm32/f2/rng.h
@@ -15,8 +15,8 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef LIBOPENCM3_RNG_F2_H
-#define LIBOPENCM3_RNG_F2_H
+#ifndef LIBOPENCM3_RNG_H
+#define LIBOPENCM3_RNG_H
#include <libopencm3/stm32/memorymap.h>
#include <libopencm3/stm32/common/rng_common_f24.h>
diff --git a/include/libopencm3/stm32/f4/rng.h b/include/libopencm3/stm32/f4/rng.h
index e8e6cc4..2dbd5f1 100644
--- a/include/libopencm3/stm32/f4/rng.h
+++ b/include/libopencm3/stm32/f4/rng.h
@@ -15,8 +15,8 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef LIBOPENCM3_RNG_F4_H
-#define LIBOPENCM3_RNG_F4_H
+#ifndef LIBOPENCM3_RNG_H
+#define LIBOPENCM3_RNG_H
#include <libopencm3/stm32/memorymap.h>
#include <libopencm3/stm32/common/rng_common_f24.h>
diff --git a/lib/stm32/common/gpio_common_f24.c b/lib/stm32/common/gpio_common_f24.c
index 63c18c3..dfa2bac 100644
--- a/lib/stm32/common/gpio_common_f24.c
+++ b/lib/stm32/common/gpio_common_f24.c
@@ -68,7 +68,6 @@ Example 2: Digital input on port C12 with pullup
/**@{*/
-#include <libopencm3/stm32/common/gpio_common_all.h>
#include <libopencm3/stm32/gpio.h>
/*-----------------------------------------------------------------------------*/
diff --git a/lib/stm32/f1/gpio.c b/lib/stm32/f1/gpio.c
index cbb6b9d..0cc4f5e 100644
--- a/lib/stm32/f1/gpio.c
+++ b/lib/stm32/f1/gpio.c
@@ -73,7 +73,6 @@ LGPL License Terms @ref lgpl_license
*/
#include <libopencm3/stm32/gpio.h>
-#include <libopencm3/stm32/common/gpio_common_all.h>
/**@{*/
diff --git a/lib/stm32/f2/gpio.c b/lib/stm32/f2/gpio.c
index 370f59b..052e306 100644
--- a/lib/stm32/f2/gpio.c
+++ b/lib/stm32/f2/gpio.c
@@ -29,5 +29,3 @@ LGPL License Terms @ref lgpl_license
*/
#include <libopencm3/stm32/gpio.h>
-#include <libopencm3/stm32/common/gpio_common_f24.h>
-
diff --git a/lib/stm32/f4/gpio.c b/lib/stm32/f4/gpio.c
index db42e8d..ea59ae7 100644
--- a/lib/stm32/f4/gpio.c
+++ b/lib/stm32/f4/gpio.c
@@ -29,5 +29,3 @@ LGPL License Terms @ref lgpl_license
*/
#include <libopencm3/stm32/gpio.h>
-#include <libopencm3/stm32/common/gpio_common_f24.h>
-
diff --git a/lib/stm32/l1/gpio.c b/lib/stm32/l1/gpio.c
index fd42ba8..46ea658 100644
--- a/lib/stm32/l1/gpio.c
+++ b/lib/stm32/l1/gpio.c
@@ -29,5 +29,3 @@ LGPL License Terms @ref lgpl_license
*/
#include <libopencm3/stm32/gpio.h>
-#include <libopencm3/stm32/common/gpio_common_all.h>
-