Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions arch/arm/src/stm32l4/hardware/stm32l4_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
************************************************************************************/

#include <nuttx/config.h>

#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/src/stm32l4/hardware/stm32l4_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
* Included Files
************************************************************************************/

#include <nuttx/config.h>

#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
7 changes: 7 additions & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_comp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <nuttx/config.h>
#include "stm32l4_memorymap.h"

/****************************************************************************************************
* Pre-processor Definitions
****************************************************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_crs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
************************************************************************************/
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/src/stm32l4/hardware/stm32l4_dac.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
* Included Files
************************************************************************************/

#include <nuttx/config.h>
#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/src/stm32l4/hardware/stm32l4_dfsdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
************************************************************************************/

#include <nuttx/config.h>

#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/src/stm32l4/hardware/stm32l4_exti.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
* Included Files
************************************************************************************/

#include <nuttx/config.h>
#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
1 change: 1 addition & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
************************************************************************************/

#include <nuttx/config.h>
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
179 changes: 177 additions & 2 deletions arch/arm/src/stm32l4/hardware/stm32l4_gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,188 @@
* Included Files
************************************************************************************/

#include <nuttx/config.h>
#include <arch/stm32l4/chip.h>
#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 */
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
************************************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_lptim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
****************************************************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_memorymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#ifndef __ARCH_ARM_SRC_STM32L4_STM32L4_MEMORYMAP_H
#define __ARCH_ARM_SRC_STM32L4_STM32L4_MEMORYMAP_H

#include <nuttx/config.h>

/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
Expand Down
9 changes: 4 additions & 5 deletions arch/arm/src/stm32l4/hardware/stm32l4_pinmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@
************************************************************************************/

#include <nuttx/config.h>
#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
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/stm32l4/hardware/stm32l4_pwr.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
************************************************************************************/

#include <nuttx/config.h>
#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
5 changes: 1 addition & 4 deletions arch/arm/src/stm32l4/hardware/stm32l4_qspi.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
* Included Files
****************************************************************************************/

#include <nuttx/config.h>
#include <arch/stm32l4/chip.h>

#include "hardware/stm32l4_memorymap.h"
#include "stm32l4_memorymap.h"

/****************************************************************************************
* Pre-processor Definitions
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/src/stm32l4/hardware/stm32l4_rng.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
* Included Files
************************************************************************************/

#include <nuttx/config.h>
#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_rtcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
************************************************************************************/
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/src/stm32l4/hardware/stm32l4_sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
* Included Files
************************************************************************************/

#include <nuttx/config.h>
#include "chip.h"
#include "stm32l4_memorymap.h"

/************************************************************************************
* Pre-processor Definitions
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/src/stm32l4/hardware/stm32l4_sdmmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
************************************************************************************/
Expand Down
Loading