Skip to content

Commit

Permalink
Merge pull request #69 from espressif/release/v4.4
Browse files Browse the repository at this point in the history
Update 29042022
  • Loading branch information
Jason2866 authored Apr 29, 2022
2 parents b98c847 + 8c8f700 commit 3010c45
Show file tree
Hide file tree
Showing 31 changed files with 145 additions and 175 deletions.
7 changes: 7 additions & 0 deletions components/bt/esp_ble_mesh/mesh_core/prov.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@

#define START_PAYLOAD_MAX 20
#define CONT_PAYLOAD_MAX 23
#define START_LAST_SEG_MAX 2

#define START_LAST_SEG(gpc) (gpc >> 2)
#define CONT_SEG_INDEX(gpc) (gpc >> 2)
Expand Down Expand Up @@ -1563,6 +1564,12 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf)
return;
}

if (START_LAST_SEG(rx->gpc) > START_LAST_SEG_MAX) {
BT_ERR("Invalid SegN 0x%02x", START_LAST_SEG(rx->gpc));
prov_send_fail_msg(PROV_ERR_UNEXP_ERR);
return;
}

if (link.rx.buf->len > link.rx.buf->size) {
BT_ERR("Too large provisioning PDU (%u bytes)",
link.rx.buf->len);
Expand Down
7 changes: 7 additions & 0 deletions components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ _Static_assert(BLE_MESH_MAX_CONN >= CONFIG_BLE_MESH_PBG_SAME_TIME,

#define START_PAYLOAD_MAX 20
#define CONT_PAYLOAD_MAX 23
#define START_LAST_SEG_MAX 2

#define START_LAST_SEG(gpc) (gpc >> 2)
#define CONT_SEG_INDEX(gpc) (gpc >> 2)
Expand Down Expand Up @@ -2980,6 +2981,12 @@ static void gen_prov_start(const uint8_t idx, struct prov_rx *rx, struct net_buf
return;
}

if (START_LAST_SEG(rx->gpc) > START_LAST_SEG_MAX) {
BT_ERR("Invalid SegN 0x%02x", START_LAST_SEG(rx->gpc));
close_link(idx, CLOSE_REASON_FAILED);
return;
}

if (link[idx].rx.buf->len > link[idx].rx.buf->size) {
BT_ERR("Too large provisioning PDU (%u bytes)",
link[idx].rx.buf->len);
Expand Down
10 changes: 5 additions & 5 deletions components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ static void btc_spp_init(btc_spp_args_t *arg)
}
if ((spp_local_param.tx_event_group = xEventGroupCreate()) == NULL) {
BTC_TRACE_ERROR("%s create tx_event_group failed\n", __func__);
osi_mutex_free(&spp_local_param.spp_slot_mutex);
ret = ESP_SPP_NO_RESOURCE;
break;
}
Expand Down Expand Up @@ -582,11 +583,6 @@ static void btc_spp_uninit(void)
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
} while(0);

if (spp_local_param.tx_event_group) {
vEventGroupDelete(spp_local_param.tx_event_group);
spp_local_param.tx_event_group = NULL;
}

if (ret != ESP_SPP_SUCCESS) {
esp_spp_cb_param_t param;
param.uninit.status = ret;
Expand Down Expand Up @@ -1256,6 +1252,10 @@ void btc_spp_cb_handler(btc_msg_t *msg)
param.uninit.status = ESP_SPP_SUCCESS;
BTA_JvFree();
osi_mutex_free(&spp_local_param.spp_slot_mutex);
if (spp_local_param.tx_event_group) {
vEventGroupDelete(spp_local_param.tx_event_group);
spp_local_param.tx_event_group = NULL;
}
#if SPP_DYNAMIC_MEMORY == TRUE
osi_free(spp_local_param_ptr);
spp_local_param_ptr = NULL;
Expand Down
8 changes: 8 additions & 0 deletions components/bt/host/bluedroid/stack/btu/btu_hcif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,11 @@ static void btu_hcif_ssr_evt_dump (UINT8 *p, UINT16 evt_len)
STREAM_TO_UINT16 (max_tx_lat, p);
STREAM_TO_UINT16 (max_rx_lat, p);

UNUSED(status);
UNUSED(handle);
UNUSED(max_tx_lat);
UNUSED(max_rx_lat);

HCI_TRACE_WARNING("hcif ssr evt: st 0x%x, hdl 0x%x, tx_lat %d rx_lat %d", status, handle, max_tx_lat, max_rx_lat);
}
#endif
Expand Down Expand Up @@ -1962,6 +1967,9 @@ static void btu_hcif_link_supv_to_changed_evt (UINT8 *p)
STREAM_TO_UINT16(handle, p);
STREAM_TO_UINT16(supv_to, p);

UNUSED(handle);
UNUSED(supv_to);

HCI_TRACE_WARNING("hcif link supv_to changed: hdl 0x%x, supv_to %d", handle, supv_to);
}

