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 Jul 2, 2024
2 parents 57afd43 + a23f078 commit d6021f8
Show file tree
Hide file tree
Showing 58 changed files with 727 additions and 1,089 deletions.
40 changes: 25 additions & 15 deletions components/bt/host/bluedroid/stack/btm/btm_ble.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void BTM_BleLoadLocalKeys(UINT8 key_type, tBTM_BLE_LOCAL_KEYS *p_key)
break;

default:
BTM_TRACE_ERROR("unknow local key type: %d", key_type);
BTM_TRACE_ERROR("unknown local key type: %d", key_type);
break;
}
}
Expand Down Expand Up @@ -694,7 +694,7 @@ void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, tBLE_ADDR
BTM_TRACE_DEBUG ("btm_find_dev_type - unknown device, BR/EDR assumed");
}
}
} else { /* there is a security device record exisitng */
} else { /* there is a security device record existing */
/* new inquiry result, overwrite device type in security device record */
if (p_inq_info) {
p_dev_rec->device_type = p_inq_info->results.device_type;
Expand All @@ -707,7 +707,7 @@ void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, tBLE_ADDR
} else if (memcmp(p_dev_rec->ble.pseudo_addr, remote_bda, BD_ADDR_LEN) == 0) {
*p_dev_type = BT_DEVICE_TYPE_BLE;
*p_addr_type = p_dev_rec->ble.ble_addr_type;
} else { /* matching static adddress only */
} else { /* matching static address only */
*p_dev_type = BT_DEVICE_TYPE_BREDR;
*p_addr_type = BLE_ADDR_PUBLIC;
}
Expand Down Expand Up @@ -1061,7 +1061,7 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
** LE link for LE COC.
**
** Parameter bdaddr: remote device address.
** psm : PSM of the LE COC sevice.
** psm : PSM of the LE COC service.
** is_originator: TRUE if outgoing connection.
** p_callback : Pointer to the callback function.
** p_ref_data : Pointer to be returned along with the callback.
Expand All @@ -1078,7 +1078,7 @@ BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originat
/* If there is no application registered with this PSM do not allow connection */
if (!p_serv_rec)
{
BTM_TRACE_WARNING ("%s PSM: %d no application registerd", __func__, psm);
BTM_TRACE_WARNING ("%s PSM: %d no application registered", __func__, psm);
(*p_callback) (bd_addr, BT_TRANSPORT_LE, p_ref_data, BTM_MODE_UNSUPPORTED);
return FALSE;
}
Expand Down Expand Up @@ -1151,7 +1151,7 @@ void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_en

/* If there was a callback address for vcs complete, call it */
if (p_enc_cplt_cback && p) {
/* Pass paramters to the callback function */
/* Pass parameters to the callback function */
STREAM_TO_UINT8(params.status, p); /* command status */

if (params.status == HCI_SUCCESS) {
Expand Down Expand Up @@ -1208,7 +1208,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
** Function btm_ble_get_enc_key_type
**
** Description This function is to get the BLE key type that has been exchanged
** in betweem local device and peer device.
** in between local device and peer device.
**
** Returns p_key_type: output parameter to carry the key type value.
**
Expand All @@ -1235,7 +1235,7 @@ BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types)
**
** Description This function is called to read the local DIV
**
** Returns TRUE - if a valid DIV is availavle
** Returns TRUE - if a valid DIV is available
*******************************************************************************/
BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div)
{
Expand Down Expand Up @@ -1487,7 +1487,7 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE

BTM_TRACE_DEBUG ("dev_rec sec_flags=0x%x", p_dev_rec->sec_flags);

/* currently encrpted */
/* currently encrypted */
if (p_dev_rec->sec_flags & BTM_SEC_LE_ENCRYPTED) {
if (p_dev_rec->sec_flags & BTM_SEC_LE_AUTHENTICATED) {
cur_sec_level = BTM_LE_SEC_AUTHENTICATED;
Expand Down Expand Up @@ -1691,7 +1691,7 @@ tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
**
** Function btm_ble_link_encrypted
**
** Description This function is called when LE link encrption status is changed.
** Description This function is called when LE link encryption status is changed.
**
** Returns void
**
Expand Down Expand Up @@ -1949,7 +1949,7 @@ static void btm_ble_resolve_random_addr_on_conn_cmpl(void *p_rec, void *p_data)
** Function btm_ble_connected
**
** Description This function is when a LE connection to the peer device is
** establsihed
** established
**
** Returns void
**
Expand Down Expand Up @@ -2060,7 +2060,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
peer_addr_type = bda_type;
match = btm_identity_addr_to_random_pseudo (bda, &bda_type, FALSE);

/* possiblly receive connection complete with resolvable random on
/* possibly receive connection complete with resolvable random on
slave role while the device has been paired */

/* It will cause that scanner doesn't send scan request to advertiser
Expand Down Expand Up @@ -2143,6 +2143,16 @@ void btm_ble_create_ll_conn_complete (UINT8 status)
if (status != HCI_SUCCESS) {
btm_ble_set_conn_st(BLE_CONN_IDLE);
btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, NULL, status);
if(l2cb.is_ble_connecting) {
/* see L2CA_CancelBleConnectReq() */
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(l2cb.ble_connecting_bda, BT_TRANSPORT_LE);
/* Do not remove lcb if an LE link is already up as a peripheral */
if (p_lcb != NULL &&
!(p_lcb->link_role == HCI_ROLE_SLAVE && BTM_ACL_IS_CONNECTED(l2cb.ble_connecting_bda))) {
p_lcb->disc_reason = L2CAP_CONN_CANCEL;
l2cu_release_lcb (p_lcb);
}
}
}
}

Expand Down Expand Up @@ -2300,15 +2310,15 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
** Function BTM_BleDataSignature
**
** Description This function is called to sign the data using AES128 CMAC
** algorith.
** algorithm.
**
** Parameter bd_addr: target device the data to be signed for.
** p_text: singing data
** len: length of the data to be signed.
** signature: output parameter where data signature is going to
** be stored.
**
** Returns TRUE if signing sucessul, otherwise FALSE.
** Returns TRUE if signing successful, otherwise FALSE.
**
*******************************************************************************/
#if (SMP_INCLUDED == TRUE)
Expand Down Expand Up @@ -2491,7 +2501,7 @@ BOOLEAN BTM_BleSecurityProcedureIsRunning(BD_ADDR bd_addr)
** Function BTM_BleGetSupportedKeySize
**
** Description This function gets the maximum encryption key size in bytes
** the local device can suport.
** the local device can support.
** record.
**
** Returns the key size or 0 if the size can't be retrieved.
Expand Down
3 changes: 3 additions & 0 deletions components/bt/host/bluedroid/stack/btu/btu_hcif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,9 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
break;

#if BLE_INCLUDED == TRUE
#if (BLE_50_FEATURE_SUPPORT == TRUE)
case HCI_BLE_EXT_CREATE_CONN:
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
case HCI_BLE_CREATE_LL_CONN:
btm_ble_create_ll_conn_complete(status);
break;
Expand Down
7 changes: 7 additions & 0 deletions components/esp_coex/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ menu "Wireless Coexistence"
This function depends on BT-off
because currently we do not support external coex and internal coex simultaneously.

config ESP_COEX_POWER_MANAGEMENT
bool "Support power management under coexistence"
default n
depends on (ESP_COEX_SW_COEXIST_ENABLE)
help
If enabled, coexist power management will be enabled.

endmenu # Wireless Coexistence
23 changes: 21 additions & 2 deletions components/esp_coex/include/private/esp_coexist_internal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -313,7 +313,7 @@ esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs);

