Skip to content

Commit 12835ff

Browse files
committed
Merge branch 'fix/gdma_psram_esp32c5' into 'master'
test(dma): only test 40MHz on esp32c5 Closes IDFCI-2876, IDFCI-2897, IDF-13029, and IDF-13035 See merge request espressif/esp-idf!38918
2 parents d839951 + 31b6be0 commit 12835ff

File tree

11 files changed

+21
-15
lines changed

11 files changed

+21
-15
lines changed

components/esp_driver_gptimer/src/gptimer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ esp_err_t gptimer_new_timer(const gptimer_config_t *config, gptimer_handle_t *re
137137
ESP_RETURN_ON_FALSE(allow_pd == false, ESP_ERR_NOT_SUPPORTED, TAG, "not able to power down in light sleep");
138138
#endif // SOC_TIMER_SUPPORT_SLEEP_RETENTION
139139

140-
timer = heap_caps_calloc(1, sizeof(gptimer_t), GPTIMER_MEM_ALLOC_CAPS);
140+
// always allocate memory from internal memory because the driver object contains atomic variable
141+
timer = heap_caps_calloc(1, sizeof(gptimer_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
141142
ESP_GOTO_ON_FALSE(timer, ESP_ERR_NO_MEM, err, TAG, "no mem for gptimer");
142143
// register timer to the group (because one group can have several timers)
143144
ESP_GOTO_ON_ERROR(gptimer_register_to_group(timer), err, TAG, "register timer failed");
@@ -392,7 +393,7 @@ esp_err_t gptimer_start(gptimer_handle_t timer)
392393
}
393394

394395
gptimer_fsm_t expected_fsm = GPTIMER_FSM_ENABLE;
395-
if (atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_RUN_WAIT)) {
396+
if (atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_WAIT)) {
396397
// the register used by the following LL functions are shared with other API,
397398
// which is possible to run along with this function, so we need to protect
398399
portENTER_CRITICAL_SAFE(&timer->spinlock);
@@ -423,7 +424,7 @@ esp_err_t gptimer_stop(gptimer_handle_t timer)
423424
}
424425

425426
gptimer_fsm_t expected_fsm = GPTIMER_FSM_RUN;
426-
if (atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_ENABLE_WAIT)) {
427+
if (atomic_compare_exchange_strong(&timer->fsm, &expected_fsm, GPTIMER_FSM_WAIT)) {
427428
// disable counter, alarm, auto-reload
428429
portENTER_CRITICAL_SAFE(&timer->spinlock);
429430
timer_ll_enable_counter(timer->hal.dev, timer->timer_id, false);

components/esp_driver_gptimer/src/gptimer_priv.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ typedef struct gptimer_group_t {
7474
} gptimer_group_t;
7575

7676
typedef enum {
77-
GPTIMER_FSM_INIT, // Timer is initialized, but not enabled
78-
GPTIMER_FSM_ENABLE, // Timer is enabled, but is not running
79-
GPTIMER_FSM_ENABLE_WAIT, // Timer is in the middle of the enable process (Intermediate state)
80-
GPTIMER_FSM_RUN, // Timer is in running
81-
GPTIMER_FSM_RUN_WAIT, // Timer is in the middle of the run process (Intermediate state)
77+
GPTIMER_FSM_INIT, // Timer is initialized, but not enabled yet
78+
GPTIMER_FSM_ENABLE, // Timer is enabled, but is not running yet
79+
GPTIMER_FSM_RUN, // Timer is in running
80+
GPTIMER_FSM_WAIT, // Timer is in the middle of state change (Intermediate state)
8281
} gptimer_fsm_t;
8382

8483
struct gptimer_t {

components/esp_driver_gptimer/test_apps/gptimer/main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ endif()
1717
# the component can be registered as WHOLE_ARCHIVE
1818
idf_component_register(
1919
SRCS ${srcs}
20-
PRIV_REQUIRES unity esp_driver_gptimer esp_driver_gpio
20+
PRIV_REQUIRES unity esp_driver_gptimer esp_driver_gpio esp_psram
2121
WHOLE_ARCHIVE
2222
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_SPIRAM=y
2+
CONFIG_SPIRAM_MODE_HEX=y
3+
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0

components/esp_driver_mcpwm/src/mcpwm_cap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ esp_err_t mcpwm_new_capture_channel(mcpwm_cap_timer_handle_t cap_timer, const mc
283283
}
284284

285285
// create instance firstly, then install onto platform
286-
cap_chan = calloc(1, sizeof(mcpwm_cap_channel_t));
286+
cap_chan = heap_caps_calloc(1, sizeof(mcpwm_cap_channel_t), MCPWM_MEM_ALLOC_CAPS);
287287
ESP_GOTO_ON_FALSE(cap_chan, ESP_ERR_NO_MEM, err, TAG, "no mem for capture channel");
288288

289289
ESP_GOTO_ON_ERROR(mcpwm_capture_channel_register_to_timer(cap_chan, cap_timer), err, TAG, "register channel failed");

components/esp_driver_mcpwm/test_apps/mcpwm/main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ endif()
2424
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
2525
# the component can be registered as WHOLE_ARCHIVE
2626
idf_component_register(SRCS ${srcs}
27-
PRIV_REQUIRES unity esp_driver_mcpwm esp_driver_gpio esp_driver_gptimer
27+
PRIV_REQUIRES unity esp_driver_mcpwm esp_driver_gpio esp_driver_gptimer esp_psram
2828
WHOLE_ARCHIVE)

components/esp_driver_mcpwm/test_apps/mcpwm/main/test_mcpwm_sleep.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ static void test_mcpwm_timer_sleep_retention(bool allow_pd)
5757
printf("create generator\r\n");
5858
mcpwm_generator_config_t gen_config = {
5959
.gen_gpio_num = generator_gpio,
60-
.flags.io_loop_back = true,
6160
};
6261
mcpwm_gen_handle_t gen = NULL;
6362
TEST_ESP_OK(mcpwm_new_generator(oper, &gen_config, &gen));
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_SPIRAM=y
2+
CONFIG_SPIRAM_MODE_HEX=y
3+
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
CONFIG_SPIRAM=y
2-
CONFIG_SPIRAM_SPEED_80M=y
2+
CONFIG_SPIRAM_SPEED_40M=y
3+
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
CONFIG_SPIRAM=y
2-
CONFIG_SPIRAM_SPEED_80M=y
2+
CONFIG_SPIRAM_SPEED_40M=y

0 commit comments

Comments
 (0)