Expand Down
3 changes: 2 additions & 1 deletion components/driver/include/driver/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull);

#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP

#define GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO(gpio_num) ((gpio_num & ~SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK) == 0)
#define GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
(((1ULL << (gpio_num)) & SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK) != 0))

/**
* @brief Enable GPIO deep-sleep wake-up function.
Expand Down
4 changes: 2 additions & 2 deletions components/esp_phy/esp32c3/include/phy_init_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ extern "C" {

// define the lowest tx power as LOWEST_PHY_TX_POWER
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52)
#define PHY_TX_POWER_OFFSET 44
#define PHY_TX_POWER_NUM 5
#define PHY_TX_POWER_OFFSET 2
#define PHY_TX_POWER_NUM 14

#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
#define PHY_CRC_ALGORITHM 1
Expand Down
4 changes: 2 additions & 2 deletions components/esp_phy/esp32s2/include/phy_init_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ extern "C" {

// define the lowest tx power as LOWEST_PHY_TX_POWER
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52)
#define PHY_TX_POWER_OFFSET 44
#define PHY_TX_POWER_NUM 5
#define PHY_TX_POWER_OFFSET 2
#define PHY_TX_POWER_NUM 14

#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
#define PHY_CRC_ALGORITHM 1
Expand Down
4 changes: 2 additions & 2 deletions components/esp_phy/esp32s3/include/phy_init_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ extern "C" {

// define the lowest tx power as LOWEST_PHY_TX_POWER
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52)
#define PHY_TX_POWER_OFFSET 44
#define PHY_TX_POWER_NUM 5
#define PHY_TX_POWER_OFFSET 2
#define PHY_TX_POWER_NUM 14

#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
#define PHY_CRC_ALGORITHM 1
Expand Down
13 changes: 8 additions & 5 deletions components/esp_phy/src/phy_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ IRAM_ATTR void esp_mac_bb_power_down(void)

const esp_phy_init_data_t* esp_phy_get_init_data(void)
{
esp_err_t err = ESP_OK;
const esp_partition_t* partition = NULL;
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
size_t init_data_store_length = sizeof(phy_init_magic_pre) +
sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post);
Expand All @@ -362,7 +360,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
memcpy(init_data_store, multi_phy_init_data_bin_start, init_data_store_length);
ESP_LOGI(TAG, "loading embedded multiple PHY init data");
#else
partition = esp_partition_find_first(
const esp_partition_t* partition = esp_partition_find_first(
ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_PHY, NULL);
if (partition == NULL) {
ESP_LOGE(TAG, "PHY data partition not found");
Expand All @@ -377,7 +375,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
return NULL;
}
// read phy data from flash
err = esp_partition_read(partition, 0, init_data_store, init_data_store_length);
esp_err_t err = esp_partition_read(partition, 0, init_data_store, init_data_store_length);
if (err != ESP_OK) {
ESP_LOGE(TAG, "failed to read PHY data partition (0x%x)", err);
free(init_data_store);
Expand All @@ -388,6 +386,11 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
if (memcmp(init_data_store, PHY_INIT_MAGIC, sizeof(phy_init_magic_pre)) != 0 ||
memcmp(init_data_store + init_data_store_length - sizeof(phy_init_magic_post),
PHY_INIT_MAGIC, sizeof(phy_init_magic_post)) != 0) {
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
ESP_LOGE(TAG, "failed to validate embedded PHY init data");
free(init_data_store);
return NULL;
#else
#ifndef CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID
ESP_LOGE(TAG, "failed to validate PHY data partition");
free(init_data_store);
Expand All @@ -414,6 +417,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
return NULL;
}
#endif // CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID
#endif // CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
}
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
if ((*(init_data_store + (sizeof(phy_init_magic_pre) + PHY_SUPPORT_MULTIPLE_BIN_OFFSET)))) {
Expand Down Expand Up @@ -603,7 +607,6 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle,
}

#if CONFIG_ESP_PHY_REDUCE_TX_POWER
// TODO: fix the esp_phy_reduce_tx_power unused warning for esp32s2 - IDF-759
static void __attribute((unused)) esp_phy_reduce_tx_power(esp_phy_init_data_t* init_data)
{
uint8_t i;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_pm/pm_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ void esp_pm_impl_waiti(void)
* the lock so that vApplicationSleep can attempt to enter light sleep.
*/
esp_pm_impl_idle_hook();
s_skipped_light_sleep[core_id] = false;
}
s_skipped_light_sleep[core_id] = true;
#else
cpu_hal_waiti();
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
Expand Down
13 changes: 13 additions & 0 deletions components/esp_wifi/include/esp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,19 @@ esp_err_t esp_wifi_get_country_code(char *country);
*/
esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate);

