Skip to content

Commit

Permalink
Merge branch 'espressif:release/v5.2' into release/v5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Apr 3, 2024
2 parents 0b1ba51 + 2152112 commit e50f897
Show file tree
Hide file tree
Showing 44 changed files with 364 additions and 97 deletions.
3 changes: 0 additions & 3 deletions components/bt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ if(CONFIG_BT_ENABLED)
elseif(CONFIG_IDF_TARGET_ESP32S3)
list(APPEND srcs "controller/esp32c3/bt.c")

elseif(CONFIG_IDF_TARGET_ESP32C2)
list(APPEND srcs "controller/esp32c2/bt.c")

elseif(CONFIG_IDF_TARGET_ESP32C2)
set(ldfragments "linker.lf.esp32c2")
list(APPEND srcs "controller/esp32c2/bt.c")
Expand Down
5 changes: 3 additions & 2 deletions components/bt/host/bluedroid/btc/core/btc_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "btc/btc_common.h"
#include "btc/btc_dm.h"
#include "btc/btc_main.h"
#include "btc/btc_util.h"
#include "common/bt_trace.h"
#include "common/bt_target.h"
#include "btc/btc_storage.h"
Expand Down Expand Up @@ -717,14 +718,14 @@ static void btc_dm_acl_link_stat(tBTA_DM_ACL_LINK_STAT *p_acl_link_stat)
switch (p_acl_link_stat->event) {
case BTA_ACL_LINK_STAT_CONN_CMPL: {
event = ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT;
param.acl_conn_cmpl_stat.stat = p_acl_link_stat->link_act.conn_cmpl.status | ESP_BT_STATUS_BASE_FOR_HCI_ERR;
param.acl_conn_cmpl_stat.stat = btc_hci_to_esp_status(p_acl_link_stat->link_act.conn_cmpl.status);
param.acl_conn_cmpl_stat.handle = p_acl_link_stat->link_act.conn_cmpl.handle;
memcpy(param.acl_conn_cmpl_stat.bda, p_acl_link_stat->link_act.conn_cmpl.bd_addr, ESP_BD_ADDR_LEN);
break;
}
case BTA_ACL_LINK_STAT_DISCONN_CMPL: {
event = ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT;
param.acl_disconn_cmpl_stat.reason = p_acl_link_stat->link_act.disconn_cmpl.reason | ESP_BT_STATUS_BASE_FOR_HCI_ERR;
param.acl_disconn_cmpl_stat.reason = btc_hci_to_esp_status(p_acl_link_stat->link_act.disconn_cmpl.reason);
param.acl_disconn_cmpl_stat.handle = p_acl_link_stat->link_act.disconn_cmpl.handle;
memcpy(param.acl_disconn_cmpl_stat.bda, p_acl_link_stat->link_act.disconn_cmpl.bd_addr, ESP_BD_ADDR_LEN);
break;
Expand Down
5 changes: 4 additions & 1 deletion components/bt/host/bluedroid/btc/core/btc_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,11 @@ esp_bt_status_t btc_hci_to_esp_status(uint8_t hci_status)
case HCI_ERR_ILLEGAL_PARAMETER_FMT:
esp_status = ESP_BT_STATUS_ERR_ILLEGAL_PARAMETER_FMT;
break;
case HCI_ERR_UNSUPPORTED_VALUE:
esp_status = ESP_BT_STATUS_UNSUPPORTED;
break;
default:
esp_status = ESP_BT_STATUS_FAIL;
esp_status = hci_status | ESP_BT_STATUS_BASE_FOR_HCI_ERR;
break;
}

Expand Down
12 changes: 7 additions & 5 deletions components/bt/host/bluedroid/btc/profile/std/sdp/btc_sdp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -285,8 +285,8 @@ static int free_sdp_slot(int id)
// Record have already been freed
handle = -1;
}
osi_free(slot);
slot = NULL;
osi_free(sdp_local_param.sdp_slots[id]);
sdp_local_param.sdp_slots[id] = NULL;

return handle;
}
Expand Down Expand Up @@ -1034,14 +1034,16 @@ static void btc_sdp_remove_record(btc_sdp_args_t *arg)
} else {
BTC_TRACE_ERROR("%s SDP record with handle %d not found",
__func__, arg->remove_record.record_handle);
return;
ret = ESP_SDP_NO_CREATE_RECORD;
break;
}

