mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Compare commits
97 Commits
fb78a7a665
...
4f002f4ed9
Author | SHA1 | Date | |
---|---|---|---|
|
4f002f4ed9 | ||
|
9b3eda0974 | ||
|
6b9242b5c7 | ||
|
86c1ad216c | ||
|
115dec68ae | ||
|
da4a0798f4 | ||
|
4c7d9f9859 | ||
|
c62555d132 | ||
|
bff2f9b2dd | ||
|
79da963c62 | ||
|
2a12872d0a | ||
|
b01fd6b026 | ||
|
534c3288ae | ||
|
cba8c5d7ca | ||
|
b3ccc09ec3 | ||
|
81f4ef73c3 | ||
|
391dd7b9ad | ||
|
b8d23b334b | ||
|
9ca231e76e | ||
|
64203d1403 | ||
|
dcd433e62c | ||
|
ed92c2c226 | ||
|
d1a00f5808 | ||
|
bf9d01bf2a | ||
|
22facff58c | ||
|
3415ff27d6 | ||
|
2dbb811747 | ||
|
6a82497bdc | ||
|
5c43055e3e | ||
|
01f521f3a0 | ||
|
eb606b9777 | ||
|
eb676c0afc | ||
|
91ad4bcbce | ||
|
fb1b91c8d7 | ||
|
7a03ac385d | ||
|
f8894140ee | ||
|
6ade64eb05 | ||
|
4d2c44f511 | ||
|
0ef9ecb715 | ||
|
c929a01931 | ||
|
afe08638a0 | ||
|
453850eff2 | ||
|
28a92e56db | ||
|
27cf5267a1 | ||
|
6a0ec48b11 | ||
|
26be72307b | ||
|
84791fce2f | ||
|
a360c737ea | ||
|
40892b67c5 | ||
|
4b74e4e595 | ||
|
030470efa6 | ||
|
1a065dc37a | ||
|
5f865a81b9 | ||
|
cb2624fb3f | ||
|
ef1bffa937 | ||
|
0244f7a9b5 | ||
|
812fbb7874 | ||
|
328de495de | ||
|
4281f58229 | ||
|
fe47676a8b | ||
|
794c60411b | ||
|
f68d16e7ad | ||
|
75fec0bdff | ||
|
4e4fb3a57b | ||
|
2113e99aeb | ||
|
cfb78587f3 | ||
|
9725f3af74 | ||
|
6ec1e9107f | ||
|
2512588884 | ||
|
5a5c004691 | ||
|
f9e7305efd | ||
|
7834519af8 | ||
|
0b70e296a0 | ||
|
83809910d2 | ||
|
dd3d5f1598 | ||
|
205e66c9fd | ||
|
1cfb537813 | ||
|
bf52e37fa8 | ||
|
436bcd6c06 | ||
|
cdb9f2b098 | ||
|
8bf68ff07b | ||
|
5fe1f22b34 | ||
|
ee9a072c82 | ||
|
27a88b83fb | ||
|
53a8345e60 | ||
|
83393cdec8 | ||
|
8fd3e8c0d3 | ||
|
08a1e1350c | ||
|
e4e23087ee | ||
|
e4a372ab76 | ||
|
58775cce6e | ||
|
952533bee3 | ||
|
fe43c8f1b5 | ||
|
70d4414eeb | ||
|
b7f95afe77 | ||
|
42af06e3c0 | ||
|
04168efcaf |
@ -59,6 +59,7 @@
|
|||||||
/CONTRIBUTING.md @esp-idf-codeowners/docs
|
/CONTRIBUTING.md @esp-idf-codeowners/docs
|
||||||
/Kconfig @esp-idf-codeowners/build-config
|
/Kconfig @esp-idf-codeowners/build-config
|
||||||
/README*.md @esp-idf-codeowners/docs
|
/README*.md @esp-idf-codeowners/docs
|
||||||
|
/ROADMAP*.md @esp-idf-codeowners/docs
|
||||||
/SUPPORT_POLICY*.md @esp-idf-codeowners/docs
|
/SUPPORT_POLICY*.md @esp-idf-codeowners/docs
|
||||||
/add_path.sh @esp-idf-codeowners/tools
|
/add_path.sh @esp-idf-codeowners/tools
|
||||||
/conftest.py @esp-idf-codeowners/ci
|
/conftest.py @esp-idf-codeowners/ci
|
||||||
|
@ -156,11 +156,12 @@ build_clang_test_apps_esp32s3:
|
|||||||
extends:
|
extends:
|
||||||
- .build_cmake_clang_template
|
- .build_cmake_clang_template
|
||||||
variables:
|
variables:
|
||||||
# For RISCV clang generates '.linker-options' sections of type 'llvm_linker_options' in asm files.
|
# https://reviews.llvm.org/D90108.
|
||||||
# See (https://llvm.org/docs/Extensions.html#linker-options-section-linker-options).
|
# GNU 'as' lets .weak override .globl since binutils-gdb
|
||||||
# Binutils gas ignores them with warning.
|
# https://github.com/bminor/binutils-gdb/commit/5ca547dc2399a0a5d9f20626d4bf5547c3ccfddd (1996)
|
||||||
# TODO: LLVM-333, Use integrated assembler.
|
# while MC lets the last directive win (PR38921).
|
||||||
TEST_BUILD_OPTS_EXTRA: "--ignore-warning-str 'Warning: unrecognized section type'"
|
# For RISCV chips we use integrated assembler by default, so suppress this warning to pass CI pipeline.
|
||||||
|
TEST_BUILD_OPTS_EXTRA: "--ignore-warning-str 'changed binding to STB_WEAK'"
|
||||||
|
|
||||||
build_clang_test_apps_esp32c3:
|
build_clang_test_apps_esp32c3:
|
||||||
extends:
|
extends:
|
||||||
|
1
Kconfig
1
Kconfig
@ -676,6 +676,5 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
|||||||
- CONFIG_ESPTOOLPY_FLASHFREQ_120M && CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR
|
- CONFIG_ESPTOOLPY_FLASHFREQ_120M && CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR
|
||||||
- CONFIG_SPIRAM_SPEED_120M && CONFIG_SPIRAM_MODE_OCT
|
- CONFIG_SPIRAM_SPEED_120M && CONFIG_SPIRAM_MODE_OCT
|
||||||
- CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
|
- CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_QUAD_FLASH
|
||||||
- CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL
|
|
||||||
- CONFIG_ESP_WIFI_EAP_TLS1_3
|
- CONFIG_ESP_WIFI_EAP_TLS1_3
|
||||||
- CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
|
- CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
|
||||||
|
123
ROADMAP.md
Normal file
123
ROADMAP.md
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
# ESP-IDF Project Roadmap 2024
|
||||||
|
|
||||||
|
This document outlines the goals of ESP-IDF project and is shared for the convenience of our customers. It is important to clarify that this document is not a binding commitment to our customers. Instead, its primary purpose is to offer a clear roadmap and direction for the project's development. By openly sharing this information, we aim to enhance our customers' understanding, promote transparency and ensure alignment with the overarching objectives of the ESP-IDF project.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
### Project Goals
|
||||||
|
|
||||||
|
In both minor and major releases, we integrate new chip support to enhance our product range. By expanding the chip matrix, we broaden the scope of our offerings, catering to a wider audience with diverse needs. This proactive approach ensures that our products remain at the forefront of technological advancements, consistently meeting and exceeding customer expectations.
|
||||||
|
|
||||||
|
Furthermore, we prioritize bugfix releases for active branches, focusing on improving the stability and performance of products already in production. By addressing bugs promptly, we aim to enhance the overall user experience and provide tangible benefits to customers relying on our solutions. This proactive maintenance strategy reflects our commitment to delivering reliable, high-quality products to our valued customer base.
|
||||||
|
|
||||||
|
Below are the main objectives that ESP-IDF project/teams would like to implement in 2024.
|
||||||
|
|
||||||
|
- New Chip Support
|
||||||
|
|
||||||
|
- Add support for ESP32-P4
|
||||||
|
- Add support for ESP32-C5
|
||||||
|
- Add support for ESP32-C61
|
||||||
|
|
||||||
|
- More Minor Releases
|
||||||
|
|
||||||
|
- Release IDF v5.3 in 2024
|
||||||
|
- Release IDF v5.4 at the start of 2025
|
||||||
|
|
||||||
|
- More Bugfix Releases
|
||||||
|
|
||||||
|
- Release v4.4.8 for IDF v4.4 before ESP-IDF v4.4 goes End of Life in July 2024
|
||||||
|
- Do more bugfix releases for IDF v5.1 before release/5.1 enters maintenance period in June 2024
|
||||||
|
- Do more bug fixes releases for release/5.2 and release/5.3, and push the two releases to be more stable and production-ready
|
||||||
|
|
||||||
|
- Updates of Libraries
|
||||||
|
|
||||||
|
- Update GDB to 14.2
|
||||||
|
- Update LLVM to 18.1.2
|
||||||
|
- Update MbedTLS to 3.6 (LTS)
|
||||||
|
- Update LWIP to 2.2.0
|
||||||
|
- Change minimal Python requirement to 3.9
|
||||||
|
|
||||||
|
Please note that support status of previous silicones could be found on [ESP-IDF Release and SoC Compatibility](https://github.com/espressif/esp-idf#esp-idf-release-and-soc-compatibility).
|
||||||
|
|
||||||
|
### Roadmap Details
|
||||||
|
|
||||||
|
The ESP-IDF project prioritizes consistent maintenance and updates to ensure our customers remain at the forefront of technological advancements. Our commitment to ongoing development ensures that customers continuously benefit from the latest innovations in the field.
|
||||||
|
|
||||||
|
Moreover, we are dedicated to empowering our customers to leverage newly implemented features and enhanced functionalities through iterative improvements. Our steadfast commitment to pushing boundaries ensures that clients not only keep pace with evolving technology but also extract optimal value from the cutting-edge capabilities of our products.
|
||||||
|
|
||||||
|
Below are the main roadmap details for functional areas inside ESP-IDF.
|
||||||
|
|
||||||
|
- New Chip Support
|
||||||
|
|
||||||
|
- Add full support for ESP32-P4 in ESP-IDF v5.3, refer to [ESP32-P4 Support Status](https://github.com/espressif/esp-idf/issues/12996)
|
||||||
|
- Add preview support for ESP32-C5 in ESP-IDF v5.3 and full support for ESP32-C5 in ESP-IDF v5.4, refer to [ESP32-C5 Support Status](https://github.com/espressif/esp-idf/issues/14021)
|
||||||
|
- Add preview support for the early samples of ESP32-C61 in ESP-IDF v5.4 and full support for mass production version in ESP-IDF v5.4.x. Refer to [ESP32-C61 Support Status](https://developer.espressif.com/pages/chip-support-status/esp32c61/#esp-idf)
|
||||||
|
|
||||||
|
- Bugfix releases
|
||||||
|
|
||||||
|
- Do bugfix release IDF v4.4.8 and stop maintaining ESP-IDF v4.4 in July 2024
|
||||||
|
- Release bugfix IDF v5.0.6 and IDF v5.0.7 in 2024 (maintenance period)
|
||||||
|
- Release bugfix IDF v5.1.3 and IDF v5.1.4 in H1 of 2024, and release IDF v5.1.5 in H2 of 2024
|
||||||
|
- Push release/5.1 to maintenance period from June 2024
|
||||||
|
- Do more bug fixes releases for release/5.2 (IDF v5.2.1, IDF v5.2.2, IDF v5.2.3) and release/5.3 (IDF v5.3.1, IDF v5.3.2), and push releases to be more stable and more production-ready
|
||||||
|
|
||||||
|
## ESP-IDF Planning information
|
||||||
|
|
||||||
|
For the full list of ESP-IDF releases, please visit https://github.com/espressif/esp-idf/releases
|
||||||
|
|
||||||
|
### ESP-IDF Major Releases
|
||||||
|
|
||||||
|
No Major Releases planned
|
||||||
|
|
||||||
|
### ESP-IDF Minor Releases
|
||||||
|
|
||||||
|
#### Quarter One
|
||||||
|
|
||||||
|
- v5.2-RC1, estimate release date: 2024/02/02
|
||||||
|
- v5.2 final release, estimate release date: 2024/02/08
|
||||||
|
|
||||||
|
#### Quarter Two
|
||||||
|
|
||||||
|
- v5.3-beta1, estimate release date:: 2024/05/13
|
||||||
|
- v5.3-beta2, estimate release date:: 2024/05/31
|
||||||
|
- v5.3-RC1, estimate release date:: 2024/07/08
|
||||||
|
|
||||||
|
#### Quarter Three
|
||||||
|
|
||||||
|
- v5.3-RC2, estimate release date:: 2024/07/26
|
||||||
|
- v5.3 final release, estimate release date:: 2024/08/02
|
||||||
|
|
||||||
|
#### Quarter Four
|
||||||
|
|
||||||
|
- v5.4-beta1, estimate release date:: 2024/11/08
|
||||||
|
- v5.4-beta2, estimate release date:: 2024/11/29
|
||||||
|
- v5.4-RC1, estimate release date:: 2025/01/09
|
||||||
|
- v5.4-RC2, estimate release date:: 2025/01/29
|
||||||
|
- v5.4 final release, estimate release date: 2025/02/05
|
||||||
|
|
||||||
|
### ESP-IDF Bugfix Releases
|
||||||
|
|
||||||
|
#### Quarter One
|
||||||
|
|
||||||
|
- v5.1.3, estimate release date: 2024/02/08
|
||||||
|
- v5.0.6, estimate release date: 2024/02/18
|
||||||
|
- v4.4.7, estimate release date:: 2024/03/19
|
||||||
|
- v5.2.1, estimate release date:: 2024/03/31
|
||||||
|
|
||||||
|
#### Quarter Two
|
||||||
|
|
||||||
|
- v5.1.4, estimate release date:: 2024/05/06
|
||||||
|
- v5.2.2, estimate release date:: 2024/06/17
|
||||||
|
- v4.4.8, estimate release date:: 2024/07/19
|
||||||
|
|
||||||
|
#### Quarter Three
|
||||||
|
|
||||||
|
- v5.0.7, estimate release date: 2024/08/22
|
||||||
|
- v5.3.1, estimate release date: 2024/09/16
|
||||||
|
- v5.2.3, estimate release date: 2024/10/10
|
||||||
|
|
||||||
|
#### Quarter Four
|
||||||
|
|
||||||
|
- v5.1.5, estimate release date: 2024/11/04 (Maintenance period since June 2024)
|
||||||
|
- v5.3.2, estimate release date: 2024/12/31
|
||||||
|
- v5.2.4, estimate release date: 2025/02/20 (Service period ends Feb. 2025)
|
@ -26,8 +26,6 @@
|
|||||||
#define ESP_APPTRACE_MAX_VPRINTF_ARGS 256
|
#define ESP_APPTRACE_MAX_VPRINTF_ARGS 256
|
||||||
#define ESP_APPTRACE_HOST_BUF_SIZE 256
|
#define ESP_APPTRACE_HOST_BUF_SIZE 256
|
||||||
|
|
||||||
#define ESP_APPTRACE_PRINT_LOCK 0
|
|
||||||
|
|
||||||
const static char *TAG = "esp_apptrace";
|
const static char *TAG = "esp_apptrace";
|
||||||
|
|
||||||
/** tracing module internal data */
|
/** tracing module internal data */
|
||||||
@ -90,7 +88,7 @@ void esp_apptrace_down_buffer_config(uint8_t *buf, uint32_t size)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// currently down buffer is supported for JTAG interface only
|
// currently down buffer is supported for JTAG interface only
|
||||||
// TODO: one more argument should be added to this function to specify HW inteface: JTAG, UART0 etc
|
// TODO: one more argument should be added to this function to specify HW interface: JTAG, UART0 etc
|
||||||
ch = &s_trace_channels[ESP_APPTRACE_DEST_JTAG];
|
ch = &s_trace_channels[ESP_APPTRACE_DEST_JTAG];
|
||||||
if (ch->hw != NULL) {
|
if (ch->hw != NULL) {
|
||||||
if (ch->hw->down_buffer_config != NULL) {
|
if (ch->hw->down_buffer_config != NULL) {
|
||||||
|
@ -9,12 +9,14 @@
|
|||||||
#include "esp_app_trace_util.h"
|
#include "esp_app_trace_util.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
#define ESP_APPTRACE_PRINT_LOCK 0
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////////////// Locks /////////////////////////////////////
|
///////////////////////////////// Locks /////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if ESP_APPTRACE_PRINT_LOCK
|
#if ESP_APPTRACE_PRINT_LOCK
|
||||||
static esp_apptrace_lock_t s_log_lock = {.irq_stat = 0, .portmux = portMUX_INITIALIZER_UNLOCKED};
|
static esp_apptrace_lock_t s_log_lock = { .mux = portMUX_INITIALIZER_UNLOCKED };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int esp_apptrace_log_lock(void)
|
int esp_apptrace_log_lock(void)
|
||||||
@ -87,7 +89,7 @@ esp_err_t esp_apptrace_lock_give(esp_apptrace_lock_t *lock)
|
|||||||
uint8_t *esp_apptrace_rb_produce(esp_apptrace_rb_t *rb, uint32_t size)
|
uint8_t *esp_apptrace_rb_produce(esp_apptrace_rb_t *rb, uint32_t size)
|
||||||
{
|
{
|
||||||
uint8_t *ptr = rb->data + rb->wr;
|
uint8_t *ptr = rb->data + rb->wr;
|
||||||
// check for avalable space
|
// check for available space
|
||||||
if (rb->rd <= rb->wr) {
|
if (rb->rd <= rb->wr) {
|
||||||
// |?R......W??|
|
// |?R......W??|
|
||||||
if (rb->wr + size >= rb->size) {
|
if (rb->wr + size >= rb->size) {
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
|
||||||
|
|
||||||
components/app_update/test_apps:
|
|
||||||
disable:
|
|
||||||
- if: IDF_TARGET in ["esp32c61"]
|
|
||||||
temporary: true
|
|
||||||
reason: target esp32c61 is not supported yet # TODO: [ESP32C61] IDF-9245
|
|
@ -1,26 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
|
||||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
|
||||||
import re
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from pytest_embedded import Dut
|
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 20
|
|
||||||
TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
|
|
||||||
|
|
||||||
|
|
||||||
def run_multiple_stages(dut: Dut, test_case_num: int, stages: int) -> None:
|
|
||||||
for stage in range(1, stages + 1):
|
|
||||||
dut.write(str(test_case_num))
|
|
||||||
dut.expect(TEST_SUBMENU_PATTERN_PYTEST, timeout=DEFAULT_TIMEOUT)
|
|
||||||
dut.write(str(stage))
|
|
||||||
if stage != stages:
|
|
||||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.supported_targets
|
|
||||||
# TODO: [ESP32C61] IDF-9245, IDF-9247, IDF-10983
|
|
||||||
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='C61 has not supported deep sleep')
|
|
||||||
@pytest.mark.generic
|
|
||||||
def test_app_update(dut: Dut) -> None:
|
|
||||||
dut.run_all_single_board_cases(timeout=90)
|
|
@ -0,0 +1,12 @@
|
|||||||
|
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||||
|
|
||||||
|
components/app_update/test_apps:
|
||||||
|
enable:
|
||||||
|
- if: CONFIG_NAME == "defaults" and IDF_TARGET != "linux"
|
||||||
|
- if: CONFIG_NAME == "xip_psram" and IDF_TARGET in ["esp32s2", "esp32s3", "esp32p4"]
|
||||||
|
# S2 doesn't have ROM for flash
|
||||||
|
- if: CONFIG_NAME == "xip_psram_with_rom_impl" and IDF_TARGET in ["esp32s3", "esp32p4"]
|
||||||
|
disable:
|
||||||
|
- if: IDF_TARGET in ["esp32c61"]
|
||||||
|
temporary: true
|
||||||
|
reason: target esp32c61 is not supported yet # TODO: [ESP32C61] IDF-9245
|
@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES cmock test_utils app_update bootloader_support nvs_flash driver spi_flash
|
PRIV_REQUIRES cmock test_utils app_update bootloader_support nvs_flash driver spi_flash esp_psram
|
||||||
WHOLE_ARCHIVE)
|
WHOLE_ARCHIVE)
|
@ -6,6 +6,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "esp_log.h"
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
@ -113,3 +114,11 @@ TEST_CASE("esp_ota_get_partition_description", "[ota]")
|
|||||||
};
|
};
|
||||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, bootloader_common_get_partition_description(¬_app_pos, &app_desc1));
|
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, bootloader_common_get_partition_description(¬_app_pos, &app_desc1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("esp_ota_get_running_partition points to correct address", "[spi_flash]")
|
||||||
|
{
|
||||||
|
const esp_partition_t *factory = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_ANY, "factory");
|
||||||
|
const esp_partition_t* part = esp_ota_get_running_partition();
|
||||||
|
ESP_LOGI("running bin", "0x%p", (void*)part->address);
|
||||||
|
TEST_ASSERT_EQUAL_HEX32(factory->address, part->address);
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
|
import re
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pytest_embedded import Dut
|
||||||
|
|
||||||
|
DEFAULT_TIMEOUT = 20
|
||||||
|
TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.supported_targets
|
||||||
|
@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='C5 has not supported deep sleep') # TODO: [ESP32C5] IDF-8640, IDF-10317
|
||||||
|
@pytest.mark.generic
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'config',
|
||||||
|
[
|
||||||
|
'defaults',
|
||||||
|
],
|
||||||
|
indirect=True,
|
||||||
|
)
|
||||||
|
def test_app_update(dut: Dut) -> None:
|
||||||
|
dut.run_all_single_board_cases(timeout=90)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.supported_targets
|
||||||
|
# TODO: [ESP32C61] IDF-9245, IDF-9247, IDF-10983
|
||||||
|
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='C61 has not supported deep sleep')
|
||||||
|
@pytest.mark.generic
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'config',
|
||||||
|
[
|
||||||
|
'xip_psram',
|
||||||
|
],
|
||||||
|
indirect=True,
|
||||||
|
)
|
||||||
|
def test_app_update_xip_psram(dut: Dut) -> None:
|
||||||
|
dut.run_all_single_board_cases(timeout=90)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.supported_targets
|
||||||
|
@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='C5 has not supported deep sleep') # TODO: [ESP32C5] IDF-8640, IDF-10317
|
||||||
|
@pytest.mark.generic
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'config',
|
||||||
|
[
|
||||||
|
'xip_psram_with_rom_impl',
|
||||||
|
],
|
||||||
|
indirect=True,
|
||||||
|
)
|
||||||
|
def test_app_update_xip_psram_rom_impl(dut: Dut) -> None:
|
||||||
|
dut.run_all_single_board_cases(timeout=90)
|
@ -0,0 +1,2 @@
|
|||||||
|
# don't delete.
|
||||||
|
# used for CI to compile a default config when 'sdkconfig.ci.xxxx' is exist
|
@ -1,2 +1,2 @@
|
|||||||
CONFIG_IDF_TARGET="esp32c5"
|
CONFIG_SPIRAM=y
|
||||||
CONFIG_SPIRAM_XIP_FROM_PSRAM=y
|
CONFIG_SPIRAM_XIP_FROM_PSRAM=y
|
@ -0,0 +1,3 @@
|
|||||||
|
CONFIG_SPIRAM=y
|
||||||
|
CONFIG_SPIRAM_XIP_FROM_PSRAM=y
|
||||||
|
CONFIG_SPI_FLASH_ROM_IMPL=y
|
@ -6,6 +6,8 @@ endif()
|
|||||||
|
|
||||||
if(CONFIG_IDF_TARGET_ESP32S3)
|
if(CONFIG_IDF_TARGET_ESP32S3)
|
||||||
set(target_name "esp32c3")
|
set(target_name "esp32c3")
|
||||||
|
elseif(CONFIG_IDF_TARGET_ESP32C61)
|
||||||
|
set(target_name "esp32c6")
|
||||||
else()
|
else()
|
||||||
set(target_name "${idf_target}")
|
set(target_name "${idf_target}")
|
||||||
endif()
|
endif()
|
||||||
@ -853,6 +855,14 @@ if(CONFIG_BT_ENABLED)
|
|||||||
target_link_directories(${COMPONENT_LIB} INTERFACE
|
target_link_directories(${COMPONENT_LIB} INTERFACE
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
|
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
|
||||||
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
|
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
|
||||||
|
elseif(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
|
add_prebuilt_library(libble_app
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c6/esp32c6-bt-lib/esp32c6/libble_app.a")
|
||||||
|
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
||||||
|
elseif(CONFIG_IDF_TARGET_ESP32C61)
|
||||||
|
add_prebuilt_library(libble_app
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c6/esp32c6-bt-lib/esp32c61/libble_app.a")
|
||||||
|
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
||||||
elseif(CONFIG_BT_CONTROLLER_ENABLED)
|
elseif(CONFIG_BT_CONTROLLER_ENABLED)
|
||||||
add_prebuilt_library(libble_app "controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a")
|
add_prebuilt_library(libble_app "controller/lib_${target_name}/${target_name}-bt-lib/libble_app.a")
|
||||||
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
||||||
|
@ -200,8 +200,8 @@ choice BT_CTRL_DFT_TX_POWER_LEVEL
|
|||||||
bool "+15dBm"
|
bool "+15dBm"
|
||||||
config BT_CTRL_DFT_TX_POWER_LEVEL_P18
|
config BT_CTRL_DFT_TX_POWER_LEVEL_P18
|
||||||
bool "+18dBm"
|
bool "+18dBm"
|
||||||
config BT_CTRL_DFT_TX_POWER_LEVEL_P21
|
config BT_CTRL_DFT_TX_POWER_LEVEL_P20
|
||||||
bool "+21dBm"
|
bool "+20dBm"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
|
config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
|
||||||
@ -221,7 +221,7 @@ config BT_CTRL_DFT_TX_POWER_LEVEL_EFF
|
|||||||
default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
|
default 12 if BT_CTRL_DFT_TX_POWER_LEVEL_P12
|
||||||
default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
|
default 13 if BT_CTRL_DFT_TX_POWER_LEVEL_P15
|
||||||
default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
|
default 14 if BT_CTRL_DFT_TX_POWER_LEVEL_P18
|
||||||
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P21
|
default 15 if BT_CTRL_DFT_TX_POWER_LEVEL_P20
|
||||||
default 0
|
default 0
|
||||||
|
|
||||||
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
|
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
source "$IDF_PATH/components/bt/controller/esp32c6/Kconfig.in"
|
@ -1 +1 @@
|
|||||||
Subproject commit e652624750341aca124e9f850e261b0c1ac63529
|
Subproject commit e5c7ef0bf701d02c2203e26081fdd348d45935e5
|
@ -1 +1 @@
|
|||||||
Subproject commit f95513f22be7b21429b01ba05dbfbc98097b5e67
|
Subproject commit 3f15aa1d602aedf510dd9c686b3f7e5ea8a44002
|
@ -1 +1 @@
|
|||||||
Subproject commit 58a293a2b4c305157723908ea29c2776f5803bbc
|
Subproject commit 50f567fff506f63b4d06ebea80d0405fe9e39568
|
@ -126,6 +126,7 @@ config BT_L2CAP_ENABLED
|
|||||||
config BT_SDP_COMMON_ENABLED
|
config BT_SDP_COMMON_ENABLED
|
||||||
bool "BT SDP COMMON"
|
bool "BT SDP COMMON"
|
||||||
depends on BT_CLASSIC_ENABLED
|
depends on BT_CLASSIC_ENABLED
|
||||||
|
default y if BT_L2CAP_ENABLED
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
This enables common SDP operation, such as SDP record creation and deletion.
|
This enables common SDP operation, such as SDP record creation and deletion.
|
||||||
|
@ -242,6 +242,7 @@ typedef union {
|
|||||||
*/
|
*/
|
||||||
struct gatts_rsp_evt_param {
|
struct gatts_rsp_evt_param {
|
||||||
esp_gatt_status_t status; /*!< Operation status */
|
esp_gatt_status_t status; /*!< Operation status */
|
||||||
|
uint16_t conn_id; /*!< Connection id */
|
||||||
uint16_t handle; /*!< Attribute handle which send response */
|
uint16_t handle; /*!< Attribute handle which send response */
|
||||||
} rsp; /*!< Gatt server callback param of ESP_GATTS_RESPONSE_EVT */
|
} rsp; /*!< Gatt server callback param of ESP_GATTS_RESPONSE_EVT */
|
||||||
|
|
||||||
|
@ -65,30 +65,32 @@ typedef enum {
|
|||||||
/**
|
/**
|
||||||
* @brief SDP header structure
|
* @brief SDP header structure
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_hdr_overlay {
|
||||||
esp_bluetooth_sdp_types_t type; /*!< SDP type */
|
esp_bluetooth_sdp_types_t type; /*!< SDP type */
|
||||||
|
esp_bt_uuid_t uuid; /*!< UUID type, include uuid and uuid length, only needed to be set for RAW record creation */
|
||||||
uint32_t service_name_length; /*!< Service name length */
|
uint32_t service_name_length; /*!< Service name length */
|
||||||
char *service_name; /*!< Service name */
|
char *service_name; /*!< Service name */
|
||||||
int32_t rfcomm_channel_number; /*!< RFCOMM channel number, if not used set to -1*/
|
int32_t rfcomm_channel_number; /*!< RFCOMM channel number, if not used set to -1*/
|
||||||
int32_t l2cap_psm; /*!< L2CAP psm, if not used set to -1 */
|
int32_t l2cap_psm; /*!< L2CAP psm, if not used set to -1 */
|
||||||
int32_t profile_version; /*!< Profile version */
|
int32_t profile_version; /*!< Profile version */
|
||||||
} esp_bluetooth_sdp_hdr_t;
|
int user1_ptr_len; /*!< User data1 length, only used for searching RAW record */
|
||||||
|
uint8_t *user1_ptr; /*!< User data1 pointer to the raw SDP response data, only used for searching RAW record */
|
||||||
|
int user2_ptr_len __attribute__((deprecated)); /*!< User data2 length, only used for searching RAW record */
|
||||||
|
uint8_t *user2_ptr __attribute__((deprecated)); /*!< User data2 pointer, only used for searching RAW record */
|
||||||
|
} esp_bluetooth_sdp_hdr_overlay_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Raw SDP record
|
* @brief Raw SDP record
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_raw_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
esp_bt_uuid_t uuid; /*!< UUID type, include uuid and uuid length */
|
|
||||||
int user1_ptr_len; /*!< Length of raw SDP data */
|
|
||||||
uint8_t *user1_ptr; /*!< Raw SDP data */
|
|
||||||
} esp_bluetooth_sdp_raw_record_t;
|
} esp_bluetooth_sdp_raw_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Message Access Profile - Server parameters
|
* @brief Message Access Profile - Server parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_mas_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint32_t mas_instance_id; /*!< MAS Instance ID */
|
uint32_t mas_instance_id; /*!< MAS Instance ID */
|
||||||
uint32_t supported_features; /*!< Map supported features */
|
uint32_t supported_features; /*!< Map supported features */
|
||||||
uint32_t supported_message_types; /*!< Supported message types */
|
uint32_t supported_message_types; /*!< Supported message types */
|
||||||
@ -97,16 +99,16 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* @brief Message Access Profile - Client (Notification Server) parameters
|
* @brief Message Access Profile - Client (Notification Server) parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_mns_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint32_t supported_features; /*!< Supported features */
|
uint32_t supported_features; /*!< Supported features */
|
||||||
} esp_bluetooth_sdp_mns_record_t;
|
} esp_bluetooth_sdp_mns_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Phone Book Profile - Server parameters
|
* @brief Phone Book Profile - Server parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_pse_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint32_t supported_features; /*!< PBAP Supported Features */
|
uint32_t supported_features; /*!< PBAP Supported Features */
|
||||||
uint32_t supported_repositories; /*!< Supported Repositories */
|
uint32_t supported_repositories; /*!< Supported Repositories */
|
||||||
} esp_bluetooth_sdp_pse_record_t;
|
} esp_bluetooth_sdp_pse_record_t;
|
||||||
@ -114,15 +116,15 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* @brief Phone Book Profile - Client parameters
|
* @brief Phone Book Profile - Client parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_pce_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
} esp_bluetooth_sdp_pce_record_t;
|
} esp_bluetooth_sdp_pce_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Object Push Profile parameters
|
* @brief Object Push Profile parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_ops_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
int supported_formats_list_len; /*!< Supported formats list length */
|
int supported_formats_list_len; /*!< Supported formats list length */
|
||||||
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH]; /*!< Supported formats list */
|
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH]; /*!< Supported formats list */
|
||||||
} esp_bluetooth_sdp_ops_record_t;
|
} esp_bluetooth_sdp_ops_record_t;
|
||||||
@ -130,8 +132,8 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
* @brief SIM Access Profile parameters
|
* @brief SIM Access Profile parameters
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_sap_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
} esp_bluetooth_sdp_sap_record_t;
|
} esp_bluetooth_sdp_sap_record_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,8 +150,8 @@ typedef enum {
|
|||||||
* @note Only one primary Device Identification service record can be added in the SDP database. If primary
|
* @note Only one primary Device Identification service record can be added in the SDP database. If primary
|
||||||
* Device Identification service is created multiple times, only the last one will take effect.
|
* Device Identification service is created multiple times, only the last one will take effect.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct bluetooth_sdp_dip_record {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
uint16_t vendor; /*!< Vendor ID */
|
uint16_t vendor; /*!< Vendor ID */
|
||||||
uint16_t vendor_id_source; /*!< Vendor ID source, 0x0001 for Bluetooth, 0x0002 for USB, other values reserved, see `esp_sdp_vendor_id_source_t` */
|
uint16_t vendor_id_source; /*!< Vendor ID source, 0x0001 for Bluetooth, 0x0002 for USB, other values reserved, see `esp_sdp_vendor_id_source_t` */
|
||||||
uint16_t product; /*!< Product ID */
|
uint16_t product; /*!< Product ID */
|
||||||
@ -162,7 +164,7 @@ typedef struct {
|
|||||||
* @brief SDP record parameters union
|
* @brief SDP record parameters union
|
||||||
*/
|
*/
|
||||||
typedef union {
|
typedef union {
|
||||||
esp_bluetooth_sdp_hdr_t hdr; /*!< General info */
|
esp_bluetooth_sdp_hdr_overlay_t hdr; /*!< General info */
|
||||||
esp_bluetooth_sdp_raw_record_t raw; /*!< Raw SDP search data for unknown UUIDs */
|
esp_bluetooth_sdp_raw_record_t raw; /*!< Raw SDP search data for unknown UUIDs */
|
||||||
esp_bluetooth_sdp_mas_record_t mas; /*!< Message Access Profile - Server */
|
esp_bluetooth_sdp_mas_record_t mas; /*!< Message Access Profile - Server */
|
||||||
esp_bluetooth_sdp_mns_record_t mns; /*!< Message Access Profile - Client (Notification Server) */
|
esp_bluetooth_sdp_mns_record_t mns; /*!< Message Access Profile - Client (Notification Server) */
|
||||||
@ -205,7 +207,7 @@ typedef union {
|
|||||||
/**
|
/**
|
||||||
* @brief ESP_SDP_CREATE_RECORD_COMP_EVT
|
* @brief ESP_SDP_CREATE_RECORD_COMP_EVT
|
||||||
*/
|
*/
|
||||||
struct sdp_crate_record_evt_param {
|
struct sdp_create_record_evt_param {
|
||||||
esp_sdp_status_t status; /*!< Status */
|
esp_sdp_status_t status; /*!< Status */
|
||||||
int record_handle; /*!< SDP record handle */
|
int record_handle; /*!< SDP record handle */
|
||||||
} create_record; /*!< SDP callback param of ESP_SDP_CREATE_RECORD_COMP_EVT */
|
} create_record; /*!< SDP callback param of ESP_SDP_CREATE_RECORD_COMP_EVT */
|
||||||
|
@ -85,8 +85,10 @@ typedef void (tBTA_SDP_DM_CBACK)(tBTA_SDP_EVT event, tBTA_SDP *p_data, void *use
|
|||||||
|
|
||||||
/* MCE configuration structure */
|
/* MCE configuration structure */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
UINT16 sdp_raw_size; /* The size of p_sdp_raw_data */
|
||||||
UINT16 sdp_db_size; /* The size of p_sdp_db */
|
UINT16 sdp_db_size; /* The size of p_sdp_db */
|
||||||
#if (SDP_INCLUDED == TRUE)
|
#if (SDP_INCLUDED == TRUE)
|
||||||
|
UINT8 *p_sdp_raw_data; /* The data buffer to keep raw data */
|
||||||
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
|
tSDP_DISCOVERY_DB *p_sdp_db; /* The data buffer to keep SDP database */
|
||||||
#endif ///SDP_INCLUDED == TRUE
|
#endif ///SDP_INCLUDED == TRUE
|
||||||
} tBTA_SDP_CFG;
|
} tBTA_SDP_CFG;
|
||||||
|
@ -395,29 +395,29 @@ static void bta_create_raw_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE
|
|||||||
tSDP_DISC_ATTR *p_attr;
|
tSDP_DISC_ATTR *p_attr;
|
||||||
tSDP_PROTOCOL_ELEM pe;
|
tSDP_PROTOCOL_ELEM pe;
|
||||||
|
|
||||||
record->hdr.type = SDP_TYPE_RAW;
|
record->raw.hdr.type = SDP_TYPE_RAW;
|
||||||
record->hdr.service_name_length = 0;
|
record->raw.hdr.service_name_length = 0;
|
||||||
record->hdr.service_name = NULL;
|
record->raw.hdr.service_name = NULL;
|
||||||
record->hdr.rfcomm_channel_number = -1;
|
record->raw.hdr.rfcomm_channel_number = -1;
|
||||||
record->hdr.l2cap_psm = -1;
|
record->raw.hdr.l2cap_psm = -1;
|
||||||
record->hdr.profile_version = -1;
|
record->raw.hdr.profile_version = -1;
|
||||||
|
|
||||||
/* Try to extract a service name */
|
/* Try to extract a service name */
|
||||||
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL) {
|
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL) {
|
||||||
record->pse.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
|
record->raw.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
|
||||||
record->pse.hdr.service_name = (char *)p_attr->attr_value.v.array;
|
record->raw.hdr.service_name = (char *)p_attr->attr_value.v.array;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL) {
|
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL) {
|
||||||
record->hdr.l2cap_psm = p_attr->attr_value.v.u16;
|
record->raw.hdr.l2cap_psm = p_attr->attr_value.v.u16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to extract an RFCOMM channel */
|
/* Try to extract an RFCOMM channel */
|
||||||
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe)) {
|
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe)) {
|
||||||
record->pse.hdr.rfcomm_channel_number = pe.params[0];
|
record->raw.hdr.rfcomm_channel_number = pe.params[0];
|
||||||
}
|
}
|
||||||
record->raw.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_size;
|
record->raw.hdr.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_used;
|
||||||
record->raw.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
|
record->raw.hdr.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -570,6 +570,10 @@ void bta_sdp_search(tBTA_SDP_MSG *p_data)
|
|||||||
SDP_InitDiscoveryDb (p_bta_sdp_cfg->p_sdp_db, p_bta_sdp_cfg->sdp_db_size, 1,
|
SDP_InitDiscoveryDb (p_bta_sdp_cfg->p_sdp_db, p_bta_sdp_cfg->sdp_db_size, 1,
|
||||||
bta_sdp_search_uuid, 0, NULL);
|
bta_sdp_search_uuid, 0, NULL);
|
||||||
|
|
||||||
|
/* tell SDP to keep the raw data */
|
||||||
|
p_bta_sdp_cfg->p_sdp_db->raw_size = p_bta_sdp_cfg->sdp_raw_size;
|
||||||
|
p_bta_sdp_cfg->p_sdp_db->raw_data = p_bta_sdp_cfg->p_sdp_raw_data;
|
||||||
|
|
||||||
if (!SDP_ServiceSearchAttributeRequest2(p_data->get_search.bd_addr, p_bta_sdp_cfg->p_sdp_db,
|
if (!SDP_ServiceSearchAttributeRequest2(p_data->get_search.bd_addr, p_bta_sdp_cfg->p_sdp_db,
|
||||||
bta_sdp_search_cback, (void *)bta_sdp_search_uuid)) {
|
bta_sdp_search_cback, (void *)bta_sdp_search_uuid)) {
|
||||||
bta_sdp_cb.sdp_active = BTA_SDP_ACTIVE_NONE;
|
bta_sdp_cb.sdp_active = BTA_SDP_ACTIVE_NONE;
|
||||||
|
@ -65,7 +65,9 @@ tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK *p_cback)
|
|||||||
#if BTA_DYNAMIC_MEMORY == TRUE
|
#if BTA_DYNAMIC_MEMORY == TRUE
|
||||||
/* Malloc buffer for SDP configuration structure */
|
/* Malloc buffer for SDP configuration structure */
|
||||||
p_bta_sdp_cfg->p_sdp_db = (tSDP_DISCOVERY_DB *)osi_malloc(p_bta_sdp_cfg->sdp_db_size);
|
p_bta_sdp_cfg->p_sdp_db = (tSDP_DISCOVERY_DB *)osi_malloc(p_bta_sdp_cfg->sdp_db_size);
|
||||||
if (p_bta_sdp_cfg->p_sdp_db == NULL) {
|
p_bta_sdp_cfg->p_sdp_raw_data = (UINT8 *)osi_malloc(p_bta_sdp_cfg->sdp_raw_size);
|
||||||
|
if (p_bta_sdp_cfg->p_sdp_db == NULL || p_bta_sdp_cfg->p_sdp_raw_data == NULL) {
|
||||||
|
BTA_SdpCleanup();
|
||||||
return BTA_SDP_FAILURE;
|
return BTA_SDP_FAILURE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -118,8 +120,15 @@ tBTA_SDP_STATUS BTA_SdpCleanup(void)
|
|||||||
bta_sys_deregister(BTA_ID_SDP);
|
bta_sys_deregister(BTA_ID_SDP);
|
||||||
#if BTA_DYNAMIC_MEMORY == TRUE
|
#if BTA_DYNAMIC_MEMORY == TRUE
|
||||||
/* Free buffer for SDP configuration structure */
|
/* Free buffer for SDP configuration structure */
|
||||||
|
if (p_bta_sdp_cfg->p_sdp_db) {
|
||||||
osi_free(p_bta_sdp_cfg->p_sdp_db);
|
osi_free(p_bta_sdp_cfg->p_sdp_db);
|
||||||
p_bta_sdp_cfg->p_sdp_db = NULL;
|
p_bta_sdp_cfg->p_sdp_db = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_bta_sdp_cfg->p_sdp_raw_data) {
|
||||||
|
osi_free(p_bta_sdp_cfg->p_sdp_raw_data);
|
||||||
|
p_bta_sdp_cfg->p_sdp_raw_data = NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return BTA_SDP_SUCCESS;
|
return BTA_SDP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,24 @@
|
|||||||
#define BTA_SDP_DB_SIZE 1500
|
#define BTA_SDP_DB_SIZE 1500
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BTA_SDP_RAW_DATA_SIZE
|
||||||
|
#define BTA_SDP_RAW_DATA_SIZE 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||||
|
static UINT8 bta_sdp_raw_data[BTA_SDP_RAW_DATA_SIZE];
|
||||||
static UINT8 __attribute__ ((aligned(4))) bta_sdp_db_data[BTA_SDP_DB_SIZE];
|
static UINT8 __attribute__ ((aligned(4))) bta_sdp_db_data[BTA_SDP_DB_SIZE];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SDP configuration structure */
|
/* SDP configuration structure */
|
||||||
tBTA_SDP_CFG bta_sdp_cfg = {
|
tBTA_SDP_CFG bta_sdp_cfg = {
|
||||||
|
BTA_SDP_RAW_DATA_SIZE,
|
||||||
BTA_SDP_DB_SIZE,
|
BTA_SDP_DB_SIZE,
|
||||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||||
|
bta_sdp_raw_data,
|
||||||
(tSDP_DISCOVERY_DB *)bta_sdp_db_data /* The data buffer to keep SDP database */
|
(tSDP_DISCOVERY_DB *)bta_sdp_db_data /* The data buffer to keep SDP database */
|
||||||
#else
|
#else
|
||||||
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -469,7 +469,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat
|
|||||||
if(gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_16 &&
|
if(gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_16 &&
|
||||||
gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_32 &&
|
gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_32 &&
|
||||||
gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_128) {
|
gatts_attr_db[i+1].att_desc.uuid_length != ESP_UUID_LEN_128) {
|
||||||
BTC_TRACE_ERROR("%s, The Charateristic uuid length = %d is invalid", __func__,\
|
BTC_TRACE_ERROR("%s, The Characteristic uuid length = %d is invalid", __func__,\
|
||||||
gatts_attr_db[i+1].att_desc.uuid_length);
|
gatts_attr_db[i+1].att_desc.uuid_length);
|
||||||
return ESP_GATT_INVALID_ATTR_LEN;
|
return ESP_GATT_INVALID_ATTR_LEN;
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat
|
|||||||
uuid == ESP_GATT_UUID_CHAR_SRVR_CONFIG || uuid == ESP_GATT_UUID_CHAR_PRESENT_FORMAT ||
|
uuid == ESP_GATT_UUID_CHAR_SRVR_CONFIG || uuid == ESP_GATT_UUID_CHAR_PRESENT_FORMAT ||
|
||||||
uuid == ESP_GATT_UUID_CHAR_AGG_FORMAT || uuid == ESP_GATT_UUID_CHAR_VALID_RANGE ||
|
uuid == ESP_GATT_UUID_CHAR_AGG_FORMAT || uuid == ESP_GATT_UUID_CHAR_VALID_RANGE ||
|
||||||
uuid == ESP_GATT_UUID_EXT_RPT_REF_DESCR || uuid == ESP_GATT_UUID_RPT_REF_DESCR) {
|
uuid == ESP_GATT_UUID_EXT_RPT_REF_DESCR || uuid == ESP_GATT_UUID_RPT_REF_DESCR) {
|
||||||
BTC_TRACE_ERROR("%s, The charateristic value uuid = %d is invalid", __func__, uuid);
|
BTC_TRACE_ERROR("%s, The characteristic value uuid = %d is invalid", __func__, uuid);
|
||||||
return ESP_GATT_INVALID_PDU;
|
return ESP_GATT_INVALID_PDU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,6 +694,7 @@ void btc_gatts_call_handler(btc_msg_t *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
param.rsp.status = 0;
|
param.rsp.status = 0;
|
||||||
|
param.rsp.conn_id = BTC_GATT_GET_CONN_ID(arg->send_rsp.conn_id);
|
||||||
btc_gatts_cb_to_app(ESP_GATTS_RESPONSE_EVT, BTC_GATT_GET_GATT_IF(arg->send_rsp.conn_id), ¶m);
|
btc_gatts_cb_to_app(ESP_GATTS_RESPONSE_EVT, BTC_GATT_GET_GATT_IF(arg->send_rsp.conn_id), ¶m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -38,56 +38,62 @@ typedef enum {
|
|||||||
SDP_TYPE_DIP_SERVER, // Device Identification Profile
|
SDP_TYPE_DIP_SERVER, // Device Identification Profile
|
||||||
} bluetooth_sdp_types;
|
} bluetooth_sdp_types;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_hdr {
|
/**
|
||||||
|
* Some signals need additional pointers, hence we introduce a
|
||||||
|
* generic way to handle these pointers.
|
||||||
|
*/
|
||||||
|
typedef struct _bluetooth_sdp_hdr_overlay {
|
||||||
bluetooth_sdp_types type;
|
bluetooth_sdp_types type;
|
||||||
|
esp_bt_uuid_t uuid;
|
||||||
uint32_t service_name_length;
|
uint32_t service_name_length;
|
||||||
char *service_name;
|
char *service_name;
|
||||||
int32_t rfcomm_channel_number;
|
int32_t rfcomm_channel_number;
|
||||||
int32_t l2cap_psm;
|
int32_t l2cap_psm;
|
||||||
int32_t profile_version;
|
int32_t profile_version;
|
||||||
} bluetooth_sdp_hdr;
|
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_raw_record {
|
|
||||||
bluetooth_sdp_hdr hdr;
|
|
||||||
esp_bt_uuid_t uuid;
|
|
||||||
int user1_ptr_len;
|
int user1_ptr_len;
|
||||||
uint8_t *user1_ptr;
|
uint8_t *user1_ptr;
|
||||||
|
int user2_ptr_len; // not used
|
||||||
|
uint8_t *user2_ptr; // not used
|
||||||
|
} bluetooth_sdp_hdr_overlay;
|
||||||
|
|
||||||
|
typedef struct _bluetooth_sdp_raw_record {
|
||||||
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
} bluetooth_sdp_raw_record;
|
} bluetooth_sdp_raw_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_mas_record {
|
typedef struct _bluetooth_sdp_mas_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint32_t mas_instance_id;
|
uint32_t mas_instance_id;
|
||||||
uint32_t supported_features;
|
uint32_t supported_features;
|
||||||
uint32_t supported_message_types;
|
uint32_t supported_message_types;
|
||||||
} bluetooth_sdp_mas_record;
|
} bluetooth_sdp_mas_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_mns_record {
|
typedef struct _bluetooth_sdp_mns_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint32_t supported_features;
|
uint32_t supported_features;
|
||||||
} bluetooth_sdp_mns_record;
|
} bluetooth_sdp_mns_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_pse_record {
|
typedef struct _bluetooth_sdp_pse_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint32_t supported_features;
|
uint32_t supported_features;
|
||||||
uint32_t supported_repositories;
|
uint32_t supported_repositories;
|
||||||
} bluetooth_sdp_pse_record;
|
} bluetooth_sdp_pse_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_pce_record {
|
typedef struct _bluetooth_sdp_pce_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
} bluetooth_sdp_pce_record;
|
} bluetooth_sdp_pce_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_ops_record {
|
typedef struct _bluetooth_sdp_ops_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
int supported_formats_list_len;
|
int supported_formats_list_len;
|
||||||
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
|
uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
|
||||||
} bluetooth_sdp_ops_record;
|
} bluetooth_sdp_ops_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_sap_record {
|
typedef struct _bluetooth_sdp_sap_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
} bluetooth_sdp_sap_record;
|
} bluetooth_sdp_sap_record;
|
||||||
|
|
||||||
typedef struct _bluetooth_sdp_dip_record {
|
typedef struct _bluetooth_sdp_dip_record {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
uint16_t vendor;
|
uint16_t vendor;
|
||||||
uint16_t vendor_id_source;
|
uint16_t vendor_id_source;
|
||||||
uint16_t product;
|
uint16_t product;
|
||||||
@ -96,7 +102,7 @@ typedef struct _bluetooth_sdp_dip_record {
|
|||||||
} bluetooth_sdp_dip_record;
|
} bluetooth_sdp_dip_record;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
bluetooth_sdp_hdr hdr;
|
bluetooth_sdp_hdr_overlay hdr;
|
||||||
bluetooth_sdp_raw_record raw;
|
bluetooth_sdp_raw_record raw;
|
||||||
bluetooth_sdp_mas_record mas;
|
bluetooth_sdp_mas_record mas;
|
||||||
bluetooth_sdp_mns_record mns;
|
bluetooth_sdp_mns_record mns;
|
||||||
|
@ -91,11 +91,6 @@ static int get_sdp_record_size(bluetooth_sdp_record* in_record)
|
|||||||
records_size = sizeof(bluetooth_sdp_record);
|
records_size = sizeof(bluetooth_sdp_record);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDP_TYPE_RAW:
|
|
||||||
if (record->raw.user1_ptr != NULL) {
|
|
||||||
records_size += record->raw.user1_ptr_len;
|
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
default:
|
default:
|
||||||
records_size += sizeof(bluetooth_sdp_record);
|
records_size += sizeof(bluetooth_sdp_record);
|
||||||
records_size += record->hdr.service_name_length;
|
records_size += record->hdr.service_name_length;
|
||||||
@ -254,12 +249,6 @@ static void copy_sdp_record_common(bluetooth_sdp_record* in_record, bluetooth_sd
|
|||||||
*(free_ptr) = '\0'; // Set '\0' termination of string
|
*(free_ptr) = '\0'; // Set '\0' termination of string
|
||||||
free_ptr++;
|
free_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_record->hdr.type == SDP_TYPE_RAW && in_record->raw.user1_ptr != NULL) {
|
|
||||||
out_record->raw.user1_ptr = (UINT8 *)free_ptr; // Update pointer
|
|
||||||
memcpy(free_ptr, in_record->raw.user1_ptr, in_record->raw.user1_ptr_len); // Copy content
|
|
||||||
free_ptr += in_record->raw.user1_ptr_len;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy_sdp_record(bluetooth_sdp_record* in_record, bluetooth_sdp_record* out_record)
|
static void copy_sdp_record(bluetooth_sdp_record* in_record, bluetooth_sdp_record* out_record)
|
||||||
@ -402,6 +391,7 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
|
|||||||
UINT8 temp[LEN_UUID_128];
|
UINT8 temp[LEN_UUID_128];
|
||||||
UINT8* p_temp = temp;
|
UINT8* p_temp = temp;
|
||||||
UINT32 sdp_handle = 0;
|
UINT32 sdp_handle = 0;
|
||||||
|
const esp_bt_uuid_t *p_uuid = &rec->hdr.uuid;
|
||||||
|
|
||||||
BTC_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
|
BTC_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
|
||||||
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
|
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
|
||||||
@ -411,15 +401,15 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
|
|||||||
return sdp_handle;
|
return sdp_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rec->uuid.len == ESP_UUID_LEN_16) {
|
if (p_uuid->len == ESP_UUID_LEN_16) {
|
||||||
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
|
||||||
UINT16_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid16);
|
UINT16_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid16);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_32) {
|
} else if (p_uuid->len == ESP_UUID_LEN_32) {
|
||||||
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
|
||||||
UINT32_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid32);
|
UINT32_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid32);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_128) {
|
} else if (p_uuid->len == ESP_UUID_LEN_128) {
|
||||||
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
|
UINT8_TO_BE_STREAM (p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
|
||||||
ARRAY_TO_BE_STREAM (p_temp, rec->uuid.uuid.uuid128, LEN_UUID_128);
|
ARRAY_TO_BE_STREAM (p_temp, p_uuid->uuid.uuid128, LEN_UUID_128);
|
||||||
} else {
|
} else {
|
||||||
SDP_DeleteRecord(sdp_handle);
|
SDP_DeleteRecord(sdp_handle);
|
||||||
sdp_handle = 0;
|
sdp_handle = 0;
|
||||||
@ -466,12 +456,12 @@ static int add_raw_sdp(const bluetooth_sdp_raw_record *rec)
|
|||||||
sdp_handle = 0;
|
sdp_handle = 0;
|
||||||
BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status);
|
BTC_TRACE_ERROR("%s() FAILED, status = %d", __func__, status);
|
||||||
} else {
|
} else {
|
||||||
if (rec->uuid.len == ESP_UUID_LEN_16) {
|
if (p_uuid->len == ESP_UUID_LEN_16) {
|
||||||
bta_sys_add_uuid(rec->uuid.uuid.uuid16);
|
bta_sys_add_uuid(p_uuid->uuid.uuid16);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_32) {
|
} else if (p_uuid->len == ESP_UUID_LEN_32) {
|
||||||
bta_sys_add_uuid_32(rec->uuid.uuid.uuid32);
|
bta_sys_add_uuid_32(p_uuid->uuid.uuid32);
|
||||||
} else if (rec->uuid.len == ESP_UUID_LEN_128) {
|
} else if (p_uuid->len == ESP_UUID_LEN_128) {
|
||||||
bta_sys_add_uuid_128((UINT8 *)&rec->uuid.uuid.uuid128);
|
bta_sys_add_uuid_128((UINT8 *)&p_uuid->uuid.uuid128);
|
||||||
}
|
}
|
||||||
BTC_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
|
BTC_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
|
||||||
}
|
}
|
||||||
@ -943,7 +933,7 @@ static int btc_handle_create_record_event(int id)
|
|||||||
switch (record->hdr.type) {
|
switch (record->hdr.type) {
|
||||||
case SDP_TYPE_RAW:
|
case SDP_TYPE_RAW:
|
||||||
sdp_handle = add_raw_sdp(&record->raw);
|
sdp_handle = add_raw_sdp(&record->raw);
|
||||||
memcpy(&service_uuid, &record->raw.uuid, sizeof(esp_bt_uuid_t));
|
memcpy(&service_uuid, &record->hdr.uuid, sizeof(esp_bt_uuid_t));
|
||||||
break;
|
break;
|
||||||
case SDP_TYPE_MAP_MAS:
|
case SDP_TYPE_MAP_MAS:
|
||||||
sdp_handle = add_maps_sdp(&record->mas);
|
sdp_handle = add_maps_sdp(&record->mas);
|
||||||
@ -1041,6 +1031,83 @@ static bool btc_sdp_remove_record_event(int id, int *p_sdp_handle)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void btc_sdp_cb_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||||
|
{
|
||||||
|
switch (msg->act) {
|
||||||
|
case BTA_SDP_SEARCH_COMP_EVT: {
|
||||||
|
tBTA_SDP_SEARCH_COMP *src_search_comp = (tBTA_SDP_SEARCH_COMP *)p_src;
|
||||||
|
tBTA_SDP_SEARCH_COMP *dest_search_comp = (tBTA_SDP_SEARCH_COMP *)p_dest;
|
||||||
|
int record_count = src_search_comp->record_count;
|
||||||
|
|
||||||
|
for (int i = 0; i < record_count; i++) {
|
||||||
|
bluetooth_sdp_record *src_record = &src_search_comp->records[i];
|
||||||
|
bluetooth_sdp_record *dest_record = &dest_search_comp->records[i];
|
||||||
|
// deep copy service name
|
||||||
|
uint32_t src_service_name_length = src_record->hdr.service_name_length;
|
||||||
|
char *src_service_name = src_record->hdr.service_name;
|
||||||
|
dest_record->hdr.service_name_length = 0;
|
||||||
|
dest_record->hdr.service_name = NULL;
|
||||||
|
if (src_service_name && src_service_name_length) {
|
||||||
|
char *service_name = (char *)osi_malloc(src_service_name_length + 1);
|
||||||
|
if (service_name) {
|
||||||
|
memcpy(service_name, src_service_name, src_service_name_length);
|
||||||
|
service_name[src_service_name_length] = '\0';
|
||||||
|
|
||||||
|
dest_record->hdr.service_name_length = src_service_name_length;
|
||||||
|
dest_record->hdr.service_name = service_name;
|
||||||
|
} else {
|
||||||
|
BTC_TRACE_ERROR("%s malloc service name failed, orig service name:%s", __func__, src_service_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// deep copy user1_ptr fow RAW type
|
||||||
|
int src_user1_ptr_len = src_record->hdr.user1_ptr_len;
|
||||||
|
uint8_t *src_user1_ptr = src_record->hdr.user1_ptr;
|
||||||
|
dest_record->hdr.user1_ptr_len = 0;
|
||||||
|
dest_record->hdr.user1_ptr = NULL;
|
||||||
|
if (src_record->hdr.type == SDP_TYPE_RAW && src_user1_ptr && src_user1_ptr_len) {
|
||||||
|
uint8_t *user1_ptr = (uint8_t *)osi_malloc(src_user1_ptr_len);
|
||||||
|
if (user1_ptr) {
|
||||||
|
memcpy(user1_ptr, src_user1_ptr, src_user1_ptr_len);
|
||||||
|
|
||||||
|
dest_record->hdr.user1_ptr_len = src_user1_ptr_len;
|
||||||
|
dest_record->hdr.user1_ptr = user1_ptr;
|
||||||
|
} else {
|
||||||
|
BTC_TRACE_ERROR("%s malloc user1_ptr failed", __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void btc_sdp_cb_arg_deep_free(btc_msg_t *msg)
|
||||||
|
{
|
||||||
|
switch (msg->act) {
|
||||||
|
case BTA_SDP_SEARCH_COMP_EVT: {
|
||||||
|
tBTA_SDP_SEARCH_COMP *search_comp = (tBTA_SDP_SEARCH_COMP *)msg->arg;
|
||||||
|
for (size_t i = 0; i < search_comp->record_count; i++) {
|
||||||
|
bluetooth_sdp_record *record = &search_comp->records[i];
|
||||||
|
if (record->hdr.service_name) {
|
||||||
|
osi_free(record->hdr.service_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (record->hdr.user1_ptr) {
|
||||||
|
osi_free(record->hdr.user1_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void btc_sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_data)
|
static void btc_sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_data)
|
||||||
{
|
{
|
||||||
btc_msg_t msg;
|
btc_msg_t msg;
|
||||||
@ -1072,7 +1139,7 @@ static void btc_sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_da
|
|||||||
msg.pid = BTC_PID_SDP;
|
msg.pid = BTC_PID_SDP;
|
||||||
msg.act = event;
|
msg.act = event;
|
||||||
|
|
||||||
status = btc_transfer_context(&msg, p_data, sizeof(tBTA_SDP), NULL, NULL);
|
status = btc_transfer_context(&msg, p_data, sizeof(tBTA_SDP), btc_sdp_cb_arg_deep_copy, btc_sdp_cb_arg_deep_free);
|
||||||
|
|
||||||
if (status != BT_STATUS_SUCCESS) {
|
if (status != BT_STATUS_SUCCESS) {
|
||||||
BTC_TRACE_ERROR("%s btc_transfer_context failed", __func__);
|
BTC_TRACE_ERROR("%s btc_transfer_context failed", __func__);
|
||||||
@ -1244,11 +1311,10 @@ static void btc_sdp_search(btc_sdp_args_t *arg)
|
|||||||
|
|
||||||
void btc_sdp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
void btc_sdp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||||
{
|
{
|
||||||
|
switch (msg->act) {
|
||||||
|
case BTC_SDP_ACT_CREATE_RECORD: {
|
||||||
bluetooth_sdp_record **dst_record = &((btc_sdp_args_t *)p_dest)->create_record.record;
|
bluetooth_sdp_record **dst_record = &((btc_sdp_args_t *)p_dest)->create_record.record;
|
||||||
bluetooth_sdp_record *src_record = ((btc_sdp_args_t *)p_src)->create_record.record;
|
bluetooth_sdp_record *src_record = ((btc_sdp_args_t *)p_src)->create_record.record;
|
||||||
|
|
||||||
switch (msg->act) {
|
|
||||||
case BTC_SDP_ACT_CREATE_RECORD:
|
|
||||||
bluetooth_sdp_record *record = (bluetooth_sdp_record *)osi_calloc(get_sdp_record_size(src_record));
|
bluetooth_sdp_record *record = (bluetooth_sdp_record *)osi_calloc(get_sdp_record_size(src_record));
|
||||||
if (record) {
|
if (record) {
|
||||||
copy_sdp_record(src_record, record);
|
copy_sdp_record(src_record, record);
|
||||||
@ -1259,6 +1325,7 @@ void btc_sdp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
|||||||
|
|
||||||
*dst_record = record;
|
*dst_record = record;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1266,15 +1333,15 @@ void btc_sdp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
|||||||
|
|
||||||
void btc_sdp_arg_deep_free(btc_msg_t *msg)
|
void btc_sdp_arg_deep_free(btc_msg_t *msg)
|
||||||
{
|
{
|
||||||
|
switch (msg->act) {
|
||||||
|
case BTC_SDP_ACT_CREATE_RECORD: {
|
||||||
btc_sdp_args_t *arg = (btc_sdp_args_t *)msg->arg;
|
btc_sdp_args_t *arg = (btc_sdp_args_t *)msg->arg;
|
||||||
bluetooth_sdp_record *record = arg->create_record.record;
|
bluetooth_sdp_record *record = arg->create_record.record;
|
||||||
|
|
||||||
switch (msg->act) {
|
|
||||||
case BTC_SDP_ACT_CREATE_RECORD:
|
|
||||||
if (record) {
|
if (record) {
|
||||||
osi_free(record);
|
osi_free(record);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1331,23 +1398,11 @@ void btc_sdp_cb_handler(btc_msg_t *msg)
|
|||||||
sdp_local_param.search_allowed = true;
|
sdp_local_param.search_allowed = true;
|
||||||
|
|
||||||
param.search.status = p_data->sdp_search_comp.status;
|
param.search.status = p_data->sdp_search_comp.status;
|
||||||
if (param.search.status == ESP_SDP_SUCCESS) {
|
|
||||||
memcpy(param.search.remote_addr, p_data->sdp_search_comp.remote_addr, sizeof(BD_ADDR));
|
memcpy(param.search.remote_addr, p_data->sdp_search_comp.remote_addr, sizeof(BD_ADDR));
|
||||||
memcpy(¶m.search.sdp_uuid, &p_data->sdp_search_comp.uuid, sizeof(tSDP_UUID));
|
memcpy(¶m.search.sdp_uuid, &p_data->sdp_search_comp.uuid, sizeof(tSDP_UUID));
|
||||||
param.search.record_count = p_data->sdp_search_comp.record_count;
|
param.search.record_count = p_data->sdp_search_comp.record_count;
|
||||||
param.search.records = osi_malloc(sizeof(esp_bluetooth_sdp_record_t)*p_data->sdp_search_comp.record_count);
|
param.search.records = (esp_bluetooth_sdp_record_t *)p_data->sdp_search_comp.records;
|
||||||
if (param.search.records != NULL) {
|
|
||||||
memcpy(param.search.records, p_data->sdp_search_comp.records,
|
|
||||||
sizeof(esp_bluetooth_sdp_record_t)*p_data->sdp_search_comp.record_count);
|
|
||||||
} else {
|
|
||||||
BTC_TRACE_ERROR("%s %d osi_malloc failed\n", __func__, event);
|
|
||||||
param.search.status = ESP_SDP_NO_RESOURCE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
btc_sdp_cb_to_app(ESP_SDP_SEARCH_COMP_EVT, ¶m);
|
btc_sdp_cb_to_app(ESP_SDP_SEARCH_COMP_EVT, ¶m);
|
||||||
if (param.search.records != NULL) {
|
|
||||||
osi_free(param.search.records);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case BTA_SDP_CREATE_RECORD_USER_EVT:
|
case BTA_SDP_CREATE_RECORD_USER_EVT:
|
||||||
param.create_record.status = p_data->sdp_create_record.status;
|
param.create_record.status = p_data->sdp_create_record.status;
|
||||||
@ -1372,6 +1427,8 @@ void btc_sdp_cb_handler(btc_msg_t *msg)
|
|||||||
BTC_TRACE_DEBUG("%s: Unhandled event (%d)!", __func__, msg->act);
|
BTC_TRACE_DEBUG("%s: Unhandled event (%d)!", __func__, msg->act);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btc_sdp_cb_arg_deep_free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif ///defined BTC_SDP_COMMON_INCLUDED && BTC_SDP_COMMON_INCLUDED == TRUE
|
#endif ///defined BTC_SDP_COMMON_INCLUDED && BTC_SDP_COMMON_INCLUDED == TRUE
|
||||||
|
@ -1310,7 +1310,7 @@
|
|||||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
#define BTM_BLE_ADV_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
|
#define BTM_BLE_ADV_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
|
||||||
#else
|
#else
|
||||||
#define BTM_BLE_ADV_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21}
|
#define BTM_BLE_ADV_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 20}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1318,7 +1318,7 @@
|
|||||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
#define BTM_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
|
#define BTM_TX_POWER {-12, -9, -6, -3, 0, 3, 6, 9}
|
||||||
#else
|
#else
|
||||||
#define BTM_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21}
|
#define BTM_TX_POWER {-24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 20}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ static void start_up(void)
|
|||||||
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||||
|
|
||||||
#if (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
|
#if (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
|
||||||
if (HCI_LE_ENHANCED_PRIVACY_SUPPORTED(controller_param.features_ble.as_array)) {
|
if (HCI_LE_EXT_ADV_SUPPORTED(controller_param.features_ble.as_array)) {
|
||||||
response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len());
|
response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len());
|
||||||
controller_param.packet_parser->parse_ble_read_adv_max_len_response(
|
controller_param.packet_parser->parse_ble_read_adv_max_len_response(
|
||||||
response,
|
response,
|
||||||
|
@ -186,7 +186,9 @@ static void parse_ble_read_resolving_list_size_response(
|
|||||||
{
|
{
|
||||||
|
|
||||||
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_RESOLVING_LIST_SIZE, 1 /* bytes after */);
|
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_RESOLVING_LIST_SIZE, 1 /* bytes after */);
|
||||||
|
if (stream) {
|
||||||
STREAM_TO_UINT8(*resolving_list_size_ptr, stream);
|
STREAM_TO_UINT8(*resolving_list_size_ptr, stream);
|
||||||
|
}
|
||||||
|
|
||||||
osi_free(response);
|
osi_free(response);
|
||||||
}
|
}
|
||||||
@ -198,10 +200,14 @@ static void parse_ble_read_suggested_default_data_length_response(
|
|||||||
{
|
{
|
||||||
|
|
||||||
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_DEFAULT_DATA_LENGTH, 2 /* bytes after */);
|
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_DEFAULT_DATA_LENGTH, 2 /* bytes after */);
|
||||||
|
if (stream) {
|
||||||
STREAM_TO_UINT16(*ble_default_packet_length_ptr, stream);
|
STREAM_TO_UINT16(*ble_default_packet_length_ptr, stream);
|
||||||
STREAM_TO_UINT16(*ble_default_packet_txtime_ptr, stream);
|
STREAM_TO_UINT16(*ble_default_packet_txtime_ptr, stream);
|
||||||
|
}
|
||||||
|
|
||||||
osi_free(response);
|
osi_free(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||||
static void parse_ble_read_adv_max_len_response(
|
static void parse_ble_read_adv_max_len_response(
|
||||||
BT_HDR *response,
|
BT_HDR *response,
|
||||||
@ -209,8 +215,10 @@ static void parse_ble_read_adv_max_len_response(
|
|||||||
{
|
{
|
||||||
|
|
||||||
uint8_t *stream = read_command_complete_header(response, HCI_BLE_RD_MAX_ADV_DATA_LEN, 1 /* bytes after */);
|
uint8_t *stream = read_command_complete_header(response, HCI_BLE_RD_MAX_ADV_DATA_LEN, 1 /* bytes after */);
|
||||||
|
if (stream) {
|
||||||
// Size: 2 Octets ; Value: 0x001F – 0x0672 ; Maximum supported advertising data length
|
// Size: 2 Octets ; Value: 0x001F – 0x0672 ; Maximum supported advertising data length
|
||||||
STREAM_TO_UINT16(*adv_max_len_ptr, stream);
|
STREAM_TO_UINT16(*adv_max_len_ptr, stream);
|
||||||
|
}
|
||||||
|
|
||||||
osi_free(response);
|
osi_free(response);
|
||||||
}
|
}
|
||||||
@ -254,6 +262,7 @@ static uint8_t *read_command_complete_header(
|
|||||||
STREAM_TO_UINT8(status, stream);
|
STREAM_TO_UINT8(status, stream);
|
||||||
|
|
||||||
if (status != HCI_SUCCESS) {
|
if (status != HCI_SUCCESS) {
|
||||||
|
HCI_TRACE_ERROR("%s failed: opcode 0x%04x, status 0x%02x", __func__, opcode, status);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1871,42 +1871,50 @@ typedef struct {
|
|||||||
#define HCI_PING_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_PING_OFF] & HCI_EXT_FEATURE_PING_MASK)
|
#define HCI_PING_SUPPORTED(x) ((x)[HCI_EXT_FEATURE_PING_OFF] & HCI_EXT_FEATURE_PING_MASK)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** LE features encoding - page 0 (the only page for now)
|
** LE features encoding - page 0
|
||||||
*/
|
*/
|
||||||
/* LE Encryption */
|
/* LE Encryption: bit 0 */
|
||||||
#define HCI_LE_FEATURE_LE_ENCRYPTION_MASK 0x01
|
#define HCI_LE_FEATURE_LE_ENCRYPTION_MASK 0x01
|
||||||
#define HCI_LE_FEATURE_LE_ENCRYPTION_OFF 0
|
#define HCI_LE_FEATURE_LE_ENCRYPTION_OFF 0
|
||||||
#define HCI_LE_ENCRYPTION_SUPPORTED(x) ((x)[HCI_LE_FEATURE_LE_ENCRYPTION_OFF] & HCI_LE_FEATURE_LE_ENCRYPTION_MASK)
|
#define HCI_LE_ENCRYPTION_SUPPORTED(x) ((x)[HCI_LE_FEATURE_LE_ENCRYPTION_OFF] & HCI_LE_FEATURE_LE_ENCRYPTION_MASK)
|
||||||
|
|
||||||
/* Connection Parameters Request Procedure */
|
/* Connection Parameters Request Procedure: bit 1 */
|
||||||
#define HCI_LE_FEATURE_CONN_PARAM_REQ_MASK 0x02
|
#define HCI_LE_FEATURE_CONN_PARAM_REQ_MASK 0x02
|
||||||
#define HCI_LE_FEATURE_CONN_PARAM_REQ_OFF 0
|
#define HCI_LE_FEATURE_CONN_PARAM_REQ_OFF 0
|
||||||
#define HCI_LE_CONN_PARAM_REQ_SUPPORTED(x) ((x)[HCI_LE_FEATURE_CONN_PARAM_REQ_OFF] & HCI_LE_FEATURE_CONN_PARAM_REQ_MASK)
|
#define HCI_LE_CONN_PARAM_REQ_SUPPORTED(x) ((x)[HCI_LE_FEATURE_CONN_PARAM_REQ_OFF] & HCI_LE_FEATURE_CONN_PARAM_REQ_MASK)
|
||||||
|
|
||||||
/* Extended Reject Indication */
|
/* Extended Reject Indication: bit 2 */
|
||||||
#define HCI_LE_FEATURE_EXT_REJ_IND_MASK 0x04
|
#define HCI_LE_FEATURE_EXT_REJ_IND_MASK 0x04
|
||||||
#define HCI_LE_FEATURE_EXT_REJ_IND_OFF 0
|
#define HCI_LE_FEATURE_EXT_REJ_IND_OFF 0
|
||||||
#define HCI_LE_EXT_REJ_IND_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_REJ_IND_OFF] & HCI_LE_FEATURE_EXT_REJ_IND_MASK)
|
#define HCI_LE_EXT_REJ_IND_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_REJ_IND_OFF] & HCI_LE_FEATURE_EXT_REJ_IND_MASK)
|
||||||
|
|
||||||
/* Slave-initiated Features Exchange */
|
/* Slave-initiated Features Exchange: bit 3 */
|
||||||
#define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK 0x08
|
#define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK 0x08
|
||||||
#define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF 0
|
#define HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF 0
|
||||||
#define HCI_LE_SLAVE_INIT_FEAT_EXC_SUPPORTED(x) ((x)[HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF] & HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK)
|
#define HCI_LE_SLAVE_INIT_FEAT_EXC_SUPPORTED(x) ((x)[HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_OFF] & HCI_LE_FEATURE_SLAVE_INIT_FEAT_EXC_MASK)
|
||||||
|
|
||||||
|
/* LE Data Packet Length Extension: bit 5 */
|
||||||
|
#define HCI_LE_FEATURE_DATA_LEN_EXT_MASK 0x20
|
||||||
|
#define HCI_LE_FEATURE_DATA_LEN_EXT_OFF 0
|
||||||
|
#define HCI_LE_DATA_LEN_EXT_SUPPORTED(x) ((x)[HCI_LE_FEATURE_DATA_LEN_EXT_OFF] & HCI_LE_FEATURE_DATA_LEN_EXT_MASK)
|
||||||
|
|
||||||
/* Enhanced privacy Feature: bit 6 */
|
/* Enhanced privacy Feature: bit 6 */
|
||||||
#define HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK 0x40
|
#define HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK 0x40
|
||||||
#define HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF 0
|
#define HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF 0
|
||||||
#define HCI_LE_ENHANCED_PRIVACY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF] & HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK)
|
#define HCI_LE_ENHANCED_PRIVACY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_ENHANCED_PRIVACY_OFF] & HCI_LE_FEATURE_ENHANCED_PRIVACY_MASK)
|
||||||
|
|
||||||
/* Extended scanner filter policy : 7 */
|
/* Extended scanner filter policy: bit 7 */
|
||||||
#define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK 0x80
|
#define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK 0x80
|
||||||
#define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF 0
|
#define HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF 0
|
||||||
#define HCI_LE_EXT_SCAN_FILTER_POLICY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF] & HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK)
|
#define HCI_LE_EXT_SCAN_FILTER_POLICY_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_OFF] & HCI_LE_FEATURE_EXT_SCAN_FILTER_POLICY_MASK)
|
||||||
|
|
||||||
/* Slave-initiated Features Exchange */
|
/*
|
||||||
#define HCI_LE_FEATURE_DATA_LEN_EXT_MASK 0x20
|
** LE features encoding - page 1
|
||||||
#define HCI_LE_FEATURE_DATA_LEN_EXT_OFF 0
|
*/
|
||||||
#define HCI_LE_DATA_LEN_EXT_SUPPORTED(x) ((x)[HCI_LE_FEATURE_DATA_LEN_EXT_OFF] & HCI_LE_FEATURE_DATA_LEN_EXT_MASK)
|
/* LE Extended Advertising: bit 12 */
|
||||||
|
#define HCI_LE_FEATURE_EXT_ADV_MASK 0x10
|
||||||
|
#define HCI_LE_FEATURE_EXT_ADV_OFF 1
|
||||||
|
#define HCI_LE_EXT_ADV_SUPPORTED(x) ((x)[HCI_LE_FEATURE_EXT_ADV_OFF] & HCI_LE_FEATURE_EXT_ADV_MASK)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Local Supported Commands encoding
|
** Local Supported Commands encoding
|
||||||
|
@ -65,7 +65,7 @@ config BT_NIMBLE_LOG_LEVEL
|
|||||||
config BT_NIMBLE_MAX_CONNECTIONS
|
config BT_NIMBLE_MAX_CONNECTIONS
|
||||||
int "Maximum number of concurrent connections"
|
int "Maximum number of concurrent connections"
|
||||||
range 1 2 if IDF_TARGET_ESP32C2
|
range 1 2 if IDF_TARGET_ESP32C2
|
||||||
range 1 70 if IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32C5
|
range 1 70 if IDF_TARGET_ESP32C6 || IDF_TARGET_ESP32C5 || IDF_TARGET_ESP32C61
|
||||||
range 1 35 if IDF_TARGET_ESP32H2
|
range 1 35 if IDF_TARGET_ESP32H2
|
||||||
range 1 9
|
range 1 9
|
||||||
default 2 if IDF_TARGET_ESP32C2
|
default 2 if IDF_TARGET_ESP32C2
|
||||||
|
@ -190,6 +190,11 @@ static void controller_rcv_pkt_ready(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dummy_controller_rcv_pkt_ready(void)
|
||||||
|
{
|
||||||
|
/* Dummy function */
|
||||||
|
}
|
||||||
|
|
||||||
void bt_record_hci_data(uint8_t *data, uint16_t len)
|
void bt_record_hci_data(uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||||
@ -203,6 +208,12 @@ void bt_record_hci_data(uint8_t *data, uint16_t len)
|
|||||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dummy_host_rcv_pkt(uint8_t *data, uint16_t len)
|
||||||
|
{
|
||||||
|
/* Dummy function */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief: BT controller callback function, to transfer data packet to the host
|
* @brief: BT controller callback function, to transfer data packet to the host
|
||||||
*/
|
*/
|
||||||
@ -264,6 +275,11 @@ static const esp_vhci_host_callback_t vhci_host_cb = {
|
|||||||
.notify_host_recv = host_rcv_pkt,
|
.notify_host_recv = host_rcv_pkt,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const esp_vhci_host_callback_t dummy_vhci_host_cb = {
|
||||||
|
.notify_host_send_available = dummy_controller_rcv_pkt_ready,
|
||||||
|
.notify_host_recv = dummy_host_rcv_pkt,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
extern void ble_transport_init(void);
|
extern void ble_transport_init(void);
|
||||||
extern esp_err_t ble_buf_alloc(void);
|
extern esp_err_t ble_buf_alloc(void);
|
||||||
@ -313,6 +329,8 @@ esp_err_t esp_nimble_hci_deinit(void)
|
|||||||
}
|
}
|
||||||
ble_transport_deinit();
|
ble_transport_deinit();
|
||||||
|
|
||||||
|
esp_vhci_host_register_callback(&dummy_vhci_host_cb);
|
||||||
|
|
||||||
ble_buf_free();
|
ble_buf_free();
|
||||||
|
|
||||||
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)
|
#if MYNEWT_VAL(BLE_QUEUE_CONG_CHECK)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 6b890f81c0db10ae4757e27eb1312f4232d8fb56
|
Subproject commit 7e4f538a23591dfd361b90415eb517c6fc901a40
|
@ -386,7 +386,8 @@ typedef enum {
|
|||||||
ESP_PWR_LVL_P12 = 12, /*!< Corresponding to +12dbm */
|
ESP_PWR_LVL_P12 = 12, /*!< Corresponding to +12dbm */
|
||||||
ESP_PWR_LVL_P15 = 13, /*!< Corresponding to +15dbm */
|
ESP_PWR_LVL_P15 = 13, /*!< Corresponding to +15dbm */
|
||||||
ESP_PWR_LVL_P18 = 14, /*!< Corresponding to +18dbm */
|
ESP_PWR_LVL_P18 = 14, /*!< Corresponding to +18dbm */
|
||||||
ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +21dbm */
|
ESP_PWR_LVL_P20 = 15, /*!< Corresponding to +20dbm */
|
||||||
|
ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +20dbm, this enum variable has been deprecated */
|
||||||
ESP_PWR_LVL_INVALID = 0xFF, /*!< Indicates an invalid value */
|
ESP_PWR_LVL_INVALID = 0xFF, /*!< Indicates an invalid value */
|
||||||
} esp_power_level_t;
|
} esp_power_level_t;
|
||||||
|
|
||||||
|
@ -206,7 +206,9 @@ typedef struct {
|
|||||||
uint8_t cca_drop_mode; /*!< CCA drop mode */
|
uint8_t cca_drop_mode; /*!< CCA drop mode */
|
||||||
int8_t cca_low_tx_pwr; /*!< CCA low transmit power */
|
int8_t cca_low_tx_pwr; /*!< CCA low transmit power */
|
||||||
uint8_t main_xtal_freq; /*!< Main crystal frequency */
|
uint8_t main_xtal_freq; /*!< Main crystal frequency */
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32C6
|
||||||
uint32_t version_num; /*!< Controller configuration version number */
|
uint32_t version_num; /*!< Controller configuration version number */
|
||||||
|
#endif //CONFIG_IDF_TARGET_ESP32C6
|
||||||
uint8_t cpu_freq_mhz; /*!< CPU frequency in megahertz (MHz) */
|
uint8_t cpu_freq_mhz; /*!< CPU frequency in megahertz (MHz) */
|
||||||
uint8_t ignore_wl_for_direct_adv; /*!< Ignore the whitelist for direct advertising */
|
uint8_t ignore_wl_for_direct_adv; /*!< Ignore the whitelist for direct advertising */
|
||||||
uint8_t enable_pcl; /*!< Enable power control */
|
uint8_t enable_pcl; /*!< Enable power control */
|
||||||
@ -214,6 +216,7 @@ typedef struct {
|
|||||||
uint32_t config_magic; /*!< Magic number for configuration validation */
|
uint32_t config_magic; /*!< Magic number for configuration validation */
|
||||||
} esp_bt_controller_config_t;
|
} esp_bt_controller_config_t;
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32C6
|
||||||
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \
|
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \
|
||||||
.config_version = CONFIG_VERSION, \
|
.config_version = CONFIG_VERSION, \
|
||||||
.ble_ll_resolv_list_size = CONFIG_BT_LE_LL_RESOLV_LIST_SIZE, \
|
.ble_ll_resolv_list_size = CONFIG_BT_LE_LL_RESOLV_LIST_SIZE, \
|
||||||
@ -261,6 +264,54 @@ typedef struct {
|
|||||||
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
|
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
|
||||||
.config_magic = CONFIG_MAGIC, \
|
.config_magic = CONFIG_MAGIC, \
|
||||||
}
|
}
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP32C61
|
||||||
|
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \
|
||||||
|
.config_version = CONFIG_VERSION, \
|
||||||
|
.ble_ll_resolv_list_size = CONFIG_BT_LE_LL_RESOLV_LIST_SIZE, \
|
||||||
|
.ble_hci_evt_hi_buf_count = DEFAULT_BT_LE_HCI_EVT_HI_BUF_COUNT, \
|
||||||
|
.ble_hci_evt_lo_buf_count = DEFAULT_BT_LE_HCI_EVT_LO_BUF_COUNT, \
|
||||||
|
.ble_ll_sync_list_cnt = DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST, \
|
||||||
|
.ble_ll_sync_cnt = DEFAULT_BT_LE_MAX_PERIODIC_SYNCS, \
|
||||||
|
.ble_ll_rsp_dup_list_count = CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT, \
|
||||||
|
.ble_ll_adv_dup_list_count = CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT, \
|
||||||
|
.ble_ll_tx_pwr_dbm = BLE_LL_TX_PWR_DBM_N, \
|
||||||
|
.rtc_freq = RTC_FREQ_N, \
|
||||||
|
.ble_ll_sca = CONFIG_BT_LE_LL_SCA, \
|
||||||
|
.ble_ll_scan_phy_number = BLE_LL_SCAN_PHY_NUMBER_N, \
|
||||||
|
.ble_ll_conn_def_auth_pyld_tmo = BLE_LL_CONN_DEF_AUTH_PYLD_TMO_N, \
|
||||||
|
.ble_ll_jitter_usecs = BLE_LL_JITTER_USECS_N, \
|
||||||
|
.ble_ll_sched_max_adv_pdu_usecs = BLE_LL_SCHED_MAX_ADV_PDU_USECS_N, \
|
||||||
|
.ble_ll_sched_direct_adv_max_usecs = BLE_LL_SCHED_DIRECT_ADV_MAX_USECS_N, \
|
||||||
|
.ble_ll_sched_adv_max_usecs = BLE_LL_SCHED_ADV_MAX_USECS_N, \
|
||||||
|
.ble_scan_rsp_data_max_len = DEFAULT_BT_LE_SCAN_RSP_DATA_MAX_LEN_N, \
|
||||||
|
.ble_ll_cfg_num_hci_cmd_pkts = BLE_LL_CFG_NUM_HCI_CMD_PKTS_N, \
|
||||||
|
.ble_ll_ctrl_proc_timeout_ms = BLE_LL_CTRL_PROC_TIMEOUT_MS_N, \
|
||||||
|
.nimble_max_connections = DEFAULT_BT_LE_MAX_CONNECTIONS, \
|
||||||
|
.ble_whitelist_size = DEFAULT_BT_NIMBLE_WHITELIST_SIZE, \
|
||||||
|
.ble_acl_buf_size = DEFAULT_BT_LE_ACL_BUF_SIZE, \
|
||||||
|
.ble_acl_buf_count = DEFAULT_BT_LE_ACL_BUF_COUNT, \
|
||||||
|
.ble_hci_evt_buf_size = DEFAULT_BT_LE_HCI_EVT_BUF_SIZE, \
|
||||||
|
.ble_multi_adv_instances = DEFAULT_BT_LE_MAX_EXT_ADV_INSTANCES, \
|
||||||
|
.ble_ext_adv_max_size = DEFAULT_BT_LE_EXT_ADV_MAX_SIZE, \
|
||||||
|
.controller_task_stack_size = NIMBLE_LL_STACK_SIZE, \
|
||||||
|
.controller_task_prio = ESP_TASK_BT_CONTROLLER_PRIO, \
|
||||||
|
.controller_run_cpu = 0, \
|
||||||
|
.enable_qa_test = RUN_QA_TEST, \
|
||||||
|
.enable_bqb_test = RUN_BQB_TEST, \
|
||||||
|
.enable_tx_cca = DEFAULT_BT_LE_TX_CCA_ENABLED, \
|
||||||
|
.cca_rssi_thresh = 256 - DEFAULT_BT_LE_CCA_RSSI_THRESH, \
|
||||||
|
.sleep_en = NIMBLE_SLEEP_ENABLE, \
|
||||||
|
.coex_phy_coded_tx_rx_time_limit = DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
|
||||||
|
.dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \
|
||||||
|
.ble_scan_classify_filter_enable = 1, \
|
||||||
|
.main_xtal_freq = CONFIG_XTAL_FREQ, \
|
||||||
|
.cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, \
|
||||||
|
.ignore_wl_for_direct_adv = 0, \
|
||||||
|
.enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED, \
|
||||||
|
.csa2_select = DEFAULT_BT_LE_50_FEATURE_SUPPORT, \
|
||||||
|
.config_magic = CONFIG_MAGIC, \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize BT controller to allocate task and other resource.
|
* @brief Initialize BT controller to allocate task and other resource.
|
||||||
|
@ -154,7 +154,7 @@ hci_driver_uart_deinit(void)
|
|||||||
|
|
||||||
ESP_ERROR_CHECK(uart_driver_delete(s_hci_driver_uart_env.hci_uart_params->hci_uart_port));
|
ESP_ERROR_CHECK(uart_driver_delete(s_hci_driver_uart_env.hci_uart_params->hci_uart_port));
|
||||||
|
|
||||||
if (!s_hci_driver_uart_env.tx_sem) {
|
if (s_hci_driver_uart_env.tx_sem) {
|
||||||
vSemaphoreDelete(s_hci_driver_uart_env.tx_sem);
|
vSemaphoreDelete(s_hci_driver_uart_env.tx_sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,10 +86,6 @@ components/driver/test_apps/touch_sensor_v2:
|
|||||||
components/driver/test_apps/twai:
|
components/driver/test_apps/twai:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_TWAI_SUPPORTED != 1
|
- if: SOC_TWAI_SUPPORTED != 1
|
||||||
disable_test:
|
|
||||||
- if: IDF_TARGET == "esp32p4"
|
|
||||||
temporary: true
|
|
||||||
reason: test not pass, should be re-enable # TODO: IDF-8966
|
|
||||||
depends_filepatterns:
|
depends_filepatterns:
|
||||||
- components/driver/twai/**/*
|
- components/driver/twai/**/*
|
||||||
depends_components:
|
depends_components:
|
||||||
|
@ -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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -16,6 +16,9 @@
|
|||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
#define TEST_TWAI_TX_PIN 4
|
||||||
|
#define TEST_TWAI_RX_PIN 5
|
||||||
|
|
||||||
#if CONFIG_TWAI_ISR_IN_IRAM
|
#if CONFIG_TWAI_ISR_IN_IRAM
|
||||||
static void IRAM_ATTR test_delay_post_cache_disable(void *args)
|
static void IRAM_ATTR test_delay_post_cache_disable(void *args)
|
||||||
{
|
{
|
||||||
@ -27,7 +30,7 @@ TEST_CASE("twai_listen_only", "[twai]")
|
|||||||
{
|
{
|
||||||
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
|
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
|
||||||
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
||||||
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(4, 5, TWAI_MODE_LISTEN_ONLY);
|
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(TEST_TWAI_TX_PIN, TEST_TWAI_RX_PIN, TWAI_MODE_LISTEN_ONLY);
|
||||||
#if CONFIG_TWAI_ISR_IN_IRAM
|
#if CONFIG_TWAI_ISR_IN_IRAM
|
||||||
g_config.intr_flags |= ESP_INTR_FLAG_IRAM;
|
g_config.intr_flags |= ESP_INTR_FLAG_IRAM;
|
||||||
#endif
|
#endif
|
||||||
@ -60,8 +63,8 @@ TEST_CASE("twai_remote_request", "[twai]")
|
|||||||
twai_handle_t bus_handle;
|
twai_handle_t bus_handle;
|
||||||
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
|
twai_timing_config_t t_config = TWAI_TIMING_CONFIG_250KBITS();
|
||||||
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
twai_filter_config_t f_config = TWAI_FILTER_CONFIG_ACCEPT_ALL();
|
||||||
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(4, 5, TWAI_MODE_NORMAL);
|
twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(TEST_TWAI_TX_PIN, TEST_TWAI_RX_PIN, TWAI_MODE_NORMAL);
|
||||||
#if CONFIG_IDF_TARGET_ESP32C6
|
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4
|
||||||
g_config.controller_id = 1;
|
g_config.controller_id = 1;
|
||||||
#endif
|
#endif
|
||||||
TEST_ESP_OK(twai_driver_install_v2(&g_config, &t_config, &f_config, &bus_handle));
|
TEST_ESP_OK(twai_driver_install_v2(&g_config, &t_config, &f_config, &bus_handle));
|
||||||
|
@ -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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -99,25 +99,27 @@ TEST_CASE("twai_mode_ext_no_ack_250kbps", "[twai-loop-back]")
|
|||||||
.extd = true, // Extended Frame Format (29bit ID)
|
.extd = true, // Extended Frame Format (29bit ID)
|
||||||
};
|
};
|
||||||
|
|
||||||
printf("install twai driver\r\n");
|
|
||||||
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
|
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
|
||||||
g_config.controller_id = i;
|
g_config.controller_id = i;
|
||||||
g_config.tx_io = i;
|
g_config.tx_io = i;
|
||||||
g_config.rx_io = i;
|
g_config.rx_io = i;
|
||||||
|
printf("install twai driver %d\r\n", g_config.controller_id);
|
||||||
TEST_ESP_OK(twai_driver_install_v2(&g_config, &t_config, &f_config, &twai_buses[i]));
|
TEST_ESP_OK(twai_driver_install_v2(&g_config, &t_config, &f_config, &twai_buses[i]));
|
||||||
TEST_ESP_OK(twai_start_v2(twai_buses[i]));
|
TEST_ESP_OK(twai_start_v2(twai_buses[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("transmit message\r\n");
|
|
||||||
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
|
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
|
||||||
|
printf("transmit message from %d\r\n", i);
|
||||||
|
tx_msg.data[5] = SOC_TWAI_CONTROLLER_NUM - i;
|
||||||
TEST_ESP_OK(twai_transmit_v2(twai_buses[i], &tx_msg, pdMS_TO_TICKS(1000)));
|
TEST_ESP_OK(twai_transmit_v2(twai_buses[i], &tx_msg, pdMS_TO_TICKS(1000)));
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("receive message\r\n");
|
|
||||||
twai_message_t rx_msg;
|
twai_message_t rx_msg;
|
||||||
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
|
for (int i = 0; i < SOC_TWAI_CONTROLLER_NUM; i++) {
|
||||||
|
printf("receive message from %d\r\n", i);
|
||||||
TEST_ESP_OK(twai_receive_v2(twai_buses[i], &rx_msg, pdMS_TO_TICKS(1000)));
|
TEST_ESP_OK(twai_receive_v2(twai_buses[i], &rx_msg, pdMS_TO_TICKS(1000)));
|
||||||
TEST_ASSERT_TRUE(rx_msg.data_length_code == 6);
|
TEST_ASSERT_TRUE(rx_msg.data_length_code == 6);
|
||||||
|
tx_msg.data[5] = SOC_TWAI_CONTROLLER_NUM - i;
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
TEST_ASSERT_EQUAL(tx_msg.data[i], rx_msg.data[i]);
|
TEST_ASSERT_EQUAL(tx_msg.data[i], rx_msg.data[i]);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from can import Bus, Message
|
from can import Bus
|
||||||
|
from can import Message
|
||||||
from pytest_embedded import Dut
|
from pytest_embedded import Dut
|
||||||
|
|
||||||
|
|
||||||
@ -16,6 +16,7 @@ from pytest_embedded import Dut
|
|||||||
@pytest.mark.esp32h2
|
@pytest.mark.esp32h2
|
||||||
@pytest.mark.esp32s2
|
@pytest.mark.esp32s2
|
||||||
@pytest.mark.esp32s3
|
@pytest.mark.esp32s3
|
||||||
|
@pytest.mark.esp32p4
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'config',
|
'config',
|
||||||
@ -46,6 +47,7 @@ def fixture_create_socket_can() -> Bus:
|
|||||||
@pytest.mark.esp32h2
|
@pytest.mark.esp32h2
|
||||||
@pytest.mark.esp32s2
|
@pytest.mark.esp32s2
|
||||||
@pytest.mark.esp32s3
|
@pytest.mark.esp32s3
|
||||||
|
@pytest.mark.esp32p4
|
||||||
@pytest.mark.twai_std
|
@pytest.mark.twai_std
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'config',
|
'config',
|
||||||
@ -79,6 +81,7 @@ def test_twai_listen_only(dut: Dut, socket_can: Bus) -> None:
|
|||||||
@pytest.mark.esp32h2
|
@pytest.mark.esp32h2
|
||||||
@pytest.mark.esp32s2
|
@pytest.mark.esp32s2
|
||||||
@pytest.mark.esp32s3
|
@pytest.mark.esp32s3
|
||||||
|
@pytest.mark.esp32p4
|
||||||
@pytest.mark.twai_std
|
@pytest.mark.twai_std
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'config',
|
'config',
|
||||||
|
@ -28,6 +28,16 @@ typedef enum {
|
|||||||
COEX_SCHM_CALLBACK_TYPE_I154,
|
COEX_SCHM_CALLBACK_TYPE_I154,
|
||||||
} coex_schm_callback_type_t;
|
} coex_schm_callback_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
COEX_SCHM_ST_TYPE_WIFI = 0,
|
||||||
|
COEX_SCHM_ST_TYPE_BLE,
|
||||||
|
COEX_SCHM_ST_TYPE_BT,
|
||||||
|
} coex_schm_st_type_t;
|
||||||
|
|
||||||
|
#define COEX_STATUS_GET_WIFI_BITMAP (1 << COEX_SCHM_ST_TYPE_WIFI)
|
||||||
|
#define COEX_STATUS_GET_BLE_BITMAP (1 << COEX_SCHM_ST_TYPE_BLE)
|
||||||
|
#define COEX_STATUS_GET_BT_BITMAP (1 << COEX_SCHM_ST_TYPE_BT)
|
||||||
|
|
||||||
typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt);
|
typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt);
|
||||||
typedef esp_err_t (* coex_set_lpclk_source_callback_t)(void);
|
typedef esp_err_t (* coex_set_lpclk_source_callback_t)(void);
|
||||||
typedef void (* coex_wifi_channel_change_cb_t)(uint8_t primary, uint8_t secondary);
|
typedef void (* coex_wifi_channel_change_cb_t)(uint8_t primary, uint8_t secondary);
|
||||||
@ -94,9 +104,11 @@ esp_err_t coex_preference_set(coex_prefer_t prefer);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get software coexist status.
|
* @brief Get software coexist status.
|
||||||
|
*
|
||||||
|
* @param bitmap : bitmap of the module getting status.
|
||||||
* @return : software coexist status
|
* @return : software coexist status
|
||||||
*/
|
*/
|
||||||
uint32_t coex_status_get(void);
|
uint32_t coex_status_get(uint8_t bitmap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief WiFi requests coexistence.
|
* @brief WiFi requests coexistence.
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit bf7cda7b17a4fd22c123d39748565a68c021e562
|
Subproject commit e15e7a161fc1a48e8fb4fd0b3da74623c30ba1cb
|
@ -239,6 +239,21 @@ esp_err_t esp_https_ota_get_img_desc(esp_https_ota_handle_t https_ota_handle, es
|
|||||||
int esp_https_ota_get_image_len_read(esp_https_ota_handle_t https_ota_handle);
|
int esp_https_ota_get_image_len_read(esp_https_ota_handle_t https_ota_handle);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns the HTTP status code of the last HTTP response.
|
||||||
|
*
|
||||||
|
* @note This API should be called only after esp_https_ota_begin() has been called.
|
||||||
|
* This can be used to check the HTTP status code of the OTA download process.
|
||||||
|
*
|
||||||
|
* @param[in] https_ota_handle pointer to esp_https_ota_handle_t structure
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - -1 On failure
|
||||||
|
* - HTTP status code
|
||||||
|
*/
|
||||||
|
int esp_https_ota_get_status_code(esp_https_ota_handle_t https_ota_handle);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function returns OTA image total size.
|
* @brief This function returns OTA image total size.
|
||||||
*
|
*
|
||||||
|
@ -724,6 +724,15 @@ esp_err_t esp_https_ota_abort(esp_https_ota_handle_t https_ota_handle)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int esp_https_ota_get_status_code(esp_https_ota_handle_t https_ota_handle)
|
||||||
|
{
|
||||||
|
esp_https_ota_t *handle = (esp_https_ota_t *) https_ota_handle;
|
||||||
|
if (handle == NULL || handle->http_client == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return esp_http_client_get_status_code(handle->http_client);
|
||||||
|
}
|
||||||
|
|
||||||
int esp_https_ota_get_image_len_read(esp_https_ota_handle_t https_ota_handle)
|
int esp_https_ota_get_image_len_read(esp_https_ota_handle_t https_ota_handle)
|
||||||
{
|
{
|
||||||
esp_https_ota_t *handle = (esp_https_ota_t *)https_ota_handle;
|
esp_https_ota_t *handle = (esp_https_ota_t *)https_ota_handle;
|
||||||
|
@ -55,7 +55,7 @@ uint32_t *freq_value)
|
|||||||
clk_src_freq = esp_clk_tree_xtal32k_get_freq_hz(precision);
|
clk_src_freq = esp_clk_tree_xtal32k_get_freq_hz(precision);
|
||||||
break;
|
break;
|
||||||
case SOC_MOD_CLK_REF_TICK:
|
case SOC_MOD_CLK_REF_TICK:
|
||||||
clk_src_freq = 1 * MHZ;
|
clk_src_freq = REF_CLK_FREQ;
|
||||||
break;
|
break;
|
||||||
case SOC_MOD_CLK_APLL:
|
case SOC_MOD_CLK_APLL:
|
||||||
clk_src_freq = clk_hal_apll_get_freq_hz();
|
clk_src_freq = clk_hal_apll_get_freq_hz();
|
||||||
|
@ -53,7 +53,7 @@ uint32_t *freq_value)
|
|||||||
clk_src_freq = esp_clk_tree_xtal32k_get_freq_hz(precision);
|
clk_src_freq = esp_clk_tree_xtal32k_get_freq_hz(precision);
|
||||||
break;
|
break;
|
||||||
case SOC_MOD_CLK_REF_TICK:
|
case SOC_MOD_CLK_REF_TICK:
|
||||||
clk_src_freq = 1 * MHZ;
|
clk_src_freq = REF_CLK_FREQ;
|
||||||
break;
|
break;
|
||||||
case SOC_MOD_CLK_APLL:
|
case SOC_MOD_CLK_APLL:
|
||||||
clk_src_freq = clk_hal_apll_get_freq_hz();
|
clk_src_freq = clk_hal_apll_get_freq_hz();
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_pmu.h"
|
#include "esp_pmu.h"
|
||||||
|
|
||||||
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE && CONFIG_IDF_TARGET_ESP32C5 // TODO: PM-202
|
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE
|
||||||
#include "soc/pmu_reg.h" // for PMU_DATE_REG, it can provide full 32 bit read and write access
|
#include "soc/pmu_reg.h" // for PMU_DATE_REG, it can provide full 32 bit read and write access
|
||||||
#endif
|
#endif
|
||||||
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
|
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
|
||||||
@ -506,7 +506,7 @@ static esp_err_t sleep_retention_entries_create_impl(const sleep_retention_entri
|
|||||||
return ESP_ERR_NOT_SUPPORTED;
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE && CONFIG_IDF_TARGET_ESP32C5 // TODO: PM-202
|
#if SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE
|
||||||
/* There is a bug in REGDMA wait mode, when two wait nodes need to wait for the
|
/* There is a bug in REGDMA wait mode, when two wait nodes need to wait for the
|
||||||
* same value (_val & _mask), the second wait node will immediately return to
|
* same value (_val & _mask), the second wait node will immediately return to
|
||||||
* wait done, The reason is that the wait mode comparison output logic immediate
|
* wait done, The reason is that the wait mode comparison output logic immediate
|
||||||
|
@ -134,8 +134,8 @@ static void s_reserve_irom_region(mem_region_t *hw_mem_regions, int region_nums)
|
|||||||
* - Now IBUS addresses (between `_instruction_reserved_start` and `_instruction_reserved_end`) are consecutive on all chips,
|
* - Now IBUS addresses (between `_instruction_reserved_start` and `_instruction_reserved_end`) are consecutive on all chips,
|
||||||
* we strongly rely on this to calculate the .text length
|
* we strongly rely on this to calculate the .text length
|
||||||
*/
|
*/
|
||||||
extern int _instruction_reserved_start;
|
extern char _instruction_reserved_start;
|
||||||
extern int _instruction_reserved_end;
|
extern char _instruction_reserved_end;
|
||||||
size_t irom_len_to_reserve = (uint32_t)&_instruction_reserved_end - (uint32_t)&_instruction_reserved_start;
|
size_t irom_len_to_reserve = (uint32_t)&_instruction_reserved_end - (uint32_t)&_instruction_reserved_start;
|
||||||
assert((mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_start)) == irom_len_to_reserve);
|
assert((mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_instruction_reserved_start)) == irom_len_to_reserve);
|
||||||
|
|
||||||
@ -162,8 +162,8 @@ static void s_reserve_drom_region(mem_region_t *hw_mem_regions, int region_nums)
|
|||||||
/**
|
/**
|
||||||
* Similarly, we follow the way how 1st bootloader load flash .rodata:
|
* Similarly, we follow the way how 1st bootloader load flash .rodata:
|
||||||
*/
|
*/
|
||||||
extern int _rodata_reserved_start;
|
extern char _rodata_reserved_start;
|
||||||
extern int _rodata_reserved_end;
|
extern char _rodata_reserved_end;
|
||||||
size_t drom_len_to_reserve = (uint32_t)&_rodata_reserved_end - (uint32_t)&_rodata_reserved_start;
|
size_t drom_len_to_reserve = (uint32_t)&_rodata_reserved_end - (uint32_t)&_rodata_reserved_start;
|
||||||
assert((mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_start)) == drom_len_to_reserve);
|
assert((mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_end) - mmu_ll_vaddr_to_laddr((uint32_t)&_rodata_reserved_start)) == drom_len_to_reserve);
|
||||||
|
|
||||||
|
@ -506,6 +506,13 @@ static BaseType_t prvCheckItemAvail(Ringbuffer_t *pxRingbuffer)
|
|||||||
return pdFALSE; //Byte buffers do not allow multiple retrievals before return
|
return pdFALSE; //Byte buffers do not allow multiple retrievals before return
|
||||||
}
|
}
|
||||||
if ((pxRingbuffer->xItemsWaiting > 0) && ((pxRingbuffer->pucRead != pxRingbuffer->pucWrite) || (pxRingbuffer->uxRingbufferFlags & rbBUFFER_FULL_FLAG))) {
|
if ((pxRingbuffer->xItemsWaiting > 0) && ((pxRingbuffer->pucRead != pxRingbuffer->pucWrite) || (pxRingbuffer->uxRingbufferFlags & rbBUFFER_FULL_FLAG))) {
|
||||||
|
// If the ring buffer is a no-split buffer, the read pointer must point to an item that has been written to.
|
||||||
|
if ((pxRingbuffer->uxRingbufferFlags & (rbBYTE_BUFFER_FLAG | rbALLOW_SPLIT_FLAG)) == 0) {
|
||||||
|
ItemHeader_t *pxHeader = (ItemHeader_t *)pxRingbuffer->pucRead;
|
||||||
|
if ((pxHeader->uxItemFlags & rbITEM_WRITTEN_FLAG) == 0) {
|
||||||
|
return pdFALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return pdTRUE; //Items/data available for retrieval
|
return pdTRUE; //Items/data available for retrieval
|
||||||
} else {
|
} else {
|
||||||
return pdFALSE; //No items/data available for retrieval
|
return pdFALSE; //No items/data available for retrieval
|
||||||
@ -979,9 +986,6 @@ BaseType_t xRingbufferSendAcquire(RingbufHandle_t xRingbuffer, void **ppvItem, s
|
|||||||
if (xItemSize > pxRingbuffer->xMaxItemSize) {
|
if (xItemSize > pxRingbuffer->xMaxItemSize) {
|
||||||
return pdFALSE; //Data will never ever fit in the queue.
|
return pdFALSE; //Data will never ever fit in the queue.
|
||||||
}
|
}
|
||||||
if ((pxRingbuffer->uxRingbufferFlags & rbBYTE_BUFFER_FLAG) && xItemSize == 0) {
|
|
||||||
return pdTRUE; //Sending 0 bytes to byte buffer has no effect
|
|
||||||
}
|
|
||||||
|
|
||||||
return prvSendAcquireGeneric(pxRingbuffer, NULL, ppvItem, xItemSize, xTicksToWait);
|
return prvSendAcquireGeneric(pxRingbuffer, NULL, ppvItem, xItemSize, xTicksToWait);
|
||||||
}
|
}
|
||||||
|
@ -723,6 +723,8 @@ size_t continuous_test_string_len(void)
|
|||||||
return sizeof(continuous_data);
|
return sizeof(continuous_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !CONFIG_FREERTOS_UNICORE
|
||||||
|
|
||||||
void send_to_buffer(RingbufHandle_t buffer, size_t max_item_size)
|
void send_to_buffer(RingbufHandle_t buffer, size_t max_item_size)
|
||||||
{
|
{
|
||||||
for (int iter = 0; iter < SMP_TEST_ITERATIONS; iter++) {
|
for (int iter = 0; iter < SMP_TEST_ITERATIONS; iter++) {
|
||||||
@ -916,6 +918,8 @@ TEST_CASE("Test static ring buffer SMP", "[esp_ringbuf][linux]")
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif //!CONFIG_FREERTOS_UNICORE
|
||||||
|
|
||||||
/* ------------------------ Test ring buffer 0 Item Size -----------------------
|
/* ------------------------ Test ring buffer 0 Item Size -----------------------
|
||||||
* The following test case tests that sending/acquiring an item/bytes of 0 size
|
* The following test case tests that sending/acquiring an item/bytes of 0 size
|
||||||
* is permissible.
|
* is permissible.
|
||||||
@ -961,3 +965,80 @@ TEST_CASE("Test ringbuffer 0 item size", "[esp_ringbuf][linux]")
|
|||||||
vRingbufferDelete(allow_split_rb);
|
vRingbufferDelete(allow_split_rb);
|
||||||
vRingbufferDelete(byte_rb);
|
vRingbufferDelete(byte_rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------- Test no-split ring buffer SendAquire and SendComplete ---------------------------
|
||||||
|
* The following test case tests the SendAquire and SendComplete functions of the no-split ring buffer.
|
||||||
|
*
|
||||||
|
* The test case will do the following...
|
||||||
|
* 1) Create a no-split ring buffer.
|
||||||
|
* 2) Acquire space on the buffer to send an item.
|
||||||
|
* 3) Send the item to the buffer.
|
||||||
|
* 4) Verify that the item is received correctly.
|
||||||
|
* 5) Acquire space on the buffer until the buffer is full.
|
||||||
|
* 6) Send the items out-of-order to the buffer.
|
||||||
|
* 7) Verify that the items are not received until the first item is sent.
|
||||||
|
* 8) Send the first item.
|
||||||
|
* 9) Verify that the items are received in the correct order.
|
||||||
|
*/
|
||||||
|
TEST_CASE("Test no-split buffers always receive items in order", "[esp_ringbuf][linux]")
|
||||||
|
{
|
||||||
|
// Create buffer
|
||||||
|
RingbufHandle_t buffer_handle = xRingbufferCreate(BUFFER_SIZE, RINGBUF_TYPE_NOSPLIT);
|
||||||
|
TEST_ASSERT_MESSAGE(buffer_handle != NULL, "Failed to create ring buffer");
|
||||||
|
|
||||||
|
// Acquire space on the buffer to send an item and write to the item
|
||||||
|
void *item1;
|
||||||
|
TEST_ASSERT_EQUAL(pdTRUE, xRingbufferSendAcquire(buffer_handle, &item1, MEDIUM_ITEM_SIZE, TIMEOUT_TICKS));
|
||||||
|
*(uint32_t *)item1 = 0x123;
|
||||||
|
|
||||||
|
// Send the item to the buffer
|
||||||
|
TEST_ASSERT_EQUAL(pdTRUE, xRingbufferSendComplete(buffer_handle, item1));
|
||||||
|
|
||||||
|
// Verify that the item is received correctly
|
||||||
|
size_t item_size;
|
||||||
|
uint32_t *received_item = xRingbufferReceive(buffer_handle, &item_size, TIMEOUT_TICKS);
|
||||||
|
TEST_ASSERT_NOT_NULL(received_item);
|
||||||
|
TEST_ASSERT_EQUAL(item_size, MEDIUM_ITEM_SIZE);
|
||||||
|
TEST_ASSERT_EQUAL(*(uint32_t *)received_item, 0x123);
|
||||||
|
|
||||||
|
// Return the space to the buffer after receiving the item
|
||||||
|
vRingbufferReturnItem(buffer_handle, received_item);
|
||||||
|
|
||||||
|
// At this point, the buffer should be empty
|
||||||
|
UBaseType_t items_waiting;
|
||||||
|
vRingbufferGetInfo(buffer_handle, NULL, NULL, NULL, NULL, &items_waiting);
|
||||||
|
TEST_ASSERT_MESSAGE(items_waiting == 0, "Incorrect items waiting");
|
||||||
|
|
||||||
|
// Acquire space on the buffer until the buffer is full
|
||||||
|
#define MAX_NUM_ITEMS ( BUFFER_SIZE / ( MEDIUM_ITEM_SIZE + ITEM_HDR_SIZE ) )
|
||||||
|
void *items[MAX_NUM_ITEMS];
|
||||||
|
for (int i = 0; i < MAX_NUM_ITEMS; i++) {
|
||||||
|
TEST_ASSERT_EQUAL(pdTRUE, xRingbufferSendAcquire(buffer_handle, &items[i], MEDIUM_ITEM_SIZE, TIMEOUT_TICKS));
|
||||||
|
TEST_ASSERT_NOT_NULL(items[i]);
|
||||||
|
*(uint32_t *)items[i] = (0x100 + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that the buffer is full by attempting to acquire space for another item
|
||||||
|
void *another_item;
|
||||||
|
TEST_ASSERT_EQUAL(pdFALSE, xRingbufferSendAcquire(buffer_handle, &another_item, MEDIUM_ITEM_SIZE, TIMEOUT_TICKS));
|
||||||
|
|
||||||
|
// Send the items out-of-order to the buffer. Verify that the items are not received until the first item is sent.
|
||||||
|
// In this case, we send the items in the reverse order until the first item is sent.
|
||||||
|
for (int i = MAX_NUM_ITEMS - 1; i > 0; i--) {
|
||||||
|
TEST_ASSERT_EQUAL(pdTRUE, xRingbufferSendComplete(buffer_handle, items[i]));
|
||||||
|
TEST_ASSERT_NULL(xRingbufferReceive(buffer_handle, &item_size, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the first item
|
||||||
|
TEST_ASSERT_EQUAL(pdTRUE, xRingbufferSendComplete(buffer_handle, items[0]));
|
||||||
|
|
||||||
|
// Verify that the items are received in the correct order
|
||||||
|
for (int i = 0; i < MAX_NUM_ITEMS; i++) {
|
||||||
|
received_item = xRingbufferReceive(buffer_handle, &item_size, TIMEOUT_TICKS);
|
||||||
|
TEST_ASSERT_EQUAL(*(uint32_t *)received_item, (0x100 + i));
|
||||||
|
vRingbufferReturnItem(buffer_handle, received_item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
vRingbufferDelete(buffer_handle);
|
||||||
|
}
|
||||||
|
@ -1174,8 +1174,8 @@ hal_set_sta_tbtt = 0x40001e4c;
|
|||||||
pm_set_sleep_type = 0x40001e54;
|
pm_set_sleep_type = 0x40001e54;
|
||||||
pm_tx_null_data_done_process = 0x40001eb0;
|
pm_tx_null_data_done_process = 0x40001eb0;
|
||||||
//pm_tx_data_process = 0x40001eb4;
|
//pm_tx_data_process = 0x40001eb4;
|
||||||
pm_attach = 0x40001eb8;
|
/*pm_attach = 0x40001eb8;*/
|
||||||
pm_coex_schm_process = 0x40001ebc;
|
/*pm_coex_schm_process = 0x40001ebc;*/
|
||||||
pm_on_probe_resp_rx = 0x40001ecc;
|
pm_on_probe_resp_rx = 0x40001ecc;
|
||||||
pm_send_probe_stop = 0x40001edc;
|
pm_send_probe_stop = 0x40001edc;
|
||||||
hal_sniffer_rx_set_promis = 0x40001ef4;
|
hal_sniffer_rx_set_promis = 0x40001ef4;
|
||||||
|
@ -1903,7 +1903,7 @@ coex_hw_timer_set = 0x4000219c;
|
|||||||
coex_schm_interval_set = 0x400021a0;
|
coex_schm_interval_set = 0x400021a0;
|
||||||
coex_schm_lock = 0x400021a4;
|
coex_schm_lock = 0x400021a4;
|
||||||
coex_schm_unlock = 0x400021a8;
|
coex_schm_unlock = 0x400021a8;
|
||||||
coex_status_get = 0x400021ac;
|
/*coex_status_get = 0x400021ac;*/
|
||||||
coex_wifi_release = 0x400021b0;
|
coex_wifi_release = 0x400021b0;
|
||||||
esp_coex_ble_conn_dynamic_prio_get = 0x400021b4;
|
esp_coex_ble_conn_dynamic_prio_get = 0x400021b4;
|
||||||
/*coex_hw_timer_tick_get = 0x400021b8;*/
|
/*coex_hw_timer_tick_get = 0x400021b8;*/
|
||||||
|
@ -1772,7 +1772,7 @@ coex_hw_timer_set = 0x400018e0;
|
|||||||
coex_schm_interval_set = 0x400018e4;
|
coex_schm_interval_set = 0x400018e4;
|
||||||
coex_schm_lock = 0x400018e8;
|
coex_schm_lock = 0x400018e8;
|
||||||
coex_schm_unlock = 0x400018ec;
|
coex_schm_unlock = 0x400018ec;
|
||||||
coex_status_get = 0x400018f0;
|
/*coex_status_get = 0x400018f0;*/
|
||||||
coex_wifi_release = 0x400018f4;
|
coex_wifi_release = 0x400018f4;
|
||||||
esp_coex_ble_conn_dynamic_prio_get = 0x400018f8;
|
esp_coex_ble_conn_dynamic_prio_get = 0x400018f8;
|
||||||
/* Data (.data, .bss, .rodata) */
|
/* Data (.data, .bss, .rodata) */
|
||||||
|
@ -35,7 +35,7 @@ coex_hw_timer_set = 0x40000afc;
|
|||||||
coex_schm_interval_set = 0x40000b00;
|
coex_schm_interval_set = 0x40000b00;
|
||||||
coex_schm_lock = 0x40000b04;
|
coex_schm_lock = 0x40000b04;
|
||||||
coex_schm_unlock = 0x40000b08;
|
coex_schm_unlock = 0x40000b08;
|
||||||
coex_status_get = 0x40000b0c;
|
/*coex_status_get = 0x40000b0c;*/
|
||||||
coex_wifi_release = 0x40000b10;
|
coex_wifi_release = 0x40000b10;
|
||||||
esp_coex_ble_conn_dynamic_prio_get = 0x40000b14;
|
esp_coex_ble_conn_dynamic_prio_get = 0x40000b14;
|
||||||
/* Data (.data, .bss, .rodata) */
|
/* Data (.data, .bss, .rodata) */
|
||||||
|
@ -35,7 +35,7 @@ coex_hw_timer_set = 0x40000b30;
|
|||||||
coex_schm_interval_set = 0x40000b34;
|
coex_schm_interval_set = 0x40000b34;
|
||||||
coex_schm_lock = 0x40000b38;
|
coex_schm_lock = 0x40000b38;
|
||||||
coex_schm_unlock = 0x40000b3c;
|
coex_schm_unlock = 0x40000b3c;
|
||||||
coex_status_get = 0x40000b40;
|
/*coex_status_get = 0x40000b40;*/
|
||||||
coex_wifi_release = 0x40000b44;
|
coex_wifi_release = 0x40000b44;
|
||||||
esp_coex_ble_conn_dynamic_prio_get = 0x40000b48;
|
esp_coex_ble_conn_dynamic_prio_get = 0x40000b48;
|
||||||
/* Data (.data, .bss, .rodata) */
|
/* Data (.data, .bss, .rodata) */
|
||||||
|
@ -35,7 +35,7 @@ coex_hw_timer_set = 0x40000a64;
|
|||||||
coex_schm_interval_set = 0x40000a68;
|
coex_schm_interval_set = 0x40000a68;
|
||||||
coex_schm_lock = 0x40000a6c;
|
coex_schm_lock = 0x40000a6c;
|
||||||
coex_schm_unlock = 0x40000a70;
|
coex_schm_unlock = 0x40000a70;
|
||||||
coex_status_get = 0x40000a74;
|
/*coex_status_get = 0x40000a74;*/
|
||||||
coex_wifi_release = 0x40000a78;
|
coex_wifi_release = 0x40000a78;
|
||||||
esp_coex_ble_conn_dynamic_prio_get = 0x40000a7c;
|
esp_coex_ble_conn_dynamic_prio_get = 0x40000a7c;
|
||||||
/* Data (.data, .bss, .rodata) */
|
/* Data (.data, .bss, .rodata) */
|
||||||
|
@ -2058,7 +2058,7 @@ coex_hw_timer_set = 0x40005c04;
|
|||||||
coex_schm_interval_set = 0x40005c10;
|
coex_schm_interval_set = 0x40005c10;
|
||||||
coex_schm_lock = 0x40005c1c;
|
coex_schm_lock = 0x40005c1c;
|
||||||
coex_schm_unlock = 0x40005c28;
|
coex_schm_unlock = 0x40005c28;
|
||||||
coex_status_get = 0x40005c34;
|
/*coex_status_get = 0x40005c34;*/
|
||||||
coex_wifi_release = 0x40005c40;
|
coex_wifi_release = 0x40005c40;
|
||||||
esp_coex_ble_conn_dynamic_prio_get = 0x40005c4c;
|
esp_coex_ble_conn_dynamic_prio_get = 0x40005c4c;
|
||||||
/* Data (.data, .bss, .rodata) */
|
/* Data (.data, .bss, .rodata) */
|
||||||
|
@ -452,7 +452,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -389,7 +389,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -406,7 +406,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -464,7 +464,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -395,7 +395,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -464,7 +464,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -443,7 +443,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -460,7 +460,7 @@ static void coex_disable_wrapper(void)
|
|||||||
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
#if CONFIG_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE
|
||||||
return coex_status_get();
|
return coex_status_get(COEX_STATUS_GET_WIFI_BITMAP);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 473674948f178962fefd7f7b1df7ebc9cc59a98a
|
Subproject commit efa80057b04ade8b1412a0dedcb5572d6ccd1fcc
|
@ -441,7 +441,7 @@ rtos_current_tcb:
|
|||||||
lw a0, pxCurrentTCBs
|
lw a0, pxCurrentTCBs
|
||||||
#endif /* ( configNUM_CORES > 1 ) */
|
#endif /* ( configNUM_CORES > 1 ) */
|
||||||
ret
|
ret
|
||||||
.size, .-rtos_current_tcb
|
.size rtos_current_tcb, .-rtos_current_tcb
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,9 +5,6 @@ components/freertos/test_apps/freertos:
|
|||||||
- if: CONFIG_NAME == "smp" and IDF_TARGET == "esp32p4"
|
- if: CONFIG_NAME == "smp" and IDF_TARGET == "esp32p4"
|
||||||
temporary: true
|
temporary: true
|
||||||
reason: target(s) not supported yet
|
reason: target(s) not supported yet
|
||||||
- if: IDF_TARGET in ["esp32c61"]
|
|
||||||
temporary: true
|
|
||||||
reason: target(s) not supported yet # TODO: [esp32c61] IDF-9280
|
|
||||||
disable_test:
|
disable_test:
|
||||||
- if: CONFIG_NAME == "smp" and IDF_TARGET == "esp32c5"
|
- if: CONFIG_NAME == "smp" and IDF_TARGET == "esp32c5"
|
||||||
temporary: true
|
temporary: true
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
||||||
|
@ -5,27 +5,15 @@ from pytest_embedded import Dut
|
|||||||
|
|
||||||
|
|
||||||
CONFIGS = [
|
CONFIGS = [
|
||||||
pytest.param('default', marks=[
|
pytest.param('default', marks=[pytest.mark.supported_targets,]),
|
||||||
pytest.mark.supported_targets,
|
pytest.param('freertos_options', marks=[pytest.mark.supported_targets]),
|
||||||
# TODO [ESP32C61] IDF-10988
|
|
||||||
pytest.mark.temp_skip_ci(targets=['esp32h2', 'esp32c61'], reason='test failed')
|
|
||||||
]),
|
|
||||||
pytest.param('freertos_options', marks=[
|
|
||||||
pytest.mark.supported_targets,
|
|
||||||
# TODO [ESP32C61] IDF-10988
|
|
||||||
pytest.mark.temp_skip_ci(targets=['esp32h2', 'esp32c61'], reason='test failed')]),
|
|
||||||
pytest.param('psram', marks=[pytest.mark.esp32]),
|
pytest.param('psram', marks=[pytest.mark.esp32]),
|
||||||
pytest.param('release', marks=[
|
|
||||||
pytest.mark.supported_targets,
|
|
||||||
# TODO [ESP32C61] IDF-10988
|
|
||||||
pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='support TBD'),
|
|
||||||
]),
|
|
||||||
pytest.param('single_core', marks=[pytest.mark.esp32, pytest.mark.esp32p4]),
|
pytest.param('single_core', marks=[pytest.mark.esp32, pytest.mark.esp32p4]),
|
||||||
# TODO: [ESP32C5] IDF-10335
|
# TODO: [ESP32C5] IDF-10335
|
||||||
# TODO [ESP32C61] IDF-10988
|
# TODO: [ESP32C61] IDF-11146
|
||||||
pytest.param('smp', marks=[
|
pytest.param('smp', marks=[
|
||||||
pytest.mark.supported_targets,
|
pytest.mark.supported_targets,
|
||||||
pytest.mark.temp_skip_ci(targets=['esp32h2', 'esp32p4', 'esp32c5', 'esp32c61'],
|
pytest.mark.temp_skip_ci(targets=['esp32p4', 'esp32c5', 'esp32c61'],
|
||||||
reason='test failed/TBD IDF-8113')
|
reason='test failed/TBD IDF-8113')
|
||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
@ -38,7 +26,6 @@ def test_freertos(dut: Dut) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.supported_targets
|
@pytest.mark.supported_targets
|
||||||
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='support TBD') # TODO [ESP32C61] IDF-10988
|
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize('config', ['freertos_options'], indirect=True)
|
@pytest.mark.parametrize('config', ['freertos_options'], indirect=True)
|
||||||
def test_task_notify_too_high_index_fails(dut: Dut) -> None:
|
def test_task_notify_too_high_index_fails(dut: Dut) -> None:
|
||||||
@ -50,7 +37,6 @@ def test_task_notify_too_high_index_fails(dut: Dut) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.supported_targets
|
@pytest.mark.supported_targets
|
||||||
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='support TBD') # TODO [ESP32C61] IDF-10988
|
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize('config', ['freertos_options'], indirect=True)
|
@pytest.mark.parametrize('config', ['freertos_options'], indirect=True)
|
||||||
def test_task_notify_wait_too_high_index_fails(dut: Dut) -> None:
|
def test_task_notify_wait_too_high_index_fails(dut: Dut) -> None:
|
||||||
@ -62,7 +48,6 @@ def test_task_notify_wait_too_high_index_fails(dut: Dut) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.supported_targets
|
@pytest.mark.supported_targets
|
||||||
@pytest.mark.temp_skip_ci(targets=['esp32c61'], reason='support TBD') # TODO [ESP32C61] IDF-10988
|
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize('config', ['default'], indirect=True)
|
@pytest.mark.parametrize('config', ['default'], indirect=True)
|
||||||
def test_port_must_assert_in_isr(dut: Dut) -> None:
|
def test_port_must_assert_in_isr(dut: Dut) -> None:
|
||||||
|
@ -669,31 +669,31 @@ static inline __attribute__((always_inline)) uint32_t clk_ll_cpu_get_divider_fro
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set REF_TICK divider to make REF_TICK frequency at 1MHz
|
* @brief Set REF_TICK divider to make REF_TICK frequency at REF_CLK_FREQ
|
||||||
*
|
*
|
||||||
* @param cpu_clk_src Selected CPU clock source (one of soc_cpu_clk_src_t values)
|
* @param cpu_clk_src Selected CPU clock source (one of soc_cpu_clk_src_t values)
|
||||||
* @param cpu_freq_mhz CPU frequency value, in MHz
|
* @param cpu_freq_mhz CPU frequency value, in MHz
|
||||||
*
|
*
|
||||||
* Divider = APB_CLK freq in Hz / 1MHz. Value in register = divider - 1.
|
* Divider = APB_CLK freq in Hz / (REF_CLK_FREQ / MHZ). Value in register = divider - 1.
|
||||||
*/
|
*/
|
||||||
static inline __attribute__((always_inline)) void clk_ll_ref_tick_set_divider(soc_cpu_clk_src_t cpu_clk_src, uint32_t cpu_freq_mhz)
|
static inline __attribute__((always_inline)) void clk_ll_ref_tick_set_divider(soc_cpu_clk_src_t cpu_clk_src, uint32_t cpu_freq_mhz)
|
||||||
{
|
{
|
||||||
uint32_t apb_freq_mhz;
|
uint32_t apb_freq_mhz;
|
||||||
switch (cpu_clk_src) {
|
switch (cpu_clk_src) {
|
||||||
case SOC_CPU_CLK_SRC_XTAL:
|
case SOC_CPU_CLK_SRC_XTAL:
|
||||||
apb_freq_mhz = cpu_freq_mhz;
|
apb_freq_mhz = cpu_freq_mhz / (REF_CLK_FREQ / MHZ);
|
||||||
REG_WRITE(SYSCON_XTAL_TICK_CONF_REG, apb_freq_mhz - 1);
|
REG_WRITE(SYSCON_XTAL_TICK_CONF_REG, apb_freq_mhz - 1);
|
||||||
break;
|
break;
|
||||||
case SOC_CPU_CLK_SRC_PLL:
|
case SOC_CPU_CLK_SRC_PLL:
|
||||||
apb_freq_mhz = 80;
|
apb_freq_mhz = 80 / (REF_CLK_FREQ / MHZ);
|
||||||
REG_WRITE(SYSCON_PLL_TICK_CONF_REG, apb_freq_mhz - 1);
|
REG_WRITE(SYSCON_PLL_TICK_CONF_REG, apb_freq_mhz - 1);
|
||||||
break;
|
break;
|
||||||
case SOC_CPU_CLK_SRC_RC_FAST:
|
case SOC_CPU_CLK_SRC_RC_FAST:
|
||||||
apb_freq_mhz = cpu_freq_mhz;
|
apb_freq_mhz = cpu_freq_mhz / (REF_CLK_FREQ / MHZ);
|
||||||
REG_WRITE(SYSCON_CK8M_TICK_CONF_REG, apb_freq_mhz - 1);
|
REG_WRITE(SYSCON_CK8M_TICK_CONF_REG, apb_freq_mhz - 1);
|
||||||
break;
|
break;
|
||||||
case SOC_CPU_CLK_SRC_APLL:
|
case SOC_CPU_CLK_SRC_APLL:
|
||||||
apb_freq_mhz = cpu_freq_mhz >> 1;
|
apb_freq_mhz = (cpu_freq_mhz / (REF_CLK_FREQ / MHZ)) >> 1;
|
||||||
REG_WRITE(SYSCON_APLL_TICK_CONF_REG, apb_freq_mhz - 1);
|
REG_WRITE(SYSCON_APLL_TICK_CONF_REG, apb_freq_mhz - 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1138,7 +1138,7 @@ menu "mbedTLS"
|
|||||||
|
|
||||||
config MBEDTLS_USE_CRYPTO_ROM_IMPL
|
config MBEDTLS_USE_CRYPTO_ROM_IMPL
|
||||||
bool "Use ROM implementation of the crypto algorithm"
|
bool "Use ROM implementation of the crypto algorithm"
|
||||||
depends on ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB && IDF_EXPERIMENTAL_FEATURES
|
depends on ESP_ROM_HAS_MBEDTLS_CRYPTO_LIB
|
||||||
default "n"
|
default "n"
|
||||||
select MBEDTLS_SHA512_C
|
select MBEDTLS_SHA512_C
|
||||||
select MBEDTLS_AES_C
|
select MBEDTLS_AES_C
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
CONFIG_IDF_TARGET="esp32c2"
|
CONFIG_IDF_TARGET="esp32c2"
|
||||||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
|
||||||
CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=y
|
CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL=y
|
||||||
|
@ -63,6 +63,7 @@ esp_pthread_cfg_t esp_pthread_get_default_config(void);
|
|||||||
* @return
|
* @return
|
||||||
* - ESP_OK if configuration was successfully set
|
* - ESP_OK if configuration was successfully set
|
||||||
* - ESP_ERR_NO_MEM if out of memory
|
* - ESP_ERR_NO_MEM if out of memory
|
||||||
|
* - ESP_ERR_INVALID_ARG if cfg is NULL
|
||||||
* - ESP_ERR_INVALID_ARG if stack_size is less than PTHREAD_STACK_MIN
|
* - ESP_ERR_INVALID_ARG if stack_size is less than PTHREAD_STACK_MIN
|
||||||
* - ESP_ERR_INVALID_ARG if stack_alloc_caps does not include MALLOC_CAP_8BIT
|
* - ESP_ERR_INVALID_ARG if stack_alloc_caps does not include MALLOC_CAP_8BIT
|
||||||
*/
|
*/
|
||||||
@ -79,6 +80,7 @@ esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg);
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK if the configuration was available
|
* - ESP_OK if the configuration was available
|
||||||
|
* - ESP_ERR_INVALID_ARG if p is NULL
|
||||||
* - ESP_ERR_NOT_FOUND if a configuration wasn't previously set
|
* - ESP_ERR_NOT_FOUND if a configuration wasn't previously set
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p);
|
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p);
|
||||||
|
@ -7,8 +7,25 @@
|
|||||||
* pthread port for Linux build
|
* pthread port for Linux build
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include "sdkconfig.h"
|
||||||
#include "esp_pthread.h"
|
#include "esp_pthread.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
|
||||||
|
static pthread_key_t s_pthread_cfg_key;
|
||||||
|
static void esp_pthread_cfg_key_destructor(void *value)
|
||||||
|
{
|
||||||
|
free(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int get_default_pthread_core(void)
|
||||||
|
{
|
||||||
|
return CONFIG_PTHREAD_TASK_CORE_DEFAULT == -1 ? tskNO_AFFINITY : CONFIG_PTHREAD_TASK_CORE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a default pthread configuration based
|
* @brief Creates a default pthread configuration based
|
||||||
@ -24,8 +41,8 @@ esp_pthread_cfg_t esp_pthread_get_default_config(void)
|
|||||||
.prio = CONFIG_PTHREAD_TASK_PRIO_DEFAULT,
|
.prio = CONFIG_PTHREAD_TASK_PRIO_DEFAULT,
|
||||||
.inherit_cfg = false,
|
.inherit_cfg = false,
|
||||||
.thread_name = NULL,
|
.thread_name = NULL,
|
||||||
.pin_to_core = 0,
|
.pin_to_core = get_default_pthread_core(),
|
||||||
.stack_alloc_caps = 0,
|
.stack_alloc_caps = MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT,
|
||||||
};
|
};
|
||||||
|
|
||||||
return cfg;
|
return cfg;
|
||||||
@ -33,11 +50,63 @@ esp_pthread_cfg_t esp_pthread_get_default_config(void)
|
|||||||
|
|
||||||
esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg)
|
esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg)
|
||||||
{
|
{
|
||||||
|
// Not checking the stack size here since PTHREAD_STACK_MIN has two conflicting declarations on Linux
|
||||||
|
|
||||||
|
if (cfg == NULL) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 is treated as default value, hence change caps to MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL in that case
|
||||||
|
int heap_caps;
|
||||||
|
if (cfg->stack_alloc_caps == 0) {
|
||||||
|
heap_caps = MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL;
|
||||||
|
} else {
|
||||||
|
// Check that memory is 8-bit capable
|
||||||
|
if (!(cfg->stack_alloc_caps & MALLOC_CAP_8BIT)) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
heap_caps = cfg->stack_alloc_caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If a value is already set, update that value */
|
||||||
|
esp_pthread_cfg_t *p = pthread_getspecific(s_pthread_cfg_key);
|
||||||
|
if (!p) {
|
||||||
|
p = malloc(sizeof(esp_pthread_cfg_t));
|
||||||
|
if (!p) {
|
||||||
|
return ESP_ERR_NO_MEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p = *cfg;
|
||||||
|
p->stack_alloc_caps = heap_caps;
|
||||||
|
p->stack_size = MAX(p->stack_size, 0x4000); // make sure Linux minimal stack size is respected
|
||||||
|
|
||||||
|
int __attribute((unused)) res = pthread_setspecific(s_pthread_cfg_key, p);
|
||||||
|
|
||||||
|
assert(res == 0);
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p)
|
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p)
|
||||||
{
|
{
|
||||||
|
if (p == NULL) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_pthread_cfg_t *cfg = pthread_getspecific(s_pthread_cfg_key);
|
||||||
|
if (cfg) {
|
||||||
|
*p = *cfg;
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
memset(p, 0, sizeof(*p));
|
memset(p, 0, sizeof(*p));
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__attribute__((constructor)) esp_err_t esp_pthread_init(void)
|
||||||
|
{
|
||||||
|
if (pthread_key_create(&s_pthread_cfg_key, esp_pthread_cfg_key_destructor) != 0) {
|
||||||
|
return ESP_ERR_NO_MEM;
|
||||||
|
}
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
@ -142,6 +142,10 @@ static void pthread_delete(esp_pthread_t *pthread)
|
|||||||
/* Call this function to configure pthread stacks in Pthreads */
|
/* Call this function to configure pthread stacks in Pthreads */
|
||||||
esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg)
|
esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg)
|
||||||
{
|
{
|
||||||
|
if (cfg == NULL) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
if (cfg->stack_size < PTHREAD_STACK_MIN) {
|
if (cfg->stack_size < PTHREAD_STACK_MIN) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
@ -174,12 +178,16 @@ esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg)
|
|||||||
p->stack_alloc_caps = heap_caps;
|
p->stack_alloc_caps = heap_caps;
|
||||||
pthread_setspecific(s_pthread_cfg_key, p);
|
pthread_setspecific(s_pthread_cfg_key, p);
|
||||||
|
|
||||||
return 0;
|
return ESP_OK;
|
||||||
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak")
|
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak")
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p)
|
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p)
|
||||||
{
|
{
|
||||||
|
if (p == NULL) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
ESP_RETURN_ON_ERROR(lazy_init_pthread_cfg_key(), TAG, "Failed to initialize pthread key");
|
ESP_RETURN_ON_ERROR(lazy_init_pthread_cfg_key(), TAG, "Failed to initialize pthread key");
|
||||||
|
|
||||||
esp_pthread_cfg_t *cfg = pthread_getspecific(s_pthread_cfg_key);
|
esp_pthread_cfg_t *cfg = pthread_getspecific(s_pthread_cfg_key);
|
||||||
|
@ -4,3 +4,7 @@ components/pthread/test_apps/pthread_psram_tests:
|
|||||||
enable:
|
enable:
|
||||||
- if: IDF_TARGET in ["esp32"]
|
- if: IDF_TARGET in ["esp32"]
|
||||||
reason: PSRAM only available on ESP32, S2, S3; code is fairly generic
|
reason: PSRAM only available on ESP32, S2, S3; code is fairly generic
|
||||||
|
|
||||||
|
components/pthread/test_apps/pthread_unity_tests:
|
||||||
|
enable:
|
||||||
|
- if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32c61", "esp32h2", "esp32p4", "esp32s2", "esp32s3", "linux"]
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | Linux |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | -------- | -------- | -------- | ----- |
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
set(sources "test_app_main.c"
|
idf_build_get_property(target IDF_TARGET)
|
||||||
"test_pthread.c"
|
|
||||||
|
set(sources "test_app_main.c" "test_esp_pthread.c")
|
||||||
|
set(priv_requires "pthread" "unity")
|
||||||
|
|
||||||
|
if(NOT ${target} STREQUAL "linux")
|
||||||
|
list(APPEND sources "test_pthread.c"
|
||||||
"test_pthread_cond_var.c"
|
"test_pthread_cond_var.c"
|
||||||
"test_pthread_local_storage.c"
|
"test_pthread_local_storage.c"
|
||||||
"test_pthread_cxx.cpp"
|
"test_pthread_cxx.cpp"
|
||||||
"test_pthread_rwlock.c"
|
"test_pthread_rwlock.c"
|
||||||
"test_pthread_semaphore.c")
|
"test_pthread_semaphore.c")
|
||||||
|
list(APPEND priv_requires "esp_timer" "test_utils")
|
||||||
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS ${sources}
|
idf_component_register(SRCS ${sources}
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES pthread esp_timer test_utils
|
REQUIRES ${priv_requires}
|
||||||
WHOLE_ARCHIVE)
|
WHOLE_ARCHIVE)
|
||||||
|
@ -1,44 +1,35 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "unity_test_runner.h"
|
#include "unity_test_runner.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "unity_test_utils_memory.h"
|
||||||
|
|
||||||
// Some resources are lazy allocated (e.g. newlib locks), the threshold is left for that case
|
// Some resources are lazy allocated (e.g. newlib locks), the threshold is left for that case
|
||||||
#define TEST_MEMORY_LEAK_THRESHOLD (-200)
|
#define TEST_MEMORY_LEAK_THRESHOLD (-200)
|
||||||
|
|
||||||
static size_t before_free_8bit;
|
|
||||||
static size_t before_free_32bit;
|
|
||||||
|
|
||||||
static void check_leak(size_t before_free, size_t after_free, const char *type)
|
|
||||||
{
|
|
||||||
ssize_t delta = after_free - before_free;
|
|
||||||
printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta);
|
|
||||||
TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak");
|
|
||||||
}
|
|
||||||
|
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
{
|
{
|
||||||
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
unity_utils_set_leak_level(TEST_MEMORY_LEAK_THRESHOLD);
|
||||||
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
unity_utils_record_free_mem();
|
||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown(void)
|
void tearDown(void)
|
||||||
{
|
{
|
||||||
|
#ifndef CONFIG_IDF_TARGET_LINUX // on Linux, we don't check for memory leaks with memory utils
|
||||||
// Add a short delay of 200ms to allow the idle task to free remaining memory
|
// Add a short delay of 200ms to allow the idle task to free remaining memory
|
||||||
vTaskDelay(pdMS_TO_TICKS(200));
|
vTaskDelay(pdMS_TO_TICKS(200));
|
||||||
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
#endif // CONFIG_IDF_TARGET_LINUX
|
||||||
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
|
||||||
check_leak(before_free_8bit, after_free_8bit, "8BIT");
|
unity_utils_evaluate_leaks();
|
||||||
check_leak(before_free_32bit, after_free_32bit, "32BIT");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user