mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'test/parlio_rx_cache_safe_v5.4' into 'release/v5.4'
Reenable parlio rx cache safe test (v5.4) See merge request espressif/esp-idf!38683
This commit is contained in:
@ -321,15 +321,14 @@ esp_err_t parlio_new_tx_unit(const parlio_tx_unit_config_t *config, parlio_tx_un
|
|||||||
ESP_RETURN_ON_FALSE(config->flags.allow_pd == 0, ESP_ERR_NOT_SUPPORTED, TAG, "register back up is not supported");
|
ESP_RETURN_ON_FALSE(config->flags.allow_pd == 0, ESP_ERR_NOT_SUPPORTED, TAG, "register back up is not supported");
|
||||||
#endif // SOC_PARLIO_SUPPORT_SLEEP_RETENTION
|
#endif // SOC_PARLIO_SUPPORT_SLEEP_RETENTION
|
||||||
|
|
||||||
// malloc unit memory
|
// allocate unit from internal memory because it contains atomic member
|
||||||
uint32_t mem_caps = PARLIO_MEM_ALLOC_CAPS;
|
unit = heap_caps_calloc(1, sizeof(parlio_tx_unit_t) + sizeof(parlio_tx_trans_desc_t) * config->trans_queue_depth, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
unit = heap_caps_calloc(1, sizeof(parlio_tx_unit_t) + sizeof(parlio_tx_trans_desc_t) * config->trans_queue_depth, mem_caps);
|
|
||||||
ESP_GOTO_ON_FALSE(unit, ESP_ERR_NO_MEM, err, TAG, "no memory for tx unit");
|
ESP_GOTO_ON_FALSE(unit, ESP_ERR_NO_MEM, err, TAG, "no memory for tx unit");
|
||||||
|
|
||||||
unit->max_transfer_bits = config->max_transfer_size * 8;
|
unit->max_transfer_bits = config->max_transfer_size * 8;
|
||||||
unit->base.dir = PARLIO_DIR_TX;
|
unit->base.dir = PARLIO_DIR_TX;
|
||||||
unit->data_width = data_width;
|
unit->data_width = data_width;
|
||||||
//create transaction queue
|
// create transaction queue
|
||||||
ESP_GOTO_ON_ERROR(parlio_tx_create_trans_queue(unit, config), err, TAG, "create transaction queue failed");
|
ESP_GOTO_ON_ERROR(parlio_tx_create_trans_queue(unit, config), err, TAG, "create transaction queue failed");
|
||||||
|
|
||||||
// register the unit to a group
|
// register the unit to a group
|
||||||
|
@ -2,11 +2,6 @@ set(srcs "test_app_main.c"
|
|||||||
"test_parlio_rx.c"
|
"test_parlio_rx.c"
|
||||||
"test_parlio_tx.c")
|
"test_parlio_tx.c")
|
||||||
|
|
||||||
# TODO: IDF-7840, semaphore in 'spi_bus_lock.c' is not IRAM safe
|
|
||||||
if(CONFIG_PARLIO_ISR_IRAM_SAFE)
|
|
||||||
list(REMOVE_ITEM srcs "test_parlio_rx.c")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CONFIG_SOC_LIGHT_SLEEP_SUPPORTED AND CONFIG_PM_ENABLE)
|
if(CONFIG_SOC_LIGHT_SLEEP_SUPPORTED AND CONFIG_PM_ENABLE)
|
||||||
list(APPEND srcs "test_parlio_sleep.c")
|
list(APPEND srcs "test_parlio_sleep.c")
|
||||||
endif()
|
endif()
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdatomic.h>
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "stdatomic.h"
|
|
||||||
#include "esp_types.h"
|
#include "esp_types.h"
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
#include "esp_check.h"
|
#include "esp_check.h"
|
||||||
@ -29,6 +29,12 @@
|
|||||||
#include "soc/dport_reg.h"
|
#include "soc/dport_reg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_SPI_MASTER_ISR_IN_IRAM || CONFIG_SPI_SLAVE_ISR_IN_IRAM
|
||||||
|
#define SPI_COMMON_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
|
||||||
|
#else
|
||||||
|
#define SPI_COMMON_MALLOC_CAPS (MALLOC_CAP_DEFAULT)
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *SPI_TAG = "spi";
|
static const char *SPI_TAG = "spi";
|
||||||
|
|
||||||
#define SPI_CHECK(a, str, ret_val) ESP_RETURN_ON_FALSE(a, ret_val, SPI_TAG, str)
|
#define SPI_CHECK(a, str, ret_val) ESP_RETURN_ON_FALSE(a, ret_val, SPI_TAG, str)
|
||||||
@ -270,7 +276,7 @@ esp_err_t spicommon_dma_chan_alloc(spi_host_device_t host_id, spi_dma_chan_t dma
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
spi_dma_ctx_t *dma_ctx = (spi_dma_ctx_t *)calloc(1, sizeof(spi_dma_ctx_t));
|
spi_dma_ctx_t *dma_ctx = (spi_dma_ctx_t *)heap_caps_calloc(1, sizeof(spi_dma_ctx_t), SPI_COMMON_MALLOC_CAPS);
|
||||||
if (!dma_ctx) {
|
if (!dma_ctx) {
|
||||||
ret = ESP_ERR_NO_MEM;
|
ret = ESP_ERR_NO_MEM;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -825,7 +831,7 @@ esp_err_t spi_bus_initialize(spi_host_device_t host_id, const spi_bus_config_t *
|
|||||||
SPI_CHECK(spi_chan_claimed, "host_id already in use", ESP_ERR_INVALID_STATE);
|
SPI_CHECK(spi_chan_claimed, "host_id already in use", ESP_ERR_INVALID_STATE);
|
||||||
|
|
||||||
//clean and initialize the context
|
//clean and initialize the context
|
||||||
ctx = (spicommon_bus_context_t *)calloc(1, sizeof(spicommon_bus_context_t));
|
ctx = (spicommon_bus_context_t *)heap_caps_calloc(1, sizeof(spicommon_bus_context_t), SPI_COMMON_MALLOC_CAPS);
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
err = ESP_ERR_NO_MEM;
|
err = ESP_ERR_NO_MEM;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -145,6 +145,12 @@ We have two bits to control the interrupt:
|
|||||||
#define SPI_MASTER_ATTR
|
#define SPI_MASTER_ATTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_SPI_MASTER_IN_IRAM || CONFIG_SPI_MASTER_ISR_IN_IRAM
|
||||||
|
#define SPI_MASTER_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
|
||||||
|
#else
|
||||||
|
#define SPI_MASTER_MALLOC_CAPS (MALLOC_CAP_DEFAULT)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SOC_PERIPH_CLK_CTRL_SHARED
|
#if SOC_PERIPH_CLK_CTRL_SHARED
|
||||||
#define SPI_MASTER_PERI_CLOCK_ATOMIC() PERIPH_RCC_ATOMIC()
|
#define SPI_MASTER_PERI_CLOCK_ATOMIC() PERIPH_RCC_ATOMIC()
|
||||||
#else
|
#else
|
||||||
@ -493,7 +499,7 @@ esp_err_t spi_bus_add_device(spi_host_device_t host_id, const spi_device_interfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Allocate memory for device
|
//Allocate memory for device
|
||||||
dev = malloc(sizeof(spi_device_t));
|
dev = heap_caps_malloc(sizeof(spi_device_t), SPI_MASTER_MALLOC_CAPS);
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
goto nomem;
|
goto nomem;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,8 @@ esp_err_t spi_slave_initialize(spi_host_device_t host, const spi_bus_config_t *b
|
|||||||
spi_chan_claimed = spicommon_periph_claim(host, "spi slave");
|
spi_chan_claimed = spicommon_periph_claim(host, "spi slave");
|
||||||
SPI_CHECK(spi_chan_claimed, "host already in use", ESP_ERR_INVALID_STATE);
|
SPI_CHECK(spi_chan_claimed, "host already in use", ESP_ERR_INVALID_STATE);
|
||||||
|
|
||||||
spihost[host] = malloc(sizeof(spi_slave_t));
|
// spi_slave_t contains atomic variable, memory must be allocated from internal memory
|
||||||
|
spihost[host] = heap_caps_malloc(sizeof(spi_slave_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
if (spihost[host] == NULL) {
|
if (spihost[host] == NULL) {
|
||||||
ret = ESP_ERR_NO_MEM;
|
ret = ESP_ERR_NO_MEM;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -585,7 +585,7 @@ SPI_BUS_LOCK_ISR_ATTR static inline esp_err_t dev_wait(spi_bus_lock_dev_t *dev_h
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
esp_err_t spi_bus_init_lock(spi_bus_lock_handle_t *out_lock, const spi_bus_lock_config_t *config)
|
esp_err_t spi_bus_init_lock(spi_bus_lock_handle_t *out_lock, const spi_bus_lock_config_t *config)
|
||||||
{
|
{
|
||||||
spi_bus_lock_t* lock = (spi_bus_lock_t*)calloc(1, sizeof(spi_bus_lock_t));
|
spi_bus_lock_t* lock = (spi_bus_lock_t*)heap_caps_calloc(1, sizeof(spi_bus_lock_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
if (lock == NULL) {
|
if (lock == NULL) {
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ esp_err_t spi_bus_lock_register_dev(spi_bus_lock_handle_t lock, spi_bus_lock_dev
|
|||||||
if (dev_lock == NULL) {
|
if (dev_lock == NULL) {
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
dev_lock->semphr = xSemaphoreCreateBinary();
|
dev_lock->semphr = xSemaphoreCreateBinaryWithCaps(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
if (dev_lock->semphr == NULL) {
|
if (dev_lock->semphr == NULL) {
|
||||||
free(dev_lock);
|
free(dev_lock);
|
||||||
atomic_store(&lock->dev[id], (intptr_t)NULL);
|
atomic_store(&lock->dev[id], (intptr_t)NULL);
|
||||||
@ -676,7 +676,7 @@ void spi_bus_lock_unregister_dev(spi_bus_lock_dev_handle_t dev_handle)
|
|||||||
|
|
||||||
atomic_store(&lock->dev[id], (intptr_t)NULL);
|
atomic_store(&lock->dev[id], (intptr_t)NULL);
|
||||||
if (dev_handle->semphr) {
|
if (dev_handle->semphr) {
|
||||||
vSemaphoreDelete(dev_handle->semphr);
|
vSemaphoreDeleteWithCaps(dev_handle->semphr);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(dev_handle);
|
free(dev_handle);
|
||||||
@ -819,7 +819,7 @@ SPI_BUS_LOCK_ISR_ATTR bool spi_bus_lock_bg_clear_req(spi_bus_lock_dev_t *dev_han
|
|||||||
}
|
}
|
||||||
|
|
||||||
SPI_BUS_LOCK_ISR_ATTR bool spi_bus_lock_bg_check_dev_acq(spi_bus_lock_t *lock,
|
SPI_BUS_LOCK_ISR_ATTR bool spi_bus_lock_bg_check_dev_acq(spi_bus_lock_t *lock,
|
||||||
spi_bus_lock_dev_handle_t *out_dev_lock)
|
spi_bus_lock_dev_handle_t *out_dev_lock)
|
||||||
{
|
{
|
||||||
BUS_LOCK_DEBUG_EXECUTE_CHECK(!lock->acquiring_dev);
|
BUS_LOCK_DEBUG_EXECUTE_CHECK(!lock->acquiring_dev);
|
||||||
uint32_t status = lock_status_fetch(lock);
|
uint32_t status = lock_status_fetch(lock);
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
| ----------------- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
| ----------------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
||||||
|
Reference in New Issue
Block a user