/* Get the Record handle, and free the slot */
/* The application layer record_handle is equivalent to the id of the btc layer */
int slot = get_sdp_slot_id_by_handle(arg->remove_record.record_handle);
if (slot < 0) {
return;
ret = ESP_SDP_NO_CREATE_RECORD;
break;
}

handle = free_sdp_slot(slot);
Expand Down
2 changes: 1 addition & 1 deletion components/bt/host/nimble/nimble
2 changes: 1 addition & 1 deletion components/esp_http_client/esp_http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ static int http_on_header_event(esp_http_client_handle_t client)
static int http_on_header_field(http_parser *parser, const char *at, size_t length)
{
esp_http_client_t *client = parser->data;
http_on_header_event(client);
http_utils_append_string(&client->current_header_key, at, length);

return 0;
Expand All @@ -258,7 +259,6 @@ static int http_on_header_value(http_parser *parser, const char *at, size_t leng
http_utils_append_string(&client->auth_header, at, length);
}
http_utils_append_string(&client->current_header_value, at, length);
http_on_header_event(client);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/esp32c2/ld/esp32c2.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1975,12 +1975,12 @@ esp_coex_rom_version_get = 0x40002168;
coex_bt_release = 0x4000216c;
coex_bt_request = 0x40002170;
coex_core_ble_conn_dyn_prio_get = 0x40002174;
coex_core_event_duration_get = 0x40002178;
/*coex_core_event_duration_get = 0x40002178;*/
coex_core_pti_get = 0x4000217c;
coex_core_release = 0x40002180;
coex_core_request = 0x40002184;
coex_core_status_get = 0x40002188;
coex_core_timer_idx_get = 0x4000218c;
/*coex_core_timer_idx_get = 0x4000218c;*/
coex_event_duration_get = 0x40002190;
coex_hw_timer_disable = 0x40002194;
coex_hw_timer_enable = 0x40002198;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ppMapWaitTxq = 0x40001810;
/*sta_input = 0x40001870;*/
ieee80211_crypto_decap = 0x4000189c;
ieee80211_decap = 0x400018a0;
coex_core_timer_idx_get = 0x400018d0;
/*coex_core_timer_idx_get = 0x400018d0;*/
rom1_chip_i2c_readReg = 0x40001924;
rom1_chip_i2c_writeReg = 0x40001928;
rom_index_to_txbbgain = 0x40001964;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_rom/esp32c3/ld/esp32c3.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ esp_coex_rom_version_get = 0x400018ac;
coex_bt_release = 0x400018b0;
coex_bt_request = 0x400018b4;
coex_core_ble_conn_dyn_prio_get = 0x400018b8;
coex_core_event_duration_get = 0x400018bc;
/*coex_core_event_duration_get = 0x400018bc;*/
coex_core_pti_get = 0x400018c0;
coex_core_release = 0x400018c4;
coex_core_request = 0x400018c8;
Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ esp_coex_rom_version_get = 0x40000afc;
coex_bt_release = 0x40000b00;
coex_bt_request = 0x40000b04;
coex_core_ble_conn_dyn_prio_get = 0x40000b08;
coex_core_event_duration_get = 0x40000b0c;
/*coex_core_event_duration_get = 0x40000b0c;*/
coex_core_pti_get = 0x40000b10;
coex_core_release = 0x40000b14;
coex_core_request = 0x40000b18;
coex_core_status_get = 0x40000b1c;
coex_core_timer_idx_get = 0x40000b20;
/*coex_core_timer_idx_get = 0x40000b20;*/
coex_event_duration_get = 0x40000b24;
coex_hw_timer_disable = 0x40000b28;
coex_hw_timer_enable = 0x40000b2c;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_rom/esp32s3/ld/esp32s3.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ esp_coex_rom_version_get = 0x40005b68;
coex_bt_release = 0x40005b74;
coex_bt_request = 0x40005b80;
coex_core_ble_conn_dyn_prio_get = 0x40005b8c;
coex_core_event_duration_get = 0x40005b98;
/*coex_core_event_duration_get = 0x40005b98;*/
coex_core_pti_get = 0x40005ba4;
coex_core_release = 0x40005bb0;
coex_core_request = 0x40005bbc;
Expand Down
18 changes: 17 additions & 1 deletion components/esp_timer/test_apps/main/test_esp_timer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -84,6 +84,7 @@ TEST_CASE("esp_timer orders timers correctly", "[esp_timer]")

}
fclose(stream);
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

