forked from espressif/esp-idf
Merge branch 'contrib/github_pr_10224' into 'master'
SPI_Master: Fix DMA rxbuf size calculation (GitHub PR) Closes IDFGH-8793 See merge request espressif/esp-idf!21198
This commit is contained in:
@@ -212,7 +212,7 @@ struct spi_bus_lock_t {
|
||||
};
|
||||
|
||||
struct spi_bus_lock_dev_t {
|
||||
SemaphoreHandle_t semphr; ///< Binray semaphore to notify the device it claimed the bus
|
||||
SemaphoreHandle_t semphr; ///< Binary semaphore to notify the device it claimed the bus
|
||||
spi_bus_lock_t* parent; ///< Pointer to parent spi_bus_lock_t
|
||||
uint32_t mask; ///< Bitwise OR-ed mask of the REQ, PEND, LOCK bits of this device
|
||||
};
|
||||
|
@@ -795,7 +795,7 @@ static SPI_MASTER_ISR_ATTR esp_err_t setup_priv_desc(spi_transaction_t *trans_de
|
||||
if (rcv_ptr && isdma && (!esp_ptr_dma_capable(rcv_ptr) || ((int)rcv_ptr % 4 != 0))) {
|
||||
//if rxbuf in the desc not DMA-capable, malloc a new one. The rx buffer need to be length of multiples of 32 bits to avoid heap corruption.
|
||||
ESP_LOGD(SPI_TAG, "Allocate RX buffer for DMA" );
|
||||
rcv_ptr = heap_caps_malloc((trans_desc->rxlength + 31) / 8, MALLOC_CAP_DMA);
|
||||
rcv_ptr = heap_caps_malloc(((trans_desc->rxlength + 31) / 32) * 4, MALLOC_CAP_DMA);
|
||||
if (rcv_ptr == NULL) goto clean_up;
|
||||
}
|
||||
new_desc->buffer_to_rcv = rcv_ptr;
|
||||
|
Reference in New Issue
Block a user