mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Add support for esp32h2 beta2
This commit is contained in:
parent
e1d07c0cf2
commit
b474c83840
@ -697,7 +697,11 @@ if(CONFIG_BT_ENABLED)
|
|||||||
"-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
|
"-L${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
|
||||||
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
|
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
|
||||||
elseif(CONFIG_IDF_TARGET_ESP32H2)
|
elseif(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
add_prebuilt_library(nimblelib "controller/lib_esp32h2/esp32h2-bt-lib/libble_app.a")
|
if(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1)
|
||||||
|
add_prebuilt_library(nimblelib "controller/lib_esp32h2/esp32h2-bt-lib/beta1/libble_app.a")
|
||||||
|
elseif(CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2)
|
||||||
|
add_prebuilt_library(nimblelib "controller/lib_esp32h2/esp32h2-bt-lib/beta2/libble_app.a")
|
||||||
|
endif()
|
||||||
target_link_libraries(${COMPONENT_LIB} PRIVATE nimblelib)
|
target_link_libraries(${COMPONENT_LIB} PRIVATE nimblelib)
|
||||||
elseif(CONFIG_IDF_TARGET_ESP32C2)
|
elseif(CONFIG_IDF_TARGET_ESP32C2)
|
||||||
add_prebuilt_library(nimblelib "controller/lib_esp32c2/esp32c2-bt-lib/libble_app.a")
|
add_prebuilt_library(nimblelib "controller/lib_esp32c2/esp32c2-bt-lib/libble_app.a")
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "esp_pm.h"
|
#include "esp_pm.h"
|
||||||
#include "esp_phy_init.h"
|
#include "esp_phy_init.h"
|
||||||
#include "soc/system_reg.h"
|
#include "soc/system_reg.h"
|
||||||
|
#include "soc/clkrst_reg.h"
|
||||||
|
|
||||||
#include "hci_uart.h"
|
#include "hci_uart.h"
|
||||||
#include "bt_osi_mem.h"
|
#include "bt_osi_mem.h"
|
||||||
@ -57,9 +58,13 @@
|
|||||||
#define OSI_COEX_VERSION 0x00010006
|
#define OSI_COEX_VERSION 0x00010006
|
||||||
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
|
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1
|
||||||
#define EXT_FUNC_VERSION 0x20220125
|
#define EXT_FUNC_VERSION 0x20220125
|
||||||
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
|
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2
|
||||||
|
#define EXT_FUNC_VERSION 0xE0000001
|
||||||
|
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
|
||||||
|
#endif
|
||||||
/* Types definition
|
/* Types definition
|
||||||
************************************************************************
|
************************************************************************
|
||||||
*/
|
*/
|
||||||
@ -89,9 +94,11 @@ struct ext_funcs_t {
|
|||||||
void (* _task_delete)(void *task_handle);
|
void (* _task_delete)(void *task_handle);
|
||||||
void (*_osi_assert)(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2);
|
void (*_osi_assert)(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2);
|
||||||
uint32_t (* _os_random)(void);
|
uint32_t (* _os_random)(void);
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1
|
||||||
int (* _ecc_gen_key_pair)(uint8_t *pub, uint8_t *priv);
|
int (* _ecc_gen_key_pair)(uint8_t *pub, uint8_t *priv);
|
||||||
int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y, const uint8_t *local_priv_key, uint8_t *dhkey);
|
int (* _ecc_gen_dh_key)(const uint8_t *remote_pub_key_x, const uint8_t *remote_pub_key_y, const uint8_t *local_priv_key, uint8_t *dhkey);
|
||||||
int (* _esp_reset_rpa_moudle)(void);
|
int (* _esp_reset_rpa_moudle)(void);
|
||||||
|
#endif
|
||||||
uint32_t magic;
|
uint32_t magic;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -207,9 +214,11 @@ struct ext_funcs_t ext_funcs_ro = {
|
|||||||
._task_delete = task_delete_wrapper,
|
._task_delete = task_delete_wrapper,
|
||||||
._osi_assert = osi_assert_wrapper,
|
._osi_assert = osi_assert_wrapper,
|
||||||
._os_random = osi_random_wrapper,
|
._os_random = osi_random_wrapper,
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1
|
||||||
._ecc_gen_key_pair = ble_sm_alg_gen_key_pair,
|
._ecc_gen_key_pair = ble_sm_alg_gen_key_pair,
|
||||||
._ecc_gen_dh_key = ble_sm_alg_gen_dhkey,
|
._ecc_gen_dh_key = ble_sm_alg_gen_dhkey,
|
||||||
._esp_reset_rpa_moudle = esp_reset_rpa_moudle,
|
._esp_reset_rpa_moudle = esp_reset_rpa_moudle,
|
||||||
|
#endif
|
||||||
.magic = EXT_FUNC_MAGIC_VALUE,
|
.magic = EXT_FUNC_MAGIC_VALUE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -566,8 +575,17 @@ void controller_sleep_deinit(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2
|
||||||
|
void periph_module_etm_active()
|
||||||
|
{
|
||||||
|
/*This part for esp32h2 beta2*/
|
||||||
|
REG_SET_BIT(SYSTEM_MODCLK_CONF_REG, SYSTEM_ETM_CLK_SEL | SYSTEM_ETM_CLK_ACTIVE ); //Active ETM clock
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
||||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
|
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
@ -613,7 +631,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
/* Initialize default event queue */
|
/* Initialize default event queue */
|
||||||
ble_npl_eventq_init(nimble_port_get_dflt_eventq());
|
ble_npl_eventq_init(nimble_port_get_dflt_eventq());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
periph_module_enable(PERIPH_BT_MODULE);
|
periph_module_enable(PERIPH_BT_MODULE);
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2
|
||||||
|
// only use for esp32h2 beta2
|
||||||
|
periph_module_etm_active();
|
||||||
|
#endif
|
||||||
|
|
||||||
// init phy
|
// init phy
|
||||||
esp_phy_enable();
|
esp_phy_enable();
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_nimble_mem.h"
|
#include "esp_nimble_mem.h"
|
||||||
|
#include "nimble/nimble_port.h"
|
||||||
#include "host/ble_hs.h"
|
#include "host/ble_hs.h"
|
||||||
|
|
||||||
static TaskHandle_t host_task_h;
|
static TaskHandle_t host_task_h;
|
||||||
@ -19,6 +20,21 @@ static struct ble_npl_eventq g_eventq_dflt;
|
|||||||
static struct ble_npl_sem ble_hs_stop_sem;
|
static struct ble_npl_sem ble_hs_stop_sem;
|
||||||
static struct ble_npl_event ble_hs_ev_stop;
|
static struct ble_npl_event ble_hs_ev_stop;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the host stop procedure has completed.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
ble_hs_stop_cb(int status, void *arg)
|
||||||
|
{
|
||||||
|
ble_npl_sem_release(&ble_hs_stop_sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nimble_port_stop_cb(struct ble_npl_event *ev)
|
||||||
|
{
|
||||||
|
ble_npl_sem_release(&ble_hs_stop_sem);
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t esp_nimble_init(void)
|
esp_err_t esp_nimble_init(void)
|
||||||
{
|
{
|
||||||
#if !SOC_ESP_NIMBLE_CONTROLLER
|
#if !SOC_ESP_NIMBLE_CONTROLLER
|
||||||
@ -63,11 +79,11 @@ esp_err_t esp_nimble_disable(void)
|
|||||||
ble_npl_sem_init(&ble_hs_stop_sem, 0);
|
ble_npl_sem_init(&ble_hs_stop_sem, 0);
|
||||||
|
|
||||||
/* Initiate a host stop procedure. */
|
/* Initiate a host stop procedure. */
|
||||||
rc = ble_hs_stop(&stop_listener, ble_hs_stop_cb,
|
err = ble_hs_stop(&stop_listener, ble_hs_stop_cb,
|
||||||
NULL);
|
NULL);
|
||||||
if (rc != 0) {
|
if (err != 0) {
|
||||||
ble_npl_sem_deinit(&ble_hs_stop_sem);
|
ble_npl_sem_deinit(&ble_hs_stop_sem);
|
||||||
return rc;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait till the host stop procedure is complete */
|
/* Wait till the host stop procedure is complete */
|
||||||
|
@ -118,9 +118,13 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
|||||||
*/
|
*/
|
||||||
esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type);
|
esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type);
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1
|
||||||
#define CONFIG_VERSION 0x20220409
|
#define CONFIG_VERSION 0x20220409
|
||||||
#define CONFIG_MAGIC 0x5A5AA5A5
|
#define CONFIG_MAGIC 0x5A5AA5A5
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2
|
||||||
|
#define CONFIG_VERSION 0x20211021
|
||||||
|
#define CONFIG_MAGIC 0x5A5AA5A5
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief Controller config options, depend on config mask.
|
* @brief Controller config options, depend on config mask.
|
||||||
* Config mask indicate which functions enabled, this means
|
* Config mask indicate which functions enabled, this means
|
||||||
@ -169,12 +173,16 @@ typedef struct {
|
|||||||
uint8_t ble_hci_uart_uart_parity;
|
uint8_t ble_hci_uart_uart_parity;
|
||||||
uint8_t enable_tx_cca;
|
uint8_t enable_tx_cca;
|
||||||
uint8_t cca_rssi_thresh;
|
uint8_t cca_rssi_thresh;
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1
|
||||||
uint8_t cca_drop_mode;
|
uint8_t cca_drop_mode;
|
||||||
int8_t cca_low_tx_pwr;
|
int8_t cca_low_tx_pwr;
|
||||||
|
#endif
|
||||||
uint8_t sleep_en;
|
uint8_t sleep_en;
|
||||||
uint8_t coex_phy_coded_tx_rx_time_limit;
|
uint8_t coex_phy_coded_tx_rx_time_limit;
|
||||||
uint8_t dis_scan_backoff;
|
uint8_t dis_scan_backoff;
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_1
|
||||||
uint8_t scan_classify_filter_enable;
|
uint8_t scan_classify_filter_enable;
|
||||||
|
#endif
|
||||||
uint32_t config_magic;
|
uint32_t config_magic;
|
||||||
} esp_bt_controller_config_t;
|
} esp_bt_controller_config_t;
|
||||||
|
|
||||||
|
@ -196,7 +196,10 @@ extern "C" {
|
|||||||
#if CONFIG_RTC_CLK_SRC_EXT_CRYS
|
#if CONFIG_RTC_CLK_SRC_EXT_CRYS
|
||||||
#define RTC_FREQ_N (32768) /* in Hz */
|
#define RTC_FREQ_N (32768) /* in Hz */
|
||||||
#else
|
#else
|
||||||
#pragma message "RTC clock source not available"
|
#define RTC_FREQ_N (32000) /* in Hz */
|
||||||
|
#if CONFIG_RTC_CLK_SRC_EXT_OSC || CONFIG_RTC_CLK_SRC_INT_RC32K
|
||||||
|
#pragma message "RTC clock source may not available"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user