This is an automated email from the ASF dual-hosted git repository. masayuki pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 605a49e9af09ab0c0b4866aee5b4526f65b367ce Author: Abdelatif Guettouche <[email protected]> AuthorDate: Thu Oct 8 00:47:34 2020 +0100 arch/xtensa/src/esp/esp32/esp32_gpio.c: Fix the function's mask test condition and the functions' values. Signed-off-by: Abdelatif Guettouche <[email protected]> --- arch/xtensa/src/esp32/esp32_gpio.c | 6 +++--- arch/xtensa/src/esp32/esp32_gpio.h | 12 ++++++------ arch/xtensa/src/esp32/esp32_psram.c | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/xtensa/src/esp32/esp32_gpio.c b/arch/xtensa/src/esp32/esp32_gpio.c index 7bee9ef..09737c7 100644 --- a/arch/xtensa/src/esp32/esp32_gpio.c +++ b/arch/xtensa/src/esp32/esp32_gpio.c @@ -213,12 +213,12 @@ int esp32_configgpio(int pin, gpio_pinattr_t attr) func |= FUN_IE; /* Select the pad's function. If no function was given, consider it a - * normal input or output (i.e. function2). + * normal input or output (i.e. function3). */ - if ((attr & FUNCTION) != 0) + if ((attr & FUNCTION_MASK) != 0) { - func |= (uint32_t)((attr >> FUNCTION_SHIFT) << MCU_SEL_S); + func |= (uint32_t)(((attr >> FUNCTION_SHIFT) - 1) << MCU_SEL_S); } else { diff --git a/arch/xtensa/src/esp32/esp32_gpio.h b/arch/xtensa/src/esp32/esp32_gpio.h index 5a2440d..e9182df 100644 --- a/arch/xtensa/src/esp32/esp32_gpio.h +++ b/arch/xtensa/src/esp32/esp32_gpio.h @@ -60,12 +60,12 @@ #define OPEN_DRAIN (1 << 5) #define FUNCTION_SHIFT 6 #define FUNCTION_MASK (7 << FUNCTION_SHIFT) -# define FUNCTION_1 (0 << FUNCTION_SHIFT) -# define FUNCTION_2 (1 << FUNCTION_SHIFT) -# define FUNCTION_3 (2 << FUNCTION_SHIFT) -# define FUNCTION_4 (3 << FUNCTION_SHIFT) -# define FUNCTION_5 (4 << FUNCTION_SHIFT) -# define FUNCTION_6 (5 << FUNCTION_SHIFT) +# define FUNCTION_1 (1 << FUNCTION_SHIFT) +# define FUNCTION_2 (2 << FUNCTION_SHIFT) +# define FUNCTION_3 (3 << FUNCTION_SHIFT) +# define FUNCTION_4 (4 << FUNCTION_SHIFT) +# define FUNCTION_5 (5 << FUNCTION_SHIFT) +# define FUNCTION_6 (6 << FUNCTION_SHIFT) #define INPUT_PULLUP (INPUT | PULLUP) #define INPUT_PULLDOWN (INPUT | PULLDOWN) diff --git a/arch/xtensa/src/esp32/esp32_psram.c b/arch/xtensa/src/esp32/esp32_psram.c index d22c56f..1617bd3 100644 --- a/arch/xtensa/src/esp32/esp32_psram.c +++ b/arch/xtensa/src/esp32/esp32_psram.c @@ -1205,10 +1205,10 @@ static void IRAM_ATTR psram_gpio_config(psram_io_t *psram_io, esp32_configgpio(psram_io->psram_clk_io, OUTPUT | FUNCTION_3); esp32_configgpio(psram_io->psram_spiq_sd0_io, OUTPUT | INPUT | FUNCTION_3); esp32_configgpio(psram_io->psram_spid_sd1_io, OUTPUT | INPUT | FUNCTION_3); - esp32_configgpio(psram_io->psram_spihd_sd2_io, OUTPUT | INPUT | \ - FUNCTION_3); - esp32_configgpio(psram_io->psram_spiwp_sd3_io, OUTPUT | INPUT | \ - FUNCTION_3); + esp32_configgpio(psram_io->psram_spihd_sd2_io, + OUTPUT | INPUT | FUNCTION_3); + esp32_configgpio(psram_io->psram_spiwp_sd3_io, + OUTPUT | INPUT | FUNCTION_3); #if 0 uint32_t flash_id = g_rom_flashchip.device_id;
