/* * Copyright (c) 2017 Linaro Limited * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_STM32_PINCTRLF1_H_ #define ZEPHYR_STM32_PINCTRLF1_H_ #include /* Adapted from Linux: include/dt-bindings/pinctrl/stm32-pinfunc.h */ /** * @brief Macro to generate pinmux int using port, pin number and mode arguments * This is adapted from Linux equivalent st,stm32f429-pinctrl binding */ #define PIN_NO(port, line) (((port) - 'A') * 0x10 + (line)) #define STM32F1_PINMUX(port, line, mode, remap) \ (((PIN_NO(port, line)) << 8) | (mode << 6) | (remap)) /** * @brief Pin modes */ #define ALTERNATE 0x0 /* Alternate function output */ #define GPIO_IN 0x1 /* Input */ #define ANALOG 0x2 /* Analog */ /** * @brief Pin remapping configurations */ #define NO_REMAP 0x0 /* No remapping */ #define REMAP_1 0x1 /* Partial remapping 1 */ #define REMAP_2 0x2 /* Partial remapping 2 */ #define REMAP_3 0x3 /* Partial remapping 3 */ #define REMAP_FULL 0x4 /* Full remapping */ /** * @brief PIN configuration bitfield * * Pin configuration is coded with the following * fields * GPIO I/O Mode [ 0 ] * GPIO Input config [ 1 : 2 ] * GPIO Output speed [ 3 : 4 ] * GPIO Output PP/OD [ 5 ] * GPIO Output AF/GP [ 6 ] * GPIO PUPD Config [ 7 : 8 ] * * Applicable to STM32F1 series */ /* Alternate functions */ /* STM32F1 Pinmux doesn't use explicit alternate functions */ /* These are kept for compatibility with other STM32 pinmux */ #define STM32_AFR_MASK 0 #define STM32_AFR_SHIFT 0 /* Port Mode */ #define STM32_MODE_INPUT (0x0<