Skip to content

Commit 3010c45

Browse files
authored
Merge pull request #69 from espressif/release/v4.4
Update 29042022
2 parents b98c847 + 8c8f700 commit 3010c45

File tree

31 files changed

+145
-175
lines changed

31 files changed

+145
-175
lines changed

components/bt/esp_ble_mesh/mesh_core/prov.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474

7575
#define START_PAYLOAD_MAX 20
7676
#define CONT_PAYLOAD_MAX 23
77+
#define START_LAST_SEG_MAX 2
7778

7879
#define START_LAST_SEG(gpc) (gpc >> 2)
7980
#define CONT_SEG_INDEX(gpc) (gpc >> 2)
@@ -1563,6 +1564,12 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf)
15631564
return;
15641565
}
15651566

1567+
if (START_LAST_SEG(rx->gpc) > START_LAST_SEG_MAX) {
1568+
BT_ERR("Invalid SegN 0x%02x", START_LAST_SEG(rx->gpc));
1569+
prov_send_fail_msg(PROV_ERR_UNEXP_ERR);
1570+
return;
1571+
}
1572+
15661573
if (link.rx.buf->len > link.rx.buf->size) {
15671574
BT_ERR("Too large provisioning PDU (%u bytes)",
15681575
link.rx.buf->len);

components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ _Static_assert(BLE_MESH_MAX_CONN >= CONFIG_BLE_MESH_PBG_SAME_TIME,
7474

7575
#define START_PAYLOAD_MAX 20
7676
#define CONT_PAYLOAD_MAX 23
77+
#define START_LAST_SEG_MAX 2
7778

7879
#define START_LAST_SEG(gpc) (gpc >> 2)
7980
#define CONT_SEG_INDEX(gpc) (gpc >> 2)
@@ -2980,6 +2981,12 @@ static void gen_prov_start(const uint8_t idx, struct prov_rx *rx, struct net_buf
29802981
return;
29812982
}
29822983

2984+
if (START_LAST_SEG(rx->gpc) > START_LAST_SEG_MAX) {
2985+
BT_ERR("Invalid SegN 0x%02x", START_LAST_SEG(rx->gpc));
2986+
close_link(idx, CLOSE_REASON_FAILED);
2987+
return;
2988+
}
2989+
29832990
if (link[idx].rx.buf->len > link[idx].rx.buf->size) {
29842991
BT_ERR("Too large provisioning PDU (%u bytes)",
29852992
link[idx].rx.buf->len);

components/bt/host/bluedroid/btc/profile/std/spp/btc_spp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ static void btc_spp_init(btc_spp_args_t *arg)
519519
}
520520
if ((spp_local_param.tx_event_group = xEventGroupCreate()) == NULL) {
521521
BTC_TRACE_ERROR("%s create tx_event_group failed\n", __func__);
522+
osi_mutex_free(&spp_local_param.spp_slot_mutex);
522523
ret = ESP_SPP_NO_RESOURCE;
523524
break;
524525
}
@@ -582,11 +583,6 @@ static void btc_spp_uninit(void)
582583
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
583584
} while(0);
584585

585-
if (spp_local_param.tx_event_group) {
586-
vEventGroupDelete(spp_local_param.tx_event_group);
587-
spp_local_param.tx_event_group = NULL;
588-
}
589-
590586
if (ret != ESP_SPP_SUCCESS) {
591587
esp_spp_cb_param_t param;
592588
param.uninit.status = ret;
@@ -1256,6 +1252,10 @@ void btc_spp_cb_handler(btc_msg_t *msg)
12561252
param.uninit.status = ESP_SPP_SUCCESS;
12571253
BTA_JvFree();
12581254
osi_mutex_free(&spp_local_param.spp_slot_mutex);
1255+
if (spp_local_param.tx_event_group) {
1256+
vEventGroupDelete(spp_local_param.tx_event_group);
1257+
spp_local_param.tx_event_group = NULL;
1258+
}
12591259
#if SPP_DYNAMIC_MEMORY == TRUE
12601260
osi_free(spp_local_param_ptr);
12611261
spp_local_param_ptr = NULL;

components/bt/host/bluedroid/stack/btu/btu_hcif.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,6 +1598,11 @@ static void btu_hcif_ssr_evt_dump (UINT8 *p, UINT16 evt_len)
15981598
STREAM_TO_UINT16 (max_tx_lat, p);
15991599
STREAM_TO_UINT16 (max_rx_lat, p);
16001600

1601+
UNUSED(status);
1602+
UNUSED(handle);
1603+
UNUSED(max_tx_lat);
1604+
UNUSED(max_rx_lat);
1605+
16011606
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);
16021607
}
16031608
#endif
@@ -1962,6 +1967,9 @@ static void btu_hcif_link_supv_to_changed_evt (UINT8 *p)
19621967
STREAM_TO_UINT16(handle, p);
19631968
STREAM_TO_UINT16(supv_to, p);
19641969

1970+
UNUSED(handle);
1971+
UNUSED(supv_to);
1972+
19651973
HCI_TRACE_WARNING("hcif link supv_to changed: hdl 0x%x, supv_to %d", handle, supv_to);
19661974
}
19671975