#if CONFIG_EXTERNAL_COEX_ENABLE
/**
* @brief Set external coexistence advanced informations, like working mode.
* @brief Set external coexistence advanced information, like working mode.
*
* @param out_pti1 This parameter no longer works, will be deprecated and later removed in future releases.
* @param out_pti2 This parameter no longer works, will be deprecated and later removed in future releases.
Expand Down Expand Up @@ -365,6 +365,25 @@ void esp_coex_external_set_txline(bool en);
#endif /*SOC_EXTERNAL_COEX_LEADER_TX_LINE*/
#endif /*External Coex*/

#if CONFIG_ESP_COEX_POWER_MANAGEMENT
/**
* @brief Set coexist scheme flexible period
*
* @param period flexible period
*
* @return
* - ESP_OK: succeed
*/
int coex_schm_flexible_period_set(uint8_t period);

/**
* @brief Get coexist scheme flexible period
*
* @return Coexist scheme flexible period
*/
uint8_t coex_schm_flexible_period_get(void);
#endif

/**
* @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library
*
Expand Down
4 changes: 4 additions & 0 deletions components/esp_hw_support/port/esp32c6/pmu_sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
analog_default.lp_sys[LP(SLEEP)].analog.bias_sleep = PMU_BIASSLP_SLEEP_ON;
analog_default.lp_sys[LP(SLEEP)].analog.dbg_atten = PMU_DBG_ATTEN_ACTIVE_DEFAULT;
analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias();
} else if (!(pd_flags & PMU_SLEEP_PD_RC_FAST)) {
analog_default.hp_sys.analog.dbias = get_act_hp_dbias();
analog_default.lp_sys[LP(SLEEP)].analog.dbg_atten = PMU_DBG_ATTEN_LIGHTSLEEP_NODROP;
analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias();
}

config->analog = analog_default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern "C" {
#define PMU_LP_DRVB_LIGHTSLEEP 0
#define PMU_HP_XPD_LIGHTSLEEP 1

#define PMU_DBG_ATTEN_LIGHTSLEEP_NODROP 0
#define PMU_DBG_ATTEN_LIGHTSLEEP_DEFAULT 0
#define PMU_HP_DBIAS_LIGHTSLEEP_0V6_DEFAULT 1
#define PMU_LP_DBIAS_LIGHTSLEEP_0V7_DEFAULT 12
Expand Down
3 changes: 3 additions & 0 deletions components/esp_hw_support/port/esp32h2/pmu_sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
analog_default.lp_sys[LP(SLEEP)].analog.pd_cur = PMU_PD_CUR_SLEEP_ON;
analog_default.lp_sys[LP(SLEEP)].analog.bias_sleep = PMU_BIASSLP_SLEEP_ON;
analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias();
} else if (!(pd_flags & PMU_SLEEP_PD_RC_FAST)) {
analog_default.hp_sys.analog.dbias = get_act_hp_dbias();
analog_default.lp_sys[LP(SLEEP)].analog.dbias = get_act_lp_dbias();
}
config->analog = analog_default;
}
Expand Down
13 changes: 12 additions & 1 deletion components/esp_netif/include/esp_netif_sntp.h
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 @@ -107,6 +107,17 @@ void esp_netif_sntp_deinit(void);
*/
esp_err_t esp_netif_sntp_sync_wait(TickType_t tout);

