donghengqaz commented on a change in pull request #1958: URL: https://github.com/apache/incubator-nuttx/pull/1958#discussion_r503234502
########## File path: arch/xtensa/src/esp32/esp32_spi.c ########## @@ -861,11 +866,43 @@ static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv, uint32_t nwords) { uint32_t bytes = nwords * (priv->nbits / 8); - uint8_t *tp = (uint8_t *)txbuffer; - uint8_t *rp = (uint8_t *)rxbuffer; + uint8_t *tp; + uint8_t *rp; uint32_t n; uint32_t regval; + /* If the buffer comes from PSRAM, allocate a new one from DRAM */ + +#ifdef CONFIG_XTENSA_USE_SEPERATE_IMEM + if (esp32_ptr_extram(txbuffer)) + { + tp = up_imm_malloc(bytes); + if (tp == NULL) Review comment: Because the `esp32_spi_dma_exchange` can't return error code tell callers that the function failed, so maybe we add an `assert` function here ? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org