mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/esp32c2_optimize_npl_api_v5.0' into 'release/v5.0'
Optimized NPL Freertos API See merge request espressif/esp-idf!21906
This commit is contained in:
commit
564b94fe5b
@ -596,7 +596,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
esp_err_t ret = ESP_OK;
|
esp_err_t ret = ESP_OK;
|
||||||
ble_npl_count_info_t npl_info;
|
ble_npl_count_info_t npl_info;
|
||||||
memset(&npl_info, 0, sizeof(ble_npl_count_info_t));
|
memset(&npl_info, 0, sizeof(ble_npl_count_info_t));
|
||||||
|
|
||||||
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_ERR_INVALID_STATE;
|
return ESP_ERR_INVALID_STATE;
|
||||||
@ -630,8 +629,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ble_get_npl_element_info(cfg, &npl_info);
|
ble_get_npl_element_info(cfg, &npl_info);
|
||||||
|
npl_freertos_set_controller_npl_info(&npl_info);
|
||||||
if (npl_freertos_mempool_init(&npl_info) != 0) {
|
if (npl_freertos_mempool_init() != 0) {
|
||||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
|
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
|
||||||
ret = ESP_ERR_INVALID_ARG;
|
ret = ESP_ERR_INVALID_ARG;
|
||||||
goto free_mem;
|
goto free_mem;
|
||||||
|
@ -613,8 +613,8 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ble_get_npl_element_info(cfg, &npl_info);
|
ble_get_npl_element_info(cfg, &npl_info);
|
||||||
|
npl_freertos_set_controller_npl_info(&npl_info);
|
||||||
if (npl_freertos_mempool_init(&npl_info) != 0) {
|
if (npl_freertos_mempool_init() != 0) {
|
||||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
|
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
|
||||||
ret = ESP_ERR_INVALID_ARG;
|
ret = ESP_ERR_INVALID_ARG;
|
||||||
goto free_mem;
|
goto free_mem;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 2d0c9d0d5df1fa825ed3c48df968e3c9b8c434ee
|
Subproject commit 10a3ea96e083dd0a7a18089407361fd52f0cbc47
|
@ -145,7 +145,7 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type
|
|||||||
*/
|
*/
|
||||||
esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||||
|
|
||||||
#define CONFIG_VERSION 0x20220824
|
#define CONFIG_VERSION 0x20230113
|
||||||
#define CONFIG_MAGIC 0x5A5AA5A5
|
#define CONFIG_MAGIC 0x5A5AA5A5
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -203,6 +203,7 @@ typedef struct {
|
|||||||
uint8_t cca_drop_mode;
|
uint8_t cca_drop_mode;
|
||||||
int8_t cca_low_tx_pwr;
|
int8_t cca_low_tx_pwr;
|
||||||
uint8_t main_xtal_freq;
|
uint8_t main_xtal_freq;
|
||||||
|
uint8_t ignore_wl_for_direct_adv;
|
||||||
uint32_t config_magic;
|
uint32_t config_magic;
|
||||||
} esp_bt_controller_config_t;
|
} esp_bt_controller_config_t;
|
||||||
|
|
||||||
@ -254,6 +255,7 @@ typedef struct {
|
|||||||
.dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \
|
.dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \
|
||||||
.ble_scan_classify_filter_enable = 0, \
|
.ble_scan_classify_filter_enable = 0, \
|
||||||
.main_xtal_freq = CONFIG_XTAL_FREQ, \
|
.main_xtal_freq = CONFIG_XTAL_FREQ, \
|
||||||
|
.ignore_wl_for_direct_adv = 0, \
|
||||||
.config_magic = CONFIG_MAGIC, \
|
.config_magic = CONFIG_MAGIC, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,14 +35,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint16_t evt_count;
|
|
||||||
uint16_t evtq_count;
|
|
||||||
uint16_t co_count;
|
|
||||||
uint16_t sem_count;
|
|
||||||
uint16_t mutex_count;
|
|
||||||
} ble_npl_count_info_t;
|
|
||||||
|
|
||||||
void nimble_port_init(void);
|
void nimble_port_init(void);
|
||||||
void nimble_port_deinit(void);
|
void nimble_port_deinit(void);
|
||||||
|
|
||||||
|
@ -35,8 +35,9 @@ void nimble_port_freertos_init(TaskFunction_t host_task_fn);
|
|||||||
void nimble_port_freertos_deinit(void);
|
void nimble_port_freertos_deinit(void);
|
||||||
void npl_freertos_funcs_init(void);
|
void npl_freertos_funcs_init(void);
|
||||||
void npl_freertos_funcs_deinit(void);
|
void npl_freertos_funcs_deinit(void);
|
||||||
int npl_freertos_mempool_init(ble_npl_count_info_t *npl_info);
|
int npl_freertos_mempool_init(void);
|
||||||
struct npl_funcs_t * npl_freertos_funcs_get(void);
|
struct npl_funcs_t * npl_freertos_funcs_get(void);
|
||||||
|
int npl_freertos_set_controller_npl_info(ble_npl_count_info_t *ctrl_npl_info);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,6 +22,14 @@ extern "C" {
|
|||||||
#define BLE_NPL_USE_ESP_TIMER (0)
|
#define BLE_NPL_USE_ESP_TIMER (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t evt_count;
|
||||||
|
uint16_t evtq_count;
|
||||||
|
uint16_t co_count;
|
||||||
|
uint16_t sem_count;
|
||||||
|
uint16_t mutex_count;
|
||||||
|
} ble_npl_count_info_t;
|
||||||
|
|
||||||
typedef void ble_npl_event_fn(struct ble_npl_event *ev);
|
typedef void ble_npl_event_fn(struct ble_npl_event *ev);
|
||||||
|
|
||||||
struct ble_npl_event_freertos {
|
struct ble_npl_event_freertos {
|
||||||
|
@ -59,6 +59,13 @@ struct os_mempool ble_freertos_mutex_pool;
|
|||||||
static os_membuf_t *ble_freertos_mutex_buf = NULL;
|
static os_membuf_t *ble_freertos_mutex_buf = NULL;
|
||||||
|
|
||||||
static uint16_t ble_freertos_total_event_cnt = 0;
|
static uint16_t ble_freertos_total_event_cnt = 0;
|
||||||
|
static ble_npl_count_info_t g_ctrl_npl_info = {
|
||||||
|
.co_count = 0,
|
||||||
|
.evt_count = 0,
|
||||||
|
.evtq_count = 0,
|
||||||
|
.mutex_count = 0,
|
||||||
|
.sem_count = 0,
|
||||||
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
IRAM_ATTR npl_freertos_os_started(void)
|
IRAM_ATTR npl_freertos_os_started(void)
|
||||||
@ -1032,8 +1039,17 @@ void npl_freertos_funcs_init(void)
|
|||||||
memcpy(npl_funcs, &npl_funcs_ro, sizeof(struct npl_funcs_t));
|
memcpy(npl_funcs, &npl_funcs_ro, sizeof(struct npl_funcs_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int npl_freertos_set_controller_npl_info(ble_npl_count_info_t *ctrl_npl_info)
|
||||||
|
{
|
||||||
|
if (!ctrl_npl_info) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int npl_freertos_mempool_init(ble_npl_count_info_t *npl_info)
|
memcpy(&g_ctrl_npl_info, ctrl_npl_info, sizeof(ble_npl_count_info_t));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int npl_freertos_mempool_init(void)
|
||||||
{
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
uint16_t ble_total_evt_count = 0;
|
uint16_t ble_total_evt_count = 0;
|
||||||
@ -1041,16 +1057,11 @@ int npl_freertos_mempool_init(ble_npl_count_info_t *npl_info)
|
|||||||
uint16_t ble_total_evtq_count = 0;
|
uint16_t ble_total_evtq_count = 0;
|
||||||
uint16_t ble_total_sem_count = 0;
|
uint16_t ble_total_sem_count = 0;
|
||||||
uint16_t ble_total_mutex_count = 0;
|
uint16_t ble_total_mutex_count = 0;
|
||||||
|
ble_total_evt_count = g_ctrl_npl_info.evt_count + BLE_HOST_EV_COUNT;
|
||||||
if (!npl_info) {
|
ble_total_evtq_count = g_ctrl_npl_info.evtq_count + BLE_HOST_EVQ_COUNT;
|
||||||
return -1;
|
ble_total_co_count = g_ctrl_npl_info.co_count + BLE_HOST_CO_COUNT;
|
||||||
}
|
ble_total_sem_count = g_ctrl_npl_info.sem_count + BLE_HOST_SEM_COUNT;
|
||||||
|
ble_total_mutex_count = g_ctrl_npl_info.mutex_count + BLE_HOST_MUTEX_COUNT;
|
||||||
ble_total_evt_count = npl_info->evt_count + BLE_HOST_EV_COUNT;
|
|
||||||
ble_total_evtq_count = npl_info->evtq_count + BLE_HOST_EVQ_COUNT;
|
|
||||||
ble_total_co_count = npl_info->co_count + BLE_HOST_CO_COUNT;
|
|
||||||
ble_total_sem_count = npl_info->sem_count + BLE_HOST_SEM_COUNT;
|
|
||||||
ble_total_mutex_count = npl_info->mutex_count + BLE_HOST_MUTEX_COUNT;
|
|
||||||
ble_freertos_total_event_cnt = ble_total_evt_count;
|
ble_freertos_total_event_cnt = ble_total_evt_count;
|
||||||
|
|
||||||
if (ble_total_evt_count) {
|
if (ble_total_evt_count) {
|
||||||
|
@ -562,7 +562,6 @@ bt_rf_coex_cfg_get_default = 0x40000ab0;
|
|||||||
bt_rf_coex_dft_pti_get_default = 0x40000ab4;
|
bt_rf_coex_dft_pti_get_default = 0x40000ab4;
|
||||||
bt_rf_coex_hooks_p_set = 0x40000ab8;
|
bt_rf_coex_hooks_p_set = 0x40000ab8;
|
||||||
r__os_mbuf_copypkthdr = 0x40000abc;
|
r__os_mbuf_copypkthdr = 0x40000abc;
|
||||||
r__os_msys_find_pool = 0x40000ac0;
|
|
||||||
r_ble_controller_get_rom_compile_version = 0x40000ac4;
|
r_ble_controller_get_rom_compile_version = 0x40000ac4;
|
||||||
r_ble_hci_ram_hs_acl_tx = 0x40000ac8;
|
r_ble_hci_ram_hs_acl_tx = 0x40000ac8;
|
||||||
r_ble_hci_ram_hs_cmd_tx = 0x40000acc;
|
r_ble_hci_ram_hs_cmd_tx = 0x40000acc;
|
||||||
@ -742,7 +741,6 @@ r_ble_ll_conn_is_empty_pdu = 0x40000df0;
|
|||||||
r_ble_ll_conn_is_lru = 0x40000df4;
|
r_ble_ll_conn_is_lru = 0x40000df4;
|
||||||
r_ble_ll_conn_master_init = 0x40000df8;
|
r_ble_ll_conn_master_init = 0x40000df8;
|
||||||
r_ble_ll_conn_module_reset = 0x40000e04;
|
r_ble_ll_conn_module_reset = 0x40000e04;
|
||||||
r_ble_ll_conn_next_event = 0x40000e08;
|
|
||||||
r_ble_ll_conn_num_comp_pkts_event_send = 0x40000e0c;
|
r_ble_ll_conn_num_comp_pkts_event_send = 0x40000e0c;
|
||||||
r_ble_ll_conn_process_conn_params = 0x40000e14;
|
r_ble_ll_conn_process_conn_params = 0x40000e14;
|
||||||
r_ble_ll_conn_req_peer_sca = 0x40000e18;
|
r_ble_ll_conn_req_peer_sca = 0x40000e18;
|
||||||
@ -825,14 +823,12 @@ r_ble_ll_get_tx_pwr_compensation = 0x40000f88;
|
|||||||
r_ble_ll_hci_acl_rx = 0x40000f8c;
|
r_ble_ll_hci_acl_rx = 0x40000f8c;
|
||||||
r_ble_ll_hci_adv_mode_ext = 0x40000f90;
|
r_ble_ll_hci_adv_mode_ext = 0x40000f90;
|
||||||
r_ble_ll_hci_adv_set_enable = 0x40000f94;
|
r_ble_ll_hci_adv_set_enable = 0x40000f94;
|
||||||
r_ble_ll_hci_cb_host_buf_size = 0x40000f98;
|
|
||||||
r_ble_ll_hci_cb_set_ctrlr_to_host_fc = 0x40000f9c;
|
r_ble_ll_hci_cb_set_ctrlr_to_host_fc = 0x40000f9c;
|
||||||
r_ble_ll_hci_cb_set_event_mask = 0x40000fa0;
|
r_ble_ll_hci_cb_set_event_mask = 0x40000fa0;
|
||||||
r_ble_ll_hci_cb_set_event_mask2 = 0x40000fa4;
|
r_ble_ll_hci_cb_set_event_mask2 = 0x40000fa4;
|
||||||
r_ble_ll_hci_chk_phy_masks = 0x40000fa8;
|
r_ble_ll_hci_chk_phy_masks = 0x40000fa8;
|
||||||
r_ble_ll_hci_cmd_proc = 0x40000fac;
|
r_ble_ll_hci_cmd_proc = 0x40000fac;
|
||||||
r_ble_ll_hci_cmd_rx = 0x40000fb0;
|
r_ble_ll_hci_cmd_rx = 0x40000fb0;
|
||||||
r_ble_ll_hci_ctlr_bb_cmd_proc = 0x40000fb4;
|
|
||||||
r_ble_ll_hci_disconnect = 0x40000fbc;
|
r_ble_ll_hci_disconnect = 0x40000fbc;
|
||||||
r_ble_ll_hci_ev_conn_update = 0x40000fc4;
|
r_ble_ll_hci_ev_conn_update = 0x40000fc4;
|
||||||
r_ble_ll_hci_ev_databuf_overflow = 0x40000fc8;
|
r_ble_ll_hci_ev_databuf_overflow = 0x40000fc8;
|
||||||
@ -902,7 +898,6 @@ r_ble_ll_is_valid_public_addr = 0x400010d4;
|
|||||||
r_ble_ll_is_valid_random_addr = 0x400010d8;
|
r_ble_ll_is_valid_random_addr = 0x400010d8;
|
||||||
r_ble_ll_misc_options_set = 0x400010e0;
|
r_ble_ll_misc_options_set = 0x400010e0;
|
||||||
r_ble_ll_modify_sca = 0x400010e4;
|
r_ble_ll_modify_sca = 0x400010e4;
|
||||||
r_ble_ll_modify_sca_action = 0x400010e8;
|
|
||||||
r_ble_ll_pdu_max_tx_octets_get = 0x400010ec;
|
r_ble_ll_pdu_max_tx_octets_get = 0x400010ec;
|
||||||
r_ble_ll_pdu_tx_time_get = 0x400010f0;
|
r_ble_ll_pdu_tx_time_get = 0x400010f0;
|
||||||
r_ble_ll_phy_to_phy_mode = 0x400010f4;
|
r_ble_ll_phy_to_phy_mode = 0x400010f4;
|
||||||
@ -1088,7 +1083,6 @@ r_ble_lll_adv_periodic_done = 0x4000143c;
|
|||||||
r_ble_lll_adv_periodic_event_done = 0x40001440;
|
r_ble_lll_adv_periodic_event_done = 0x40001440;
|
||||||
r_ble_lll_adv_periodic_rmvd_from_sched = 0x40001444;
|
r_ble_lll_adv_periodic_rmvd_from_sched = 0x40001444;
|
||||||
r_ble_lll_adv_periodic_schedule_first = 0x40001448;
|
r_ble_lll_adv_periodic_schedule_first = 0x40001448;
|
||||||
r_ble_lll_adv_periodic_start = 0x40001450;
|
|
||||||
r_ble_lll_adv_pri_schedule_tx_pdu = 0x40001458;
|
r_ble_lll_adv_pri_schedule_tx_pdu = 0x40001458;
|
||||||
r_ble_lll_adv_reschedule_event = 0x4000145c;
|
r_ble_lll_adv_reschedule_event = 0x4000145c;
|
||||||
r_ble_lll_adv_reschedule_periodic_event = 0x40001460;
|
r_ble_lll_adv_reschedule_periodic_event = 0x40001460;
|
||||||
@ -1320,7 +1314,6 @@ r_ble_phy_set_conn_ind_pdu = 0x40001890;
|
|||||||
r_ble_phy_set_conn_mode = 0x40001894;
|
r_ble_phy_set_conn_mode = 0x40001894;
|
||||||
r_ble_phy_set_dev_address = 0x40001898;
|
r_ble_phy_set_dev_address = 0x40001898;
|
||||||
r_ble_phy_set_rx_pwr_compensation = 0x4000189c;
|
r_ble_phy_set_rx_pwr_compensation = 0x4000189c;
|
||||||
r_ble_phy_set_scan_mode = 0x400018a4;
|
|
||||||
r_ble_phy_set_single_packet_rx_sequence = 0x400018ac;
|
r_ble_phy_set_single_packet_rx_sequence = 0x400018ac;
|
||||||
r_ble_phy_set_single_packet_tx_sequence = 0x400018b0;
|
r_ble_phy_set_single_packet_tx_sequence = 0x400018b0;
|
||||||
r_ble_phy_set_tx_rx_transition = 0x400018b4;
|
r_ble_phy_set_tx_rx_transition = 0x400018b4;
|
||||||
@ -1388,7 +1381,6 @@ r_os_cputime_timer_start = 0x400019d0;
|
|||||||
r_os_cputime_timer_stop = 0x400019d4;
|
r_os_cputime_timer_stop = 0x400019d4;
|
||||||
r_os_cputime_usecs_to_ticks = 0x400019d8;
|
r_os_cputime_usecs_to_ticks = 0x400019d8;
|
||||||
r_os_mbuf_adj = 0x400019dc;
|
r_os_mbuf_adj = 0x400019dc;
|
||||||
r_os_mbuf_append = 0x400019e0;
|
|
||||||
r_os_mbuf_appendfrom = 0x400019e4;
|
r_os_mbuf_appendfrom = 0x400019e4;
|
||||||
r_os_mbuf_cmpf = 0x400019e8;
|
r_os_mbuf_cmpf = 0x400019e8;
|
||||||
r_os_mbuf_cmpm = 0x400019ec;
|
r_os_mbuf_cmpm = 0x400019ec;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user