gustavonihei commented on a change in pull request #5795: URL: https://github.com/apache/incubator-nuttx/pull/5795#discussion_r830346622
########## File path: arch/xtensa/src/esp32s3/esp32s3_gpio.c ########## @@ -171,24 +244,38 @@ void esp32s3_gpio_matrix_in(uint32_t gpio, uint32_t signal_idx, bool inv) * Name: esp32s3_gpio_matrix_out * * Description: - * Set signal output to gpio - * NOTE: one signal can output to several gpios - * If signal_idx == 0x100, cancel output put to the gpio + * Set signal output to GPIO. + * NOTE: one signal can output to several GPIOs. + * + * Input Parameters: + * pin - GPIO pin to be configured. + * signal_idx - Signal index. + * - If signal_idx == 0x100, cancel output to the GPIO. + * out_inv - Flag indicating whether the signal output is inverted. + * oen_inv - Flag indicating whether the signal output enable is + * inverted. + * + * Returned Value: + * None. * ****************************************************************************/ -void esp32s3_gpio_matrix_out(uint32_t gpio, uint32_t signal_idx, - bool out_inv, bool oen_inv) +void esp32s3_gpio_matrix_out(uint32_t pin, uint32_t signal_idx, bool out_inv, + bool oen_inv) { - uint32_t regaddr = GPIO_FUNC0_OUT_SEL_CFG_REG + (gpio * 4); + uint32_t regaddr = GPIO_FUNC0_OUT_SEL_CFG_REG + (pin * 4); uint32_t regval = signal_idx << GPIO_FUNC0_OUT_SEL_S; - if (gpio >= ESP32S3_NGPIOS) + DEBUGASSERT(is_valid_gpio(pin)); + + if (pin < 32) { - return; + putreg32((UINT32_C(1) << pin), GPIO_ENABLE_W1TS_REG); + } + else + { + putreg32((UINT32_C(1) << (pin - 32)), GPIO_ENABLE1_W1TS_REG); } - - putreg32(1ul << gpio, GPIO_ENABLE_W1TS_REG); if (out_inv) Review comment: In fact the hardware register already expects that value and will behave accordingly, so there is no need for performing any validations on the driver level. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org