static const int test_time_sec = 10;
Expand Down Expand Up @@ -160,6 +161,7 @@ TEST_CASE("esp_timer produces correct delay", "[esp_timer]")
TEST_ESP_OK( esp_timer_dump(stdout) );

esp_timer_delete(timer1);
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

// no, we can't make this a const size_t (§6.7.5.2)
Expand Down Expand Up @@ -218,6 +220,7 @@ TEST_CASE("periodic esp_timer produces correct delays", "[esp_timer]")

TEST_ESP_OK( esp_timer_delete(timer1) );
vSemaphoreDelete(args.done);
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}
#undef NUM_INTERVALS

Expand Down Expand Up @@ -342,6 +345,7 @@ TEST_CASE("multiple timers are ordered correctly", "[esp_timer]")
TEST_ESP_OK( esp_timer_delete(args1.timer) );
TEST_ESP_OK( esp_timer_delete(args2.timer) );
TEST_ESP_OK( esp_timer_delete(args3.timer) );
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}
#undef N

Expand Down Expand Up @@ -384,6 +388,7 @@ TEST_CASE("esp_timer for very short intervals", "[esp_timer]")
vSemaphoreDelete(semaphore);
TEST_ESP_OK(esp_timer_delete(timer1));
TEST_ESP_OK(esp_timer_delete(timer2));
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]")
Expand Down Expand Up @@ -633,6 +638,7 @@ TEST_CASE("after esp_timer_impl_advance, timers run when expected", "[esp_timer]

ref_clock_deinit();
TEST_ESP_OK(esp_timer_delete(timer));
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

static esp_timer_handle_t timer1;
Expand Down Expand Up @@ -670,6 +676,7 @@ TEST_CASE("Can start/stop timer from ISR context", "[esp_timer]")
esp_deregister_freertos_tick_hook(test_tick_hook);
TEST_ESP_OK( esp_timer_delete(timer1) );
vSemaphoreDelete(sem);
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

#if !defined(CONFIG_FREERTOS_UNICORE) && SOC_DPORT_WORKAROUND
Expand Down Expand Up @@ -861,6 +868,7 @@ TEST_CASE("Test a latency between a call of callback and real event", "[esp_time
TEST_ESP_OK(esp_timer_dump(stdout));
TEST_ESP_OK(esp_timer_stop(periodic_timer));
TEST_ESP_OK(esp_timer_delete(periodic_timer));
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

static void test_timer_triggered(void* timer1_trig)
Expand Down Expand Up @@ -909,6 +917,7 @@ TEST_CASE("periodic esp_timer can be restarted", "[esp_timer]")

TEST_ESP_OK( esp_timer_stop(timer1) );
TEST_ESP_OK( esp_timer_delete(timer1) );
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

TEST_CASE("one-shot esp_timer can be restarted", "[esp_timer]")
Expand Down Expand Up @@ -943,6 +952,7 @@ TEST_CASE("one-shot esp_timer can be restarted", "[esp_timer]")
TEST_ASSERT_EQUAL(0, timer_trig);

TEST_ESP_OK( esp_timer_delete(timer1) );
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}


Expand Down Expand Up @@ -1002,6 +1012,7 @@ TEST_CASE("Test ESP_TIMER_ISR dispatch method", "[esp_timer]")
TEST_ESP_OK(esp_timer_delete(periodic_timer2));
printf("timers deleted\n");
TEST_ESP_OK(esp_timer_dump(stdout));
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

static void dump_task(void* arg)
Expand Down Expand Up @@ -1062,6 +1073,7 @@ TEST_CASE("Test ESP_TIMER_ISR dispatch method is not blocked", "[esp_timer]")
TEST_ESP_OK(esp_timer_delete(periodic_timer1));
TEST_ESP_OK(esp_timer_delete(periodic_timer2));
printf("timer deleted\n");
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

static void isr_callback1(void* arg)
Expand Down Expand Up @@ -1121,6 +1133,7 @@ TEST_CASE("Test ESP_TIMER_ISR, stop API cleans alarm reg if TASK timer list is e
TEST_ESP_OK(esp_timer_delete(timer2));
vSemaphoreDelete(done);
printf("timer deleted\n");
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

static void isr_callback2(void* arg)
Expand Down Expand Up @@ -1176,6 +1189,7 @@ TEST_CASE("Test ESP_TIMER_ISR, stop API cleans alarm reg if ISR timer list is em
TEST_ESP_OK(esp_timer_delete(timer2));
vSemaphoreDelete(done);
printf("timer deleted\n");
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

#ifndef CONFIG_FREERTOS_UNICORE
Expand Down Expand Up @@ -1214,6 +1228,7 @@ TEST_CASE("Test that CPU1 can handle esp_timer ISR even when CPU0 is blocked", "
TEST_ESP_OK(esp_timer_dump(stdout));
TEST_ASSERT_INT_WITHIN(3, 10, data);
TEST_ESP_OK(esp_timer_delete(timer));
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}
#endif // not CONFIG_FREERTOS_UNICORE

Expand Down Expand Up @@ -1283,6 +1298,7 @@ TEST_CASE("Test ISR dispatch callbacks are not blocked even if TASK callbacks ta
TEST_ESP_OK(esp_timer_stop(isr_timer_handle));
TEST_ESP_OK(esp_timer_delete(task_timer_handle));
TEST_ESP_OK(esp_timer_delete(isr_timer_handle));
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

#endif // CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
18 changes: 12 additions & 6 deletions components/esp_timer/test_apps/main/test_esp_timer_light_sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <time.h>
#include <sys/time.h>
#include <sys/param.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_timer.h"
#include "unity.h"
#include "esp_rom_sys.h"
Expand Down Expand Up @@ -35,22 +37,26 @@ TEST_CASE("Test the periodic timer does not handle lost events during light slee

int period_cb_ms = 10;
int interval_ms = 50;
TEST_ESP_OK(esp_timer_start_periodic(periodic_timer, period_cb_ms * 1000));
TEST_ESP_OK(esp_sleep_enable_timer_wakeup(interval_ms * 1000));
printf("Run light sleep\n");
printf("count_calls should be around = %d\n", interval_ms / period_cb_ms);
TEST_ESP_OK(esp_sleep_enable_timer_wakeup(interval_ms * 1000));
TEST_ESP_OK(esp_timer_start_periodic(periodic_timer, period_cb_ms * 1000));
for (int i = 0; i < 3; i++) {
count_calls = 0;
TEST_ESP_OK(esp_light_sleep_start());
do {
count_calls = 0;
} while (esp_light_sleep_start() != ESP_OK);
esp_rom_delay_us(interval_ms * 1000);
printf("count_calls = %d\n", count_calls);
TEST_ASSERT_INT_WITHIN(2, interval_ms / period_cb_ms, count_calls);
vTaskDelay(1); // wait for the esp_timer task to start on another core processing period_timer after sleep
int saved_count_calls = count_calls;
printf("count_calls = %d\n", saved_count_calls);
TEST_ESP_OK(esp_timer_dump(stdout));
TEST_ASSERT_INT_WITHIN(2, interval_ms / period_cb_ms, saved_count_calls);
}
TEST_ESP_OK(esp_timer_stop(periodic_timer));
// times_skipped is about 12 (4 from each sleep time).
TEST_ESP_OK(esp_timer_dump(stdout));
TEST_ESP_OK(esp_timer_delete(periodic_timer));
vTaskDelay(3); // wait for the esp_timer task to delete all timers
}

#endif //#!TEMPORARY_DISABLED_FOR_TARGETS(ESP32P4)
20 changes: 20 additions & 0 deletions components/esp_wifi/include/esp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,26 @@ esp_err_t esp_wifi_ftm_end_session(void);
*/
esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm);

/**
* @brief Get FTM measurements report copied into a user provided buffer.
*
* @attention 1. To get the FTM report, user first needs to allocate a buffer of size
* (sizeof(wifi_ftm_report_entry_t) * num_entries) where the API will fill up to num_entries
* valid FTM measurements in the buffer. Total number of entries can be found in the event
* WIFI_EVENT_FTM_REPORT as ftm_report_num_entries
* @attention 2. The internal FTM report is freed upon use of this API which means the API can only be used
* once afer every FTM session initiated
* @attention 3. Passing the buffer as NULL merely frees the FTM report
*
* @param report Pointer to the buffer for receiving the FTM report
* @param num_entries Number of FTM report entries to be filled in the report
*
* @return
* - ESP_OK: succeed
* - others: failed
*/
esp_err_t esp_wifi_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries);

/**
* @brief Enable or disable 11b rate of specified interface
*
Expand Down
Loading

0 comments on commit e50f897

Please sign in to comment.