/**
* @brief Disable PMF configuration for specified interface
*
* @attention This API should be called after esp_wifi_set_config() and before esp_wifi_start().
*
* @param ifx Interface to be configured.
*
* @return
* - ESP_OK: succeed
* - others: failed
*/
esp_err_t esp_wifi_disable_pmf_config(wifi_interface_t ifx);

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions components/esp_wifi/src/wifi_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ esp_err_t esp_wifi_clear_default_wifi_driver_and_handlers(void *esp_netif)
if (s_wifi_netifs[i] == esp_netif) {
s_wifi_netifs[i] = NULL;
}
}
for (i = 0; i< MAX_WIFI_IFS; ++i) {
// check if all netifs are cleared to delete default handlers
if (s_wifi_netifs[i] != NULL) {
break;
Expand Down
2 changes: 1 addition & 1 deletion components/mqtt/esp-mqtt
7 changes: 0 additions & 7 deletions docs/en/api-reference/bluetooth/controller_vhci.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
Controller && VHCI
==================

Overview
--------

`Instructions`_

.. _Instructions: ../template.html

Application Example
-------------------

Expand Down
7 changes: 0 additions & 7 deletions docs/en/api-reference/bluetooth/esp_a2dp.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
Bluetooth A2DP API
==================

Overview
--------

`Instructions`_

.. _Instructions: ../template.html

Application Example
-------------------

Expand Down
9 changes: 0 additions & 9 deletions docs/en/api-reference/bluetooth/esp_avrc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ Overview

Bluetooth AVRCP reference APIs.

`Instructions`_

Application Example
-------------------

`Instructions`_

.. _Instructions: ../template.html

API Reference
-------------

Expand Down
13 changes: 0 additions & 13 deletions docs/en/api-reference/bluetooth/esp_bt_defs.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
BT GENERIC DEFINES
==================

Overview
--------

`Instructions`_

Application Example
-------------------

`Instructions`_

.. _Instructions: ../template.html


API Reference
-------------

Expand Down
9 changes: 0 additions & 9 deletions docs/en/api-reference/bluetooth/esp_bt_device.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ Overview

Bluetooth device reference APIs.

`Instructions`_

Application Example
-------------------

`Instructions`_

.. _Instructions: ../template.html

API Reference
-------------

Expand Down
13 changes: 0 additions & 13 deletions docs/en/api-reference/bluetooth/esp_bt_main.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
BT MAIN API
===========

Overview
--------

`Instructions`_

Application Example
-------------------

`Instructions`_

.. _Instructions: ../template.html


API Reference
-------------

Expand Down
9 changes: 1 addition & 8 deletions docs/en/api-reference/bluetooth/esp_gap_ble.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
GAP API
=======

Overview
--------

`Instructions`_

.. _Instructions: ../template.html

Application Example
-------------------

Expand All @@ -18,7 +11,7 @@ Check :example:`bluetooth/bluedroid/ble` folder in ESP-IDF examples, which conta
- :example:`bluetooth/bluedroid/ble/gatt_security_client`
- :example_file:`GATT Security Client Example Walkthrough <bluetooth/bluedroid/ble/gatt_security_client/tutorial/Gatt_Security_Client_Example_Walkthrough.md>`

* This is a SMP security server demo and its tutorial. This demo initiates its security parameters and acts as a GATT server, which can send a pair request to the peer device and then complete the encryption procedure.
* This is a SMP security server demo and its tutorial. This demo initiates its security parameters and acts as a GATT server, which can send a pair request to the peer device and then complete the encryption procedure.

- :example:`bluetooth/bluedroid/ble/gatt_security_server`
- :example_file:`GATT Security Server Example Walkthrough <bluetooth/bluedroid/ble/gatt_security_server/tutorial/Gatt_Security_Server_Example_Walkthrough.md>`
Expand Down
12 changes: 0 additions & 12 deletions docs/en/api-reference/bluetooth/esp_gap_bt.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
CLASSIC BLUETOOTH GAP API
=========================

Overview
--------

`Instructions`_

Application Example
-------------------

`Instructions`_

.. _Instructions: ../template.html

API Reference
-------------

Expand Down
12 changes: 0 additions & 12 deletions docs/en/api-reference/bluetooth/esp_gatt_defs.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
GATT DEFINES
============

Overview
--------

`Instructions`_

Application Example
-------------------

`Instructions`_

.. _Instructions: ../template.html

API Reference
-------------

Expand Down
Loading

0 comments on commit 3010c45

Please sign in to comment.