diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_adc.h b/arch/arm/src/stm32l4/hardware/stm32l4_adc.h index 5db9b10cfb23b..07a2acc4e0c49 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_adc.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_adc.h @@ -42,8 +42,7 @@ ************************************************************************************/ #include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_can.h b/arch/arm/src/stm32l4/hardware/stm32l4_can.h index 2eca71947d718..b4a621ad94f2f 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_can.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_can.h @@ -44,9 +44,7 @@ * Included Files ************************************************************************************/ -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_comp.h b/arch/arm/src/stm32l4/hardware/stm32l4_comp.h index 3501b88fb4c55..4576603e517f0 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_comp.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_comp.h @@ -36,6 +36,13 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_COMP_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_COMP_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_crs.h b/arch/arm/src/stm32l4/hardware/stm32l4_crs.h index 57a95ef875051..c37a2e0cb2cac 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_crs.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_crs.h @@ -37,6 +37,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_CRS_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_CRS_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_dac.h b/arch/arm/src/stm32l4/hardware/stm32l4_dac.h index 2c2fb81c50277..c1923e3df7df0 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_dac.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_dac.h @@ -41,8 +41,7 @@ * Included Files ************************************************************************************/ -#include -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_dfsdm.h b/arch/arm/src/stm32l4/hardware/stm32l4_dfsdm.h index 0d0f564a03a9e..4b7b1b6e8c67b 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_dfsdm.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_dfsdm.h @@ -41,8 +41,7 @@ ************************************************************************************/ #include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_exti.h b/arch/arm/src/stm32l4/hardware/stm32l4_exti.h index 05970c97391e3..ebda097b91cf3 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_exti.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_exti.h @@ -40,8 +40,7 @@ * Included Files ************************************************************************************/ -#include -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_flash.h b/arch/arm/src/stm32l4/hardware/stm32l4_flash.h index 23f48add2336f..f347b330a29b5 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_flash.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_flash.h @@ -43,6 +43,7 @@ ************************************************************************************/ #include +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_gpio.h b/arch/arm/src/stm32l4/hardware/stm32l4_gpio.h index 7254ee696265f..d1aa7295ffede 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_gpio.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_gpio.h @@ -40,13 +40,188 @@ * Included Files ************************************************************************************/ -#include -#include +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ +/* Bit-encoded input to stm32l4_configgpio() */ + +/* Each port bit of the general-purpose I/O (GPIO) ports can be individually configured + * by software in several modes: + * + * - Input floating + * - Input pull-up + * - Input-pull-down + * - Output open-drain with pull-up or pull-down capability + * - Output push-pull with pull-up or pull-down capability + * - Alternate function push-pull with pull-up or pull-down capability + * - Alternate function open-drain with pull-up or pull-down capability + * - Analog + * + * 20-bit Encoding: 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * Inputs: MMUU .... ...X PPPP BBBB + * Outputs: MMUU .... FFOV PPPP BBBB + * Alternate Functions: MMUU AAAA FFO. PPPP BBBB + * Analog: MM.. .... .... PPPP BBBB + */ + +/* Mode: + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * MM.. .... .... .... .... + */ + +#define GPIO_MODE_SHIFT (18) /* Bits 18-19: GPIO port mode */ +#define GPIO_MODE_MASK (3 << GPIO_MODE_SHIFT) +# define GPIO_INPUT (0 << GPIO_MODE_SHIFT) /* Input mode */ +# define GPIO_OUTPUT (1 << GPIO_MODE_SHIFT) /* General purpose output mode */ +# define GPIO_ALT (2 << GPIO_MODE_SHIFT) /* Alternate function mode */ +# define GPIO_ANALOG (3 << GPIO_MODE_SHIFT) /* Analog mode */ + +/* Input/output pull-ups/downs (not used with analog): + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * ..UU .... .... .... .... + */ + +#define GPIO_PUPD_SHIFT (16) /* Bits 16-17: Pull-up/pull down */ +#define GPIO_PUPD_MASK (3 << GPIO_PUPD_SHIFT) +# define GPIO_FLOAT (0 << GPIO_PUPD_SHIFT) /* No pull-up, pull-down */ +# define GPIO_PULLUP (1 << GPIO_PUPD_SHIFT) /* Pull-up */ +# define GPIO_PULLDOWN (2 << GPIO_PUPD_SHIFT) /* Pull-down */ + +/* Alternate Functions: + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * .... AAAA .... .... .... + */ + +#define GPIO_AF_SHIFT (12) /* Bits 12-15: Alternate function */ +#define GPIO_AF_MASK (15 << GPIO_AF_SHIFT) +# define GPIO_AF(n) ((n) << GPIO_AF_SHIFT) +# define GPIO_AF0 (0 << GPIO_AF_SHIFT) +# define GPIO_AF1 (1 << GPIO_AF_SHIFT) +# define GPIO_AF2 (2 << GPIO_AF_SHIFT) +# define GPIO_AF3 (3 << GPIO_AF_SHIFT) +# define GPIO_AF4 (4 << GPIO_AF_SHIFT) +# define GPIO_AF5 (5 << GPIO_AF_SHIFT) +# define GPIO_AF6 (6 << GPIO_AF_SHIFT) +# define GPIO_AF7 (7 << GPIO_AF_SHIFT) +# define GPIO_AF8 (8 << GPIO_AF_SHIFT) +# define GPIO_AF9 (9 << GPIO_AF_SHIFT) +# define GPIO_AF10 (10 << GPIO_AF_SHIFT) +# define GPIO_AF11 (11 << GPIO_AF_SHIFT) +# define GPIO_AF12 (12 << GPIO_AF_SHIFT) +# define GPIO_AF13 (13 << GPIO_AF_SHIFT) +# define GPIO_AF14 (14 << GPIO_AF_SHIFT) +# define GPIO_AF15 (15 << GPIO_AF_SHIFT) + +/* Output/Alt function frequency selection: + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * .... .... FF.. .... .... + */ + +#define GPIO_SPEED_SHIFT (10) /* Bits 10-11: GPIO frequency selection */ +#define GPIO_SPEED_MASK (3 << GPIO_SPEED_SHIFT) +# define GPIO_SPEED_2MHz (0 << GPIO_SPEED_SHIFT) /* 2 MHz Low speed output */ +# define GPIO_SPEED_25MHz (1 << GPIO_SPEED_SHIFT) /* 25 MHz Medium speed output */ +# define GPIO_SPEED_50MHz (2 << GPIO_SPEED_SHIFT) /* 50 MHz High speed output */ +# define GPIO_SPEED_100MHz (3 << GPIO_SPEED_SHIFT) /* 100 MHz Very High speed output */ + +/* Output/Alt function type selection: + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * .... .... ..O. .... .... + */ + +#define GPIO_OPENDRAIN (1 << 9) /* Bit9: 1=Open-drain output */ +#define GPIO_PUSHPULL (0) /* Bit9: 0=Push-pull output */ + +/* If the pin is a GPIO digital output, then this identifies the initial output value. + * If the pin is an input, this bit is overloaded to provide the qualifier to + * distinquish input pull-up and -down: + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * .... .... ...V .... .... + */ + +#define GPIO_OUTPUT_SET (1 << 8) /* Bit 8: If output, initial value of output */ +#define GPIO_OUTPUT_CLEAR (0) + +/* External interrupt selection (GPIO inputs only): + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * .... .... ...X .... .... + */ + +#define GPIO_EXTI (1 << 8) /* Bit 8: Configure as EXTI interrupt */ + +/* This identifies the GPIO port: + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * .... .... .... PPPP .... + */ + +#define GPIO_PORT_SHIFT (4) /* Bit 4-7: Port number */ +#define GPIO_PORT_MASK (15 << GPIO_PORT_SHIFT) +# define GPIO_PORTA (0 << GPIO_PORT_SHIFT) /* GPIOA */ +# define GPIO_PORTB (1 << GPIO_PORT_SHIFT) /* GPIOB */ +# define GPIO_PORTC (2 << GPIO_PORT_SHIFT) /* GPIOC */ +# define GPIO_PORTD (3 << GPIO_PORT_SHIFT) /* GPIOD */ +# define GPIO_PORTE (4 << GPIO_PORT_SHIFT) /* GPIOE */ +# define GPIO_PORTF (5 << GPIO_PORT_SHIFT) /* GPIOF */ +# define GPIO_PORTG (6 << GPIO_PORT_SHIFT) /* GPIOG */ +# define GPIO_PORTH (7 << GPIO_PORT_SHIFT) /* GPIOH */ +# define GPIO_PORTI (8 << GPIO_PORT_SHIFT) /* GPIOI */ + +/* This identifies the bit in the port: + * + * 1111 1111 1100 0000 0000 + * 9876 5432 1098 7654 3210 + * ---- ---- ---- ---- ---- + * .... .... .... .... BBBB + */ + +#define GPIO_PIN_SHIFT (0) /* Bits 0-3: GPIO number: 0-15 */ +#define GPIO_PIN_MASK (15 << GPIO_PIN_SHIFT) +# define GPIO_PIN0 (0 << GPIO_PIN_SHIFT) +# define GPIO_PIN1 (1 << GPIO_PIN_SHIFT) +# define GPIO_PIN2 (2 << GPIO_PIN_SHIFT) +# define GPIO_PIN3 (3 << GPIO_PIN_SHIFT) +# define GPIO_PIN4 (4 << GPIO_PIN_SHIFT) +# define GPIO_PIN5 (5 << GPIO_PIN_SHIFT) +# define GPIO_PIN6 (6 << GPIO_PIN_SHIFT) +# define GPIO_PIN7 (7 << GPIO_PIN_SHIFT) +# define GPIO_PIN8 (8 << GPIO_PIN_SHIFT) +# define GPIO_PIN9 (9 << GPIO_PIN_SHIFT) +# define GPIO_PIN10 (10 << GPIO_PIN_SHIFT) +# define GPIO_PIN11 (11 << GPIO_PIN_SHIFT) +# define GPIO_PIN12 (12 << GPIO_PIN_SHIFT) +# define GPIO_PIN13 (13 << GPIO_PIN_SHIFT) +# define GPIO_PIN14 (14 << GPIO_PIN_SHIFT) +# define GPIO_PIN15 (15 << GPIO_PIN_SHIFT) + /* Register Offsets *****************************************************************/ #define STM32L4_GPIO_MODER_OFFSET 0x0000 /* GPIO port mode register */ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_i2c.h b/arch/arm/src/stm32l4/hardware/stm32l4_i2c.h index 4720c00254e77..bf288ba316d39 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_i2c.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_i2c.h @@ -36,6 +36,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_I2C_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_I2C_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_lptim.h b/arch/arm/src/stm32l4/hardware/stm32l4_lptim.h index 773a05201faeb..12d61a7cdb3d7 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_lptim.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_lptim.h @@ -37,6 +37,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_LPTIM_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_LPTIM_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_memorymap.h b/arch/arm/src/stm32l4/hardware/stm32l4_memorymap.h index 66c669aed35c4..9588f7cfbb233 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_memorymap.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_memorymap.h @@ -36,6 +36,8 @@ #ifndef __ARCH_ARM_SRC_STM32L4_STM32L4_MEMORYMAP_H #define __ARCH_ARM_SRC_STM32L4_STM32L4_MEMORYMAP_H +#include + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_pinmap.h b/arch/arm/src/stm32l4/hardware/stm32l4_pinmap.h index 77e053f2fbf0e..ca5538d623710 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_pinmap.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_pinmap.h @@ -42,16 +42,15 @@ ************************************************************************************/ #include -#include "chip.h" #if defined(CONFIG_STM32L4_STM32L4X3) -# include "hardware/stm32l4x3xx_pinmap.h" +# include "stm32l4x3xx_pinmap.h" #elif defined(CONFIG_STM32L4_STM32L4X5) -# include "hardware/stm32l4x5xx_pinmap.h" +# include "stm32l4x5xx_pinmap.h" #elif defined(CONFIG_STM32L4_STM32L4X6) -# include "hardware/stm32l4x6xx_pinmap.h" +# include "stm32l4x6xx_pinmap.h" #elif defined(CONFIG_STM32L4_STM32L4XR) -# include "hardware/stm32l4xrxx_pinmap.h" +# include "stm32l4xrxx_pinmap.h" #else # error "Unsupported STM32 L4 pin map" #endif diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_pwr.h b/arch/arm/src/stm32l4/hardware/stm32l4_pwr.h index 0677c51f99d08..a65a217d9e6aa 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_pwr.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_pwr.h @@ -41,7 +41,7 @@ ************************************************************************************/ #include -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_qspi.h b/arch/arm/src/stm32l4/hardware/stm32l4_qspi.h index 33e771d9dd8ee..16da987737c25 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_qspi.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_qspi.h @@ -40,10 +40,7 @@ * Included Files ****************************************************************************************/ -#include -#include - -#include "hardware/stm32l4_memorymap.h" +#include "stm32l4_memorymap.h" /**************************************************************************************** * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_rng.h b/arch/arm/src/stm32l4/hardware/stm32l4_rng.h index 094ed66b2863d..c1b80d1024381 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_rng.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_rng.h @@ -40,8 +40,7 @@ * Included Files ************************************************************************************/ -#include -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_rtcc.h b/arch/arm/src/stm32l4/hardware/stm32l4_rtcc.h index 4853936a8b901..09517e037fe05 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_rtcc.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_rtcc.h @@ -36,6 +36,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_RTCC_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_RTCC_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_sai.h b/arch/arm/src/stm32l4/hardware/stm32l4_sai.h index 59d8033259380..1f1d6bca07a59 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_sai.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_sai.h @@ -40,8 +40,7 @@ * Included Files ************************************************************************************/ -#include -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_sdmmc.h b/arch/arm/src/stm32l4/hardware/stm32l4_sdmmc.h index f68a6a9366ae5..fb4419285e587 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_sdmmc.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_sdmmc.h @@ -38,6 +38,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_SDMMC_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_SDMMC_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_spi.h b/arch/arm/src/stm32l4/hardware/stm32l4_spi.h index b1694db2021ee..1ea6a2fdab160 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_spi.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_spi.h @@ -40,8 +40,7 @@ * Included Files ************************************************************************************/ -#include -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_syscfg.h b/arch/arm/src/stm32l4/hardware/stm32l4_syscfg.h index 4537397c45f3c..c4a436e5d2603 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_syscfg.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_syscfg.h @@ -41,16 +41,15 @@ ************************************************************************************/ #include -#include "chip.h" #if defined(CONFIG_STM32L4_STM32L4X3) -# include "hardware/stm32l4x3xx_syscfg.h" +# include "stm32l4x3xx_syscfg.h" #elif defined(CONFIG_STM32L4_STM32L4X5) -# include "hardware/stm32l4x5xx_syscfg.h" +# include "stm32l4x5xx_syscfg.h" #elif defined(CONFIG_STM32L4_STM32L4X6) -# include "hardware/stm32l4x6xx_syscfg.h" +# include "stm32l4x6xx_syscfg.h" #elif defined(CONFIG_STM32L4_STM32L4XR) -# include "hardware/stm32l4xrxx_syscfg.h" +# include "stm32l4xrxx_syscfg.h" #else # error "Unsupported STM32 L4 chip" #endif diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_tim.h b/arch/arm/src/stm32l4/hardware/stm32l4_tim.h index 5a559ac8a5212..4c98557070efd 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_tim.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_tim.h @@ -37,6 +37,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_TIM_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4_TIM_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_uart.h b/arch/arm/src/stm32l4/hardware/stm32l4_uart.h index efd5a95a3bbeb..814e9372291c5 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_uart.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_uart.h @@ -40,9 +40,7 @@ * Included Files ************************************************************************************/ -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_usbdev.h b/arch/arm/src/stm32l4/hardware/stm32l4_usbdev.h index f1a9cc44bbb39..6ef2fd6c8e83c 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_usbdev.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_usbdev.h @@ -41,10 +41,11 @@ ************************************************************************************/ #include -#include #if defined(CONFIG_STM32L4_STM32L4X2) +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4_wdg.h b/arch/arm/src/stm32l4/hardware/stm32l4_wdg.h index 38831acaebc55..771bce700da11 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4_wdg.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4_wdg.h @@ -41,9 +41,7 @@ * Included Files ************************************************************************************/ -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dbgmcu.h b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dbgmcu.h index f4ce46bd548de..a7dff67ee1388 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dbgmcu.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dbgmcu.h @@ -42,9 +42,7 @@ * Included Files ****************************************************************************/ -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /**************************************************************************** * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dma.h b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dma.h index 8a7d531525a01..896e3d2b154c2 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dma.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_dma.h @@ -36,6 +36,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4X3XX_DMA_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4X3XX_DMA_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_firewall.h b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_firewall.h index dcd754e2935c2..1e346dfcd3755 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_firewall.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_firewall.h @@ -40,10 +40,7 @@ * Included Files ************************************************************************************/ -#include -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_pinmap.h b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_pinmap.h index 93adb335de65a..df55f4a2ee8e9 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_pinmap.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_pinmap.h @@ -41,7 +41,7 @@ * Included Files ************************************************************************************/ -#include +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_rcc.h b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_rcc.h index 33e839c128bd7..d0e0b86dcde45 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_rcc.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_rcc.h @@ -47,6 +47,8 @@ #if defined(CONFIG_STM32L4_STM32L4X3) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_syscfg.h b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_syscfg.h index e3c41fb2c0788..462232477b137 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x3xx_syscfg.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x3xx_syscfg.h @@ -41,10 +41,11 @@ ****************************************************************************************************/ #include -#include "chip.h" #if defined(CONFIG_STM32L4_STM32L4X3) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dbgmcu.h b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dbgmcu.h index 5c89eee3194bc..0bd4ebf81ee73 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dbgmcu.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dbgmcu.h @@ -42,10 +42,6 @@ * Included Files ****************************************************************************/ -#include - -#include "chip.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dma.h b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dma.h index 6ff86f4ed6cfb..d176cd0352bfa 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dma.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_dma.h @@ -36,6 +36,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4X5XX_DMA_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4X5XX_DMA_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_firewall.h b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_firewall.h index 6cd2433c97138..2175ced8e1ca6 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_firewall.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_firewall.h @@ -42,10 +42,7 @@ * Included Files ************************************************************************************/ -#include -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_otgfs.h b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_otgfs.h index 19d3990a90d5e..2a3ef5db85271 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_otgfs.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_otgfs.h @@ -42,6 +42,9 @@ /**************************************************************************************************** * Included Files ****************************************************************************************************/ + +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_pinmap.h b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_pinmap.h index 77b8c431c2504..d3fcaeb3575a6 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_pinmap.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_pinmap.h @@ -41,7 +41,7 @@ * Included Files ************************************************************************************/ -#include +#include "stm32l4_gpio.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_rcc.h b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_rcc.h index dee3f83f5608a..75d70e62eca65 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_rcc.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_rcc.h @@ -46,6 +46,8 @@ #if defined(CONFIG_STM32L4_STM32L4X5) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_syscfg.h b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_syscfg.h index f1bf322e341da..3a12832517a44 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x5xx_syscfg.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x5xx_syscfg.h @@ -41,10 +41,11 @@ ****************************************************************************************************/ #include -#include "chip.h" #if defined(CONFIG_STM32L4_STM32L4X5) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dbgmcu.h b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dbgmcu.h index 4e8acff1baf2a..4ed53de43cc7a 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dbgmcu.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dbgmcu.h @@ -44,8 +44,6 @@ #include -#include "chip.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dma.h b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dma.h index c16ebbdf7be29..3cb5f017fd202 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dma.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_dma.h @@ -36,6 +36,12 @@ #ifndef __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4X6XX_DMA_H #define __ARCH_ARM_SRC_STM32L4_HARDWARE_STM32L4X6XX_DMA_H +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include "stm32l4_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_firewall.h b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_firewall.h index c6cb47c8025c3..0c3211057872b 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_firewall.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_firewall.h @@ -41,9 +41,7 @@ ************************************************************************************/ #include -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_otgfs.h b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_otgfs.h index bc4700734ff1c..b4a16946c2055 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_otgfs.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_otgfs.h @@ -42,6 +42,9 @@ /**************************************************************************************************** * Included Files ****************************************************************************************************/ + +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_pinmap.h b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_pinmap.h index 93cd5b29d1a78..63322237e46a7 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_pinmap.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_pinmap.h @@ -40,7 +40,7 @@ * Included Files ************************************************************************************/ -#include +#include "stm32l4_gpio.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_rcc.h b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_rcc.h index 3337387e01ca1..2f5efc4fbc604 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_rcc.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_rcc.h @@ -46,6 +46,8 @@ #if defined(CONFIG_STM32L4_STM32L4X6) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_syscfg.h b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_syscfg.h index 4625ac8a293e3..14b208166daf7 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4x6xx_syscfg.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4x6xx_syscfg.h @@ -41,10 +41,11 @@ ****************************************************************************************************/ #include -#include "chip.h" #if defined(CONFIG_STM32L4_STM32L4X6) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dbgmcu.h b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dbgmcu.h index 2e92797159c09..5b791feeaeacd 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dbgmcu.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dbgmcu.h @@ -42,10 +42,6 @@ * Included Files ****************************************************************************/ -#include - -#include "chip.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dma.h b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dma.h index e014159358796..47e7d70d6154c 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dma.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dma.h @@ -40,8 +40,7 @@ * Included Files ************************************************************************************/ -#include -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dmamux.h b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dmamux.h index 1f331eaba634f..a8059b4c5aa1d 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dmamux.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_dmamux.h @@ -43,8 +43,6 @@ * Included Files ************************************************************************************/ -#include -#include "chip.h" #include "stm32l4xrxx_dma.h" /************************************************************************************ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_firewall.h b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_firewall.h index f16208cdc0c07..c7a8ccadc4642 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_firewall.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_firewall.h @@ -40,10 +40,7 @@ * Included Files ************************************************************************************/ -#include -#include - -#include "chip.h" +#include "stm32l4_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_pinmap.h b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_pinmap.h index f64565f0cdd64..8c9d7fa088d5c 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_pinmap.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_pinmap.h @@ -40,7 +40,7 @@ * Included Files ************************************************************************************/ -#include +#include "../stm32l4_gpio.h" /************************************************************************************ * Pre-processor Definitions diff --git a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_rcc.h b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_rcc.h index 3cddebf3e04d6..667e338ad77cc 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_rcc.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_rcc.h @@ -47,6 +47,8 @@ #if defined(CONFIG_STM32L4_STM32L4XR) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_syscfg.h b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_syscfg.h index d92924e240f6e..38f3b79103bff 100644 --- a/arch/arm/src/stm32l4/hardware/stm32l4xrxx_syscfg.h +++ b/arch/arm/src/stm32l4/hardware/stm32l4xrxx_syscfg.h @@ -41,10 +41,11 @@ ****************************************************************************************************/ #include -#include "chip.h" #if defined(CONFIG_STM32L4_STM32L4XR) +#include "stm32l4_memorymap.h" + /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_gpio.h b/arch/arm/src/stm32l4/stm32l4_gpio.h index f6920e664cf4d..6fb69e408a71a 100644 --- a/arch/arm/src/stm32l4/stm32l4_gpio.h +++ b/arch/arm/src/stm32l4/stm32l4_gpio.h @@ -65,182 +65,6 @@ * Pre-Processor Declarations ************************************************************************************/ -/* Bit-encoded input to stm32l4_configgpio() */ - -/* Each port bit of the general-purpose I/O (GPIO) ports can be individually configured - * by software in several modes: - * - * - Input floating - * - Input pull-up - * - Input-pull-down - * - Output open-drain with pull-up or pull-down capability - * - Output push-pull with pull-up or pull-down capability - * - Alternate function push-pull with pull-up or pull-down capability - * - Alternate function open-drain with pull-up or pull-down capability - * - Analog - * - * 20-bit Encoding: 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * Inputs: MMUU .... ...X PPPP BBBB - * Outputs: MMUU .... FFOV PPPP BBBB - * Alternate Functions: MMUU AAAA FFO. PPPP BBBB - * Analog: MM.. .... .... PPPP BBBB - */ - -/* Mode: - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * MM.. .... .... .... .... - */ - -#define GPIO_MODE_SHIFT (18) /* Bits 18-19: GPIO port mode */ -#define GPIO_MODE_MASK (3 << GPIO_MODE_SHIFT) -# define GPIO_INPUT (0 << GPIO_MODE_SHIFT) /* Input mode */ -# define GPIO_OUTPUT (1 << GPIO_MODE_SHIFT) /* General purpose output mode */ -# define GPIO_ALT (2 << GPIO_MODE_SHIFT) /* Alternate function mode */ -# define GPIO_ANALOG (3 << GPIO_MODE_SHIFT) /* Analog mode */ - -/* Input/output pull-ups/downs (not used with analog): - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * ..UU .... .... .... .... - */ - -#define GPIO_PUPD_SHIFT (16) /* Bits 16-17: Pull-up/pull down */ -#define GPIO_PUPD_MASK (3 << GPIO_PUPD_SHIFT) -# define GPIO_FLOAT (0 << GPIO_PUPD_SHIFT) /* No pull-up, pull-down */ -# define GPIO_PULLUP (1 << GPIO_PUPD_SHIFT) /* Pull-up */ -# define GPIO_PULLDOWN (2 << GPIO_PUPD_SHIFT) /* Pull-down */ - -/* Alternate Functions: - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * .... AAAA .... .... .... - */ - -#define GPIO_AF_SHIFT (12) /* Bits 12-15: Alternate function */ -#define GPIO_AF_MASK (15 << GPIO_AF_SHIFT) -# define GPIO_AF(n) ((n) << GPIO_AF_SHIFT) -# define GPIO_AF0 (0 << GPIO_AF_SHIFT) -# define GPIO_AF1 (1 << GPIO_AF_SHIFT) -# define GPIO_AF2 (2 << GPIO_AF_SHIFT) -# define GPIO_AF3 (3 << GPIO_AF_SHIFT) -# define GPIO_AF4 (4 << GPIO_AF_SHIFT) -# define GPIO_AF5 (5 << GPIO_AF_SHIFT) -# define GPIO_AF6 (6 << GPIO_AF_SHIFT) -# define GPIO_AF7 (7 << GPIO_AF_SHIFT) -# define GPIO_AF8 (8 << GPIO_AF_SHIFT) -# define GPIO_AF9 (9 << GPIO_AF_SHIFT) -# define GPIO_AF10 (10 << GPIO_AF_SHIFT) -# define GPIO_AF11 (11 << GPIO_AF_SHIFT) -# define GPIO_AF12 (12 << GPIO_AF_SHIFT) -# define GPIO_AF13 (13 << GPIO_AF_SHIFT) -# define GPIO_AF14 (14 << GPIO_AF_SHIFT) -# define GPIO_AF15 (15 << GPIO_AF_SHIFT) - -/* Output/Alt function frequency selection: - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * .... .... FF.. .... .... - */ - -#define GPIO_SPEED_SHIFT (10) /* Bits 10-11: GPIO frequency selection */ -#define GPIO_SPEED_MASK (3 << GPIO_SPEED_SHIFT) -# define GPIO_SPEED_2MHz (0 << GPIO_SPEED_SHIFT) /* 2 MHz Low speed output */ -# define GPIO_SPEED_25MHz (1 << GPIO_SPEED_SHIFT) /* 25 MHz Medium speed output */ -# define GPIO_SPEED_50MHz (2 << GPIO_SPEED_SHIFT) /* 50 MHz High speed output */ -# define GPIO_SPEED_100MHz (3 << GPIO_SPEED_SHIFT) /* 100 MHz Very High speed output */ - -/* Output/Alt function type selection: - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * .... .... ..O. .... .... - */ - -#define GPIO_OPENDRAIN (1 << 9) /* Bit9: 1=Open-drain output */ -#define GPIO_PUSHPULL (0) /* Bit9: 0=Push-pull output */ - -/* If the pin is a GPIO digital output, then this identifies the initial output value. - * If the pin is an input, this bit is overloaded to provide the qualifier to - * distinquish input pull-up and -down: - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * .... .... ...V .... .... - */ - -#define GPIO_OUTPUT_SET (1 << 8) /* Bit 8: If output, initial value of output */ -#define GPIO_OUTPUT_CLEAR (0) - -/* External interrupt selection (GPIO inputs only): - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * .... .... ...X .... .... - */ - -#define GPIO_EXTI (1 << 8) /* Bit 8: Configure as EXTI interrupt */ - -/* This identifies the GPIO port: - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * .... .... .... PPPP .... - */ - -#define GPIO_PORT_SHIFT (4) /* Bit 4-7: Port number */ -#define GPIO_PORT_MASK (15 << GPIO_PORT_SHIFT) -# define GPIO_PORTA (0 << GPIO_PORT_SHIFT) /* GPIOA */ -# define GPIO_PORTB (1 << GPIO_PORT_SHIFT) /* GPIOB */ -# define GPIO_PORTC (2 << GPIO_PORT_SHIFT) /* GPIOC */ -# define GPIO_PORTD (3 << GPIO_PORT_SHIFT) /* GPIOD */ -# define GPIO_PORTE (4 << GPIO_PORT_SHIFT) /* GPIOE */ -# define GPIO_PORTF (5 << GPIO_PORT_SHIFT) /* GPIOF */ -# define GPIO_PORTG (6 << GPIO_PORT_SHIFT) /* GPIOG */ -# define GPIO_PORTH (7 << GPIO_PORT_SHIFT) /* GPIOH */ -# define GPIO_PORTI (8 << GPIO_PORT_SHIFT) /* GPIOI */ - -/* This identifies the bit in the port: - * - * 1111 1111 1100 0000 0000 - * 9876 5432 1098 7654 3210 - * ---- ---- ---- ---- ---- - * .... .... .... .... BBBB - */ - -#define GPIO_PIN_SHIFT (0) /* Bits 0-3: GPIO number: 0-15 */ -#define GPIO_PIN_MASK (15 << GPIO_PIN_SHIFT) -# define GPIO_PIN0 (0 << GPIO_PIN_SHIFT) -# define GPIO_PIN1 (1 << GPIO_PIN_SHIFT) -# define GPIO_PIN2 (2 << GPIO_PIN_SHIFT) -# define GPIO_PIN3 (3 << GPIO_PIN_SHIFT) -# define GPIO_PIN4 (4 << GPIO_PIN_SHIFT) -# define GPIO_PIN5 (5 << GPIO_PIN_SHIFT) -# define GPIO_PIN6 (6 << GPIO_PIN_SHIFT) -# define GPIO_PIN7 (7 << GPIO_PIN_SHIFT) -# define GPIO_PIN8 (8 << GPIO_PIN_SHIFT) -# define GPIO_PIN9 (9 << GPIO_PIN_SHIFT) -# define GPIO_PIN10 (10 << GPIO_PIN_SHIFT) -# define GPIO_PIN11 (11 << GPIO_PIN_SHIFT) -# define GPIO_PIN12 (12 << GPIO_PIN_SHIFT) -# define GPIO_PIN13 (13 << GPIO_PIN_SHIFT) -# define GPIO_PIN14 (14 << GPIO_PIN_SHIFT) -# define GPIO_PIN15 (15 << GPIO_PIN_SHIFT) - /************************************************************************************ * Public Data ************************************************************************************/