forked from espressif/esp-idf
Compare commits
11 Commits
v5.4-dev
...
feature/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
138a47c750 | ||
| fa35d505a1 | |||
| b2e1f274f1 | |||
| d9fd7e602d | |||
| 50c3b729a2 | |||
| b9e1e73880 | |||
| 48559b6129 | |||
| 299874f2eb | |||
| f25593c36f | |||
| 0a90b8dcd1 | |||
| f098bf2fcf |
@@ -156,7 +156,6 @@
|
||||
|
||||
/docs/ @esp-idf-codeowners/docs
|
||||
/docs/**/api-guides/tools/ @esp-idf-codeowners/tools
|
||||
/docs/en/api-guides/core_dump.rst @esp-idf-codeowners/debugging
|
||||
/docs/en/api-guides/jtag-debugging/ @esp-idf-codeowners/debugging
|
||||
/docs/**/api-reference/bluetooth/ @esp-idf-codeowners/bluetooth
|
||||
/docs/**/api-reference/network/ @esp-idf-codeowners/network @esp-idf-codeowners/wifi
|
||||
@@ -207,19 +206,13 @@
|
||||
/tools/ldgen/ @esp-idf-codeowners/build-config
|
||||
/tools/mass_mfg/ @esp-idf-codeowners/app-utilities
|
||||
/tools/mocks/ @esp-idf-codeowners/system
|
||||
|
||||
/tools/test_apps/ @esp-idf-codeowners/ci
|
||||
/tools/test_apps/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
|
||||
/tools/test_apps/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
|
||||
|
||||
## Note: owners here should be the same as the owners for the same example subdir, above
|
||||
/tools/test_apps/build_system/ @esp-idf-codeowners/build-config
|
||||
/tools/test_apps/configs/ @esp-idf-codeowners/system
|
||||
/tools/test_apps/linux_compatible/ @esp-idf-codeowners/system
|
||||
/tools/test_apps/peripherals/ @esp-idf-codeowners/peripherals
|
||||
/tools/test_apps/phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
|
||||
/tools/test_apps/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
|
||||
/tools/test_apps/security/ @esp-idf-codeowners/security
|
||||
/tools/test_apps/storage/ @esp-idf-codeowners/storage
|
||||
/tools/test_apps/system/ @esp-idf-codeowners/system
|
||||
|
||||
/tools/test_apps/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
|
||||
|
||||
@@ -194,12 +194,8 @@ build_clang_test_apps_esp32c6:
|
||||
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
|
||||
- cd ${IDF_PATH}/tools/test_build_system
|
||||
- python ${IDF_PATH}/tools/ci/get_known_failure_cases_file.py
|
||||
- pytest
|
||||
--cleanup-idf-copy
|
||||
--parallel-count ${CI_NODE_TOTAL:-1}
|
||||
--parallel-index ${CI_NODE_INDEX:-1}
|
||||
--work-dir ${CI_PROJECT_DIR}/test_build_system
|
||||
--junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml
|
||||
- pytest --parallel-count ${CI_NODE_TOTAL:-1} --parallel-index ${CI_NODE_INDEX:-1}
|
||||
--work-dir ${CI_PROJECT_DIR}/test_build_system --junitxml=${CI_PROJECT_DIR}/XUNIT_RESULT.xml
|
||||
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
|
||||
|
||||
pytest_build_system:
|
||||
@@ -210,14 +206,11 @@ pytest_build_system_macos:
|
||||
extends:
|
||||
- .test_build_system_template
|
||||
- .before_script:build:macos
|
||||
- .after_script:build:macos:upload-when-fail
|
||||
- .rules:build:macos
|
||||
tags:
|
||||
- macos_shell
|
||||
parallel: 3
|
||||
variables:
|
||||
PYENV_VERSION: "3.8"
|
||||
CI_CCACHE_DISABLE: "1" # ccache: error: Read-only file system
|
||||
allow_failure: true # IDFCI-2107
|
||||
|
||||
build_docker:
|
||||
extends:
|
||||
@@ -264,6 +257,7 @@ generate_build_child_pipeline:
|
||||
dependencies: # set dependencies to null to avoid missing artifacts issue
|
||||
needs:
|
||||
- pipeline_variables
|
||||
- check_test_cases_env_markers_and_required_runners
|
||||
artifacts:
|
||||
paths:
|
||||
- build_child_pipeline.yml
|
||||
|
||||
@@ -39,7 +39,7 @@ variables:
|
||||
GIT_FETCH_EXTRA_FLAGS: "--no-recurse-submodules --prune --prune-tags"
|
||||
# we're using .cache folder for caches
|
||||
GIT_CLEAN_FLAGS: -ffdx -e .cache/
|
||||
LATEST_GIT_TAG: v5.4-dev
|
||||
LATEST_GIT_TAG: v5.3-dev
|
||||
|
||||
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
|
||||
# by default we will fetch all submodules
|
||||
@@ -52,11 +52,12 @@ variables:
|
||||
IDF_PATH: "$CI_PROJECT_DIR"
|
||||
V: "0"
|
||||
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
|
||||
PYTHON_VER: 3.8.17
|
||||
|
||||
# Docker images
|
||||
ESP_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-env-v5.4:1"
|
||||
ESP_IDF_DOC_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-doc-env-v5.4:1-1"
|
||||
TARGET_TEST_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/target-test-env-v5.4:1"
|
||||
ESP_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-env-v5.3:1"
|
||||
ESP_IDF_DOC_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-doc-env-v5.3:1-1"
|
||||
TARGET_TEST_ENV_IMAGE: "${CI_DOCKER_REGISTRY}/target-test-env-v5.3:1"
|
||||
SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:5"
|
||||
PRE_COMMIT_IMAGE: "${CI_DOCKER_REGISTRY}/esp-idf-pre-commit:1"
|
||||
|
||||
@@ -72,7 +73,7 @@ variables:
|
||||
CI_PYTHON_CONSTRAINT_BRANCH: ""
|
||||
|
||||
# Update the filename for a specific ESP-IDF release. It is used only with CI_PYTHON_CONSTRAINT_BRANCH.
|
||||
CI_PYTHON_CONSTRAINT_FILE: "espidf.constraints.v5.4.txt"
|
||||
CI_PYTHON_CONSTRAINT_FILE: "espidf.constraints.v5.3.txt"
|
||||
|
||||
# Set this variable to repository name of a Python tool you wish to install and test in the context of ESP-IDF CI.
|
||||
# Keep the variable empty when not used.
|
||||
@@ -207,10 +208,6 @@ variables:
|
||||
|
||||
.before_script:build:macos:
|
||||
before_script:
|
||||
# macos is running shell executor, which means it would use
|
||||
# the system installed /usr/local/bin/python3 by default.
|
||||
# Ensure pyenv and PYENV_VERSION installed
|
||||
- eval "$(pyenv init -)"
|
||||
- *common-before_scripts
|
||||
# On macOS, these tools need to be installed
|
||||
- export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}"
|
||||
@@ -219,14 +216,6 @@ variables:
|
||||
- *setup_tools_and_idf_python_venv
|
||||
- fetch_submodules
|
||||
|
||||
.after_script:build:macos:upload-when-fail:
|
||||
after_script:
|
||||
# macos is running shell executor, which means it would use
|
||||
# the system installed /usr/local/bin/python3 by default.
|
||||
# Ensure pyenv and PYENV_VERSION installed
|
||||
- eval "$(pyenv init -)"
|
||||
- *upload_failed_job_log_artifacts
|
||||
|
||||
.before_script:build:
|
||||
before_script:
|
||||
- *common-before_scripts
|
||||
|
||||
@@ -102,7 +102,7 @@ check_docs_lang_sync:
|
||||
parallel:
|
||||
matrix:
|
||||
- DOCLANG: ["en", "zh_CN"]
|
||||
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32c5","esp32h2", "esp32p4"]
|
||||
DOCTGT: ["esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32h2", "esp32p4"]
|
||||
|
||||
check_docs_gh_links:
|
||||
image: $ESP_IDF_DOC_ENV_IMAGE
|
||||
|
||||
@@ -166,3 +166,10 @@ pipeline_variables:
|
||||
- pipeline.env
|
||||
expire_in: 1 week
|
||||
when: always
|
||||
|
||||
check_test_cases_env_markers_and_required_runners:
|
||||
extends:
|
||||
- .pre_check_template
|
||||
tags: [fast_run, shiny]
|
||||
script:
|
||||
- python tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py --check
|
||||
|
||||
@@ -203,7 +203,7 @@ repos:
|
||||
- id: check-copyright
|
||||
args: ['--ignore', 'tools/ci/check_copyright_ignore.txt', '--config', 'tools/ci/check_copyright_config.yaml']
|
||||
- repo: https://github.com/espressif/conventional-precommit-linter
|
||||
rev: v1.7.0
|
||||
rev: v1.6.0
|
||||
hooks:
|
||||
- id: conventional-precommit-linter
|
||||
stages: [commit-msg]
|
||||
|
||||
@@ -61,10 +61,14 @@ Supported since ESP-IDF v4.2.
|
||||
|
||||
### ESP32-C3
|
||||
|
||||
#### v0.2 - v0.4
|
||||
#### v0.2, v0.3
|
||||
|
||||
Supported since ESP-IDF v4.3.
|
||||
|
||||
#### v0.4
|
||||
|
||||
To be added.
|
||||
|
||||
#### v1.1
|
||||
|
||||
| Release branch | Recommended | Required |
|
||||
|
||||
@@ -61,10 +61,14 @@
|
||||
|
||||
### ESP32-C3
|
||||
|
||||
#### v0.2 - v0.4
|
||||
#### v0.2 和 v0.3
|
||||
|
||||
从 ESP-IDF v4.3 开始支持。
|
||||
|
||||
#### v0.4
|
||||
|
||||
待更新。
|
||||
|
||||
#### v1.1
|
||||
|
||||
| 发布分支 | 推荐版本 | 需求版本 |
|
||||
|
||||
@@ -174,7 +174,7 @@ void esp_apptrace_log_unlock(void);
|
||||
#define ESP_APPTRACE_LOG_LEV( _L_, level, format, ... ) \
|
||||
do { \
|
||||
if (LOG_LOCAL_LEVEL >= level) { \
|
||||
ESP_APPTRACE_LOG(LOG_FORMAT(_L_, format), esp_log_early_timestamp(), TAG, ##__VA_ARGS__); \
|
||||
ESP_APPTRACE_LOG(LOG_FORMAT(_L_, format), esp_log_early_timestamp(), TAG, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "bootloader_sha.h"
|
||||
#include "sys/param.h"
|
||||
#include "bootloader_flash_priv.h"
|
||||
#include "esp_rom_caps.h"
|
||||
|
||||
#define ESP_PARTITION_HASH_LEN 32 /* SHA-256 digest length */
|
||||
#define IS_MAX_REV_SET(max_chip_rev_full) (((max_chip_rev_full) != 65535) && ((max_chip_rev_full) != 0))
|
||||
@@ -213,12 +212,7 @@ void bootloader_common_update_rtc_retain_mem(esp_partition_pos_t* partition, boo
|
||||
rtc_retain_mem_t* bootloader_common_get_rtc_retain_mem(void)
|
||||
{
|
||||
#ifdef BOOTLOADER_BUILD
|
||||
|
||||
#if ESP_ROM_HAS_LP_ROM
|
||||
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_LOW)
|
||||
#else
|
||||
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_HIGH - sizeof(rtc_retain_mem_t))
|
||||
#endif //ESP_ROM_HAS_LP_ROM
|
||||
static rtc_retain_mem_t *const s_bootloader_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR;
|
||||
return s_bootloader_retain_mem;
|
||||
#else
|
||||
@@ -227,5 +221,4 @@ rtc_retain_mem_t* bootloader_common_get_rtc_retain_mem(void)
|
||||
#endif // !BOOTLOADER_BUILD
|
||||
}
|
||||
|
||||
|
||||
#endif // CONFIG_BOOTLOADER_RESERVE_RTC_MEM
|
||||
|
||||
@@ -615,7 +615,25 @@ static void load_image(const esp_image_metadata_t *image_data)
|
||||
*/
|
||||
ESP_LOGI(TAG, "Checking flash encryption...");
|
||||
bool flash_encryption_enabled = esp_flash_encrypt_state();
|
||||
if (!flash_encryption_enabled) {
|
||||
if (flash_encryption_enabled) {
|
||||
#if BOOTLOADER_BUILD
|
||||
/* Ensure security eFuses are burnt */
|
||||
esp_efuse_batch_write_begin();
|
||||
esp_err_t err = esp_flash_encryption_enable_secure_features();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Error setting security eFuses (err=0x%x).", err);
|
||||
esp_efuse_batch_write_cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
err = esp_efuse_batch_write_commit();
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Error programming security eFuses (err=0x%x).", err);
|
||||
return;
|
||||
}
|
||||
ESP_LOGI(TAG, "Security eFuses are burnt");
|
||||
#endif // BOOTLOADER_BUILD
|
||||
} else {
|
||||
#ifdef CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED
|
||||
ESP_LOGE(TAG, "flash encryption is not enabled, and SECURE_FLASH_REQUIRE_ALREADY_ENABLED is set, refusing to boot.");
|
||||
return;
|
||||
|
||||
@@ -847,8 +847,17 @@ if(CONFIG_BT_ENABLED)
|
||||
target_link_directories(${COMPONENT_LIB} INTERFACE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
|
||||
elseif(CONFIG_BT_CONTROLLER_ENABLED)
|
||||
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a")
|
||||
elseif(CONFIG_IDF_TARGET_ESP32C2 AND CONFIG_BT_CONTROLLER_ENABLED)
|
||||
add_prebuilt_library(libble_app "controller/lib_esp32c2/esp32c2-bt-lib/libble_app.a")
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
||||
elseif(CONFIG_IDF_TARGET_ESP32C6 AND CONFIG_BT_CONTROLLER_ENABLED)
|
||||
add_prebuilt_library(libble_app "controller/lib_esp32c6/esp32c6-bt-lib/libble_app.a")
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
||||
elseif(CONFIG_IDF_TARGET_ESP32H2 AND CONFIG_BT_CONTROLLER_ENABLED)
|
||||
add_prebuilt_library(libble_app "controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a")
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
||||
elseif(CONFIG_IDF_TARGET_ESP32C5 AND CONFIG_BT_CONTROLLER_ENABLED)
|
||||
add_prebuilt_library(libble_app "controller/lib_esp32c5/esp32c5-bt-lib/libble_app.a")
|
||||
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
case BTA_GATTS_CREATE_EVT:
|
||||
blufi_env.handle_srvc = p_data->create.service_id;
|
||||
|
||||
//add the first blufi characteristic --> write characteristic
|
||||
//add the frist blufi characteristic --> write characteristic
|
||||
BTA_GATTS_AddCharacteristic(blufi_env.handle_srvc, &blufi_char_uuid_p2e,
|
||||
(GATT_PERM_WRITE),
|
||||
(GATT_CHAR_PROP_BIT_WRITE),
|
||||
@@ -370,7 +370,7 @@ void esp_blufi_deinit(void)
|
||||
|
||||
void esp_blufi_adv_start(void)
|
||||
{
|
||||
esp_ble_gap_set_device_name(BLUFI_DEVICE_NAME);
|
||||
esp_bt_dev_set_device_name(BLUFI_DEVICE_NAME);
|
||||
esp_ble_gap_config_adv_data(&blufi_adv_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,11 +117,11 @@
|
||||
|
||||
#define BT_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_INITIAL_TRACE_LEVEL, LOG_LOCAL_LEVEL_MAPPING) >= BT_TRACE_LEVEL_##LEVEL)
|
||||
|
||||
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
|
||||
|
||||
#if !UC_BT_STACK_NO_LOG
|
||||
|
||||
@@ -450,7 +450,6 @@ config BT_LE_USE_ESP_TIMER
|
||||
|
||||
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
|
||||
bool "BLE adv report flow control supported"
|
||||
depends on BT_LE_ROLE_OBSERVER_ENABLE
|
||||
default y
|
||||
help
|
||||
The function is mainly used to enable flow control for advertising reports. When it is enabled,
|
||||
@@ -499,31 +498,3 @@ config BT_LE_CCA_RSSI_THRESH
|
||||
default 20
|
||||
help
|
||||
Power threshold of CCA in unit of -1 dBm.
|
||||
|
||||
config BT_LE_ROLE_CENTROL_ENABLE
|
||||
bool "Enable BLE Centrol role function"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable centrol role function.
|
||||
|
||||
config BT_LE_ROLE_PERIPHERAL_ENABLE
|
||||
bool "Enable BLE Peripheral role function"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable Peripheral role function.
|
||||
|
||||
config BT_LE_ROLE_BROADCASTER_ENABLE
|
||||
bool "Enable BLE Broadcaster role function"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable broadcaster role function.
|
||||
|
||||
config BT_LE_ROLE_OBSERVER_ENABLE
|
||||
bool "Enable BLE Observer role function"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable observer role function.
|
||||
|
||||
@@ -652,15 +652,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if DEFAULT_BT_LE_50_FEATURE_SUPPORT || DEFAULT_BT_LE_ROLE_CENTROL || DEFAULT_BT_LE_ROLE_OBSERVER
|
||||
extern int esp_ble_rom_func_ptr_init_all(void);
|
||||
esp_ble_rom_func_ptr_init_all();
|
||||
#else
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Init only legacy adv and slave function");
|
||||
extern int esp_ble_rom_func_ptr_init_legacy_adv_and_slave(void);
|
||||
esp_ble_rom_func_ptr_init_legacy_adv_and_slave();
|
||||
#endif
|
||||
|
||||
/* Initialize the function pointers for OS porting */
|
||||
npl_freertos_funcs_init();
|
||||
struct npl_funcs_t *p_npl_funcs = npl_freertos_funcs_get();
|
||||
|
||||
@@ -46,10 +46,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_ROLE_OBSERVER MYNEWT_VAL(BLE_ROLE_OBSERVER)
|
||||
#define DEFAULT_BT_LE_ROLE_CENTROL MYNEWT_VAL(BLE_ROLE_CENTRAL)
|
||||
#define DEFAULT_BT_LE_ROLE_PERIPHERAL MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
|
||||
#define DEFAULT_BT_LE_ROLE_BROADCASTER MYNEWT_VAL(BLE_ROLE_BROADCASTER)
|
||||
#else
|
||||
|
||||
#if CONFIG_BT_LE_LL_CFG_FEAT_LE_CODED_PHY
|
||||
@@ -61,13 +57,13 @@ extern "C" {
|
||||
#if defined(CONFIG_BT_LE_MAX_PERIODIC_ADVERTISER_LIST)
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (CONFIG_BT_LE_MAX_PERIODIC_ADVERTISER_LIST)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (0)
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (5)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_LE_MAX_PERIODIC_SYNCS)
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (CONFIG_BT_LE_MAX_PERIODIC_SYNCS)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (0)
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (1)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_LE_MAX_CONNECTIONS)
|
||||
@@ -129,29 +125,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_LE_ROLE_CENTROL_ENABLE)
|
||||
#define DEFAULT_BT_LE_ROLE_CENTROL (1)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_ROLE_CENTROL (0)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_LE_ROLE_PERIPHERAL_ENABLE)
|
||||
#define DEFAULT_BT_LE_ROLE_PERIPHERAL (1)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_ROLE_PERIPHERAL (0)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_LE_ROLE_BROADCASTER_ENABLE)
|
||||
#define DEFAULT_BT_LE_ROLE_BROADCASTER (1)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_ROLE_BROADCASTER (0)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_LE_ROLE_OBSERVER_ENABLE)
|
||||
#define DEFAULT_BT_LE_ROLE_OBSERVER (1)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_ROLE_OBSERVER (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF
|
||||
|
||||
Submodule components/bt/controller/lib_esp32c2/esp32c2-bt-lib updated: b9a902c355...05fa7ad7ed
@@ -61,11 +61,11 @@ extern "C" {
|
||||
|
||||
#define BLE_MESH_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_LOG_LEVEL, BLE_MESH_LOG_LOCAL_LEVEL_MAPPING) >= BLE_MESH_LOG_LEVEL_##LEVEL)
|
||||
|
||||
#define BLE_MESH_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define BLE_MESH_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
|
||||
#define printk esp_rom_printf
|
||||
|
||||
|
||||
@@ -1132,7 +1132,7 @@ int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc)
|
||||
|
||||
int bt_mesh_gatts_set_local_device_name(const char *name)
|
||||
{
|
||||
BTM_SetLocalDeviceName((char *)name, BT_DEVICE_TYPE_BLE);
|
||||
BTM_SetLocalDeviceName((char *)name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ static void bt_mesh_bta_gattc_cb(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
/* Register Notification for Mesh Provisioning/Proxy Data Out Characteristic */
|
||||
/* Register Notification fot Mesh Provisioning/Proxy Data Out Characteristic */
|
||||
status = BTA_GATTC_RegisterForNotifications(bt_mesh_gattc_if, bt_mesh_gattc_info[i].addr.val,
|
||||
bt_mesh_gattc_info[i].data_out_handle);
|
||||
if (status != BTA_GATT_OK) {
|
||||
|
||||
Submodule components/bt/esp_ble_mesh/lib/lib updated: 4934ca9038...41bf5fc092
@@ -360,7 +360,6 @@ esp_err_t esp_ble_gap_config_local_icon (uint16_t icon)
|
||||
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV:
|
||||
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD:
|
||||
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV:
|
||||
case ESP_BLE_APPEARANCE_STANDALONE_SPEAKER:
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON;
|
||||
@@ -458,25 +457,9 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
|
||||
|
||||
esp_err_t esp_ble_gap_set_device_name(const char *name)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (!name){
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (strlen(name) > BTC_MAX_LOC_BD_NAME_LEN) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_SET_DEV_NAME;
|
||||
arg.set_dev_name.device_name = (char *)name;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
return esp_bt_dev_set_device_name(name);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_get_device_name(void)
|
||||
|
||||
@@ -517,40 +517,4 @@ esp_err_t esp_bt_gap_set_min_enc_key_size(uint8_t key_size)
|
||||
}
|
||||
#endif /* #if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE) */
|
||||
|
||||
esp_err_t esp_bt_gap_set_device_name(const char *name)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_gap_bt_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if ((!name) || (strlen(name) > BTC_MAX_LOC_BD_NAME_LEN)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BT;
|
||||
msg.act = BTC_GAP_BT_ACT_SET_DEV_NAME;
|
||||
arg.bt_set_dev_name.device_name = (char *)name;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), btc_gap_bt_arg_deep_copy,
|
||||
btc_gap_bt_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_gap_get_device_name(void)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BT;
|
||||
msg.act = BTC_GAP_BT_ACT_GET_DEV_NAME;
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#endif /* #if BTC_GAP_BT_INCLUDED == TRUE */
|
||||
|
||||
@@ -96,7 +96,7 @@ const uint8_t *esp_bt_dev_get_address(void);
|
||||
* - ESP_ERR_INVALID_STATE : if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL : others
|
||||
*/
|
||||
esp_err_t esp_bt_dev_set_device_name(const char *name) __attribute__((deprecated("Please use esp_bt_gap_set_device_name or esp_ble_gap_set_device_name")));
|
||||
esp_err_t esp_bt_dev_set_device_name(const char *name);
|
||||
|
||||
/**
|
||||
* @brief Get bluetooth device name. This function should be called after esp_bluedroid_enable()
|
||||
@@ -110,7 +110,7 @@ esp_err_t esp_bt_dev_set_device_name(const char *name) __attribute__((deprecated
|
||||
* - ESP_ERR_INVALID_STATE : if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL : others
|
||||
*/
|
||||
esp_err_t esp_bt_dev_get_device_name(void) __attribute__((deprecated("Please use esp_bt_gap_get_device_name or esp_ble_gap_get_device_name")));
|
||||
esp_err_t esp_bt_dev_get_device_name(void);
|
||||
|
||||
/**
|
||||
* @brief Config bluetooth device coexis status. This function should be called after esp_bluedroid_enable()
|
||||
|
||||
@@ -70,7 +70,7 @@ esp_err_t esp_bluedroid_disable(void);
|
||||
* - ESP_OK : Succeed
|
||||
* - Other : Failed
|
||||
*/
|
||||
esp_err_t esp_bluedroid_init(void);
|
||||
esp_err_t esp_bluedroid_init(void) __attribute__((deprecated("Please use esp_bluedroid_init_with_cfg")));
|
||||
|
||||
/**
|
||||
* @brief Init and alloc the resource for bluetooth, must be prior to every bluetooth stuff.
|
||||
|
||||
@@ -104,7 +104,6 @@ typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_CADENCE 0x0483 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_CADENCE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_POWER 0x0484 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_POWER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_STANDALONE_SPEAKER 0x0841 /*!< relate to BTM_BLE_APPEARANCE_STANDALONE_SPEAKER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 /*!< relate to BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 /*!< relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 /*!< relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST in stack/btm_ble_api.h */
|
||||
@@ -1814,7 +1813,7 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_device_name(const char *name);
|
||||
esp_err_t esp_ble_gap_set_device_name(const char *name) __attribute__((deprecated("Please use esp_bt_dev_set_device_name")));
|
||||
|
||||
/**
|
||||
* @brief Get device name of the local device
|
||||
@@ -1824,7 +1823,7 @@ esp_err_t esp_ble_gap_set_device_name(const char *name);
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_get_device_name(void);
|
||||
esp_err_t esp_ble_gap_get_device_name(void) __attribute__((deprecated("Please use esp_bt_dev_get_device_name")));
|
||||
|
||||
/**
|
||||
* @brief This function is called to get local used address and address type.
|
||||
|
||||
@@ -105,7 +105,7 @@ typedef uint8_t esp_bt_eir_type_t;
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 0x1000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 0x2000
|
||||
|
||||
// DM1 can not be disabled. All options are mandatory to include DM1.
|
||||
// DM1 cann not be disabled. All options are mandatory to include DM1.
|
||||
#define ESP_BT_ACL_DM1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM1 | 0x330e) /* 0x330e */
|
||||
#define ESP_BT_ACL_DH1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH1 | 0x330e) /* 0x331e */
|
||||
#define ESP_BT_ACL_DM3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM3 | 0x330e) /* 0x370e */
|
||||
@@ -146,7 +146,7 @@ typedef struct {
|
||||
uint8_t *p_url; /*!< URL point */
|
||||
} esp_bt_eir_data_t;
|
||||
|
||||
/// Major service class field of Class of Device, multiple bits can be set
|
||||
/// Major service class field of Class of Device, mutiple bits can be set
|
||||
typedef enum {
|
||||
ESP_BT_COD_SRVC_NONE = 0, /*!< None indicates an invalid value */
|
||||
ESP_BT_COD_SRVC_LMTD_DISCOVER = 0x1, /*!< Limited Discoverable Mode */
|
||||
@@ -271,7 +271,6 @@ typedef enum {
|
||||
ESP_BT_GAP_ACL_PKT_TYPE_CHANGED_EVT, /*!< Set ACL packet types event */
|
||||
ESP_BT_GAP_ENC_CHG_EVT, /*!< Encryption change event */
|
||||
ESP_BT_GAP_SET_MIN_ENC_KEY_SIZE_EVT, /*!< Set minimum encryption key size */
|
||||
ESP_BT_GAP_GET_DEV_NAME_CMPL_EVT, /*!< Get device name complete event */
|
||||
ESP_BT_GAP_EVT_MAX,
|
||||
} esp_bt_gap_cb_event_t;
|
||||
|
||||
@@ -488,14 +487,6 @@ typedef union {
|
||||
uint16_t handle; /*!< ACL connection handle */
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address */
|
||||
} acl_disconn_cmpl_stat; /*!< ACL disconnection complete status parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_GAP_BT_GET_DEV_NAME_CMPL_EVT
|
||||
*/
|
||||
struct get_dev_name_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the get device name success status */
|
||||
char *name; /*!< Name of bluetooth device */
|
||||
} get_dev_name_cmpl; /*!< Get device name complete status parameter struct */
|
||||
} esp_bt_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@@ -562,7 +553,7 @@ static inline uint32_t esp_bt_gap_get_cod_format_type(uint32_t cod)
|
||||
*
|
||||
* @return
|
||||
* - true if cod is valid
|
||||
* - false otherwise
|
||||
* - false otherise
|
||||
*/
|
||||
static inline bool esp_bt_gap_is_valid_cod(uint32_t cod)
|
||||
{
|
||||
@@ -931,7 +922,7 @@ esp_err_t esp_bt_gap_get_page_timeout(void);
|
||||
esp_err_t esp_bt_gap_set_acl_pkt_types(esp_bd_addr_t remote_bda, esp_bt_acl_pkt_type_t pkt_types);
|
||||
|
||||
/**
|
||||
* @brief Set the minimal size of encryption key
|
||||
* @brief Set the mininal size of encryption key
|
||||
*
|
||||
* @return - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@@ -939,26 +930,6 @@ esp_err_t esp_bt_gap_set_acl_pkt_types(esp_bd_addr_t remote_bda, esp_bt_acl_pkt_
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_min_enc_key_size(uint8_t key_size);
|
||||
|
||||
/**
|
||||
* @brief Set device name to the local device
|
||||
*
|
||||
* @param[in] name - device name.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_device_name(const char *name);
|
||||
|
||||
/**
|
||||
* @brief Get device name of the local device
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_device_name(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -683,11 +683,9 @@ static void bta_dm_disable_timer_cback (TIMER_LIST_ENT *p_tle)
|
||||
*******************************************************************************/
|
||||
void bta_dm_set_dev_name (tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_SetLocalDeviceName((char *)p_data->set_name.name, p_data->set_name.name_type);
|
||||
BTM_SetLocalDeviceName((char *)p_data->set_name.name);
|
||||
#if CLASSIC_BT_INCLUDED
|
||||
if (p_data->set_name.name_type & BT_DEVICE_TYPE_BREDR) {
|
||||
bta_dm_set_eir ((char *)p_data->set_name.name);
|
||||
}
|
||||
bta_dm_set_eir ((char *)p_data->set_name.name);
|
||||
#endif /// CLASSIC_BT_INCLUDED
|
||||
}
|
||||
|
||||
@@ -706,7 +704,7 @@ void bta_dm_get_dev_name (tBTA_DM_MSG *p_data)
|
||||
tBTM_STATUS status;
|
||||
char *name = NULL;
|
||||
|
||||
status = BTM_ReadLocalDeviceName(&name, p_data->get_name.name_type);
|
||||
status = BTM_ReadLocalDeviceName(&name);
|
||||
if (p_data->get_name.p_cback) {
|
||||
(*p_data->get_name.p_cback)(status, name);
|
||||
}
|
||||
@@ -4170,7 +4168,7 @@ static void bta_dm_set_eir (char *local_name)
|
||||
if (p_bta_dm_eir_cfg->bta_dm_eir_included_name) {
|
||||
/* if local name is not provided, get it from controller */
|
||||
if ( local_name == NULL ) {
|
||||
if ( BTM_ReadLocalDeviceName( &local_name, BT_DEVICE_TYPE_BREDR) != BTM_SUCCESS ) {
|
||||
if ( BTM_ReadLocalDeviceName( &local_name ) != BTM_SUCCESS ) {
|
||||
APPL_TRACE_ERROR("Fail to read local device name for EIR");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void BTA_DisableTestMode(void)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmSetDeviceName(const char *p_name, tBT_DEVICE_TYPE name_type)
|
||||
void BTA_DmSetDeviceName(const char *p_name)
|
||||
{
|
||||
|
||||
tBTA_DM_API_SET_NAME *p_msg;
|
||||
@@ -176,7 +176,6 @@ void BTA_DmSetDeviceName(const char *p_name, tBT_DEVICE_TYPE name_type)
|
||||
/* truncate the name if needed */
|
||||
BCM_STRNCPY_S((char *)p_msg->name, p_name, BD_NAME_LEN);
|
||||
p_msg->name[BD_NAME_LEN] = '\0';
|
||||
p_msg->name_type = name_type;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
@@ -192,14 +191,13 @@ void BTA_DmSetDeviceName(const char *p_name, tBT_DEVICE_TYPE name_type)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback, tBT_DEVICE_TYPE name_type)
|
||||
void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback)
|
||||
{
|
||||
tBTA_DM_API_GET_NAME *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_GET_NAME *) osi_malloc(sizeof(tBTA_DM_API_GET_NAME))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_GET_NAME_EVT;
|
||||
p_msg->p_cback = p_cback;
|
||||
p_msg->name_type = name_type;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,13 +255,11 @@ typedef struct {
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_NAME name; /* max 248 bytes name, plus must be Null terminated */
|
||||
tBT_DEVICE_TYPE name_type; /* name for BLE, name for BT or name for BTDM */
|
||||
} tBTA_DM_API_SET_NAME;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BT_HDR hdr;
|
||||
tBTA_GET_DEV_NAME_CBACK *p_cback;
|
||||
tBT_DEVICE_TYPE name_type;
|
||||
} tBTA_DM_API_GET_NAME;
|
||||
|
||||
#if (ESP_COEX_VSC_INCLUDED == TRUE)
|
||||
|
||||
@@ -276,7 +276,7 @@ static void bta_hh_di_sdp_cback(UINT16 result)
|
||||
bta_hh_update_di_info(p_cb, di_rec.rec.vendor, di_rec.rec.product, di_rec.rec.version, 0);
|
||||
}
|
||||
|
||||
} else { /* no DI record available */
|
||||
} else { /* no DI recrod available */
|
||||
bta_hh_update_di_info(p_cb, BTA_HH_VENDOR_ID_INVALID, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
|
||||
return;
|
||||
}
|
||||
/* GetSDPRecord. at one time only one SDP procedure can be active */
|
||||
/* GetSDPRecord. at one time only one SDP precedure can be active */
|
||||
else if (!bta_hh_cb.p_disc_db) {
|
||||
bta_hh_cb.p_disc_db = (tSDP_DISCOVERY_DB *) osi_malloc(p_bta_hh_cfg->sdp_db_size);
|
||||
|
||||
@@ -429,7 +429,6 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
APPL_TRACE_DEBUG ("bta_hh_sdp_cmpl: HID_HostOpenDev failed: \
|
||||
Status 0x%2X", ret);
|
||||
#endif
|
||||
conn_dat.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
|
||||
/* open fail, remove device from management device list */
|
||||
HID_HostRemoveDev( p_cb->hid_handle);
|
||||
status = BTA_HH_ERR;
|
||||
@@ -453,6 +452,8 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
HID_HostRemoveDev( p_cb->incoming_hid_handle);
|
||||
}
|
||||
conn_dat.status = status;
|
||||
/* check if host initiate the connection*/
|
||||
conn_dat.is_orig = !p_cb->incoming_conn;
|
||||
(* bta_hh_cb.p_cback)(BTA_HH_OPEN_EVT, (tBTA_HH *)&conn_dat);
|
||||
|
||||
/* move state machine W4_CONN ->IDLE */
|
||||
@@ -522,7 +523,8 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
|
||||
memset((void *)&conn, 0, sizeof (tBTA_HH_CONN));
|
||||
conn.handle = dev_handle;
|
||||
conn.is_orig = HID_HostConnectOrig(dev_handle);
|
||||
/* check if host initiate the connection*/
|
||||
conn.is_orig = !p_cb->incoming_conn;
|
||||
bdcpy(conn.bda, p_cb->addr);
|
||||
|
||||
/* increase connection number */
|
||||
@@ -594,7 +596,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
if (p_cb->app_id != 0) {
|
||||
bta_hh_sm_execute(p_cb, BTA_HH_OPEN_CMPL_EVT, p_data);
|
||||
} else
|
||||
/* app_id == 0 indicates an incoming connection request arrives without SDP
|
||||
/* app_id == 0 indicates an incoming conenction request arrives without SDP
|
||||
performed, do it first */
|
||||
{
|
||||
/* store the handle here in case sdp fails - need to disconnect */
|
||||
@@ -635,7 +637,7 @@ void bta_hh_data_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
**
|
||||
** Function bta_hh_handsk_act
|
||||
**
|
||||
** Description HID Host process a handshake acknowledgement.
|
||||
** Description HID Host process a handshake acknoledgement.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
@@ -672,7 +674,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
p_cb->w4_evt = 0;
|
||||
break;
|
||||
|
||||
/* acknowledgement from HID device for SET_ transaction */
|
||||
/* acknoledgement from HID device for SET_ transaction */
|
||||
case BTA_HH_SET_RPT_EVT:
|
||||
case BTA_HH_SET_PROTO_EVT:
|
||||
case BTA_HH_SET_IDLE_EVT :
|
||||
@@ -691,7 +693,8 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
case BTA_HH_OPEN_EVT:
|
||||
conn.status = p_data->hid_cback.data ? BTA_HH_ERR_PROTO : BTA_HH_OK;
|
||||
conn.handle = p_cb->hid_handle;
|
||||
conn.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
|
||||
/* check if host initiate the connection*/
|
||||
conn.is_orig = !p_cb->incoming_conn;
|
||||
bdcpy(conn.bda, p_cb->addr);
|
||||
(* bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH *)&conn);
|
||||
#if BTA_HH_DEBUG
|
||||
@@ -701,12 +704,12 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
break;
|
||||
|
||||
default:
|
||||
/* unknown transaction handshake response */
|
||||
/* unknow transaction handshake response */
|
||||
APPL_TRACE_DEBUG("unknown transaction type");
|
||||
break;
|
||||
}
|
||||
|
||||
/* transaction acknowledgement received, inform PM for mode change */
|
||||
/* transaction achknoledgement received, inform PM for mode change */
|
||||
bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr);
|
||||
return;
|
||||
}
|
||||
@@ -796,7 +799,7 @@ void bta_hh_open_failure(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
conn_dat.status = (reason == HID_ERR_AUTH_FAILED) ?
|
||||
BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR;
|
||||
/* check if host initiate the connection*/
|
||||
conn_dat.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
|
||||
conn_dat.is_orig = !p_cb->incoming_conn;
|
||||
bdcpy(conn_dat.bda, p_cb->addr);
|
||||
HID_HostCloseDev(p_cb->hid_handle);
|
||||
|
||||
@@ -841,13 +844,13 @@ void bta_hh_close_act (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||
|
||||
/* Check reason for closing */
|
||||
if ((reason & (HID_L2CAP_CONN_FAIL | HID_L2CAP_REQ_FAIL)) || /* Failure to initialize connection (page timeout or l2cap error) */
|
||||
(reason == HID_ERR_AUTH_FAILED) || /* Authentication error (while initiating) */
|
||||
(reason == HID_ERR_AUTH_FAILED) || /* Authenication error (while initiating) */
|
||||
(reason == HID_ERR_L2CAP_FAILED)) { /* Failure creating l2cap connection */
|
||||
/* Failure in opening connection */
|
||||
conn_dat.handle = p_cb->hid_handle;
|
||||
conn_dat.status = (reason == HID_ERR_AUTH_FAILED) ? BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR;
|
||||
/* check if host initiate the connection*/
|
||||
conn_dat.is_orig = HID_HostConnectOrig(p_cb->hid_handle);
|
||||
conn_dat.is_orig = !p_cb->incoming_conn;
|
||||
bdcpy(conn_dat.bda, p_cb->addr);
|
||||
HID_HostCloseDev(p_cb->hid_handle);
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event, tBTA_HH_DATA *p_data)
|
||||
cback_data.conn.status = BTA_HH_ERR_DB_FULL;
|
||||
cback_data.conn.handle = BTA_HH_INVALID_HANDLE;
|
||||
/* check if host initiate the connection*/
|
||||
cback_data.conn.is_orig = TRUE;
|
||||
cback_data.conn.is_orig = !p_cb->incoming_conn;
|
||||
break;
|
||||
/* DB full, BTA_HhAddDev */
|
||||
case BTA_HH_API_MAINT_DEV_EVT:
|
||||
|
||||
@@ -1728,7 +1728,7 @@ extern void BTA_DisableTestMode(void);
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmSetDeviceName(const char *p_name, tBT_DEVICE_TYPE name_type);
|
||||
extern void BTA_DmSetDeviceName(const char *p_name);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -1740,7 +1740,7 @@ extern void BTA_DmSetDeviceName(const char *p_name, tBT_DEVICE_TYPE name_type);
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback, tBT_DEVICE_TYPE name_type);
|
||||
extern void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
||||
@@ -141,10 +141,10 @@ void btc_dev_call_handler(btc_msg_t *msg)
|
||||
|
||||
switch (msg->act) {
|
||||
case BTC_DEV_ACT_SET_DEVICE_NAME:
|
||||
BTA_DmSetDeviceName(arg->set_dev_name.device_name, BT_DEVICE_TYPE_DUMO);
|
||||
BTA_DmSetDeviceName(arg->set_dev_name.device_name);
|
||||
break;
|
||||
case BTC_DEV_ACT_GET_DEVICE_NAME:
|
||||
BTA_DmGetDeviceName(btc_dev_get_dev_name_callback, BT_DEVICE_TYPE_DUMO);
|
||||
BTA_DmGetDeviceName(btc_dev_get_dev_name_callback);
|
||||
break;
|
||||
#if (ESP_COEX_VSC_INCLUDED == TRUE)
|
||||
case BTC_DEV_ACT_CFG_COEX_STATUS:
|
||||
|
||||
@@ -789,7 +789,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
/* Set initial device name, it can be overwritten later */
|
||||
if (p_data->enable.status == BTA_SUCCESS) {
|
||||
const char *initial_device_name = "ESP32";
|
||||
BTA_DmSetDeviceName(initial_device_name, BT_DEVICE_TYPE_DUMO);
|
||||
BTA_DmSetDeviceName(initial_device_name);
|
||||
}
|
||||
btc_enable_bluetooth_evt(p_data->enable.status);
|
||||
break;
|
||||
|
||||
@@ -1694,18 +1694,6 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BLE_ACT_SET_DEV_NAME:{
|
||||
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
|
||||
btc_ble_gap_args_t *dst = (btc_ble_gap_args_t *)p_dest;
|
||||
dst->set_dev_name.device_name = (char *)osi_malloc((BTC_MAX_LOC_BD_NAME_LEN + 1) * sizeof(char));
|
||||
if (dst->set_dev_name.device_name) {
|
||||
BCM_STRNCPY_S(dst->set_dev_name.device_name, src->set_dev_name.device_name, BTC_MAX_LOC_BD_NAME_LEN);
|
||||
dst->set_dev_name.device_name[BTC_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
|
||||
break;
|
||||
@@ -1834,14 +1822,6 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BLE_ACT_SET_DEV_NAME:{
|
||||
char *p_name = ((btc_ble_gap_args_t *)msg->arg)->set_dev_name.device_name;
|
||||
if (p_name) {
|
||||
osi_free((uint8_t *)p_name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
BTC_TRACE_DEBUG("Unhandled deep free %d\n", msg->act);
|
||||
break;
|
||||
@@ -1964,10 +1944,10 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
break;
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
case BTC_GAP_BLE_ACT_SET_DEV_NAME:
|
||||
BTA_DmSetDeviceName(arg->set_dev_name.device_name, BT_DEVICE_TYPE_BLE);
|
||||
BTA_DmSetDeviceName(arg->set_dev_name.device_name);
|
||||
break;
|
||||
case BTC_GAP_BLE_ACT_GET_DEV_NAME:
|
||||
BTA_DmGetDeviceName(btc_gap_ble_get_dev_name_callback, BT_DEVICE_TYPE_BLE);
|
||||
BTA_DmGetDeviceName(btc_gap_ble_get_dev_name_callback);
|
||||
break;
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
case BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW:
|
||||
|
||||
@@ -878,33 +878,6 @@ static void btc_gap_bt_set_qos(btc_gap_bt_args_t *arg)
|
||||
#endif /// (BTA_DM_QOS_INCLUDED == TRUE)
|
||||
}
|
||||
|
||||
static void btc_gap_bt_get_dev_name_callback(UINT8 status, char *name)
|
||||
{
|
||||
esp_bt_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
memset(¶m, 0, sizeof(esp_bt_gap_cb_param_t));
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BT;
|
||||
msg.act = BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT;
|
||||
|
||||
param.get_dev_name_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
param.get_dev_name_cmpl.name = (char *)osi_malloc(BTC_MAX_LOC_BD_NAME_LEN + 1);
|
||||
if (param.get_dev_name_cmpl.name) {
|
||||
BCM_STRNCPY_S(param.get_dev_name_cmpl.name, name, BTC_MAX_LOC_BD_NAME_LEN);
|
||||
param.get_dev_name_cmpl.name[BTC_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
} else {
|
||||
param.get_dev_name_cmpl.status = ESP_BT_STATUS_NOMEM;
|
||||
}
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_bt_gap_cb_param_t), NULL, NULL);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
{
|
||||
switch (msg->act) {
|
||||
@@ -924,7 +897,6 @@ void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
case BTC_GAP_BT_ACT_SET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_GET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
|
||||
case BTC_GAP_BT_ACT_GET_DEV_NAME:
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
case BTC_GAP_BT_ACT_SET_MIN_ENC_KEY_SIZE:
|
||||
#endif
|
||||
@@ -969,18 +941,6 @@ void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BT_ACT_SET_DEV_NAME: {
|
||||
btc_gap_bt_args_t *src = (btc_gap_bt_args_t *)p_src;
|
||||
btc_gap_bt_args_t *dst = (btc_gap_bt_args_t *)p_dest;
|
||||
dst->bt_set_dev_name.device_name = (char *)osi_malloc((BTC_MAX_LOC_BD_NAME_LEN + 1) * sizeof(char));
|
||||
if (dst->bt_set_dev_name.device_name) {
|
||||
BCM_STRNCPY_S(dst->bt_set_dev_name.device_name, src->bt_set_dev_name.device_name, BTC_MAX_LOC_BD_NAME_LEN);
|
||||
dst->bt_set_dev_name.device_name[BTC_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s %d no mem\n", __func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
|
||||
break;
|
||||
@@ -1007,7 +967,6 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
|
||||
case BTC_GAP_BT_ACT_SET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_GET_PAGE_TIMEOUT:
|
||||
case BTC_GAP_BT_ACT_SET_ACL_PKT_TYPES:
|
||||
case BTC_GAP_BT_ACT_GET_DEV_NAME:
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
case BTC_GAP_BT_ACT_SET_MIN_ENC_KEY_SIZE:
|
||||
#endif
|
||||
@@ -1029,13 +988,6 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
|
||||
osi_free(arg->config_eir.eir_data.p_url);
|
||||
}
|
||||
break;
|
||||
case BTC_GAP_BT_ACT_SET_DEV_NAME: {
|
||||
char *p_name = arg->bt_set_dev_name.device_name;
|
||||
if (p_name) {
|
||||
osi_free((uint8_t *)p_name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_ERROR("Unhandled deep copy %d, arg: %p\n", msg->act, arg);
|
||||
break;
|
||||
@@ -1134,14 +1086,6 @@ void btc_gap_bt_call_handler(btc_msg_t *msg)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case BTC_GAP_BT_ACT_SET_DEV_NAME: {
|
||||
BTA_DmSetDeviceName(arg->bt_set_dev_name.device_name, BT_DEVICE_TYPE_BREDR);
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BT_ACT_GET_DEV_NAME: {
|
||||
BTA_DmGetDeviceName(btc_gap_bt_get_dev_name_callback, BT_DEVICE_TYPE_BREDR);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1197,7 +1141,6 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg)
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
case BTC_GAP_BT_SET_MIN_ENC_KEY_SIZE_EVT:
|
||||
#endif /// ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE
|
||||
case BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT:
|
||||
break;
|
||||
default:
|
||||
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
|
||||
@@ -1295,10 +1238,6 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT: {
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_GET_DEV_NAME_CMPL_EVT, (esp_bt_gap_cb_param_t *)msg->arg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
|
||||
break;
|
||||
|
||||
@@ -318,19 +318,9 @@ bt_status_t btc_hf_init(void)
|
||||
|
||||
BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients);
|
||||
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
if (hf_local_param == NULL) {
|
||||
if ((hf_local_param = (hf_local_param_t *)osi_malloc(BTC_HF_NUM_CB * sizeof(hf_local_param_t))) == NULL) {
|
||||
BTC_TRACE_ERROR("%s malloc failed!", __func__);
|
||||
return BT_STATUS_NOMEM;
|
||||
}
|
||||
}
|
||||
memset((void *)hf_local_param, 0, BTC_HF_NUM_CB * sizeof(hf_local_param_t));
|
||||
#endif
|
||||
|
||||
/* Invoke the enable service API to the core to set the appropriate service_id
|
||||
* Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
|
||||
* otherwise only HSP is enabled (tablet)*/
|
||||
* othwerwise only HSP is enabled (tablet)*/
|
||||
#if (defined(BTC_HF_SERVICES) && (BTC_HF_SERVICES & BTA_HFP_SERVICE_MASK))
|
||||
btc_dm_enable_service(BTA_HFP_SERVICE_ID);
|
||||
#else
|
||||
@@ -757,7 +747,7 @@ static bt_status_t btc_hf_phone_state_update(bt_bdaddr_t *bd_addr,int num_active
|
||||
}
|
||||
/* CIND response should have been updated. */
|
||||
BTA_AgResult(BTA_AG_HANDLE_ALL, res, &ag_res);
|
||||
/* Just open SCO connection. */
|
||||
/* Just open SCO conenction. */
|
||||
BTA_AgAudioOpen(ag_res.audio_handle);
|
||||
activeCallUpdated = TRUE;
|
||||
}
|
||||
@@ -1570,7 +1560,7 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
||||
CHECK_HF_IDX(idx);
|
||||
BTC_TRACE_DEBUG("AG Bitmap of peer-codecs %d", p_data->val.num);
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
/* If the peer supports mSBC and the BTC preferred codec is also mSBC, then
|
||||
/* If the peer supports mSBC and the BTC prefferred codec is also mSBC, then
|
||||
** we should set the BTA AG Codec to mSBC. This would trigger a +BCS to mSBC at the time
|
||||
** of SCO connection establishment */
|
||||
if ((btc_conf_hf_force_wbs == TRUE) && (p_data->val.num & BTA_AG_CODEC_MSBC)) {
|
||||
@@ -1606,7 +1596,7 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
||||
BTC_TRACE_DEBUG("AG final seleded codec is %d 1=CVSD 2=MSBC", p_data->val.num);
|
||||
memcpy(param.bcs_rep.remote_addr, &hf_local_param[idx].btc_hf_cb.connected_bda,sizeof(esp_bd_addr_t));
|
||||
param.bcs_rep.mode = p_data->val.num;
|
||||
/* No ESP_HF_WBS_NONE case, because HFP 1.6 supported device can send BCS */
|
||||
/* No ESP_HF_WBS_NONE case, becuase HFP 1.6 supported device can send BCS */
|
||||
btc_hf_cb_to_app(ESP_HF_BCS_RESPONSE_EVT, ¶m);
|
||||
} while (0);
|
||||
break;
|
||||
|
||||
@@ -189,7 +189,7 @@ static btc_hh_device_t *btc_hh_find_connected_dev_by_bda(BD_ADDR bd_addr)
|
||||
*
|
||||
* Function btc_hh_stop_vup_timer
|
||||
*
|
||||
* Description stop virtual unplug timer
|
||||
* Description stop vitual unplug timer
|
||||
*
|
||||
* Returns void
|
||||
******************************************************************************/
|
||||
@@ -316,7 +316,7 @@ void btc_hh_remove_device(BD_ADDR bd_addr)
|
||||
|
||||
for (i = 0; i < BTC_HH_MAX_ADDED_DEV; i++) {
|
||||
p_added_dev = &btc_hh_cb.added_devices[i];
|
||||
if (memcmp(p_added_dev->bd_addr, bd_addr, BD_ADDR_LEN) == 0) {
|
||||
if (p_added_dev->bd_addr == bd_addr) {
|
||||
BTA_HhRemoveDev(p_added_dev->dev_handle);
|
||||
btc_storage_remove_hid_info((bt_bdaddr_t *)p_added_dev->bd_addr);
|
||||
memset(p_added_dev->bd_addr, 0, 6);
|
||||
@@ -544,11 +544,6 @@ static void btc_hh_connect(btc_hidh_args_t *arg)
|
||||
BTC_TRACE_ERROR("%s exceeded the maximum supported HID device number %d!", __func__, BTC_HH_MAX_HID);
|
||||
ret = ESP_HIDH_ERR_NO_RES;
|
||||
break;
|
||||
} else if (dev && dev->dev_status == ESP_HIDH_CONN_STATE_CONNECTED) {
|
||||
BTC_TRACE_WARNING("%s Device[%s] already connected", __func__,
|
||||
bdaddr_to_string((const bt_bdaddr_t *)arg->connect.bd_addr, bdstr, sizeof(bdstr)));
|
||||
param.open.conn_status = ESP_HIDH_CONN_STATE_CONNECTED;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < BTC_HH_MAX_ADDED_DEV; i++) {
|
||||
@@ -667,7 +662,7 @@ static void btc_hh_virtual_unplug(btc_hidh_args_t *arg)
|
||||
param.unplug.conn_status = ESP_HIDH_CONN_STATE_DISCONNECTING;
|
||||
param.unplug.handle = p_dev->dev_handle;
|
||||
} else if ((p_dev != NULL) && (p_dev->dev_status == ESP_HIDH_CONN_STATE_CONNECTED)) {
|
||||
BTC_TRACE_WARNING("%s: Virtual unplug not supported, disconnecting device", __func__);
|
||||
BTC_TRACE_WARNING("%s: Virtual unplug not suported, disconnecting device", __func__);
|
||||
/* start the timer */
|
||||
btc_hh_start_vup_timer(arg->unplug.bd_addr);
|
||||
p_dev->local_vup = true;
|
||||
|
||||
@@ -185,7 +185,7 @@ typedef union {
|
||||
//BTC_GAP_BLE_ACT_SET_DEV_NAME,
|
||||
struct set_dev_name_args {
|
||||
#define ESP_GAP_DEVICE_NAME_MAX (32)
|
||||
char *device_name;
|
||||
char device_name[ESP_GAP_DEVICE_NAME_MAX + 1];
|
||||
} set_dev_name;
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
//BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW,
|
||||
|
||||
@@ -38,7 +38,6 @@ typedef enum {
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
BTC_GAP_BT_SET_MIN_ENC_KEY_SIZE_EVT,
|
||||
#endif
|
||||
BTC_GAP_BT_GET_DEV_NAME_CMPL_EVT,
|
||||
}btc_gap_bt_evt_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -65,8 +64,6 @@ typedef enum {
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
BTC_GAP_BT_ACT_SET_MIN_ENC_KEY_SIZE,
|
||||
#endif
|
||||
BTC_GAP_BT_ACT_SET_DEV_NAME,
|
||||
BTC_GAP_BT_ACT_GET_DEV_NAME,
|
||||
} btc_gap_bt_act_t;
|
||||
|
||||
/* btc_bt_gap_args_t */
|
||||
@@ -180,11 +177,6 @@ typedef union {
|
||||
uint8_t key_size;
|
||||
} set_min_enc_key_size;
|
||||
#endif
|
||||
|
||||
// BTC_GAP_BT_ACT_SET_DEV_NAME
|
||||
struct bt_set_dev_name_args {
|
||||
char *device_name;
|
||||
} bt_set_dev_name;
|
||||
} btc_gap_bt_args_t;
|
||||
|
||||
void btc_gap_bt_call_handler(btc_msg_t *msg);
|
||||
|
||||
@@ -209,11 +209,11 @@ static inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t l
|
||||
// btla-specific --
|
||||
|
||||
#if !UC_BT_STACK_NO_LOG
|
||||
#define LOG_ERROR(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) esp_log_write(ESP_LOG_ERROR, "BT_LOG", LOG_FORMAT(E, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
|
||||
#define LOG_WARN(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) esp_log_write(ESP_LOG_WARN, "BT_LOG", LOG_FORMAT(W, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
|
||||
#define LOG_INFO(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) esp_log_write(ESP_LOG_INFO, "BT_LOG", LOG_FORMAT(I, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
|
||||
#define LOG_DEBUG(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) esp_log_write(ESP_LOG_DEBUG, "BT_LOG", LOG_FORMAT(D, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
|
||||
#define LOG_VERBOSE(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) esp_log_write(ESP_LOG_VERBOSE, "BT_LOG", LOG_FORMAT(V, format), esp_log_timestamp(), "BT_LOG", ##__VA_ARGS__); }
|
||||
#define LOG_ERROR(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) esp_log_write(ESP_LOG_ERROR, "BT_LOG", LOG_FORMAT(E, format), esp_log_timestamp(), "BT_LOG", LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define LOG_WARN(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) esp_log_write(ESP_LOG_WARN, "BT_LOG", LOG_FORMAT(W, format), esp_log_timestamp(), "BT_LOG", LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define LOG_INFO(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) esp_log_write(ESP_LOG_INFO, "BT_LOG", LOG_FORMAT(I, format), esp_log_timestamp(), "BT_LOG", LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define LOG_DEBUG(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) esp_log_write(ESP_LOG_DEBUG, "BT_LOG", LOG_FORMAT(D, format), esp_log_timestamp(), "BT_LOG", LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
#define LOG_VERBOSE(format, ... ) {if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) esp_log_write(ESP_LOG_VERBOSE, "BT_LOG", LOG_FORMAT(V, format), esp_log_timestamp(), "BT_LOG", LOG_ADDITIONAL_ARGS, ##__VA_ARGS__); }
|
||||
|
||||
/* Define tracing for BTM
|
||||
*/
|
||||
|
||||
@@ -144,10 +144,6 @@ void hci_shut_down(void)
|
||||
|
||||
bool hci_downstream_data_post(uint32_t timeout)
|
||||
{
|
||||
if (hci_host_env.downstream_data_ready == NULL) {
|
||||
HCI_TRACE_WARNING("%s downstream_data_ready event not created", __func__);
|
||||
return false;
|
||||
}
|
||||
return osi_thread_post_event(hci_host_env.downstream_data_ready, timeout);
|
||||
}
|
||||
|
||||
@@ -267,7 +263,7 @@ static void transmit_command(
|
||||
// in case the upper layer didn't already
|
||||
command->event = MSG_STACK_TO_HC_HCI_CMD;
|
||||
|
||||
HCI_TRACE_DEBUG("HCI Enqueue Command opcode=0x%x\n", metadata->opcode);
|
||||
HCI_TRACE_DEBUG("HCI Enqueue Comamnd opcode=0x%x\n", metadata->opcode);
|
||||
BTTRC_DUMP_BUFFER(NULL, command->data + command->offset, command->len);
|
||||
|
||||
fixed_pkt_queue_enqueue(hci_host_env.command_queue, linked_pkt, FIXED_PKT_QUEUE_MAX_TIMEOUT);
|
||||
|
||||
@@ -2236,16 +2236,16 @@ UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
|
||||
/* device name */
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
if (len > MIN_ADV_LENGTH && data_mask & BTM_BLE_AD_BIT_DEV_NAME) {
|
||||
if (strlen(btm_cb.cfg.ble_bd_name) > (UINT16)(len - MIN_ADV_LENGTH)) {
|
||||
if (strlen(btm_cb.cfg.bd_name) > (UINT16)(len - MIN_ADV_LENGTH)) {
|
||||
cp_len = (UINT16)(len - MIN_ADV_LENGTH);
|
||||
*p++ = cp_len + 1;
|
||||
*p++ = BTM_BLE_AD_TYPE_NAME_SHORT;
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.ble_bd_name, cp_len);
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
|
||||
} else {
|
||||
cp_len = (UINT16)strlen(btm_cb.cfg.ble_bd_name);
|
||||
cp_len = (UINT16)strlen(btm_cb.cfg.bd_name);
|
||||
*p++ = cp_len + 1;
|
||||
*p++ = BTM_BLE_AD_TYPE_NAME_CMPL;
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.ble_bd_name, cp_len);
|
||||
ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
|
||||
}
|
||||
len -= (cp_len + MIN_ADV_LENGTH);
|
||||
data_mask &= ~BTM_BLE_AD_BIT_DEV_NAME;
|
||||
@@ -3291,7 +3291,6 @@ static void btm_ble_appearance_to_cod(UINT16 appearance, UINT8 *dev_class)
|
||||
case BTM_BLE_APPEARANCE_CYCLING_CADENCE:
|
||||
case BTM_BLE_APPEARANCE_CYCLING_POWER:
|
||||
case BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE:
|
||||
case BTM_BLE_APPEARANCE_STANDALONE_SPEAKER:
|
||||
case BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS:
|
||||
case BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION:
|
||||
case BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV:
|
||||
|
||||
@@ -81,8 +81,7 @@ void btm_dev_init (void)
|
||||
|
||||
/* Initialize nonzero defaults */
|
||||
#if (BTM_MAX_LOC_BD_NAME_LEN > 0)
|
||||
memset(btm_cb.cfg.ble_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
|
||||
memset(btm_cb.cfg.bredr_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
|
||||
memset(btm_cb.cfg.bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
|
||||
#endif
|
||||
|
||||
btm_cb.devcb.reset_timer.param = (TIMER_PARAM_TYPE)TT_DEV_RESET;
|
||||
@@ -450,11 +449,11 @@ static void btm_decode_ext_features_page (UINT8 page_number, const BD_FEATURES p
|
||||
** Returns status of the operation
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
|
||||
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
|
||||
{
|
||||
UINT8 *p;
|
||||
|
||||
if (!p_name || !p_name[0] || (strlen ((char *)p_name) > BD_NAME_LEN) || (name_type > BT_DEVICE_TYPE_DUMO)) {
|
||||
if (!p_name || !p_name[0] || (strlen ((char *)p_name) > BD_NAME_LEN)) {
|
||||
return (BTM_ILLEGAL_VALUE);
|
||||
}
|
||||
|
||||
@@ -464,26 +463,16 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
|
||||
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
/* Save the device name if local storage is enabled */
|
||||
if (name_type & BT_DEVICE_TYPE_BLE) {
|
||||
p = (UINT8 *)btm_cb.cfg.ble_bd_name;
|
||||
if (p != (UINT8 *)p_name) {
|
||||
BCM_STRNCPY_S(btm_cb.cfg.ble_bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
btm_cb.cfg.ble_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (name_type & BT_DEVICE_TYPE_BREDR) {
|
||||
p = (UINT8 *)btm_cb.cfg.bredr_bd_name;
|
||||
if (p != (UINT8 *)p_name) {
|
||||
BCM_STRNCPY_S(btm_cb.cfg.bredr_bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
btm_cb.cfg.bredr_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
}
|
||||
p = (UINT8 *)btm_cb.cfg.bd_name;
|
||||
if (p != (UINT8 *)p_name) {
|
||||
BCM_STRNCPY_S(btm_cb.cfg.bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
btm_cb.cfg.bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
}
|
||||
#else
|
||||
p = (UINT8 *)p_name;
|
||||
#endif
|
||||
#if CLASSIC_BT_INCLUDED
|
||||
if ((name_type & BT_DEVICE_TYPE_BREDR) && btsnd_hcic_change_name(p)) {
|
||||
if (btsnd_hcic_change_name(p)) {
|
||||
return (BTM_CMD_STARTED);
|
||||
} else
|
||||
#endif
|
||||
@@ -507,33 +496,10 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
|
||||
** is returned and p_name is set to NULL
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name, tBT_DEVICE_TYPE name_type)
|
||||
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name)
|
||||
{
|
||||
/*
|
||||
// name_type should be BT_DEVICE_TYPE_BLE or BT_DEVICE_TYPE_BREDR
|
||||
if (name_type > BT_DEVICE_TYPE_BREDR) {
|
||||
*p_name = NULL;
|
||||
BTM_TRACE_ERROR("name_type unknown %d", name_type);
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
*/
|
||||
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
if ((name_type == BT_DEVICE_TYPE_DUMO) &&
|
||||
(BCM_STRNCMP_S(btm_cb.cfg.bredr_bd_name, btm_cb.cfg.ble_bd_name, BTM_MAX_LOC_BD_NAME_LEN) != 0)) {
|
||||
*p_name = NULL;
|
||||
BTM_TRACE_ERROR("Error, BLE and BREDR have different names, return NULL\n");
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
|
||||
if (name_type & BT_DEVICE_TYPE_BLE) {
|
||||
*p_name = btm_cb.cfg.ble_bd_name;
|
||||
}
|
||||
|
||||
if (name_type & BT_DEVICE_TYPE_BREDR) {
|
||||
*p_name = btm_cb.cfg.bredr_bd_name;
|
||||
}
|
||||
|
||||
*p_name = btm_cb.cfg.bd_name;
|
||||
return (BTM_SUCCESS);
|
||||
#else
|
||||
*p_name = NULL;
|
||||
@@ -781,7 +747,7 @@ void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
|
||||
|
||||
/* If there was a callback address for vcs complete, call it */
|
||||
if (p_vsc_cplt_cback) {
|
||||
/* Pass parameters to the callback function */
|
||||
/* Pass paramters to the callback function */
|
||||
vcs_cplt_params.opcode = opcode; /* Number of bytes in return info */
|
||||
vcs_cplt_params.param_len = evt_len; /* Number of bytes in return info */
|
||||
vcs_cplt_params.p_param_buf = p;
|
||||
|
||||
@@ -809,7 +809,7 @@ void btm_sec_clr_temp_auth_service (BD_ADDR bda)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Reset the temporary authorized flag so that next time (untrusted) service is accessed authorization will take place */
|
||||
/* Reset the temporary authorized flag so that next time (untrusted) service is accessed autorization will take place */
|
||||
if (p_dev_rec->last_author_service_id != BTM_SEC_NO_LAST_SERVICE_ID && p_dev_rec->p_cur_service) {
|
||||
BTM_TRACE_DEBUG ("btm_sec_clr_auth_service_by_psm [clearing device: %02x:%02x:%02x:%02x:%02x:%02x]\n",
|
||||
bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
|
||||
@@ -1364,7 +1364,7 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE
|
||||
|| (transport == BT_TRANSPORT_LE && p_dev_rec->ble_hci_handle == BTM_SEC_INVALID_HANDLE)
|
||||
#endif
|
||||
) {
|
||||
/* Connection should be up and running */
|
||||
/* Connection should be up and runnning */
|
||||
BTM_TRACE_WARNING ("Security Manager: BTM_SetEncryption not connected\n");
|
||||
|
||||
if (p_callback) {
|
||||
@@ -1790,15 +1790,15 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
|
||||
}
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
name_size = name_len;
|
||||
if (name_size > strlen(btm_cb.cfg.bredr_bd_name)) {
|
||||
if (name_size > strlen(btm_cb.cfg.bd_name)) {
|
||||
name_type = BTM_EIR_COMPLETE_LOCAL_NAME_TYPE;
|
||||
name_size = (UINT16)strlen(btm_cb.cfg.bredr_bd_name);
|
||||
name_size = (UINT16)strlen(btm_cb.cfg.bd_name);
|
||||
}
|
||||
delta = name_size + 2;
|
||||
if (max_len >= delta) {
|
||||
*p++ = name_size + 1;
|
||||
*p++ = name_type;
|
||||
ARRAY_TO_STREAM (p, btm_cb.cfg.bredr_bd_name, name_size);
|
||||
ARRAY_TO_STREAM (p, btm_cb.cfg.bd_name, name_size);
|
||||
len += delta;
|
||||
max_len -= delta;
|
||||
}
|
||||
@@ -2118,7 +2118,7 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle
|
||||
|
||||
/* If there is no application registered with this PSM do not allow connection */
|
||||
if (!p_serv_rec) {
|
||||
BTM_TRACE_WARNING ("%s() PSM: %d no application registered\n", __func__, psm);
|
||||
BTM_TRACE_WARNING ("%s() PSM: %d no application registerd\n", __func__, psm);
|
||||
(*p_callback) (bd_addr, transport, p_ref_data, BTM_MODE_UNSUPPORTED);
|
||||
return (BTM_MODE_UNSUPPORTED);
|
||||
}
|
||||
@@ -2514,7 +2514,7 @@ tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_o
|
||||
|
||||
if (rc == BTM_SUCCESS) {
|
||||
BTM_TRACE_EVENT("%s: allow to bypass, checking authorization\n", __FUNCTION__);
|
||||
/* the security in BTM_SEC_IN_FLAGS is fulfilled so far, check the requirements in */
|
||||
/* the security in BTM_SEC_IN_FLAGS is fullfilled so far, check the requirements in */
|
||||
/* btm_sec_execute_procedure */
|
||||
if ((is_originator && (p_serv_rec->security_flags & BTM_SEC_OUT_AUTHORIZE)) ||
|
||||
(!is_originator && (p_serv_rec->security_flags & BTM_SEC_IN_AUTHORIZE))) {
|
||||
@@ -3979,7 +3979,7 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status)
|
||||
/* or BR key is higher security than existing LE keys */
|
||||
(!(p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_AUTHED) &&
|
||||
(p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_AUTHED)))) {
|
||||
BTM_TRACE_DEBUG ("link encrypted after dedic bonding can use SMP_BR_CHNL\n");
|
||||
BTM_TRACE_DEBUG ("link encrypted afer dedic bonding can use SMP_BR_CHNL\n");
|
||||
|
||||
if (btm_sec_is_master(p_dev_rec)) {
|
||||
// Encryption is required to start SM over BR/EDR
|
||||
@@ -4255,7 +4255,7 @@ static void btm_sec_connect_after_reject_timeout (TIMER_LIST_ENT *p_tle)
|
||||
** Function btm_sec_connected
|
||||
**
|
||||
** Description This function is when a connection to the peer device is
|
||||
** established
|
||||
** establsihed
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -5926,7 +5926,7 @@ static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
**
|
||||
** Function btm_sec_auth_payload_tout
|
||||
**
|
||||
** Description Processes the HCI Authenticated Payload Timeout Event
|
||||
** Description Processes the HCI Autheniticated Payload Timeout Event
|
||||
** indicating that a packet containing a valid MIC on the
|
||||
** connection handle was not received within the programmed
|
||||
** timeout value. (Spec Default is 30 secs, but can be
|
||||
@@ -6294,7 +6294,7 @@ static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
** Description This function is called when legacy authentication is used
|
||||
** and only remote device has completed the authentication
|
||||
**
|
||||
** Returns TRUE if authentication command sent successfully
|
||||
** Returns TRUE if aunthentication command sent successfully
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN btm_sec_legacy_authentication_mutual (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
|
||||
@@ -721,8 +721,7 @@ struct tBTM_SEC_DEV_REC{
|
||||
*/
|
||||
typedef struct {
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
tBTM_LOC_BD_NAME bredr_bd_name; /* local BREDR device name */
|
||||
tBTM_LOC_BD_NAME ble_bd_name; /* local BLE device name */
|
||||
tBTM_LOC_BD_NAME bd_name; /* local Bluetooth device name */
|
||||
#endif
|
||||
BOOLEAN pin_type; /* TRUE if PIN type is fixed */
|
||||
UINT8 pin_code_len; /* Bonding information */
|
||||
|
||||
@@ -65,7 +65,7 @@ static const tGATT_CBACK gap_cback = {
|
||||
**
|
||||
** Function gap_find_clcb_by_bd_addr
|
||||
**
|
||||
** Description The function searches all LCB with matching bd address
|
||||
** Description The function searches all LCB with macthing bd address
|
||||
**
|
||||
** Returns total number of clcb found.
|
||||
**
|
||||
@@ -88,7 +88,7 @@ tGAP_CLCB *gap_find_clcb_by_bd_addr(BD_ADDR bda)
|
||||
**
|
||||
** Function gap_ble_find_clcb_by_conn_id
|
||||
**
|
||||
** Description The function searches all LCB with matching connection ID
|
||||
** Description The function searches all LCB with macthing connection ID
|
||||
**
|
||||
** Returns total number of clcb found.
|
||||
**
|
||||
@@ -163,7 +163,7 @@ void gap_ble_dealloc_clcb(tGAP_CLCB *p_clcb)
|
||||
**
|
||||
** Description The function enqueue a GAP client request
|
||||
**
|
||||
** Returns TRUE is successful; FALSE otherwise
|
||||
** Returns TRUE is successul; FALSE otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN gap_ble_enqueue_request (tGAP_CLCB *p_clcb, UINT16 uuid, tGAP_BLE_CMPL_CBACK *p_cback)
|
||||
@@ -185,7 +185,7 @@ BOOLEAN gap_ble_enqueue_request (tGAP_CLCB *p_clcb, UINT16 uuid, tGAP_BLE_CMPL_C
|
||||
**
|
||||
** Description The function dequeue a GAP client request if any
|
||||
**
|
||||
** Returns TRUE is successful; FALSE otherwise
|
||||
** Returns TRUE is successul; FALSE otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN gap_ble_dequeue_request (tGAP_CLCB *p_clcb, UINT16 *p_uuid, tGAP_BLE_CMPL_CBACK **p_cback)
|
||||
@@ -221,7 +221,7 @@ tGATT_STATUS gap_read_attr_value (UINT16 handle, tGATT_VALUE *p_value, BOOLEAN i
|
||||
|
||||
switch (p_db_attr->uuid) {
|
||||
case GATT_UUID_GAP_DEVICE_NAME:
|
||||
BTM_ReadLocalDeviceName((char **)&p_dev_name, BT_DEVICE_TYPE_BLE);
|
||||
BTM_ReadLocalDeviceName((char **)&p_dev_name);
|
||||
if (strlen ((char *)p_dev_name) > GATT_MAX_ATTR_LEN) {
|
||||
p_value->len = GATT_MAX_ATTR_LEN;
|
||||
} else {
|
||||
@@ -304,7 +304,7 @@ UINT8 gap_proc_write_req( tGATTS_REQ_TYPE type, tGATT_WRITE_REQ *p_data)
|
||||
case GATT_UUID_GAP_DEVICE_NAME: {
|
||||
UINT8 *p_val = p_data->value;
|
||||
p_val[p_data->len] = '\0';
|
||||
BTM_SetLocalDeviceName((char *)p_val, BT_DEVICE_TYPE_BLE);
|
||||
BTM_SetLocalDeviceName((char *)p_val);
|
||||
return GATT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
@@ -385,7 +385,7 @@ void gap_ble_s_attr_request_cback (UINT16 conn_id, UINT32 trans_id,
|
||||
**
|
||||
** Function btm_ble_att_db_init
|
||||
**
|
||||
** Description GAP ATT database initialization.
|
||||
** Description GAP ATT database initalization.
|
||||
**
|
||||
** Returns void.
|
||||
**
|
||||
@@ -510,7 +510,7 @@ void GAP_BleAttrDBUpdate(UINT16 attr_uuid, tGAP_BLE_ATTR_VALUE *p_value)
|
||||
break;
|
||||
|
||||
case GATT_UUID_GAP_DEVICE_NAME:
|
||||
BTM_SetLocalDeviceName((char *)p_value->p_dev_name, BT_DEVICE_TYPE_BLE);
|
||||
BTM_SetLocalDeviceName((char *)p_value->p_dev_name);
|
||||
break;
|
||||
|
||||
case GATT_UUID_GAP_CENTRAL_ADDR_RESOL:
|
||||
@@ -529,7 +529,7 @@ void GAP_BleAttrDBUpdate(UINT16 attr_uuid, tGAP_BLE_ATTR_VALUE *p_value)
|
||||
**
|
||||
** Function gap_ble_send_cl_read_request
|
||||
**
|
||||
** Description utility function to send a read request for a GAP characteristic
|
||||
** Description utility function to send a read request for a GAP charactersitic
|
||||
**
|
||||
** Returns TRUE if read started, else FALSE if GAP is busy
|
||||
**
|
||||
|
||||
@@ -379,7 +379,6 @@ tHID_STATUS HID_HostAddDev ( BD_ADDR addr, UINT16 attr_mask, UINT8 *handle )
|
||||
if (!hh_cb.devices[i].in_use) {
|
||||
hh_cb.devices[i].in_use = TRUE;
|
||||
hh_cb.devices[i].delay_remove = FALSE;
|
||||
hh_cb.devices[i].is_orig = FALSE;
|
||||
memcpy( hh_cb.devices[i].addr, addr, sizeof( BD_ADDR ) ) ;
|
||||
hh_cb.devices[i].state = HID_DEV_NO_CONN;
|
||||
hh_cb.devices[i].conn_tries = 0 ;
|
||||
@@ -487,7 +486,6 @@ tHID_STATUS HID_HostOpenDev ( UINT8 dev_handle )
|
||||
}
|
||||
|
||||
hh_cb.devices[dev_handle].conn_tries = 1;
|
||||
hh_cb.devices[dev_handle].is_orig = TRUE;
|
||||
return hidh_conn_initiate( dev_handle );
|
||||
}
|
||||
|
||||
@@ -653,23 +651,4 @@ BOOLEAN hid_known_hid_device (BD_ADDR bd_addr)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN HID_HostConnectOrig(UINT8 dev_handle)
|
||||
{
|
||||
BOOLEAN ret = FALSE;
|
||||
|
||||
do {
|
||||
if (!hh_cb.reg_flag) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((dev_handle >= HID_HOST_MAX_DEVICES) || (!hh_cb.devices[dev_handle].in_use)) {
|
||||
break;
|
||||
}
|
||||
|
||||
ret = hh_cb.devices[dev_handle].is_orig;
|
||||
} while (0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif //HID_HOST_INCLUDED
|
||||
|
||||
@@ -35,11 +35,11 @@ enum { HID_DEV_NO_CONN, HID_DEV_CONNECTED };
|
||||
typedef struct per_device_ctb {
|
||||
BOOLEAN in_use;
|
||||
BOOLEAN delay_remove;
|
||||
BOOLEAN is_orig;
|
||||
BD_ADDR addr; /* BD-Addr of the host device */
|
||||
UINT16 attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate;
|
||||
0x04- sdp_disable; */
|
||||
UINT8 state; /* Device state if in HOST-KNOWN mode */
|
||||
UINT8 conn_substate;
|
||||
UINT8 conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
|
||||
|
||||
tHID_CONN conn; /* L2CAP channel info */
|
||||
|
||||
@@ -33,8 +33,6 @@ typedef int32_t INT32;
|
||||
|
||||
#define BCM_STRCPY_S(x1,x2) strcpy((x1),(x2))
|
||||
#define BCM_STRNCPY_S(x1,x2,x3) strncpy((x1),(x2),(x3))
|
||||
#define BCM_STRCMP_S(x1,x2) strcmp((x1),(x2))
|
||||
#define BCM_STRNCMP_S(x1,x2,x3) strncmp((x1),(x2),(x3))
|
||||
|
||||
/* READ WELL !!
|
||||
**
|
||||
|
||||
@@ -473,6 +473,7 @@ typedef enum {
|
||||
#define BTM_COD_SERVICE_CLASS_LO_B 0x00E0
|
||||
#define BTM_COD_SERVICE_CLASS_MASK 0xFFE0
|
||||
|
||||
|
||||
/* BTM service definitions
|
||||
** Used for storing EIR data to bit mask
|
||||
*/
|
||||
@@ -2078,7 +2079,7 @@ BOOLEAN BTM_IsDeviceUp (void);
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type);
|
||||
tBTM_STATUS BTM_SetLocalDeviceName (char *p_name);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -2107,7 +2108,7 @@ tBTM_STATUS BTM_SetDeviceClass (DEV_CLASS dev_class);
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name, tBT_DEVICE_TYPE name_type);
|
||||
tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
||||
@@ -254,7 +254,6 @@ typedef UINT8 BLE_SIGNATURE[BTM_BLE_AUTH_SIGN_LEN]; /* Device address */
|
||||
#define BTM_BLE_APPEARANCE_CYCLING_CADENCE 0x0483
|
||||
#define BTM_BLE_APPEARANCE_CYCLING_POWER 0x0484
|
||||
#define BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485
|
||||
#define BTM_BLE_APPEARANCE_STANDALONE_SPEAKER 0x0841
|
||||
#define BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40
|
||||
#define BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41
|
||||
#define BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42
|
||||
|
||||
@@ -249,17 +249,6 @@ BOOLEAN hid_known_hid_device (BD_ADDR bd_addr);
|
||||
*******************************************************************************/
|
||||
extern UINT8 HID_HostSetTraceLevel (UINT8 new_level);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostConnectOrig
|
||||
**
|
||||
** Description Check if the HID Host initiates the connection
|
||||
**
|
||||
** Returns TRUE if the HID Host initiates the connection else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN HID_HostConnectOrig(UINT8 dev_handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Submodule components/bt/host/nimble/nimble updated: cc997ecc33...8d5c871596
@@ -178,7 +178,6 @@ enum KEY_ACTION{
|
||||
CTRL_U = 21, /* Ctrl+u */
|
||||
CTRL_W = 23, /* Ctrl+w */
|
||||
ESC = 27, /* Escape */
|
||||
UNIT_SEP = 31, /* ctrl-_ */
|
||||
BACKSPACE = 127 /* Backspace */
|
||||
};
|
||||
|
||||
@@ -1132,23 +1131,15 @@ static int linenoiseDumb(char* buf, size_t buflen, const char* prompt) {
|
||||
int c = fgetc(stdin);
|
||||
if (c == '\n') {
|
||||
break;
|
||||
} else if (c == BACKSPACE || c == CTRL_H) {
|
||||
} else if (c >= 0x1c && c <= 0x1f){
|
||||
continue; /* consume arrow keys */
|
||||
} else if (c == BACKSPACE || c == 0x8) {
|
||||
if (count > 0) {
|
||||
buf[count - 1] = 0;
|
||||
count--;
|
||||
|
||||
/* Only erase symbol echoed from stdin. */
|
||||
fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */
|
||||
flushWrite();
|
||||
} else {
|
||||
/* Consume backspace if the command line is empty to avoid erasing the prompt */
|
||||
continue;
|
||||
count --;
|
||||
}
|
||||
|
||||
} else if (c <= UNIT_SEP) {
|
||||
/* Consume all character that are non printable (the backspace
|
||||
* case is handled above) */
|
||||
continue;
|
||||
fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */
|
||||
flushWrite();
|
||||
} else {
|
||||
buf[count] = c;
|
||||
++count;
|
||||
|
||||
@@ -126,7 +126,7 @@ static ssize_t tcp_read(esp_tls_t *tls, char *data, size_t datalen)
|
||||
|
||||
static ssize_t tcp_write(esp_tls_t *tls, const char *data, size_t datalen)
|
||||
{
|
||||
return send(tls->sockfd, data, datalen, 0);
|
||||
return send(tls->sockfd, data, datalen, MSG_MORE);
|
||||
}
|
||||
|
||||
ssize_t esp_tls_conn_read(esp_tls_t *tls, void *data, size_t datalen)
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
/** Major version number (X.x.x) */
|
||||
#define ESP_IDF_VERSION_MAJOR 5
|
||||
/** Minor version number (x.X.x) */
|
||||
#define ESP_IDF_VERSION_MINOR 4
|
||||
#define ESP_IDF_VERSION_MINOR 3
|
||||
/** Patch version number (x.x.X) */
|
||||
#define ESP_IDF_VERSION_PATCH 0
|
||||
|
||||
|
||||
@@ -32,11 +32,8 @@ typedef struct {
|
||||
int lane_bit_rate_mbps; ///< Lane bit rate in Mbps
|
||||
mipi_csi_color_t input_data_color_type; ///< Input color type
|
||||
mipi_csi_color_t output_data_color_type; ///< Output color type
|
||||
bool byte_swap_en; ///< Enable byte swap
|
||||
int queue_items; ///< Queue items
|
||||
struct {
|
||||
uint32_t byte_swap_en : 1; ///< Enable byte swap
|
||||
uint32_t bk_buffer_dis : 1; ///< Disable backup buffer
|
||||
}; ///< Boolean Flags
|
||||
} esp_cam_ctlr_csi_config_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,8 +42,6 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
|
||||
static esp_err_t s_del_csi_ctlr(csi_controller_t *ctlr);
|
||||
static esp_err_t s_ctlr_del(esp_cam_ctlr_t *cam_ctlr);
|
||||
static esp_err_t s_register_event_callbacks(esp_cam_ctlr_handle_t handle, const esp_cam_ctlr_evt_cbs_t *cbs, void *user_data);
|
||||
static esp_err_t s_csi_ctlr_get_internal_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...);
|
||||
static esp_err_t s_csi_ctlr_get_buffer_length(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len);
|
||||
static esp_err_t s_csi_ctlr_enable(esp_cam_ctlr_handle_t ctlr);
|
||||
static esp_err_t s_ctlr_csi_start(esp_cam_ctlr_handle_t handle);
|
||||
static esp_err_t s_ctlr_csi_stop(esp_cam_ctlr_handle_t handle);
|
||||
@@ -101,17 +99,12 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_
|
||||
csi_controller_t *ctlr = heap_caps_calloc(1, sizeof(csi_controller_t), CSI_MEM_ALLOC_CAPS);
|
||||
ESP_RETURN_ON_FALSE(ctlr, ESP_ERR_NO_MEM, TAG, "no mem for csi controller context");
|
||||
|
||||
ret = s_csi_claim_controller(ctlr);
|
||||
if (ret != ESP_OK) {
|
||||
//claim fail, clean and return directly
|
||||
free(ctlr);
|
||||
ESP_RETURN_ON_ERROR(ret, TAG, "no available csi controller");
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "config->queue_items: %d", config->queue_items);
|
||||
ctlr->trans_que = xQueueCreateWithCaps(config->queue_items, sizeof(esp_cam_ctlr_trans_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||
ESP_GOTO_ON_FALSE(ctlr->trans_que, ESP_ERR_NO_MEM, err, TAG, "no memory for transaction queue");
|
||||
|
||||
//claim a controller, then do assignment
|
||||
ESP_GOTO_ON_ERROR(s_csi_claim_controller(ctlr), err, TAG, "no available csi controller");
|
||||
#if SOC_ISP_SHARE_CSI_BRG
|
||||
ESP_GOTO_ON_ERROR(mipi_csi_brg_claim(MIPI_CSI_BRG_USER_CSI, &ctlr->csi_brg_id), err, TAG, "csi bridge is in use already");
|
||||
ctlr->csi_brg_in_use = true;
|
||||
@@ -154,19 +147,16 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_
|
||||
ctlr->fb_size_in_bytes = fb_size_in_bits / 8;
|
||||
ESP_LOGD(TAG, "ctlr->fb_size_in_bytes=%d", ctlr->fb_size_in_bytes);
|
||||
|
||||
ctlr->bk_buffer_dis = config->bk_buffer_dis;
|
||||
if (!ctlr->bk_buffer_dis) {
|
||||
size_t dma_alignment = 4; //TODO: IDF-9126, replace with dwgdma alignment API
|
||||
size_t cache_alignment = 1;
|
||||
ESP_GOTO_ON_ERROR(esp_cache_get_alignment(MALLOC_CAP_SPIRAM | MALLOC_CAP_DMA, &cache_alignment), err, TAG, "failed to get cache alignment");
|
||||
size_t alignment = MAX(cache_alignment, dma_alignment);
|
||||
ESP_LOGD(TAG, "alignment: 0x%x\n", alignment);
|
||||
size_t dma_alignment = 4; //TODO: IDF-9126, replace with dwgdma alignment API
|
||||
size_t cache_alignment = 1;
|
||||
ESP_GOTO_ON_ERROR(esp_cache_get_alignment(MALLOC_CAP_SPIRAM | MALLOC_CAP_DMA, &cache_alignment), err, TAG, "failed to get cache alignment");
|
||||
size_t alignment = MAX(cache_alignment, dma_alignment);
|
||||
ESP_LOGD(TAG, "alignment: 0x%x\n", alignment);
|
||||
|
||||
ctlr->backup_buffer = heap_caps_aligned_alloc(alignment, ctlr->fb_size_in_bytes, MALLOC_CAP_SPIRAM);
|
||||
ESP_GOTO_ON_FALSE(ctlr->backup_buffer, ESP_ERR_NO_MEM, err, TAG, "no mem for backup buffer");
|
||||
ESP_LOGD(TAG, "ctlr->backup_buffer: %p\n", ctlr->backup_buffer);
|
||||
esp_cache_msync((void *)(ctlr->backup_buffer), ctlr->fb_size_in_bytes, ESP_CACHE_MSYNC_FLAG_DIR_C2M);
|
||||
}
|
||||
ctlr->backup_buffer = heap_caps_aligned_alloc(alignment, ctlr->fb_size_in_bytes, MALLOC_CAP_SPIRAM);
|
||||
ESP_GOTO_ON_FALSE(ctlr->backup_buffer, ESP_ERR_NO_MEM, err, TAG, "no mem for backup buffer");
|
||||
ESP_LOGD(TAG, "ctlr->backup_buffer: %p\n", ctlr->backup_buffer);
|
||||
esp_cache_msync((void *)(ctlr->backup_buffer), ctlr->fb_size_in_bytes, ESP_CACHE_MSYNC_FLAG_DIR_C2M);
|
||||
|
||||
mipi_csi_hal_config_t hal_config;
|
||||
hal_config.frame_height = config->h_res;
|
||||
@@ -217,8 +207,6 @@ esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_
|
||||
ctlr->base.disable = s_csi_ctlr_disable;
|
||||
ctlr->base.receive = s_ctlr_csi_receive;
|
||||
ctlr->base.register_event_callbacks = s_register_event_callbacks;
|
||||
ctlr->base.get_internal_buffer = s_csi_ctlr_get_internal_buffer;
|
||||
ctlr->base.get_buffer_len = s_csi_ctlr_get_buffer_length;
|
||||
|
||||
*ret_handle = &(ctlr->base);
|
||||
|
||||
@@ -249,9 +237,7 @@ esp_err_t s_del_csi_ctlr(csi_controller_t *ctlr)
|
||||
PERIPH_RCC_ATOMIC() {
|
||||
mipi_csi_ll_enable_phy_config_clock(ctlr->csi_id, 0);
|
||||
}
|
||||
if (!ctlr->bk_buffer_dis) {
|
||||
free(ctlr->backup_buffer);
|
||||
}
|
||||
free(ctlr->backup_buffer);
|
||||
vQueueDeleteWithCaps(ctlr->trans_que);
|
||||
free(ctlr);
|
||||
|
||||
@@ -265,36 +251,6 @@ static esp_err_t s_ctlr_del(esp_cam_ctlr_t *cam_ctlr)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t s_csi_ctlr_get_internal_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...)
|
||||
{
|
||||
csi_controller_t *csi_ctlr = __containerof(handle, csi_controller_t, base);
|
||||
ESP_RETURN_ON_FALSE((csi_ctlr->csi_fsm >= CSI_FSM_INIT) && (csi_ctlr->backup_buffer), ESP_ERR_INVALID_STATE, TAG, "driver don't initialized or back_buffer not available");
|
||||
ESP_RETURN_ON_FALSE(fb_num && fb_num <= 1, ESP_ERR_INVALID_ARG, TAG, "invalid frame buffer number");
|
||||
|
||||
csi_ctlr->bk_buffer_exposed = true;
|
||||
const void **fb_itor = fb0;
|
||||
va_list args;
|
||||
va_start(args, fb0);
|
||||
for (uint32_t i = 0; i < fb_num; i++) {
|
||||
if (fb_itor) {
|
||||
*fb_itor = csi_ctlr->backup_buffer;
|
||||
fb_itor = va_arg(args, const void **);
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t s_csi_ctlr_get_buffer_length(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len)
|
||||
{
|
||||
csi_controller_t *csi_ctlr = __containerof(handle, csi_controller_t, base);
|
||||
ESP_RETURN_ON_FALSE((csi_ctlr->csi_fsm >= CSI_FSM_INIT) && (csi_ctlr->backup_buffer), ESP_ERR_INVALID_STATE, TAG, "driver don't initialized or back_buffer not available");
|
||||
|
||||
*ret_fb_len = csi_ctlr->fb_size_in_bytes;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_gdma_trans_done_event_data_t *event_data, void *user_data)
|
||||
{
|
||||
bool need_yield = false;
|
||||
@@ -335,7 +291,7 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
|
||||
} else {
|
||||
csi_dma_transfer_config.dst.addr = (uint32_t)(new_trans.buffer);
|
||||
}
|
||||
} else if (!ctlr->bk_buffer_dis) {
|
||||
} else {
|
||||
use_backup = true;
|
||||
}
|
||||
|
||||
@@ -344,15 +300,13 @@ static bool csi_dma_trans_done_callback(dw_gdma_channel_handle_t chan, const dw_
|
||||
new_trans.buflen = ctlr->fb_size_in_bytes;
|
||||
ESP_EARLY_LOGD(TAG, "no new buffer or no long enough new buffer, use driver internal buffer");
|
||||
csi_dma_transfer_config.dst.addr = (uint32_t)ctlr->backup_buffer;
|
||||
} else {
|
||||
assert(false && "no new buffer, and no driver internal buffer");
|
||||
}
|
||||
|
||||
ESP_EARLY_LOGD(TAG, "new_trans.buffer: %p, new_trans.buflen: %d", new_trans.buffer, new_trans.buflen);
|
||||
dw_gdma_channel_config_transfer(chan, &csi_dma_transfer_config);
|
||||
dw_gdma_channel_enable_ctrl(chan, true);
|
||||
|
||||
if ((ctlr->trans.buffer != ctlr->backup_buffer) || ctlr->bk_buffer_exposed) {
|
||||
if (ctlr->trans.buffer != ctlr->backup_buffer) {
|
||||
esp_err_t ret = esp_cache_msync((void *)(ctlr->trans.buffer), ctlr->trans.received_size, ESP_CACHE_MSYNC_FLAG_INVALIDATE);
|
||||
assert(ret == ESP_OK);
|
||||
assert(ctlr->cbs.on_trans_finished);
|
||||
@@ -429,11 +383,9 @@ esp_err_t s_ctlr_csi_start(esp_cam_ctlr_handle_t handle)
|
||||
if (ctlr->cbs.on_get_new_trans) {
|
||||
ctlr->cbs.on_get_new_trans(handle, &trans, ctlr->cbs_user_data);
|
||||
ESP_RETURN_ON_FALSE(trans.buffer, ESP_ERR_INVALID_STATE, TAG, "no ready transaction, cannot start");
|
||||
} else if (!ctlr->bk_buffer_dis) {
|
||||
} else {
|
||||
trans.buffer = ctlr->backup_buffer;
|
||||
trans.buflen = ctlr->fb_size_in_bytes;
|
||||
} else {
|
||||
ESP_RETURN_ON_FALSE(false, ESP_ERR_INVALID_STATE, TAG, "no ready transaction, and no backup buffer");
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "trans.buffer: %p, trans.buflen: %d", trans.buffer, trans.buflen);
|
||||
|
||||
@@ -26,7 +26,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
CSI_FSM_INIT = 1,
|
||||
CSI_FSM_INIT,
|
||||
CSI_FSM_ENABLED,
|
||||
CSI_FSM_STARTED,
|
||||
} csi_fsm_t;
|
||||
@@ -55,8 +55,6 @@ struct csi_controller_t {
|
||||
size_t fb_size_in_bytes; //Frame buffer size, in bytes
|
||||
esp_cam_ctlr_trans_t trans; //Saved done transaction to be given out to callers
|
||||
void *backup_buffer; //backup buffer to make csi bridge can work to avoid wrong state
|
||||
bool bk_buffer_exposed; //status of if back_buffer is exposed to users
|
||||
bool bk_buffer_dis; //Allow to not malloc backup_buffer
|
||||
QueueHandle_t trans_que; //transaction queue
|
||||
esp_cam_ctlr_evt_cbs_t cbs; //user callbacks
|
||||
void *cbs_user_data; //callback userdata
|
||||
|
||||
@@ -64,26 +64,6 @@ esp_err_t esp_cam_ctlr_register_event_callbacks(esp_cam_ctlr_handle_t handle, co
|
||||
return handle->register_event_callbacks(handle, cbs, user_data);
|
||||
}
|
||||
|
||||
esp_err_t esp_cam_ctlr_get_frame_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null handle");
|
||||
ESP_RETURN_ON_FALSE(handle->get_internal_buffer, ESP_ERR_NOT_SUPPORTED, TAG, "get buffer function not supported");
|
||||
|
||||
va_list args;
|
||||
va_start(args, fb0);
|
||||
esp_err_t ret = handle->get_internal_buffer(handle, fb_num, fb0, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t esp_cam_ctlr_get_frame_buffer_len(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(handle && ret_fb_len, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null handle");
|
||||
ESP_RETURN_ON_FALSE(handle->get_buffer_len, ESP_ERR_NOT_SUPPORTED, TAG, "get buffer length function not supported");
|
||||
|
||||
return handle->get_buffer_len(handle, ret_fb_len);
|
||||
}
|
||||
|
||||
esp_err_t esp_cam_del_ctlr(esp_cam_ctlr_handle_t handle)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
||||
|
||||
@@ -102,36 +102,6 @@ esp_err_t esp_cam_del_ctlr(esp_cam_ctlr_handle_t handle);
|
||||
*/
|
||||
esp_err_t esp_cam_ctlr_register_event_callbacks(esp_cam_ctlr_handle_t handle, const esp_cam_ctlr_evt_cbs_t *cbs, void *user_data);
|
||||
|
||||
/**
|
||||
* @brief Get ESP CAM controller internal malloced backup buffer(s) addr
|
||||
*
|
||||
* @note Generally, data in internal buffer is ready when `on_trans_finished` event
|
||||
*
|
||||
* @param[in] handle ESP CAM controller handle
|
||||
* @param[in] fb_num Number of frame buffer(s) to get. This value must be the same as the number of the followed fbN parameters
|
||||
* @param[out] fb0 Address of the frame buffer 0 (first frame buffer)
|
||||
* @param[out] ... List of other frame buffers if any
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_ERR_INVALID_ARG: Invalid argument
|
||||
* - ESP_ERR_INVALID_STATE: Invalid driver state
|
||||
*/
|
||||
esp_err_t esp_cam_ctlr_get_frame_buffer(esp_cam_ctlr_handle_t handle, uint32_t fb_num, const void **fb0, ...);
|
||||
|
||||
/**
|
||||
* @brief Get ESP CAM controller internal backup buffer length
|
||||
*
|
||||
* @param[in] handle ESP CAM controller handle
|
||||
* @param[out] ret_fb_len Optional, The size of each frame buffer, in bytes.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_ERR_INVALID_ARG: NULL ptr
|
||||
* - ESP_ERR_INVALID_STATE: Invalid driver state
|
||||
*/
|
||||
esp_err_t esp_cam_ctlr_get_frame_buffer_len(esp_cam_ctlr_handle_t handle, size_t *ret_fb_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -105,34 +105,6 @@ struct esp_cam_ctlr_t {
|
||||
*/
|
||||
esp_err_t (*register_event_callbacks)(esp_cam_ctlr_t *ctlr, const esp_cam_ctlr_evt_cbs_t *cbs, void *user_ctx);
|
||||
|
||||
/**
|
||||
* @brief Get ESP CAM controller internal malloced backup buffer(s) addr
|
||||
*
|
||||
* @param[in] esp_cam_ctlr_t * ESP CAM controller handle
|
||||
* @param[in] uint32_t Number of frame buffer(s) to get. This value must be the same as the number of the followed fbN parameters
|
||||
* @param[out] const void ** Address of the frame buffer 0 (first frame buffer)
|
||||
* @param[out] ... List of other frame buffers if any
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_ERR_INVALID_ARG: Invalid argument
|
||||
* - ESP_ERR_INVALID_STATE: Invalid driver state
|
||||
*/
|
||||
esp_err_t (*get_internal_buffer)(esp_cam_ctlr_t *, uint32_t, const void **, ...);
|
||||
|
||||
/**
|
||||
* @brief Get ESP CAM controller internal backup buffer length
|
||||
*
|
||||
* @param[in] esp_cam_ctlr_t * ESP CAM controller handle
|
||||
* @param[out] size_t * The size of each frame buffer, in bytes.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_ERR_INVALID_ARG: NULL ptr
|
||||
* - ESP_ERR_INVALID_STATE: Invalid driver state
|
||||
*/
|
||||
esp_err_t (*get_buffer_len)(esp_cam_ctlr_t *, size_t *);
|
||||
|
||||
void *user_data; ///< User data
|
||||
};
|
||||
|
||||
|
||||
@@ -25,39 +25,5 @@ TEST_CASE("TEST CSI driver allocation", "[csi]")
|
||||
esp_cam_ctlr_handle_t handle = NULL;
|
||||
TEST_ESP_OK(esp_cam_new_csi_ctlr(&csi_config, &handle));
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, esp_cam_new_csi_ctlr(&csi_config, &handle));
|
||||
|
||||
uint8_t *bk_buffer = NULL;
|
||||
size_t bk_buffer_len = 0;
|
||||
TEST_ESP_OK(esp_cam_ctlr_get_frame_buffer(handle, 1, (const void **)&bk_buffer));
|
||||
TEST_ESP_OK(esp_cam_ctlr_get_frame_buffer_len(handle, &bk_buffer_len));
|
||||
TEST_ASSERT_NOT_NULL(bk_buffer);
|
||||
TEST_ASSERT_EQUAL((csi_config.h_res * csi_config.v_res * 2), bk_buffer_len); // out type RGB565 using 2 byte / pixel
|
||||
TEST_ESP_OK(esp_cam_del_ctlr(handle));
|
||||
}
|
||||
|
||||
TEST_CASE("TEST CSI driver no backup buffer usage", "[csi]")
|
||||
{
|
||||
esp_cam_ctlr_csi_config_t csi_config = {
|
||||
.ctlr_id = 0,
|
||||
.h_res = 800,
|
||||
.v_res = 640,
|
||||
.lane_bit_rate_mbps = 200,
|
||||
.input_data_color_type = MIPI_CSI_COLOR_RAW8,
|
||||
.output_data_color_type = MIPI_CSI_COLOR_RGB565,
|
||||
.data_lane_num = 2,
|
||||
.byte_swap_en = false,
|
||||
.queue_items = 1,
|
||||
.bk_buffer_dis = 1,
|
||||
};
|
||||
esp_cam_ctlr_handle_t handle = NULL;
|
||||
TEST_ESP_OK(esp_cam_new_csi_ctlr(&csi_config, &handle));
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, esp_cam_new_csi_ctlr(&csi_config, &handle));
|
||||
|
||||
uint8_t *bk_buffer = NULL;
|
||||
size_t bk_buffer_len = 0;
|
||||
TEST_ESP_ERR(ESP_ERR_INVALID_STATE, esp_cam_ctlr_get_frame_buffer(handle, 1, (const void **)&bk_buffer));
|
||||
TEST_ESP_ERR(ESP_ERR_INVALID_STATE, esp_cam_ctlr_get_frame_buffer_len(handle, &bk_buffer_len));
|
||||
TEST_ASSERT_NULL(bk_buffer);
|
||||
TEST_ASSERT_EQUAL(0, bk_buffer_len);
|
||||
TEST_ESP_OK(esp_cam_del_ctlr(handle));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
#include "jpeg_types.h"
|
||||
#include "hal/jpeg_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -20,7 +19,7 @@ extern "C" {
|
||||
*/
|
||||
typedef struct {
|
||||
jpeg_dec_output_format_t output_format; /*!< JPEG decoder output format */
|
||||
jpeg_dec_rgb_element_order_t rgb_order; /*!< JPEG decoder output order */
|
||||
jpeg_dec_rgb_element_order_t rgb_order; /*!< JPEG decoder output order */
|
||||
jpeg_yuv_rgb_conv_std_t conv_std; /*!< JPEG decoder yuv->rgb standard */
|
||||
} jpeg_decode_cfg_t;
|
||||
|
||||
@@ -38,7 +37,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint32_t width; /*!< Number of pixels in the horizontal direction */
|
||||
uint32_t height; /*!< Number of pixels in the vertical direction */
|
||||
jpeg_down_sampling_type_t sample_method; /*!< compressed JPEG picture sampling method */
|
||||
} jpeg_decode_picture_info_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,9 +20,6 @@ typedef enum {
|
||||
JPEG_DECODE_OUT_FORMAT_RGB888 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB888), /*!< output RGB888 format */
|
||||
JPEG_DECODE_OUT_FORMAT_RGB565 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB565), /*!< output RGB565 format */
|
||||
JPEG_DECODE_OUT_FORMAT_GRAY = COLOR_TYPE_ID(COLOR_SPACE_GRAY, COLOR_PIXEL_GRAY8), /*!< output the gray picture */
|
||||
JPEG_DECODE_OUT_FORMAT_YUV444 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV444), /*!< output yuv444 format */
|
||||
JPEG_DECODE_OUT_FORMAT_YUV422 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV422), /*!< output yuv422 format */
|
||||
JPEG_DECODE_OUT_FORMAT_YUV420 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV420), /*!< output yuv420 format */
|
||||
} jpeg_dec_output_format_t;
|
||||
|
||||
/**
|
||||
@@ -56,7 +53,6 @@ typedef enum {
|
||||
JPEG_ENCODE_IN_FORMAT_RGB888 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB888), /*!< input RGB888 format */
|
||||
JPEG_ENCODE_IN_FORMAT_RGB565 = COLOR_TYPE_ID(COLOR_SPACE_RGB, COLOR_PIXEL_RGB565), /*!< input RGB565 format */
|
||||
JPEG_ENCODE_IN_FORMAT_GRAY = COLOR_TYPE_ID(COLOR_SPACE_GRAY, COLOR_PIXEL_GRAY8), /*!< input GRAY format */
|
||||
JPEG_ENCODE_IN_FORMAT_YUV422 = COLOR_TYPE_ID(COLOR_SPACE_YUV, COLOR_PIXEL_YUV422), /*!< input YUV422 format */
|
||||
} jpeg_enc_input_format_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -144,7 +144,6 @@ esp_err_t jpeg_decoder_get_info(const uint8_t *in_buf, uint32_t inbuf_len, jpeg_
|
||||
uint16_t width = 0;
|
||||
uint8_t thischar = 0;
|
||||
uint8_t lastchar = 0;
|
||||
uint8_t hivi = 0;
|
||||
|
||||
while (header_info->buffer_left) {
|
||||
lastchar = thischar;
|
||||
@@ -156,10 +155,6 @@ esp_err_t jpeg_decoder_get_info(const uint8_t *in_buf, uint32_t inbuf_len, jpeg_
|
||||
jpeg_get_bytes(header_info, 1);
|
||||
height = jpeg_get_bytes(header_info, 2);
|
||||
width = jpeg_get_bytes(header_info, 2);
|
||||
|
||||
jpeg_get_bytes(header_info, 1);
|
||||
jpeg_get_bytes(header_info, 1);
|
||||
hivi = jpeg_get_bytes(header_info, 1);
|
||||
break;
|
||||
}
|
||||
// This function only used for get width and height. So only read SOF marker is enough.
|
||||
@@ -172,21 +167,6 @@ esp_err_t jpeg_decoder_get_info(const uint8_t *in_buf, uint32_t inbuf_len, jpeg_
|
||||
picture_info->height = height;
|
||||
picture_info->width = width;
|
||||
|
||||
switch (hivi) {
|
||||
case 0x11:
|
||||
picture_info->sample_method = JPEG_DOWN_SAMPLING_YUV444;
|
||||
break;
|
||||
case 0x21:
|
||||
picture_info->sample_method = JPEG_DOWN_SAMPLING_YUV422;
|
||||
break;
|
||||
case 0x22:
|
||||
picture_info->sample_method = JPEG_DOWN_SAMPLING_YUV420;
|
||||
break;
|
||||
default:
|
||||
ESP_LOGE(TAG, "Sampling factor cannot be recognized");
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
free(header_info);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -215,13 +195,14 @@ esp_err_t jpeg_decoder_process(jpeg_decoder_handle_t decoder_engine, const jpeg_
|
||||
decoder_engine->output_format = decode_cfg->output_format;
|
||||
decoder_engine->rgb_order = decode_cfg->rgb_order;
|
||||
decoder_engine->conv_std = decode_cfg->conv_std;
|
||||
|
||||
decoder_engine->decoded_buf = decode_outbuf;
|
||||
|
||||
ESP_GOTO_ON_ERROR(jpeg_parse_marker(decoder_engine, bit_stream, stream_size), err, TAG, "jpeg parse marker failed");
|
||||
ESP_GOTO_ON_ERROR(jpeg_parse_header_info_to_hw(decoder_engine), err, TAG, "write header info to hw failed");
|
||||
ESP_GOTO_ON_ERROR(jpeg_dec_config_dma_descriptor(decoder_engine), err, TAG, "config dma descriptor failed");
|
||||
|
||||
*out_size = decoder_engine->header_info->process_h * decoder_engine->header_info->process_v * decoder_engine->bit_per_pixel / 8;
|
||||
*out_size = decoder_engine->header_info->process_h * decoder_engine->header_info->process_v * decoder_engine->pixel;
|
||||
ESP_GOTO_ON_FALSE((*out_size <= outbuf_size), ESP_ERR_INVALID_ARG, err, TAG, "Given buffer size % " PRId32 " is smaller than actual jpeg decode output size % " PRId32 "the height and width of output picture size will be adjusted to 16 bytes aligned automatically", outbuf_size, *out_size);
|
||||
|
||||
dma2d_trans_config_t trans_desc = {
|
||||
@@ -241,8 +222,8 @@ esp_err_t jpeg_decoder_process(jpeg_decoder_handle_t decoder_engine, const jpeg_
|
||||
// Blocking for JPEG decode transaction finishes.
|
||||
while (1) {
|
||||
jpeg_dma2d_dec_evt_t jpeg_dma2d_event;
|
||||
BaseType_t ret_val = xQueueReceive(decoder_engine->evt_queue, &jpeg_dma2d_event, decoder_engine->timeout_tick);
|
||||
ESP_GOTO_ON_FALSE(ret_val == pdTRUE, ESP_ERR_TIMEOUT, err, TAG, "jpeg-dma2d handle jpeg decode timeout, please check `timeout_ms` ");
|
||||
BaseType_t ret = xQueueReceive(decoder_engine->evt_queue, &jpeg_dma2d_event, decoder_engine->timeout_tick);
|
||||
ESP_GOTO_ON_FALSE(ret == pdTRUE, ESP_ERR_TIMEOUT, err, TAG, "jpeg-dma2d handle jpeg decode timeout, please check `timeout_ms` ");
|
||||
|
||||
// Dealing with JPEG event
|
||||
if (jpeg_dma2d_event.jpgd_status != 0) {
|
||||
@@ -347,49 +328,23 @@ static esp_err_t jpeg_dec_config_dma_descriptor(jpeg_decoder_handle_t decoder_en
|
||||
jpeg_dec_format_hb_t best_hb_idx = 0;
|
||||
color_space_pixel_format_t picture_format;
|
||||
picture_format.color_type_id = decoder_engine->output_format;
|
||||
decoder_engine->bit_per_pixel = color_hal_pixel_format_get_bit_depth(picture_format);
|
||||
if (decoder_engine->no_color_conversion == false) {
|
||||
switch (decoder_engine->output_format) {
|
||||
case JPEG_DECODE_OUT_FORMAT_RGB888:
|
||||
best_hb_idx = JPEG_DEC_RGB888_HB;
|
||||
break;
|
||||
case JPEG_DECODE_OUT_FORMAT_RGB565:
|
||||
best_hb_idx = JPEG_DEC_RGB565_HB;
|
||||
break;
|
||||
case JPEG_DECODE_OUT_FORMAT_GRAY:
|
||||
best_hb_idx = JPEG_DEC_GRAY_HB;
|
||||
break;
|
||||
case JPEG_DECODE_OUT_FORMAT_YUV444:
|
||||
best_hb_idx = JPEG_DEC_YUV444_HB;
|
||||
break;
|
||||
default:
|
||||
ESP_LOGE(TAG, "wrong, we don't support decode to such format.");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
} else {
|
||||
best_hb_idx = JPEG_DEC_DIRECT_OUTPUT_HB;
|
||||
}
|
||||
|
||||
uint8_t sample_method_idx = 0;
|
||||
switch (decoder_engine->sample_method) {
|
||||
case JPEG_DOWN_SAMPLING_YUV444:
|
||||
sample_method_idx = 0;
|
||||
decoder_engine->pixel = color_hal_pixel_format_get_bit_depth(picture_format) / 8;
|
||||
switch (decoder_engine->output_format) {
|
||||
case JPEG_DECODE_OUT_FORMAT_RGB888:
|
||||
best_hb_idx = JPEG_DEC_RGB888_HB;
|
||||
break;
|
||||
case JPEG_DOWN_SAMPLING_YUV422:
|
||||
sample_method_idx = 1;
|
||||
case JPEG_DECODE_OUT_FORMAT_RGB565:
|
||||
best_hb_idx = JPEG_DEC_RGB565_HB;
|
||||
break;
|
||||
case JPEG_DOWN_SAMPLING_YUV420:
|
||||
sample_method_idx = 2;
|
||||
break;
|
||||
case JPEG_DOWN_SAMPLING_GRAY:
|
||||
sample_method_idx = 3;
|
||||
case JPEG_DECODE_OUT_FORMAT_GRAY:
|
||||
best_hb_idx = JPEG_DEC_GRAY_HB;
|
||||
break;
|
||||
default:
|
||||
ESP_LOGE(TAG, "wrong, we don't support such sampling mode.");
|
||||
ESP_LOGE(TAG, "wrong, we don't support decode to such format.");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
uint32_t dma_hb = dec_hb_tbl[sample_method_idx][best_hb_idx];
|
||||
uint32_t dma_hb = dec_hb_tbl[decoder_engine->sample_method][best_hb_idx];
|
||||
uint32_t dma_vb = decoder_engine->header_info->mcuy;
|
||||
|
||||
// Configure tx link descriptor
|
||||
@@ -420,6 +375,7 @@ static void jpeg_dec_config_dma_csc(jpeg_decoder_handle_t decoder_engine, dma2d_
|
||||
|
||||
dma2d_scramble_order_t post_scramble = DMA2D_SCRAMBLE_ORDER_BYTE2_1_0;
|
||||
dma2d_csc_rx_option_t rx_csc_option = DMA2D_CSC_RX_NONE;
|
||||
|
||||
// Config output Endians
|
||||
if (decoder_engine->rgb_order == JPEG_DEC_RGB_ELEMENT_ORDER_RGB) {
|
||||
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_RGB565) {
|
||||
@@ -442,13 +398,7 @@ static void jpeg_dec_config_dma_csc(jpeg_decoder_handle_t decoder_engine, dma2d_
|
||||
} else if (decoder_engine->conv_std == JPEG_YUV_RGB_CONV_STD_BT709) {
|
||||
rx_csc_option = DMA2D_CSC_RX_YUV420_TO_RGB888_709;
|
||||
}
|
||||
} else if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV444) {
|
||||
if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV422) {
|
||||
rx_csc_option = DMA2D_CSC_RX_YUV422_TO_YUV444;
|
||||
} else if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV420) {
|
||||
rx_csc_option = DMA2D_CSC_RX_YUV420_TO_YUV444;
|
||||
}
|
||||
} else {
|
||||
} else if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_GRAY) {
|
||||
rx_csc_option = DMA2D_CSC_RX_NONE;
|
||||
}
|
||||
|
||||
@@ -543,27 +493,6 @@ static bool jpeg_dec_transaction_on_picked(uint32_t channel_num, const dma2d_tra
|
||||
return false;
|
||||
}
|
||||
|
||||
static esp_err_t jpeg_color_space_support_check(jpeg_decoder_handle_t decoder_engine)
|
||||
{
|
||||
if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV444) {
|
||||
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV422 || decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV420) {
|
||||
ESP_LOGE(TAG, "Detected YUV444 but want to convert to YUV422/YUV420, which is not supported");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
} else if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV422) {
|
||||
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV420) {
|
||||
ESP_LOGE(TAG, "Detected YUV422 but want to convert to YUV420, which is not supported");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
} else if (decoder_engine->sample_method == JPEG_DOWN_SAMPLING_YUV420) {
|
||||
if (decoder_engine->output_format == JPEG_DECODE_OUT_FORMAT_YUV422) {
|
||||
ESP_LOGE(TAG, "Detected YUV420 but want to convert to YUV422, which is not supported");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t jpeg_parse_header_info_to_hw(jpeg_decoder_handle_t decoder_engine)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(decoder_engine, ESP_ERR_INVALID_ARG, TAG, "jpeg decode handle is null");
|
||||
@@ -605,12 +534,6 @@ static esp_err_t jpeg_parse_header_info_to_hw(jpeg_decoder_handle_t decoder_engi
|
||||
decoder_engine->sample_method = JPEG_DOWN_SAMPLING_GRAY;
|
||||
}
|
||||
|
||||
ESP_RETURN_ON_ERROR(jpeg_color_space_support_check(decoder_engine), TAG, "jpeg decoder not support the combination of output format and down sampling format");
|
||||
|
||||
if ((uint32_t)decoder_engine->sample_method == (uint32_t)decoder_engine->output_format) {
|
||||
decoder_engine->no_color_conversion = true;
|
||||
}
|
||||
|
||||
// Write DHT information
|
||||
dht_func[0][0](hal, header_info->huffbits[0][0], header_info->huffcode[0][0], header_info->tmp_huff);
|
||||
dht_func[0][1](hal, header_info->huffbits[0][1], header_info->huffcode[0][1], header_info->tmp_huff);
|
||||
|
||||
@@ -142,9 +142,6 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
|
||||
ESP_RETURN_ON_FALSE(encode_inbuf, ESP_ERR_INVALID_ARG, TAG, "jpeg encode picture buffer is null");
|
||||
ESP_RETURN_ON_FALSE(out_size, ESP_ERR_INVALID_ARG, TAG, "jpeg encode picture out_size is null");
|
||||
ESP_RETURN_ON_FALSE(((uintptr_t)bit_stream % cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA)) == 0, ESP_ERR_INVALID_ARG, TAG, "jpeg encode bit stream is not aligned, please use jpeg_alloc_encoder_mem to malloc your buffer");
|
||||
if (encode_cfg->src_type == JPEG_ENCODE_IN_FORMAT_YUV422) {
|
||||
ESP_RETURN_ON_FALSE(encode_cfg->sub_sample == JPEG_DOWN_SAMPLING_YUV422, ESP_ERR_INVALID_ARG, TAG, "Sub sampling is not supported under this source type");
|
||||
}
|
||||
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
@@ -179,10 +176,6 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
|
||||
encoder_engine->color_space = JPEG_ENC_SRC_GRAY;
|
||||
best_hb_idx = JPEG_ENC_SRC_GRAY_HB;
|
||||
break;
|
||||
case JPEG_ENCODE_IN_FORMAT_YUV422:
|
||||
encoder_engine->color_space = JPEG_ENC_SRC_YUV422;
|
||||
best_hb_idx = JPEG_ENC_SRC_YUV422_HB;
|
||||
break;
|
||||
default:
|
||||
ESP_LOGE(TAG, "wrong, we don't support encode from such format.");
|
||||
ret = ESP_ERR_NOT_SUPPORTED;
|
||||
@@ -205,26 +198,7 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
|
||||
ESP_GOTO_ON_ERROR(s_jpeg_set_header_info(encoder_engine), err, TAG, "set header failed");
|
||||
jpeg_hal_set_quantization_coefficient(hal, encoder_engine->header_info->m_quantization_tables[0], encoder_engine->header_info->m_quantization_tables[1]);
|
||||
|
||||
uint8_t sample_method_idx = 0;
|
||||
switch (encoder_engine->header_info->sub_sample) {
|
||||
case JPEG_DOWN_SAMPLING_YUV444:
|
||||
sample_method_idx = 0;
|
||||
break;
|
||||
case JPEG_DOWN_SAMPLING_YUV422:
|
||||
sample_method_idx = 1;
|
||||
break;
|
||||
case JPEG_DOWN_SAMPLING_YUV420:
|
||||
sample_method_idx = 2;
|
||||
break;
|
||||
case JPEG_DOWN_SAMPLING_GRAY:
|
||||
sample_method_idx = 3;
|
||||
break;
|
||||
default:
|
||||
ESP_LOGE(TAG, "wrong, we don't support such sampling mode.");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
uint32_t dma_hb = enc_hb_tbl[best_hb_idx][sample_method_idx];
|
||||
uint32_t dma_hb = enc_hb_tbl[best_hb_idx][encoder_engine->header_info->sub_sample];
|
||||
uint32_t dma_vb = encoder_engine->mcuy;
|
||||
|
||||
ESP_GOTO_ON_FALSE((encoder_engine->header_info->header_len % cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA)) == 0, ESP_ERR_INVALID_STATE, err, TAG, "The header is not cache line aligned, please check");
|
||||
@@ -263,8 +237,8 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
|
||||
|
||||
if (s_rcv_event.dma_evt & JPEG_DMA2D_RX_EOF) {
|
||||
compressed_size = s_dma_desc_get_len(encoder_engine->rxlink);
|
||||
uint32_t _compressed_size = JPEG_ALIGN_UP(compressed_size, cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA));
|
||||
ESP_GOTO_ON_ERROR(esp_cache_msync((void*)(bit_stream + encoder_engine->header_info->header_len), _compressed_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C), err, TAG, "sync memory to cache failed");
|
||||
compressed_size = JPEG_ALIGN_UP(compressed_size, cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA));
|
||||
ESP_GOTO_ON_ERROR(esp_cache_msync((void*)(bit_stream + encoder_engine->header_info->header_len), compressed_size, ESP_CACHE_MSYNC_FLAG_DIR_M2C), err, TAG, "sync memory to cache failed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ const uint8_t zigzag_arr[64] = {
|
||||
* decompression. It is used to decode the Huffman-coded symbols in the compressed
|
||||
* data stream during the decoding process.
|
||||
*/
|
||||
const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_NUM][JPEG_DEC_BEST_HB_MAX] = {
|
||||
const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_MAX][JPEG_DEC_BEST_HB_MAX] = {
|
||||
{40, 40, 40, 32, 0},
|
||||
{64, 32, 32, 64, 0},
|
||||
{48, 32, 32, 48, 0},
|
||||
@@ -53,7 +53,7 @@ const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_NUM][JPEG_DEC_BEST_HB_MAX] = {
|
||||
* compression. It is used to decode the Huffman-coded symbols in the compressed
|
||||
* data stream during the encoding process.
|
||||
*/
|
||||
const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_NUM] = {
|
||||
const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_MAX] = {
|
||||
{40, 32, 32, 0},
|
||||
{0, 64, 0, 0},
|
||||
{64, 64, 48, 0},
|
||||
|
||||
@@ -56,8 +56,9 @@ struct jpeg_codec_t {
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
JPEG_DEC_DIRECT_OUTPUT_HB = 0, /*!< Direct output */
|
||||
JPEG_DEC_YUV444_HB = 1, /*!< output YUV444 format */
|
||||
// TODO: Support DR and YUV444 on decoder.
|
||||
//JPEG_DEC_DR_HB = 0, /*!< Direct output */
|
||||
//JPEG_DEC_YUV444_HB = 1, /*!< output YUV444 format */
|
||||
JPEG_DEC_RGB888_HB = 2, /*!< output RGB888 format */
|
||||
JPEG_DEC_RGB565_HB = 3, /*!< output RGB565 format */
|
||||
JPEG_DEC_GRAY_HB = 4, /*!< output the gray picture */
|
||||
@@ -95,10 +96,9 @@ struct jpeg_decoder_t {
|
||||
jpeg_dec_header_info_t *header_info; // Pointer to current picture information
|
||||
jpeg_down_sampling_type_t sample_method; // method of sampling the JPEG picture.
|
||||
jpeg_dec_output_format_t output_format; // picture output format.
|
||||
jpeg_dec_rgb_element_order_t rgb_order; // RGB pixel order
|
||||
jpeg_dec_rgb_element_order_t rgb_order; // RGB pixel order
|
||||
jpeg_yuv_rgb_conv_std_t conv_std; // YUV RGB conversion standard
|
||||
bool no_color_conversion; // No color conversion, directly output based on compressed format
|
||||
uint8_t bit_per_pixel; // bit size per pixel
|
||||
uint8_t pixel; // size per pixel
|
||||
QueueHandle_t evt_queue; // jpeg event from 2DDMA and JPEG engine
|
||||
uint8_t *decoded_buf; // pointer to the rx buffer.
|
||||
uint32_t total_size; // jpeg picture origin size (in bytes)
|
||||
@@ -127,7 +127,8 @@ typedef struct {
|
||||
|
||||
typedef enum {
|
||||
JPEG_ENC_SRC_RGB888_HB = 0, // Input RGB888 format
|
||||
JPEG_ENC_SRC_YUV422_HB = 1, // Input YUV422 format
|
||||
// TODO: Support encoder source format for yuv422
|
||||
// JPEG_ENC_SRC_YUV422_HB = 1, // Input YUV422 format
|
||||
JPEG_ENC_SRC_RGB565_HB = 2, // Input RGB565 format
|
||||
JPEG_ENC_SRC_GRAY_HB = 3, // Input GRAY format
|
||||
JPEG_ENC_BEST_HB_MAX,
|
||||
|
||||
@@ -36,7 +36,7 @@ extern const uint8_t zigzag_arr[64];
|
||||
* decompression. It is used to decode the Huffman-coded symbols in the compressed
|
||||
* data stream during the decoding process.
|
||||
*/
|
||||
extern const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_NUM][JPEG_DEC_BEST_HB_MAX];
|
||||
extern const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_MAX][JPEG_DEC_BEST_HB_MAX];
|
||||
|
||||
/**
|
||||
* @brief DMA2D best hb value table for JPEG compression.
|
||||
@@ -45,7 +45,7 @@ extern const uint32_t dec_hb_tbl[JPEG_DOWN_SAMPLING_NUM][JPEG_DEC_BEST_HB_MAX];
|
||||
* compression. It is used to decode the Huffman-coded symbols in the compressed
|
||||
* data stream during the encoding process.
|
||||
*/
|
||||
extern const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_NUM];
|
||||
extern const uint32_t enc_hb_tbl[JPEG_ENC_BEST_HB_MAX][JPEG_DOWN_SAMPLING_MAX];
|
||||
|
||||
/**
|
||||
* @brief Setup the standard Huffman tables (JPEG standard sections K.3.3)
|
||||
|
||||
@@ -348,8 +348,7 @@ esp_err_t sdmmc_host_start_command(int slot, sdmmc_hw_cmd_t cmd, uint32_t arg)
|
||||
if (!(slot == 0 || slot == 1)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
// if this isn't a clock update command, check the card detect status
|
||||
if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot) && !cmd.update_clk_reg) {
|
||||
if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot)) {
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
if (cmd.data_expected && cmd.rw && sdmmc_ll_is_card_write_protected(s_host_ctx.hal.dev, slot)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/task.h"
|
||||
#include "soc/sdmmc_periph.h"
|
||||
#include "soc/soc_memory_layout.h"
|
||||
#include "driver/sdmmc_types.h"
|
||||
#include "driver/sdmmc_defs.h"
|
||||
#include "driver/sdmmc_host.h"
|
||||
@@ -129,18 +130,14 @@ esp_err_t sdmmc_host_do_transaction(int slot, sdmmc_command_t* cmdinfo)
|
||||
if (cmdinfo->data) {
|
||||
// Length should be either <4 or >=4 and =0 (mod 4).
|
||||
if (cmdinfo->datalen >= 4 && cmdinfo->datalen % 4 != 0) {
|
||||
ESP_LOGE(TAG, "%s: invalid size: total=%d",
|
||||
ESP_LOGD(TAG, "%s: invalid size: total=%d",
|
||||
__func__, cmdinfo->datalen);
|
||||
ret = ESP_ERR_INVALID_SIZE;
|
||||
goto out;
|
||||
}
|
||||
esp_dma_mem_info_t dma_mem_info;
|
||||
sdmmc_host_get_dma_info(slot, &dma_mem_info);
|
||||
#ifdef SOC_SDMMC_PSRAM_DMA_CAPABLE
|
||||
dma_mem_info.extra_heap_caps |= MALLOC_CAP_SPIRAM;
|
||||
#endif
|
||||
if (!esp_dma_is_buffer_alignment_satisfied(cmdinfo->data, cmdinfo->buflen, dma_mem_info)) {
|
||||
ESP_LOGE(TAG, "%s: buffer %p can not be used for DMA", __func__, cmdinfo->data);
|
||||
if ((intptr_t) cmdinfo->data % 4 != 0 ||
|
||||
!esp_ptr_dma_capable(cmdinfo->data)) {
|
||||
ESP_LOGD(TAG, "%s: buffer %p can not be used for DMA", __func__, cmdinfo->data);
|
||||
ret = ESP_ERR_INVALID_ARG;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include "esp_dma_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "test_utils.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/soc_caps.h"
|
||||
@@ -20,8 +17,7 @@
|
||||
#include "sdmmc_test_rw_common.h"
|
||||
|
||||
static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
|
||||
size_t block_count, size_t alignment, FILE* performance_log,
|
||||
uint32_t extra_alloc_caps);
|
||||
size_t block_count, size_t alignment, FILE* performance_log);
|
||||
|
||||
static void fill_buffer(uint32_t seed, uint8_t* dst, size_t count)
|
||||
{
|
||||
@@ -45,22 +41,13 @@ static void check_buffer(uint32_t seed, const uint8_t* src, size_t count)
|
||||
}
|
||||
|
||||
static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
|
||||
size_t block_count, size_t alignment, FILE* performance_log,
|
||||
uint32_t extra_alloc_caps)
|
||||
size_t block_count, size_t alignment, FILE* performance_log)
|
||||
{
|
||||
size_t block_size = card->csd.sector_size;
|
||||
size_t total_size = block_size * block_count;
|
||||
const char* alloc_str = (extra_alloc_caps & MALLOC_CAP_SPIRAM) ? "spiram" : " sram ";
|
||||
printf(" %8d | %3d | %d | %s | %4.1f ", start_block, block_count, alignment, alloc_str, total_size / 1024.0f);
|
||||
|
||||
size_t actual_size = 0;
|
||||
uint32_t *buffer = NULL;
|
||||
esp_dma_mem_info_t dma_mem_info = {
|
||||
.extra_heap_caps = extra_alloc_caps,
|
||||
.dma_alignment_bytes = 64,
|
||||
};
|
||||
TEST_ESP_OK(esp_dma_capable_malloc(total_size + 4, &dma_mem_info, (void**) &buffer, &actual_size));
|
||||
printf(" %8d | %3d | %d | %4.1f ", start_block, block_count, alignment, total_size / 1024.0f);
|
||||
|
||||
uint32_t* buffer = heap_caps_malloc(total_size + 4, MALLOC_CAP_DMA);
|
||||
size_t offset = alignment % 4;
|
||||
uint8_t* c_buffer = (uint8_t*) buffer + offset;
|
||||
fill_buffer(start_block, c_buffer, total_size / sizeof(buffer[0]));
|
||||
@@ -93,10 +80,10 @@ static void do_single_rw_perf_test(sdmmc_card_t* card, size_t start_block,
|
||||
static const char wr_speed_str[] = "SDMMC_WR_SPEED";
|
||||
static const char rd_speed_str[] = "SDMMC_RD_SPEED";
|
||||
int aligned = ((alignment % 4) == 0) ? 1 : 0;
|
||||
IDF_LOG_PERFORMANCE(wr_speed_str, "%d, blk_n: %d, aligned: %d, alloc: %s",
|
||||
(int)(total_size * 1000 / time_wr), block_count, aligned, alloc_str);
|
||||
IDF_LOG_PERFORMANCE(rd_speed_str, "%d, blk_n: %d, aligned: %d, alloc: %s",
|
||||
(int)(total_size * 1000 / time_rd), block_count, aligned, alloc_str);
|
||||
IDF_LOG_PERFORMANCE(wr_speed_str, "%d, blk_n: %d, aligned: %d",
|
||||
(int)(total_size * 1000 / time_wr), block_count, aligned);
|
||||
IDF_LOG_PERFORMANCE(rd_speed_str, "%d, blk_n: %d, aligned: %d",
|
||||
(int)(total_size * 1000 / time_rd), block_count, aligned);
|
||||
stdout = old_stdout;
|
||||
}
|
||||
}
|
||||
@@ -106,13 +93,7 @@ void sdmmc_test_rw_unaligned_buffer(sdmmc_card_t* card)
|
||||
const size_t buffer_size = 4096;
|
||||
const size_t block_count = buffer_size / 512;
|
||||
const size_t extra = 4;
|
||||
const size_t total_size = buffer_size + extra;
|
||||
size_t actual_size = 0;
|
||||
uint8_t *buffer = NULL;
|
||||
esp_dma_mem_info_t dma_mem_info = {
|
||||
.dma_alignment_bytes = 64,
|
||||
};
|
||||
TEST_ESP_OK(esp_dma_capable_malloc(total_size + 4, &dma_mem_info, (void**) &buffer, &actual_size));
|
||||
uint8_t* buffer = heap_caps_malloc(buffer_size + extra, MALLOC_CAP_DMA);
|
||||
|
||||
// Check read behavior: do aligned write, then unaligned read
|
||||
const uint32_t seed = 0x89abcdef;
|
||||
@@ -135,30 +116,20 @@ void sdmmc_test_rw_unaligned_buffer(sdmmc_card_t* card)
|
||||
void sdmmc_test_rw_performance(sdmmc_card_t *card, FILE *perf_log)
|
||||
{
|
||||
sdmmc_card_print_info(stdout, card);
|
||||
printf(" sector | count | align | alloc | size(kB) | wr_time(ms) | wr_speed(MB/s) | rd_time(ms) | rd_speed(MB/s)\n");
|
||||
printf(" sector | count | align | size(kB) | wr_time(ms) | wr_speed(MB/s) | rd_time(ms) | rd_speed(MB/s)\n");
|
||||
const int offset = 0;
|
||||
/* aligned */
|
||||
do_single_rw_perf_test(card, offset, 1, 4, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 4, 4, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 8, 4, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 16, 4, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 32, 4, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 64, 4, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 128, 4, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 1, 4, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 4, 4, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 8, 4, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 16, 4, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 32, 4, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 64, 4, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 128, 4, perf_log);
|
||||
/* unaligned */
|
||||
do_single_rw_perf_test(card, offset, 1, 1, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 8, 1, perf_log, 0);
|
||||
do_single_rw_perf_test(card, offset, 128, 1, perf_log, 0);
|
||||
#if CONFIG_SPIRAM && SOC_SDMMC_PSRAM_DMA_CAPABLE
|
||||
/* spiram */
|
||||
do_single_rw_perf_test(card, offset, 1, 4, perf_log, MALLOC_CAP_SPIRAM);
|
||||
do_single_rw_perf_test(card, offset, 4, 4, perf_log, MALLOC_CAP_SPIRAM);
|
||||
do_single_rw_perf_test(card, offset, 8, 4, perf_log, MALLOC_CAP_SPIRAM);
|
||||
do_single_rw_perf_test(card, offset, 16, 4, perf_log, MALLOC_CAP_SPIRAM);
|
||||
do_single_rw_perf_test(card, offset, 32, 4, perf_log, MALLOC_CAP_SPIRAM);
|
||||
do_single_rw_perf_test(card, offset, 64, 4, perf_log, MALLOC_CAP_SPIRAM);
|
||||
do_single_rw_perf_test(card, offset, 128, 4, perf_log, MALLOC_CAP_SPIRAM);
|
||||
#endif
|
||||
do_single_rw_perf_test(card, offset, 1, 1, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 8, 1, perf_log);
|
||||
do_single_rw_perf_test(card, offset, 128, 1, perf_log);
|
||||
}
|
||||
|
||||
void sdmmc_test_rw_with_offset(sdmmc_card_t* card)
|
||||
@@ -166,22 +137,22 @@ void sdmmc_test_rw_with_offset(sdmmc_card_t* card)
|
||||
sdmmc_card_print_info(stdout, card);
|
||||
printf(" sector | count | align | size(kB) | wr_time(ms) | wr_speed(MB/s) | rd_time(ms) | rd_speed(MB/s)\n");
|
||||
/* aligned */
|
||||
do_single_rw_perf_test(card, 1, 16, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, 16, 32, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, 48, 64, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, 128, 128, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity - 64, 32, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity - 64, 64, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity - 8, 1, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 4, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 16, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 32, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 64, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 4, NULL, 0);
|
||||
do_single_rw_perf_test(card, 1, 16, 4, NULL);
|
||||
do_single_rw_perf_test(card, 16, 32, 4, NULL);
|
||||
do_single_rw_perf_test(card, 48, 64, 4, NULL);
|
||||
do_single_rw_perf_test(card, 128, 128, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity - 64, 32, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity - 64, 64, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity - 8, 1, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 4, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 16, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 32, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 64, 4, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 4, NULL);
|
||||
/* unaligned */
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 1, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 1, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 1, NULL, 0);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 1, 1, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 8, 1, NULL);
|
||||
do_single_rw_perf_test(card, card->csd.capacity / 2, 128, 1, NULL);
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ static const sdmmc_test_board_info_t s_board_info = {
|
||||
.d7 = GPIO_NUM_NC,
|
||||
.cd = GPIO_NUM_NC,
|
||||
.wp = GPIO_NUM_NC,
|
||||
.unused_pin = 54,
|
||||
.unused_pin = 2,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "sd_pwr_ctrl.h"
|
||||
#include "sd_pwr_ctrl_by_on_chip_ldo.h"
|
||||
|
||||
//TODO: IDF-8734
|
||||
#if !CONFIG_IDF_TARGET_ESP32 && !CONFIG_IDF_TARGET_ESP32S3
|
||||
TEST_CASE("CD input works in SD mode", "[sdmmc]")
|
||||
{
|
||||
sdmmc_host_t config = SDMMC_HOST_DEFAULT();
|
||||
@@ -19,17 +21,6 @@ TEST_CASE("CD input works in SD mode", "[sdmmc]")
|
||||
sdmmc_test_board_get_config_sdmmc(SDMMC_HOST_SLOT_1, &config, &slot_config);
|
||||
const int test_gpio = sdmmc_test_board_get_slot_info(SDMMC_HOST_SLOT_1)->unused_pin;
|
||||
slot_config.gpio_cd = test_gpio;
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
#define SDMMC_PWR_LDO_CHANNEL 4
|
||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
|
||||
};
|
||||
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
|
||||
|
||||
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
|
||||
config.pwr_ctrl_handle = pwr_ctrl_handle;
|
||||
#endif
|
||||
|
||||
sdmmc_test_board_card_power_set(true);
|
||||
TEST_ESP_OK(sdmmc_host_init());
|
||||
TEST_ESP_OK(sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config));
|
||||
@@ -51,17 +42,6 @@ TEST_CASE("WP input works in SD mode", "[sdmmc]")
|
||||
sdmmc_test_board_get_config_sdmmc(SDMMC_HOST_SLOT_1, &config, &slot_config);
|
||||
const int test_gpio = sdmmc_test_board_get_slot_info(SDMMC_HOST_SLOT_1)->unused_pin;
|
||||
slot_config.gpio_wp = test_gpio;
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
#define SDMMC_PWR_LDO_CHANNEL 4
|
||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
|
||||
};
|
||||
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
|
||||
|
||||
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
|
||||
config.pwr_ctrl_handle = pwr_ctrl_handle;
|
||||
#endif
|
||||
|
||||
TEST_ESP_OK(sdmmc_host_init());
|
||||
TEST_ESP_OK(sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config));
|
||||
|
||||
@@ -73,3 +53,4 @@ TEST_CASE("WP input works in SD mode", "[sdmmc]")
|
||||
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(config.pwr_ctrl_handle));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,8 +5,6 @@ set(priv_requires
|
||||
sdmmc_tests
|
||||
# general
|
||||
unity
|
||||
# for PSRAM tests
|
||||
esp_psram
|
||||
)
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
|
||||
@@ -13,13 +13,11 @@
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
printf("%s", ""); /* sneakily lazy-allocate the reent structure for this test task */
|
||||
unity_utils_record_free_mem();
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
esp_reent_cleanup();
|
||||
unity_utils_evaluate_leaks_direct(TEST_MEMORY_LEAK_THRESHOLD);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf import IdfDut
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='lack of runners, IDF-8970')
|
||||
@pytest.mark.sdcard
|
||||
def test_sdmmc(dut: IdfDut) -> None:
|
||||
# SDMMC driver can't be reinitialized if the test fails,
|
||||
# so we need to reset the board between tests to avoid failing
|
||||
# all the tests after the first one fails.
|
||||
dut.run_all_single_board_cases(reset=True)
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
CONFIG_SDMMC_BOARD_ESP32P4_EV_BOARD=y
|
||||
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
||||
CONFIG_SPIRAM_SPEED_200M=y
|
||||
@@ -265,7 +265,8 @@ static int http_on_header_value(http_parser *parser, const char *at, size_t leng
|
||||
} else if (strcasecmp(client->current_header_key, "Transfer-Encoding") == 0
|
||||
&& memcmp(at, "chunked", length) == 0) {
|
||||
client->response->is_chunked = true;
|
||||
} else if (strcasecmp(client->current_header_key, "WWW-Authenticate") == 0) {
|
||||
} else if (strcasecmp(client->current_header_key, "WWW-Authenticate") == 0 ||
|
||||
strcasecmp(client->current_header_key, "X-WWW-Authenticate") == 0) {
|
||||
http_utils_append_string(&client->auth_header, at, length);
|
||||
}
|
||||
http_utils_append_string(&client->current_header_value, at, length);
|
||||
@@ -1256,7 +1257,7 @@ int esp_http_client_read(esp_http_client_handle_t client, char *buffer, int len)
|
||||
esp_err_t esp_http_client_perform(esp_http_client_handle_t client)
|
||||
{
|
||||
esp_err_t err;
|
||||
do {
|
||||
//do {
|
||||
if (client->process_again) {
|
||||
esp_http_client_prepare(client);
|
||||
}
|
||||
@@ -1364,8 +1365,9 @@ esp_err_t esp_http_client_perform(esp_http_client_handle_t client)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} while (client->process_again);
|
||||
return ESP_OK;
|
||||
//} while (client->process_again);
|
||||
//return ESP_OK;
|
||||
return client->process_again ? ESP_ERR_HTTP_EAGAIN : ESP_OK;
|
||||
}
|
||||
|
||||
int64_t esp_http_client_fetch_headers(esp_http_client_handle_t client)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ int httpd_send(httpd_req_t *r, const char *buf, size_t buf_len)
|
||||
}
|
||||
|
||||
struct httpd_req_aux *ra = r->aux;
|
||||
int ret = ra->sd->send_fn(ra->sd->handle, ra->sd->fd, buf, buf_len, 0);
|
||||
int ret = ra->sd->send_fn(ra->sd->handle, ra->sd->fd, buf, buf_len, MSG_MORE);
|
||||
if (ret < 0) {
|
||||
ESP_LOGD(TAG, LOG_FMT("error in send_fn"));
|
||||
return ret;
|
||||
@@ -70,7 +70,7 @@ static esp_err_t httpd_send_all(httpd_req_t *r, const char *buf, size_t buf_len)
|
||||
int ret;
|
||||
|
||||
while (buf_len > 0) {
|
||||
ret = ra->sd->send_fn(ra->sd->handle, ra->sd->fd, buf, buf_len, 0);
|
||||
ret = ra->sd->send_fn(ra->sd->handle, ra->sd->fd, buf, buf_len, MSG_MORE);
|
||||
if (ret < 0) {
|
||||
ESP_LOGD(TAG, LOG_FMT("error in send_fn"));
|
||||
return ESP_FAIL;
|
||||
@@ -392,54 +392,54 @@ esp_err_t httpd_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const ch
|
||||
const char *status;
|
||||
|
||||
switch (error) {
|
||||
case HTTPD_501_METHOD_NOT_IMPLEMENTED:
|
||||
status = "501 Method Not Implemented";
|
||||
msg = "Server does not support this method";
|
||||
break;
|
||||
case HTTPD_505_VERSION_NOT_SUPPORTED:
|
||||
status = "505 Version Not Supported";
|
||||
msg = "HTTP version not supported by server";
|
||||
break;
|
||||
case HTTPD_400_BAD_REQUEST:
|
||||
status = "400 Bad Request";
|
||||
msg = "Bad request syntax";
|
||||
break;
|
||||
case HTTPD_401_UNAUTHORIZED:
|
||||
status = "401 Unauthorized";
|
||||
msg = "No permission -- see authorization schemes";
|
||||
break;
|
||||
case HTTPD_403_FORBIDDEN:
|
||||
status = "403 Forbidden";
|
||||
msg = "Request forbidden -- authorization will not help";
|
||||
break;
|
||||
case HTTPD_404_NOT_FOUND:
|
||||
status = "404 Not Found";
|
||||
msg = "Nothing matches the given URI";
|
||||
break;
|
||||
case HTTPD_405_METHOD_NOT_ALLOWED:
|
||||
status = "405 Method Not Allowed";
|
||||
msg = "Specified method is invalid for this resource";
|
||||
break;
|
||||
case HTTPD_408_REQ_TIMEOUT:
|
||||
status = "408 Request Timeout";
|
||||
msg = "Server closed this connection";
|
||||
break;
|
||||
case HTTPD_414_URI_TOO_LONG:
|
||||
status = "414 URI Too Long";
|
||||
msg = "URI is too long";
|
||||
break;
|
||||
case HTTPD_411_LENGTH_REQUIRED:
|
||||
status = "411 Length Required";
|
||||
msg = "Client must specify Content-Length";
|
||||
break;
|
||||
case HTTPD_431_REQ_HDR_FIELDS_TOO_LARGE:
|
||||
status = "431 Request Header Fields Too Large";
|
||||
msg = "Header fields are too long";
|
||||
break;
|
||||
case HTTPD_500_INTERNAL_SERVER_ERROR:
|
||||
default:
|
||||
status = "500 Internal Server Error";
|
||||
msg = "Server has encountered an unexpected error";
|
||||
case HTTPD_501_METHOD_NOT_IMPLEMENTED:
|
||||
status = "501 Method Not Implemented";
|
||||
msg = "Server does not support this method";
|
||||
break;
|
||||
case HTTPD_505_VERSION_NOT_SUPPORTED:
|
||||
status = "505 Version Not Supported";
|
||||
msg = "HTTP version not supported by server";
|
||||
break;
|
||||
case HTTPD_400_BAD_REQUEST:
|
||||
status = "400 Bad Request";
|
||||
msg = "Bad request syntax";
|
||||
break;
|
||||
case HTTPD_401_UNAUTHORIZED:
|
||||
status = "401 Unauthorized";
|
||||
msg = "No permission -- see authorization schemes";
|
||||
break;
|
||||
case HTTPD_403_FORBIDDEN:
|
||||
status = "403 Forbidden";
|
||||
msg = "Request forbidden -- authorization will not help";
|
||||
break;
|
||||
case HTTPD_404_NOT_FOUND:
|
||||
status = "404 Not Found";
|
||||
msg = "Nothing matches the given URI";
|
||||
break;
|
||||
case HTTPD_405_METHOD_NOT_ALLOWED:
|
||||
status = "405 Method Not Allowed";
|
||||
msg = "Specified method is invalid for this resource";
|
||||
break;
|
||||
case HTTPD_408_REQ_TIMEOUT:
|
||||
status = "408 Request Timeout";
|
||||
msg = "Server closed this connection";
|
||||
break;
|
||||
case HTTPD_414_URI_TOO_LONG:
|
||||
status = "414 URI Too Long";
|
||||
msg = "URI is too long";
|
||||
break;
|
||||
case HTTPD_411_LENGTH_REQUIRED:
|
||||
status = "411 Length Required";
|
||||
msg = "Client must specify Content-Length";
|
||||
break;
|
||||
case HTTPD_431_REQ_HDR_FIELDS_TOO_LARGE:
|
||||
status = "431 Request Header Fields Too Large";
|
||||
msg = "Header fields are too long";
|
||||
break;
|
||||
case HTTPD_500_INTERNAL_SERVER_ERROR:
|
||||
default:
|
||||
status = "500 Internal Server Error";
|
||||
msg = "Server has encountered an unexpected error";
|
||||
}
|
||||
|
||||
/* If user has provided custom message, override default message */
|
||||
@@ -614,19 +614,6 @@ esp_err_t httpd_req_async_handler_begin(httpd_req_t *r, httpd_req_t **out)
|
||||
}
|
||||
memcpy(async->aux, r->aux, sizeof(struct httpd_req_aux));
|
||||
|
||||
// Copy response header block
|
||||
struct httpd_data *hd = (struct httpd_data *) r->handle;
|
||||
struct httpd_req_aux *async_aux = (struct httpd_req_aux *) async->aux;
|
||||
struct httpd_req_aux *r_aux = (struct httpd_req_aux *) r->aux;
|
||||
|
||||
async_aux->resp_hdrs = calloc(hd->config.max_resp_headers, sizeof(struct resp_hdr));
|
||||
if (async_aux->resp_hdrs == NULL) {
|
||||
free(async_aux);
|
||||
free(async);
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
memcpy(async_aux->resp_hdrs, r_aux->resp_hdrs, hd->config.max_resp_headers * sizeof(struct resp_hdr));
|
||||
|
||||
// mark socket as "in use"
|
||||
struct httpd_req_aux *ra = r->aux;
|
||||
ra->sd->for_async_req = true;
|
||||
@@ -645,7 +632,6 @@ esp_err_t httpd_req_async_handler_complete(httpd_req_t *r)
|
||||
struct httpd_req_aux *ra = r->aux;
|
||||
ra->sd->for_async_req = false;
|
||||
|
||||
free(ra->resp_hdrs);
|
||||
free(r->aux);
|
||||
free(r);
|
||||
|
||||
@@ -672,7 +658,7 @@ static int httpd_sock_err(const char *ctx, int sockfd)
|
||||
int errval;
|
||||
ESP_LOGW(TAG, LOG_FMT("error in %s : %d"), ctx, errno);
|
||||
|
||||
switch (errno) {
|
||||
switch(errno) {
|
||||
case EAGAIN:
|
||||
case EINTR:
|
||||
errval = HTTPD_SOCK_ERR_TIMEOUT;
|
||||
|
||||
@@ -292,10 +292,31 @@ esp_err_t httpd_uri(struct httpd_data *hd)
|
||||
|
||||
/* If URI with method not found, respond with error code */
|
||||
if (uri == NULL) {
|
||||
|
||||
switch (err) {
|
||||
case HTTPD_404_NOT_FOUND:
|
||||
ESP_LOGW(TAG, LOG_FMT("URI '%s' not found"), req->uri);
|
||||
{
|
||||
char ipstr[INET6_ADDRSTRLEN] = "UNKNOWN";
|
||||
|
||||
const int sockfd = httpd_req_to_sockfd(req);
|
||||
|
||||
if (sockfd < 0)
|
||||
ESP_LOGW(TAG, "httpd_req_to_sockfd() failed with %i", sockfd);
|
||||
else
|
||||
{
|
||||
struct sockaddr_in6 addr; // esp_http_server uses IPv6 addressing
|
||||
socklen_t addr_size = sizeof(addr);
|
||||
const int result = getpeername(sockfd, (struct sockaddr *)&addr, &addr_size);
|
||||
|
||||
if (result < 0)
|
||||
ESP_LOGW(TAG, "getpeername() failed with %i", result);
|
||||
else
|
||||
inet_ntop(AF_INET, &addr.sin6_addr.un.u32_addr[3], ipstr, sizeof(ipstr));
|
||||
}
|
||||
|
||||
ESP_LOGW(TAG, LOG_FMT("URI '%s' not found for %s"), req->uri, ipstr);
|
||||
return httpd_req_handle_err(req, HTTPD_404_NOT_FOUND);
|
||||
}
|
||||
case HTTPD_405_METHOD_NOT_ALLOWED:
|
||||
ESP_LOGW(TAG, LOG_FMT("Method '%d' not allowed for URI '%s'"),
|
||||
req->method, req->uri);
|
||||
|
||||
@@ -416,14 +416,14 @@ esp_err_t httpd_ws_send_frame_async(httpd_handle_t hd, int fd, httpd_ws_frame_t
|
||||
}
|
||||
|
||||
/* Send off header */
|
||||
if (sess->send_fn(hd, fd, (const char *)header_buf, tx_len, 0) < 0) {
|
||||
if (sess->send_fn(hd, fd, (const char *)header_buf, tx_len, MSG_MORE) < 0) {
|
||||
ESP_LOGW(TAG, LOG_FMT("Failed to send WS header"));
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
/* Send off payload */
|
||||
if(frame->len > 0 && frame->payload != NULL) {
|
||||
if (sess->send_fn(hd, fd, (const char *)frame->payload, frame->len, 0) < 0) {
|
||||
if (sess->send_fn(hd, fd, (const char *)frame->payload, frame->len, MSG_MORE) < 0) {
|
||||
ESP_LOGW(TAG, LOG_FMT("Failed to send WS payload"));
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_assert.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/io_mux_reg.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -22,20 +20,35 @@ typedef enum clock_out_channel {
|
||||
CLKOUT_CHANNEL_MAX,
|
||||
} clock_out_channel_t;
|
||||
|
||||
#if SOC_GPIO_CLOCKOUT_BY_IO_MUX
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define CLKOUT_CHANNEL1_GPIO GPIO_NUM_0
|
||||
#define CLKOUT_CHANNEL2_GPIO GPIO_NUM_3
|
||||
#define CLKOUT_CHANNEL3_GPIO GPIO_NUM_1
|
||||
#define FUNC_CLK_OUT1 FUNC_GPIO0_CLK_OUT1
|
||||
#define FUNC_CLK_OUT2 FUNC_U0RXD_CLK_OUT2
|
||||
#define FUNC_CLK_OUT3 FUNC_U0TXD_CLK_OUT3
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||
#define CLKOUT_CHANNEL1_GPIO GPIO_NUM_20
|
||||
#define CLKOUT_CHANNEL2_GPIO GPIO_NUM_19
|
||||
#define CLKOUT_CHANNEL3_GPIO GPIO_NUM_18
|
||||
#define FUNC_CLK_OUT1 FUNC_GPIO20_CLK_OUT1
|
||||
#define FUNC_CLK_OUT2 FUNC_GPIO19_CLK_OUT2
|
||||
#define FUNC_CLK_OUT3 FUNC_DAC_2_CLK_OUT3
|
||||
|
||||
#endif
|
||||
#define IONUM_TO_CLKOUT_CHANNEL(gpio_num) ((gpio_num == CLKOUT_CHANNEL1_GPIO) ? CLKOUT_CHANNEL_1 : \
|
||||
(gpio_num == CLKOUT_CHANNEL2_GPIO) ? CLKOUT_CHANNEL_2 : \
|
||||
(gpio_num == CLKOUT_CHANNEL3_GPIO) ? CLKOUT_CHANNEL_3 : -1)
|
||||
(gpio_num == CLKOUT_CHANNEL3_GPIO) ? CLKOUT_CHANNEL_3 : 0)
|
||||
#define CLKOUT_CHANNEL_TO_IOMUX_FUNC(channel) ((channel == CLKOUT_CHANNEL_1) ? FUNC_CLK_OUT1 : \
|
||||
(channel == CLKOUT_CHANNEL_2) ? FUNC_CLK_OUT2 : \
|
||||
(channel == CLKOUT_CHANNEL_3) ? FUNC_CLK_OUT3 : -1)
|
||||
(channel == CLKOUT_CHANNEL_3) ? FUNC_CLK_OUT3 : 0)
|
||||
#define IS_VALID_CLKOUT_IO(gpio_num) ((gpio_num == CLKOUT_CHANNEL1_GPIO) || (gpio_num == CLKOUT_CHANNEL2_GPIO) || (gpio_num == CLKOUT_CHANNEL3_GPIO))
|
||||
#elif SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX
|
||||
#define CLKOUT_CHANNEL_TO_GPIO_SIG_ID(channel) ((channel == CLKOUT_CHANNEL_1) ? CLK_OUT_OUT1_IDX : \
|
||||
(channel == CLKOUT_CHANNEL_2) ? CLK_OUT_OUT2_IDX : \
|
||||
(channel == CLKOUT_CHANNEL_3) ? CLK_OUT_OUT3_IDX : SIG_GPIO_OUT_IDX)
|
||||
#define IS_VALID_CLKOUT_IO(gpio_num) GPIO_IS_VALID_GPIO(gpio_num)
|
||||
#endif
|
||||
|
||||
#define CLKOUT_CHANNEL_MASK(channel) ((channel == CLKOUT_CHANNEL_1) ? CLK_OUT1 : \
|
||||
(channel == CLKOUT_CHANNEL_2) ? CLK_OUT2 : \
|
||||
@@ -45,8 +58,6 @@ typedef enum clock_out_channel {
|
||||
(channel == CLKOUT_CHANNEL_2) ? CLK_OUT2_S : \
|
||||
(channel == CLKOUT_CHANNEL_3) ? CLK_OUT3_S : 0)
|
||||
|
||||
ESP_STATIC_ASSERT(CLKOUT_CHANNEL_MAX == SOC_GPIO_CLOCKOUT_CHANNEL_NUM, "clock_out_channel enumeration mismatch");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -11,9 +11,8 @@
|
||||
#include "esp_clock_output.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
#include "soc/clkout_channel.h"
|
||||
#include "clkout_channel.h"
|
||||
#include "hal/gpio_hal.h"
|
||||
#include "hal/clk_tree_hal.h"
|
||||
#include "hal/clk_tree_ll.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/io_mux_reg.h"
|
||||
@@ -21,7 +20,7 @@
|
||||
typedef struct clkout_channel_handle {
|
||||
bool is_mapped;
|
||||
soc_clkout_sig_id_t mapped_clock;
|
||||
clock_out_channel_t channel_id;
|
||||
uint8_t channel_id;
|
||||
uint8_t ref_cnt;
|
||||
uint64_t mapped_io_bmap;
|
||||
portMUX_TYPE clkout_channel_lock;
|
||||
@@ -88,12 +87,13 @@ static clkout_channel_handle_t* clkout_channel_alloc(soc_clkout_sig_id_t clk_sig
|
||||
allocated_channel->mapped_io_bmap |= BIT(gpio_num);
|
||||
allocated_channel->mapped_clock = clk_sig;
|
||||
allocated_channel->ref_cnt++;
|
||||
|
||||
if (allocated_channel->ref_cnt == 1) {
|
||||
portENTER_CRITICAL(&s_clkout_lock);
|
||||
#if SOC_CLOCKOUT_HAS_SOURCE_GATE
|
||||
clk_ll_enable_clkout_source(clk_sig, true);
|
||||
#endif
|
||||
clk_hal_clock_output_setup(clk_sig, allocated_channel->channel_id);
|
||||
gpio_ll_set_pin_ctrl(clk_sig, CLKOUT_CHANNEL_MASK(allocated_channel->channel_id), CLKOUT_CHANNEL_SHIFT(allocated_channel->channel_id));
|
||||
portEXIT_CRITICAL(&s_clkout_lock);
|
||||
}
|
||||
portEXIT_CRITICAL(&allocated_channel->clkout_channel_lock);
|
||||
@@ -150,7 +150,7 @@ static void clkout_channel_free(clkout_channel_handle_t *channel_hdl)
|
||||
#if SOC_CLOCKOUT_HAS_SOURCE_GATE
|
||||
clk_ll_enable_clkout_source(channel_hdl->mapped_clock, false);
|
||||
#endif
|
||||
clk_hal_clock_output_teardown(channel_hdl->channel_id);
|
||||
gpio_ll_set_pin_ctrl(0, CLKOUT_CHANNEL_MASK(channel_hdl->channel_id), CLKOUT_CHANNEL_SHIFT(channel_hdl->channel_id));
|
||||
portEXIT_CRITICAL(&s_clkout_lock);
|
||||
channel_hdl->mapped_clock = CLKOUT_SIG_INVALID;
|
||||
channel_hdl->is_mapped = false;
|
||||
@@ -187,11 +187,7 @@ static void clkout_mapping_free(esp_clock_output_mapping_t *mapping_hdl)
|
||||
esp_err_t esp_clock_output_start(soc_clkout_sig_id_t clk_sig, gpio_num_t gpio_num, esp_clock_output_mapping_handle_t *clkout_mapping_ret_hdl)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE((clkout_mapping_ret_hdl != NULL), ESP_ERR_INVALID_ARG, TAG, "Clock out mapping handle passed in is invalid");
|
||||
#if SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX
|
||||
ESP_RETURN_ON_FALSE(GPIO_IS_VALID_GPIO(gpio_num), ESP_ERR_INVALID_ARG, TAG, "%s", "Output GPIO number error");
|
||||
#else
|
||||
ESP_RETURN_ON_FALSE(IS_VALID_CLKOUT_IO(gpio_num), ESP_ERR_INVALID_ARG, TAG, "%s", "Output GPIO number error");
|
||||
#endif
|
||||
|
||||
esp_clock_output_mapping_t *hdl;
|
||||
SLIST_FOREACH(hdl, &s_mapping_list, next) {
|
||||
@@ -218,18 +214,6 @@ esp_err_t esp_clock_output_stop(esp_clock_output_mapping_handle_t clkout_mapping
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER
|
||||
esp_err_t esp_clock_output_set_divider(esp_clock_output_mapping_handle_t clkout_mapping_hdl, uint32_t div_num)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(((div_num > 0) && (div_num <= 256)), ESP_ERR_INVALID_ARG, TAG, "Divider number must be in the range of [1, 256]");
|
||||
ESP_RETURN_ON_FALSE((clkout_mapping_hdl != NULL), ESP_ERR_INVALID_ARG, TAG, "Clock out mapping handle passed in is invalid");
|
||||
portENTER_CRITICAL(&clkout_mapping_hdl->clkout_mapping_lock);
|
||||
clk_hal_clock_output_set_divider(clkout_mapping_hdl->clkout_channel_hdl->channel_id, div_num);
|
||||
portEXIT_CRITICAL(&clkout_mapping_hdl->clkout_mapping_lock);
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
// Due to a hardware bug, PIN_CTRL cannot select 0xf output, whereas 0xf is the default value.
|
||||
__attribute__((constructor))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ typedef struct esp_clock_output_mapping *esp_clock_output_mapping_handle_t;
|
||||
*
|
||||
* @param[in] clk_src The clock signal source to be mapped to GPIOs
|
||||
* @param[in] gpio_num GPIO number to be mapped soc_root_clk signal source
|
||||
* @param[out] clkout_mapping_ret_hdl Clock output control handler
|
||||
* @param[out] clkout_mapping_ret_hdl Clock output controll handler
|
||||
* @return
|
||||
* - ESP_OK: Output specified clock signal to specified GPIO successfully
|
||||
* - ESP_ERR_INVALID_ARG: Specified GPIO not supported to output internal clock
|
||||
@@ -36,26 +36,12 @@ esp_err_t esp_clock_output_start(soc_clkout_sig_id_t clk_sig, gpio_num_t gpio_nu
|
||||
|
||||
/**
|
||||
* @brief Stop clock signal to GPIO outputting
|
||||
* @param[in] clkout_mapping_hdl Clock output mapping control handle
|
||||
* @param[in] clkout_mapping_hdl Clock output mapping controll handle
|
||||
* @return
|
||||
* - ESP_OK: Disable the clock output on GPIO successfully
|
||||
* - ESP_ERR_INVALID_ARG The clock mapping handle is not initialized yet
|
||||
* - ESP_ERR_INVALID_STATE The clock mapping handle is already in the disabled state
|
||||
* - ESP_ERR_INVALID_STATE The clock in handle is already in the disabled state
|
||||
*/
|
||||
esp_err_t esp_clock_output_stop(esp_clock_output_mapping_handle_t clkout_mapping_hdl);
|
||||
|
||||
#if SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER
|
||||
/**
|
||||
* @brief Output the mapped clock after frequency division
|
||||
* @param clkout_mapping_hdl clkout_mapping_hdl Clock output mapping control handle
|
||||
* @param div_num clock frequency division value, should be in the range of 1 ~ 256
|
||||
* @return
|
||||
* - ESP_OK: Disable the clock output on GPIO successfully
|
||||
* - ESP_ERR_INVALID_ARG The clock mapping handle is not initialized yet or the div_num is in bad range
|
||||
*/
|
||||
esp_err_t esp_clock_output_set_divider(esp_clock_output_mapping_handle_t clkout_mapping_hdl, uint32_t div_num);
|
||||
#endif
|
||||
|
||||
#endif // SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX || SOC_GPIO_CLOCKOUT_BY_IO_MUX
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ void rtc_clk_cpu_set_to_default_config(void);
|
||||
* Currently, this function is only used for tracking whether USB Serial/JTAG is using the 48MHz PHY clock
|
||||
*
|
||||
* Note: Calling this function only helps to not disable the BBPLL clock in `rtc_clk_cpu_freq_set_config`.
|
||||
* For light and deep sleep, whether to disable the BBPLL in the internal call to `rtc_clk_cpu_freq_set_xtal`
|
||||
* For light and deep sleep, whether to disable the BBPLL in the interal call to `rtc_clk_cpu_freq_set_xtal`
|
||||
* varies for targets.
|
||||
* On ESP32C3/S3, USB CDC device can not function properly during sleep due to the lack of APB clock. Therefore.
|
||||
* `rtc_clk_cpu_freq_set_xtal` will always disable BBPLL, no matter whether BBPLL has any consumer.
|
||||
@@ -65,13 +65,6 @@ void rtc_clk_mpll_disable(void);
|
||||
* @param[in] mpll_freq MPLL frequency
|
||||
*/
|
||||
void rtc_clk_mpll_configure(uint32_t xtal_freq, uint32_t mpll_freq);
|
||||
|
||||
/**
|
||||
* Get the MPLL frequency
|
||||
* @return the value of MPLL frequency in MHz
|
||||
*/
|
||||
uint32_t rtc_clk_mpll_get_freq(void);
|
||||
|
||||
#endif //#if SOC_CLK_MPLL_SUPPORTED
|
||||
|
||||
/**
|
||||
|
||||
@@ -586,6 +586,7 @@ void sleep_smp_cpu_sleep_prepare(void)
|
||||
esp_ipc_isr_call((esp_ipc_isr_func_t)smp_core_do_retention, NULL);
|
||||
#else
|
||||
esp_ipc_isr_stall_other_cpu();
|
||||
esp_ipc_isr_stall_pause();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -600,6 +601,7 @@ void sleep_smp_cpu_wakeup_prepare(void)
|
||||
}
|
||||
atomic_store(&s_smp_retention_state[core_id], SMP_IDLE);
|
||||
#else
|
||||
esp_ipc_isr_stall_resume();
|
||||
esp_ipc_isr_release_other_cpu();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -209,7 +209,6 @@ void esp_cpu_configure_region_protection(void)
|
||||
|
||||
// 6. LP memory
|
||||
#if CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT && !BOOTLOADER_BUILD
|
||||
extern int _rtc_text_start;
|
||||
extern int _rtc_text_end;
|
||||
/* Reset the corresponding PMP config because PMP_ENTRY_SET only sets the given bits
|
||||
* Bootloader might have given extra permissions and those won't be cleared
|
||||
@@ -219,9 +218,13 @@ void esp_cpu_configure_region_protection(void)
|
||||
PMP_ENTRY_CFG_RESET(11);
|
||||
PMP_ENTRY_CFG_RESET(12);
|
||||
PMP_ENTRY_SET(9, SOC_RTC_IRAM_LOW, NONE);
|
||||
// First part of LP mem is reserved for RTC reserved mem (shared between bootloader and app)
|
||||
// as well as memory for ULP coprocessor
|
||||
PMP_ENTRY_SET(10, (int)&_rtc_text_start, PMP_TOR | RW);
|
||||
#if CONFIG_ULP_COPROC_RESERVE_MEM
|
||||
// First part of LP mem is reserved for coprocessor
|
||||
PMP_ENTRY_SET(10, SOC_RTC_IRAM_LOW + CONFIG_ULP_COPROC_RESERVE_MEM, PMP_TOR | RW);
|
||||
#else // CONFIG_ULP_COPROC_RESERVE_MEM
|
||||
// Repeat same previous entry, to ensure next entry has correct base address (TOR)
|
||||
PMP_ENTRY_SET(10, SOC_RTC_IRAM_LOW, NONE);
|
||||
#endif // !CONFIG_ULP_COPROC_RESERVE_MEM
|
||||
PMP_ENTRY_SET(11, (int)&_rtc_text_end, PMP_TOR | RX);
|
||||
PMP_ENTRY_SET(12, SOC_RTC_IRAM_HIGH, PMP_TOR | RW);
|
||||
#else
|
||||
|
||||
@@ -159,10 +159,6 @@ const pmu_sleep_config_t* pmu_sleep_config_default(
|
||||
config->digital = digital_default;
|
||||
|
||||
pmu_sleep_analog_config_t analog_default = PMU_SLEEP_ANALOG_LSLP_CONFIG_DEFAULT(pd_flags);
|
||||
#if CONFIG_SPIRAM
|
||||
analog_default.hp_sys.analog.pd_cur = 1;
|
||||
analog_default.lp_sys[PMU_MODE_LP_SLEEP].analog.pd_cur = 1;
|
||||
#endif
|
||||
config->analog = analog_default;
|
||||
}
|
||||
return config;
|
||||
@@ -261,13 +257,13 @@ void pmu_sleep_init(const pmu_sleep_config_t *config, bool dslp)
|
||||
void pmu_sleep_increase_ldo_volt(void) {
|
||||
REG_SET_FIELD(PMU_HP_ACTIVE_HP_REGULATOR0_REG, PMU_HP_ACTIVE_HP_REGULATOR_DBIAS, 30);
|
||||
REG_SET_BIT(PMU_HP_ACTIVE_HP_REGULATOR0_REG, PMU_HP_ACTIVE_HP_REGULATOR_XPD);
|
||||
// Decrease the DCDC voltage to reduce the voltage difference between the DCDC and the LDO to avoid overshooting the DCDC voltage during wake-up.
|
||||
REG_SET_FIELD(PMU_HP_ACTIVE_BIAS_REG, PMU_HP_ACTIVE_DCM_VSET, 24);
|
||||
}
|
||||
|
||||
void pmu_sleep_shutdown_dcdc(void) {
|
||||
SET_PERI_REG_MASK(LP_SYSTEM_REG_SYS_CTRL_REG, LP_SYSTEM_REG_LP_FIB_DCDC_SWITCH); //0: enable, 1: disable
|
||||
REG_SET_BIT(PMU_DCM_CTRL_REG, PMU_DCDC_OFF_REQ);
|
||||
// Decrease the DCDC voltage to reduce the voltage difference between the DCDC and the LDO to avoid overshooting the DCDC voltage during wake-up.
|
||||
REG_SET_FIELD(PMU_HP_ACTIVE_BIAS_REG, PMU_HP_ACTIVE_DCM_VSET, 24);
|
||||
// Decrease hp_ldo voltage.
|
||||
REG_SET_FIELD(PMU_HP_ACTIVE_HP_REGULATOR0_REG, PMU_HP_ACTIVE_HP_REGULATOR_DBIAS, 24);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define PMU_SDIO_WAKEUP_EN BIT(0)
|
||||
#define PMU_LP_CORE_WAKEUP_EN BIT(1)
|
||||
#define PMU_SW_WAKEUP_HP_EN BIT(1)
|
||||
#define PMU_GPIO_WAKEUP_EN BIT(2)
|
||||
#define PMU_USB_WAKEUP_EN BIT(3)
|
||||
#define PMU_UART4_WAKEUP_EN BIT(4)
|
||||
@@ -26,7 +26,7 @@ extern "C" {
|
||||
#define PMU_LP_TIMER_WAKEUP_EN BIT(13)
|
||||
#define PMU_BOD_WAKEUP_EN BIT(14)
|
||||
#define PMU_VDDBAT_UNDERVOLT_WAKEUP_EN BIT(15)
|
||||
#define PMU_LP_CORE_TRAP_WAKEUP_EN BIT(16)
|
||||
#define PMU_LP_CORE_WAKEUP_EN BIT(16)
|
||||
#define PMU_ETM_WAKEUP_EN BIT(17)
|
||||
#define PMU_LP_TIMER1_WAKEUP_EN BIT(18)
|
||||
#define PMU_LP_I2S_WAKEUP_EN BIT(19)
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "esp32p4/rom/rtc.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "esp_private/rtc_clk.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_hw_log.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "hal/clk_tree_ll.h"
|
||||
@@ -27,9 +26,6 @@ static const char *TAG = "rtc_clk";
|
||||
// CPLL frequency option, in 360/400MHz. Zero if CPLL is not enabled.
|
||||
static int s_cur_cpll_freq = 0;
|
||||
|
||||
// MPLL frequency option, 400MHz. Zero if MPLL is not enabled.
|
||||
static DRAM_ATTR uint32_t s_cur_mpll_freq = 0;
|
||||
|
||||
void rtc_clk_32k_enable(bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
@@ -487,7 +483,6 @@ bool rtc_dig_8m_enabled(void)
|
||||
void rtc_clk_mpll_disable(void)
|
||||
{
|
||||
clk_ll_mpll_disable();
|
||||
s_cur_mpll_freq = 0;
|
||||
}
|
||||
|
||||
void rtc_clk_mpll_enable(void)
|
||||
@@ -505,10 +500,4 @@ void rtc_clk_mpll_configure(uint32_t xtal_freq, uint32_t mpll_freq)
|
||||
while(!regi2c_ctrl_ll_mpll_calibration_is_done());
|
||||
/* MPLL calibration stop */
|
||||
regi2c_ctrl_ll_mpll_calibration_stop();
|
||||
s_cur_mpll_freq = mpll_freq;
|
||||
}
|
||||
|
||||
uint32_t rtc_clk_mpll_get_freq(void)
|
||||
{
|
||||
return s_cur_mpll_freq;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "esp_private/esp_sleep_internal.h"
|
||||
#include "esp_private/esp_timer_private.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "esp_private/rtc_clk.h"
|
||||
#include "esp_private/sleep_event.h"
|
||||
#include "esp_private/system_internal.h"
|
||||
#include "esp_log.h"
|
||||
@@ -28,7 +27,6 @@
|
||||
#include "soc/soc_caps.h"
|
||||
#include "driver/rtc_io.h"
|
||||
#include "hal/rtc_io_hal.h"
|
||||
#include "hal/clk_tree_hal.h"
|
||||
|
||||
#if SOC_PM_SUPPORT_PMU_MODEM_STATE
|
||||
#include "esp_private/pm_impl.h"
|
||||
@@ -926,13 +924,6 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if SOC_CLK_MPLL_SUPPORTED
|
||||
uint32_t mpll_freq_mhz = rtc_clk_mpll_get_freq();
|
||||
if (mpll_freq_mhz) {
|
||||
rtc_clk_mpll_disable();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SOC_DCDC_SUPPORTED
|
||||
uint64_t ldo_increased_us = rtc_time_slowclk_to_us(rtc_time_get() - s_config.rtc_ticks_at_ldo_prepare, s_config.rtc_clk_cal_period);
|
||||
if (ldo_increased_us < LDO_POWER_TAKEOVER_PREPARATION_TIME_US) {
|
||||
@@ -960,13 +951,6 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m
|
||||
result = call_rtc_sleep_start(reject_triggers, config.lslp_mem_inf_fpu, deep_sleep);
|
||||
#endif
|
||||
|
||||
#if SOC_CLK_MPLL_SUPPORTED
|
||||
if (mpll_freq_mhz) {
|
||||
rtc_clk_mpll_enable();
|
||||
rtc_clk_mpll_configure(clk_hal_xtal_get_freq_mhz(), mpll_freq_mhz);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Unhold the SPI CS pin */
|
||||
#if (CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP && CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND)
|
||||
#if !CONFIG_IDF_TARGET_ESP32H2 // ESP32H2 TODO IDF-7359: related rtcio ll func not supported yet
|
||||
@@ -1260,9 +1244,9 @@ esp_err_t esp_light_sleep_start(void)
|
||||
sleep_smp_cpu_sleep_prepare();
|
||||
#else
|
||||
esp_ipc_isr_stall_other_cpu();
|
||||
#endif
|
||||
esp_ipc_isr_stall_pause();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION && CONFIG_PM_SLP_IRAM_OPT
|
||||
/* Cache Suspend 0: if CONFIG_PM_SLP_IRAM_OPT is enabled, suspend cache here so that the access to flash
|
||||
@@ -1411,10 +1395,10 @@ esp_err_t esp_light_sleep_start(void)
|
||||
#endif
|
||||
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
esp_ipc_isr_stall_resume();
|
||||
#if CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP && SOC_PM_CPU_RETENTION_BY_SW
|
||||
sleep_smp_cpu_wakeup_prepare();
|
||||
#else
|
||||
esp_ipc_isr_stall_resume();
|
||||
esp_ipc_isr_release_other_cpu();
|
||||
#endif
|
||||
#endif
|
||||
@@ -1424,6 +1408,7 @@ esp_err_t esp_light_sleep_start(void)
|
||||
wdt_hal_disable(&rtc_wdt_ctx);
|
||||
wdt_hal_write_protect_enable(&rtc_wdt_ctx);
|
||||
}
|
||||
portEXIT_CRITICAL(&s_config.lock);
|
||||
|
||||
#if CONFIG_ESP_TASK_WDT_USE_ESP_TIMER
|
||||
/* Restart the Task Watchdog timer as it was stopped before sleeping. */
|
||||
@@ -1440,8 +1425,6 @@ esp_err_t esp_light_sleep_start(void)
|
||||
s_sleep_ctx->sleep_request_result = err;
|
||||
}
|
||||
#endif
|
||||
|
||||
portEXIT_CRITICAL(&s_config.lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -20,8 +20,6 @@
|
||||
static const int test_clk_out_io[] = {0, 1, 3};
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||
static const int test_clk_out_io[] = {18, 19, 20};
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
static const int test_clk_out_io[] = {7, 8};
|
||||
#else
|
||||
static const int test_clk_out_io[] = {3, 4, 5, 6};
|
||||
#endif
|
||||
@@ -35,9 +33,6 @@ void output_clock_1(void *pvParameter)
|
||||
esp_clock_output_mapping_handle_t clkout_mapping_hdl;
|
||||
for (int i = 0; i < TEST_LOOPS; ++i) {
|
||||
TEST_ESP_OK(esp_clock_output_start(test_clk_out_sig[0], test_clk_out_io[0], &clkout_mapping_hdl));
|
||||
#if SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER
|
||||
TEST_ESP_OK(esp_clock_output_set_divider(clkout_mapping_hdl, 8));
|
||||
#endif
|
||||
vTaskDelay(3);
|
||||
TEST_ESP_OK(esp_clock_output_stop(clkout_mapping_hdl));
|
||||
vTaskDelay(7);
|
||||
@@ -59,7 +54,6 @@ void output_clock_2(void *pvParameter)
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
#if SOC_GPIO_CLOCKOUT_CHANNEL_NUM >= 3
|
||||
void output_clock_3(void *pvParameter)
|
||||
{
|
||||
rtc_dig_clk8m_enable();
|
||||
@@ -73,7 +67,7 @@ void output_clock_3(void *pvParameter)
|
||||
xSemaphoreGive(test_done_semphr);
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// This case is now tested only manually
|
||||
TEST_CASE("GPIO output internal clock", "[gpio_output_clock][ignore]")
|
||||
@@ -81,12 +75,10 @@ TEST_CASE("GPIO output internal clock", "[gpio_output_clock][ignore]")
|
||||
test_done_semphr = xSemaphoreCreateCounting(3, 0);
|
||||
xTaskCreate(&output_clock_1, "output_clock_1", 4096, NULL, 4, NULL);
|
||||
xTaskCreate(&output_clock_2, "output_clock_2", 4096, NULL, 4, NULL);
|
||||
#if SOC_GPIO_CLOCKOUT_CHANNEL_NUM >= 3
|
||||
xTaskCreate(&output_clock_3, "output_clock_3", 4096, NULL, 4, NULL);
|
||||
#endif
|
||||
|
||||
int cnt = 0;
|
||||
while (cnt < SOC_GPIO_CLOCKOUT_CHANNEL_NUM) {
|
||||
while (cnt < 3) {
|
||||
if (xSemaphoreTake(test_done_semphr, portMAX_DELAY) == pdTRUE) {
|
||||
cnt++;
|
||||
}
|
||||
@@ -94,13 +86,8 @@ TEST_CASE("GPIO output internal clock", "[gpio_output_clock][ignore]")
|
||||
vTaskDelay(1);
|
||||
|
||||
vSemaphoreDelete(test_done_semphr);
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
/* ESP32 clock out channel pin reuses UART TX/RX pin, restore its default
|
||||
configuration at the end of the test */
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD);
|
||||
gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_U0TXD);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef _ESP_NETIF_PPP_H_
|
||||
#define _ESP_NETIF_PPP_H_
|
||||
|
||||
#include "esp_netif_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -5,5 +5,5 @@ set(sources "test_app_main.c"
|
||||
# the component must be registered as a WHOLE_ARCHIVE
|
||||
idf_component_register(SRCS ${sources}
|
||||
INCLUDE_DIRS "."
|
||||
PRIV_REQUIRES unity esp_pm ulp driver esp_timer esp_psram
|
||||
PRIV_REQUIRES unity esp_pm ulp driver esp_timer
|
||||
WHOLE_ARCHIVE)
|
||||
|
||||
@@ -14,31 +14,3 @@ from pytest_embedded import Dut
|
||||
], indirect=True)
|
||||
def test_esp_pm(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
# psram attr tests with xip_psram
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'pm_xip_psram_esp32s2'
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_esp_attr_xip_psram_esp32s2(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
# psram attr tests with xip_psram
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'pm_xip_psram_esp32s3'
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_esp_attr_xip_psram_esp32s3(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
|
||||
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
|
||||
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
|
||||
CONFIG_SPIRAM_RODATA=y
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user