components/driver/include/driver/gpio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull);
498498

499499
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
500500

501-
#define GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO(gpio_num) ((gpio_num & ~SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK) == 0)
501+
#define GPIO_IS_DEEP_SLEEP_WAKEUP_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
502+
(((1ULL << (gpio_num)) & SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK) != 0))
502503

503504
/**
504505
* @brief Enable GPIO deep-sleep wake-up function.

components/esp_phy/esp32c3/include/phy_init_data.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ extern "C" {
2020

2121
// define the lowest tx power as LOWEST_PHY_TX_POWER
2222
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52)
23-
#define PHY_TX_POWER_OFFSET 44
24-
#define PHY_TX_POWER_NUM 5
23+
#define PHY_TX_POWER_OFFSET 2
24+
#define PHY_TX_POWER_NUM 14
2525

2626
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
2727
#define PHY_CRC_ALGORITHM 1

components/esp_phy/esp32s2/include/phy_init_data.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ extern "C" {
2020

2121
// define the lowest tx power as LOWEST_PHY_TX_POWER
2222
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52)
23-
#define PHY_TX_POWER_OFFSET 44
24-
#define PHY_TX_POWER_NUM 5
23+
#define PHY_TX_POWER_OFFSET 2
24+
#define PHY_TX_POWER_NUM 14
2525

2626
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
2727
#define PHY_CRC_ALGORITHM 1

components/esp_phy/esp32s3/include/phy_init_data.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ extern "C" {
2020

2121
// define the lowest tx power as LOWEST_PHY_TX_POWER
2222
#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP_PHY_MAX_TX_POWER * 4, 0, 52)
23-
#define PHY_TX_POWER_OFFSET 44
24-
#define PHY_TX_POWER_NUM 5
23+
#define PHY_TX_POWER_OFFSET 2
24+
#define PHY_TX_POWER_NUM 14
2525

2626
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
2727
#define PHY_CRC_ALGORITHM 1

components/esp_phy/src/phy_init.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,6 @@ IRAM_ATTR void esp_mac_bb_power_down(void)
349349

350350
const esp_phy_init_data_t* esp_phy_get_init_data(void)
351351
{
352-
esp_err_t err = ESP_OK;
353-
const esp_partition_t* partition = NULL;
354352
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
355353
size_t init_data_store_length = sizeof(phy_init_magic_pre) +
356354
sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post);
@@ -362,7 +360,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
362360
memcpy(init_data_store, multi_phy_init_data_bin_start, init_data_store_length);
363361
ESP_LOGI(TAG, "loading embedded multiple PHY init data");
364362
#else
365-
partition = esp_partition_find_first(
363+
const esp_partition_t* partition = esp_partition_find_first(
366364
ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_PHY, NULL);
367365
if (partition == NULL) {
368366
ESP_LOGE(TAG, "PHY data partition not found");
@@ -377,7 +375,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
377375
return NULL;
378376
}
379377
// read phy data from flash
380-
err = esp_partition_read(partition, 0, init_data_store, init_data_store_length);
378+
esp_err_t err = esp_partition_read(partition, 0, init_data_store, init_data_store_length);
381379
if (err != ESP_OK) {
382380
ESP_LOGE(TAG, "failed to read PHY data partition (0x%x)", err);
383381
free(init_data_store);
@@ -388,6 +386,11 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
388386
if (memcmp(init_data_store, PHY_INIT_MAGIC, sizeof(phy_init_magic_pre)) != 0 ||
389387
memcmp(init_data_store + init_data_store_length - sizeof(phy_init_magic_post),
390388
PHY_INIT_MAGIC, sizeof(phy_init_magic_post)) != 0) {
389+
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
390+
ESP_LOGE(TAG, "failed to validate embedded PHY init data");
391+
free(init_data_store);
392+
return NULL;
393+
#else
391394
#ifndef CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID
392395
ESP_LOGE(TAG, "failed to validate PHY data partition");
393396
free(init_data_store);
@@ -414,6 +417,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
414417
return NULL;
415418
}
416419
#endif // CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID
420+
#endif // CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED
417421
}
418422
#if CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
419423
if ((*(init_data_store + (sizeof(phy_init_magic_pre) + PHY_SUPPORT_MULTIPLE_BIN_OFFSET)))) {
@@ -603,7 +607,6 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle,
603607
}
604608

605609
#if CONFIG_ESP_PHY_REDUCE_TX_POWER
606-
// TODO: fix the esp_phy_reduce_tx_power unused warning for esp32s2 - IDF-759
607610
static void __attribute((unused)) esp_phy_reduce_tx_power(esp_phy_init_data_t* init_data)
608611
{
609612
uint8_t i;

components/esp_pm/pm_impl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,8 @@ void esp_pm_impl_waiti(void)
831831
* the lock so that vApplicationSleep can attempt to enter light sleep.
832832
*/
833833
esp_pm_impl_idle_hook();
834-
s_skipped_light_sleep[core_id] = false;
835834
}
835+
s_skipped_light_sleep[core_id] = true;
836836
#else
837837
cpu_hal_waiti();
838838
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE

0 commit comments

Comments
 (0)