Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/stm32l4/Doxyfile5
-rw-r--r--include/libopencm3/stm32/gpio.h2
-rw-r--r--include/libopencm3/stm32/l4/gpio.h89
-rw-r--r--include/libopencm3/stm32/l4/memorymap.h10
-rw-r--r--lib/stm32/l4/Makefile1
5 files changed, 102 insertions, 5 deletions
diff --git a/doc/stm32l4/Doxyfile b/doc/stm32l4/Doxyfile
index f9fdf216..6af32498 100644
--- a/doc/stm32l4/Doxyfile
+++ b/doc/stm32l4/Doxyfile
@@ -19,10 +19,15 @@ INPUT = ../../include/libopencm3/license.dox
INPUT +=../../include/libopencm3/stm32/l4
#INPUT +=../../include/libopencm3/stm32/common
INPUT +=../../include/libopencm3/stm32/common/rcc_common_all.h
+INPUT +=../../include/libopencm3/stm32/common/gpio_common_all.h
+INPUT +=../../include/libopencm3/stm32/common/gpio_common_f234.h
+INPUT +=../../include/libopencm3/stm32/common/gpio_common_f24.h
INPUT +=../../lib/stm32/l4
#INPUT +=../../lib/stm32/common
INPUT +=../../lib/stm32/common/rcc_common_all.c
+INPUT +=../../lib/stm32/common/gpio_common_all.c
+INPUT +=../../lib/stm32/common/gpio_common_f0234.c
# No headers to exclude until we include some!
EXCLUDE =
diff --git a/include/libopencm3/stm32/gpio.h b/include/libopencm3/stm32/gpio.h
index 3aa55740..fe6b19cb 100644
--- a/include/libopencm3/stm32/gpio.h
+++ b/include/libopencm3/stm32/gpio.h
@@ -36,6 +36,8 @@
# include <libopencm3/stm32/l0/gpio.h>
#elif defined(STM32L1)
# include <libopencm3/stm32/l1/gpio.h>
+#elif defined(STM32L4)
+# include <libopencm3/stm32/l4/gpio.h>
#else
# error "stm32 family not defined."
#endif
diff --git a/include/libopencm3/stm32/l4/gpio.h b/include/libopencm3/stm32/l4/gpio.h
new file mode 100644
index 00000000..2f077daf
--- /dev/null
+++ b/include/libopencm3/stm32/l4/gpio.h
@@ -0,0 +1,89 @@
+/** @defgroup gpio_defines GPIO Defines
+ *
+ * @brief <b>Defined Constants and Types for the STM32L4xx General Purpose I/O</b>
+ *
+ * @ingroup STM32L4xx_defines
+ *
+ * @version 1.0.0
+ *
+ * @date 12 November 2015
+ *
+ * LGPL License Terms @ref lgpl_license
+ */
+
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBOPENCM3_GPIO_H
+#define LIBOPENCM3_GPIO_H
+
+#include <libopencm3/stm32/common/gpio_common_f24.h>
+
+/*****************************************************************************/
+/* Module definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Register definitions */
+/*****************************************************************************/
+
+#define GPIO_BRR(port) MMIO32((port) + 0x28)
+#define GPIOA_BRR GPIO_BRR(GPIOA)
+#define GPIOB_BRR GPIO_BRR(GPIOB)
+#define GPIOC_BRR GPIO_BRR(GPIOC)
+#define GPIOD_BRR GPIO_BRR(GPIOD)
+#define GPIOE_BRR GPIO_BRR(GPIOE)
+#define GPIOF_BRR GPIO_BRR(GPIOF)
+#define GPIOG_BRR GPIO_BRR(GPIOG)
+#define GPIOH_BRR GPIO_BRR(GPIOH)
+
+#define GPIO_ASC(port) MMIO32((port) + 0x2c)
+#define GPIOA_ASC GPIO_ASC(GPIOA)
+#define GPIOB_ASC GPIO_ASC(GPIOB)
+#define GPIOC_ASC GPIO_ASC(GPIOC)
+#define GPIOD_ASC GPIO_ASC(GPIOD)
+#define GPIOE_ASC GPIO_ASC(GPIOE)
+#define GPIOF_ASC GPIO_ASC(GPIOF)
+#define GPIOG_ASC GPIO_ASC(GPIOG)
+#define GPIOH_ASC GPIO_ASC(GPIOH)
+
+/*****************************************************************************/
+/* Register values */
+/*****************************************************************************/
+
+/** @defgroup gpio_speed GPIO Output Pin Speed
+@ingroup gpio_defines
+@{*/
+#define GPIO_OSPEED_LOW 0x0
+#define GPIO_OSPEED_MED 0x1
+#define GPIO_OSPEED_FAST 0x2
+#define GPIO_OSPEED_HIGH 0x3
+/**@}*/
+
+/*****************************************************************************/
+/* API definitions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* API Functions */
+/*****************************************************************************/
+
+BEGIN_DECLS
+
+END_DECLS
+
+#endif
diff --git a/include/libopencm3/stm32/l4/memorymap.h b/include/libopencm3/stm32/l4/memorymap.h
index dbfe612f..f5d9e02c 100644
--- a/include/libopencm3/stm32/l4/memorymap.h
+++ b/include/libopencm3/stm32/l4/memorymap.h
@@ -32,7 +32,7 @@
#define PERIPH_BASE_APB1 (PERIPH_BASE + 0x00000)
#define PERIPH_BASE_APB2 (PERIPH_BASE + 0x10000)
#define PERIPH_BASE_AHB1 (PERIPH_BASE + 0x20000)
-#define PERIPH_BASE_AHB2 (PERIPH_BASE + 0x80000)
+#define PERIPH_BASE_AHB2 (0x48000000U)
/* Register boundary addresses */
@@ -93,10 +93,10 @@
#define TSC_BASE (PERIPH_BASE_AHB1 + 0x4000)
/* AHB2 */
-#define GPIO_PORT_A_BASE (PERIPH_BASE_AHB2 + 0x00000)
-#define GPIO_PORT_B_BASE (PERIPH_BASE_AHB2 + 0x00000)
-#define GPIO_PORT_C_BASE (PERIPH_BASE_AHB2 + 0x00000)
-#define GPIO_PORT_D_BASE (PERIPH_BASE_AHB2 + 0x00000)
+#define GPIO_PORT_A_BASE (PERIPH_BASE_AHB2 + 0x0000)
+#define GPIO_PORT_B_BASE (PERIPH_BASE_AHB2 + 0x0400)
+#define GPIO_PORT_C_BASE (PERIPH_BASE_AHB2 + 0x0800)
+#define GPIO_PORT_D_BASE (PERIPH_BASE_AHB2 + 0x0c00)
#define GPIO_PORT_E_BASE (PERIPH_BASE_AHB2 + 0x1000)
#define GPIO_PORT_F_BASE (PERIPH_BASE_AHB2 + 0x1400)
#define GPIO_PORT_G_BASE (PERIPH_BASE_AHB2 + 0x1800)
diff --git a/lib/stm32/l4/Makefile b/lib/stm32/l4/Makefile
index 4dd738c8..8a8e6904 100644
--- a/lib/stm32/l4/Makefile
+++ b/lib/stm32/l4/Makefile
@@ -41,6 +41,7 @@ OBJS =
# common/shared objs
OBJS += rcc_common_all.o
+OBJS += gpio_common_all.o gpio_common_f0234.o
VPATH += ../../usb:../:../../cm3:../common
VPATH += ../../ethernet