aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/hal/ports/STM32/LLD/GPIOv3/stm32_gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/hal/ports/STM32/LLD/GPIOv3/stm32_gpio.h')
-rw-r--r--lib/chibios/os/hal/ports/STM32/LLD/GPIOv3/stm32_gpio.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/lib/chibios/os/hal/ports/STM32/LLD/GPIOv3/stm32_gpio.h b/lib/chibios/os/hal/ports/STM32/LLD/GPIOv3/stm32_gpio.h
new file mode 100644
index 000000000..79ffa7ca8
--- /dev/null
+++ b/lib/chibios/os/hal/ports/STM32/LLD/GPIOv3/stm32_gpio.h
@@ -0,0 +1,113 @@
1/*
2 ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file GPIOv3/stm32_gpio.h
19 * @brief STM32 GPIO units common header.
20 * @note This file requires definitions from the ST STM32 header file.
21 *
22 * @addtogroup STM32_GPIOv3
23 * @{
24 */
25
26#ifndef STM32_GPIO_H
27#define STM32_GPIO_H
28
29/*===========================================================================*/
30/* Driver constants. */
31/*===========================================================================*/
32
33/* Discarded definitions from the ST headers, the PAL driver uses its own
34 definitions in order to have an unified handling for all devices.
35 Unfortunately the ST headers have no uniform definitions for the same
36 objects across the various sub-families.*/
37#undef GPIOA
38#undef GPIOB
39#undef GPIOC
40#undef GPIOD
41#undef GPIOE
42#undef GPIOF
43#undef GPIOG
44#undef GPIOH
45#undef GPIOI
46#undef GPIOJ
47#undef GPIOK
48
49/**
50 * @name GPIO ports definitions
51 * @{
52 */
53#define GPIOA ((stm32_gpio_t *)GPIOA_BASE)
54#define GPIOB ((stm32_gpio_t *)GPIOB_BASE)
55#define GPIOC ((stm32_gpio_t *)GPIOC_BASE)
56#define GPIOD ((stm32_gpio_t *)GPIOD_BASE)
57#define GPIOE ((stm32_gpio_t *)GPIOE_BASE)
58#define GPIOF ((stm32_gpio_t *)GPIOF_BASE)
59#define GPIOG ((stm32_gpio_t *)GPIOG_BASE)
60#define GPIOH ((stm32_gpio_t *)GPIOH_BASE)
61#define GPIOI ((stm32_gpio_t *)GPIOI_BASE)
62#define GPIOJ ((stm32_gpio_t *)GPIOJ_BASE)
63#define GPIOK ((stm32_gpio_t *)GPIOK_BASE)
64/** @} */
65
66/*===========================================================================*/
67/* Driver pre-compile time settings. */
68/*===========================================================================*/
69
70/*===========================================================================*/
71/* Derived constants and error checks. */
72/*===========================================================================*/
73
74/*===========================================================================*/
75/* Driver data structures and types. */
76/*===========================================================================*/
77
78/**
79 * @brief STM32 GPIO registers block.
80 */
81typedef struct {
82
83 volatile uint32_t MODER;
84 volatile uint32_t OTYPER;
85 volatile uint32_t OSPEEDR;
86 volatile uint32_t PUPDR;
87 volatile uint32_t IDR;
88 volatile uint32_t ODR;
89 volatile union {
90 uint32_t W;
91 struct {
92 uint16_t set;
93 uint16_t clear;
94 } H;
95 } BSRR;
96 volatile uint32_t LOCKR;
97 volatile uint32_t AFRL;
98 volatile uint32_t AFRH;
99 volatile uint32_t BRR;
100 volatile uint32_t ASCR;
101} stm32_gpio_t;
102
103/*===========================================================================*/
104/* Driver macros. */
105/*===========================================================================*/
106
107/*===========================================================================*/
108/* External declarations. */
109/*===========================================================================*/
110
111#endif /* STM32_GPIO_H */
112
113/** @} */