/**
* @brief Returns SNTP server's reachability shift register as described in RFC 5905.
*
* @param index Index of the SERVER
* @param reachability reachability shift register
* @return ESP_OK on success,
* ESP_ERR_INVALID_STATE if SNTP not initialized
* ESP_ERR_INVALID_ARG if invalid arguments
*/
esp_err_t esp_netif_sntp_reachability(unsigned int index, unsigned int *reachability);

/**
* @}
*/
Expand Down
15 changes: 14 additions & 1 deletion components/esp_netif/lwip/esp_netif_sntp.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 @@ -91,6 +91,7 @@ void esp_netif_sntp_renew_servers(void *handler_args, esp_event_base_t base, int
esp_err_t esp_netif_sntp_init(const esp_sntp_config_t * config)
{
esp_err_t ret = ESP_OK;
ESP_RETURN_ON_FALSE(s_storage == NULL, ESP_ERR_INVALID_STATE, TAG, "esp_netif_sntp already initialized");
s_storage = calloc(1, sizeof(sntp_storage_t) + // allocate space for servers only if we are supposed to refresh the settings
(config->renew_servers_after_new_IP ? config->num_of_servers * sizeof(char*) : 0));
ESP_GOTO_ON_FALSE(s_storage != NULL, ESP_ERR_NO_MEM, err, TAG, "Failed to allocate SNTP storage");
Expand Down Expand Up @@ -177,3 +178,15 @@ esp_err_t esp_netif_sntp_start(void)
{
return esp_netif_tcpip_exec(sntp_start_api, NULL);
}

esp_err_t esp_netif_sntp_reachability(unsigned int index, unsigned int *reachability)
{
if (index >= SNTP_MAX_SERVERS || reachability == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (s_storage == NULL || sntp_enabled() == 0) {
return ESP_ERR_INVALID_STATE;
}
*reachability = sntp_getreachability(index);
return ESP_OK;
}
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: Unlicense OR CC0-1.0
*/
Expand Down Expand Up @@ -48,7 +48,20 @@ TEST(esp_netif, init_and_destroy_sntp)
{
esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG("127.0.0.1");
config.start = false;
esp_netif_sntp_init(&config);
TEST_ESP_OK(esp_netif_sntp_init(&config));
// Cannot initialize multiple times
TEST_ASSERT_NOT_EQUAL(ESP_OK, esp_netif_sntp_init(&config));
// Try again to see that the state didn't change
TEST_ASSERT_NOT_EQUAL(ESP_OK, esp_netif_sntp_init(&config));
esp_netif_sntp_deinit();

// Can initialize again once it's destroyed
TEST_ESP_OK(esp_netif_sntp_init(&config));

// Test the reachability API
size_t reachability = 0;
// Invalid state is expected since SNTP service didn't start
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_STATE, esp_netif_sntp_reachability(0, &reachability));
esp_netif_sntp_deinit();
}

Expand Down
6 changes: 3 additions & 3 deletions components/esp_rom/esp32c2/ld/esp32c2.rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ mac_tx_set_plcp2 = 0x40001b68;
/* pm_check_state = 0x40001b6c; */
pm_disable_dream_timer = 0x40001b70;
pm_disable_sleep_delay_timer = 0x40001b74;
pm_dream = 0x40001b78;
/*pm_dream = 0x40001b78;*/
pm_mac_wakeup = 0x40001b7c;
pm_mac_sleep = 0x40001b80;
pm_enable_active_timer = 0x40001b84;
Expand Down Expand Up @@ -1684,7 +1684,7 @@ hal_disable_sta_tbtt = 0x40001e3c;
ppCalTxopDur = 0x40001e40;
wDev_IndicateCtrlFrame = 0x40001e44;
hal_enable_sta_tbtt = 0x40001e48;
hal_set_sta_tbtt = 0x40001e4c;
/*hal_set_sta_tbtt = 0x40001e4c;*/
/* pm_update_next_tbtt = 0x40001e50;*/
/* pm_set_sleep_type = 0x40001e54; */
wDev_Rxbuf_Init = 0x40001e58;
Expand Down Expand Up @@ -1743,7 +1743,7 @@ tsf_hal_set_tbtt_intr_enable = 0x40001f28;
tsf_hal_set_tbtt_intr_disable = 0x40001f2c;
tsf_hal_set_tbtt_soc_wakeup_enable = 0x40001f30;
tsf_hal_set_tbtt_soc_wakeup_disable = 0x40001f34;
tsf_hal_set_tbtt_start_time = 0x40001f38;
/*tsf_hal_set_tbtt_start_time = 0x40001f38;*/
tsf_hal_set_tbtt_early_time = 0x40001f3c;
tsf_hal_set_tbtt_interval = 0x40001f40;
tsf_hal_get_tbtt_interval = 0x40001f44;
Expand Down
4 changes: 2 additions & 2 deletions components/esp_rom/esp32c3/ld/esp32c3.rom.eco7.ld
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lmacTxFrame = 0x40001630;
mac_tx_set_htsig = 0x40001638;
mac_tx_set_plcp1 = 0x40001640;
pm_check_state = 0x40001648;
pm_on_beacon_rx = 0x4000167c;
/*pm_on_beacon_rx = 0x4000167c;*/
/*pm_parse_beacon = 0x40001688;*/
pm_process_tim = 0x4000168c;
pm_rx_beacon_process = 0x40001690;
Expand All @@ -33,7 +33,7 @@ wDevCheckBlockError = 0x400017b4;
wDev_ProcessFiq = 0x400017f0;
/*wDev_ProcessRxSucData = 0x400017f4;*/
/*ppProcTxDone = 0x40001804;*/
pm_tx_data_done_process = 0x40001808;
/*pm_tx_data_done_process = 0x40001808;*/
ppMapWaitTxq = 0x40001810;
/*ieee80211_encap_esfbuf = 0x4000185c;*/
/*sta_input = 0x40001870;*/
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 @@ -1538,7 +1538,7 @@ mac_tx_set_plcp2 = 0x40001644;
/* pm_check_state = 0x40001648; */
pm_disable_dream_timer = 0x4000164c;
pm_disable_sleep_delay_timer = 0x40001650;
pm_dream = 0x40001654;
/*pm_dream = 0x40001654;*/
pm_mac_wakeup = 0x40001658;
pm_mac_sleep = 0x4000165c;
pm_enable_active_timer = 0x40001660;
Expand Down
Loading

0 comments on commit d6021f8

Please sign in to comment.