mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-08 14:16:35 +03:00
fix(ble/bluedroid): Optimize some bluedroid code
This commit is contained in:
@@ -2097,6 +2097,10 @@ esp_err_t esp_ble_gap_set_periodic_adv_subevent_data(esp_ble_per_adv_subevent_da
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
if ((subevent_data_params->num_subevents_with_data > 0x0F) || (!subevent_data_params->num_subevents_with_data)) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < subevent_data_params->num_subevents_with_data; i++)
|
||||
{
|
||||
if (subevent_data_params->subevent_params[i].subevent_data_len && (subevent_data_params->subevent_params[i].subevent_data == NULL)) {
|
||||
|
||||
@@ -963,18 +963,8 @@ typedef struct {
|
||||
uint8_t sid; /*!< ext adv sid */
|
||||
bool scan_req_notif; /*!< ext adv scan request event notify */
|
||||
#if (CONFIG_BT_BLE_FEAT_ADV_CODING_SELECTION)
|
||||
esp_ble_gap_adv_phy_options_t primary_adv_phy_options; /*!<
|
||||
0x00: The Host has no preferred or required coding when transmitting on the LE Coded PHY
|
||||
0x01: The Host prefers that S=2 coding be used when transmitting on the LE Coded PHY
|
||||
0x02: The Host prefers that S=8 coding be used when transmitting on the LE Coded PHY
|
||||
0x03: The Host requires that S=2 coding be used when transmitting on the LE Coded PHY
|
||||
0x04: The Host requires that S=8 coding be used when transmitting on the LE Coded PHY */
|
||||
esp_ble_gap_adv_phy_options_t secondary_adv_phy_options; /*!<
|
||||
0x00: The Host has no preferred or required coding when transmitting on the LE Coded PHY
|
||||
0x01: The Host prefers that S=2 coding be used when transmitting on the LE Coded PHY
|
||||
0x02: The Host prefers that S=8 coding be used when transmitting on the LE Coded PHY
|
||||
0x03: The Host requires that S=2 coding be used when transmitting on the LE Coded PHY
|
||||
0x04: The Host requires that S=8 coding be used when transmitting on the LE Coded PHY */
|
||||
esp_ble_gap_adv_phy_options_t primary_adv_phy_options; /*!< The Host's preference or requirement concerning coding scheme */
|
||||
esp_ble_gap_adv_phy_options_t secondary_adv_phy_options; /*!< The Host's preference or requirement concerning coding scheme(including for periodic advertising) */
|
||||
#endif // CONFIG_BT_BLE_FEAT_ADV_CODING_SELECTION
|
||||
} esp_ble_gap_ext_adv_params_t;
|
||||
|
||||
@@ -1097,7 +1087,7 @@ typedef struct {
|
||||
Otherwise: Reserved for future use
|
||||
*/
|
||||
|
||||
esp_ble_gap_rpt_phy_t secondly_phy; /*!< extend advertising secondary phy
|
||||
esp_ble_gap_rpt_phy_t secondary_phy; /*!< extend advertising secondary phy
|
||||
0x00: No packets on the secondary advertising physical channel
|
||||
0x01: Advertiser PHY is LE 1M
|
||||
0x02: Advertiser PHY is LE 2M
|
||||
@@ -1405,6 +1395,9 @@ typedef uint8_t esp_ble_cs_rtt_caps_opt_t;
|
||||
/** CS_SYNC 2M 2BT phy supported */
|
||||
#define ESP_BLE_CS_SYNC_PHYS_2M_2BT_SUPPORTED (1 << 2)
|
||||
|
||||
/**The length of Channel Sounding channel map */
|
||||
#define ESP_BLE_CS_CHAN_MAP_LEN 10
|
||||
|
||||
/**
|
||||
* @brief CS write cached remote supported capabilities parameters
|
||||
*/
|
||||
@@ -1584,24 +1577,24 @@ typedef struct {
|
||||
0x01: Reflector
|
||||
*/
|
||||
esp_ble_cs_rtt_type_opt_t rtt_type; /*!< 0x00: RTT AA-only
|
||||
0x01: RTT with 32-bit sounding sequence
|
||||
0x02: RTT with 96-bit sounding sequence
|
||||
0x03: RTT with 32-bit random sequence
|
||||
0x04: RTT with 64-bit random sequence
|
||||
0x05: RTT with 96-bit random sequence
|
||||
0x06: RTT with 128-bit random sequence
|
||||
0x01: RTT with 32-bit sounding sequence
|
||||
0x02: RTT with 96-bit sounding sequence
|
||||
0x03: RTT with 32-bit random sequence
|
||||
0x04: RTT with 64-bit random sequence
|
||||
0x05: RTT with 96-bit random sequence
|
||||
0x06: RTT with 128-bit random sequence
|
||||
*/
|
||||
esp_ble_cs_sync_phy_opt_t cs_sync_phy; /*!< 0x01: LE 1M PHY
|
||||
0x02: LE 2M PHY
|
||||
0x03: LE 2M 2BT PHY
|
||||
*/
|
||||
uint8_t channel_map[10]; /*!< This parameter contains 80 1-bit fields.
|
||||
The nth such field (in the range 0 to 78) contains the value for the CS channel index n.
|
||||
Channel n is enabled for CS procedure = 1
|
||||
Channel n is disabled for CS procedure = 0
|
||||
Channels n = 0, 1, 23, 24, 25, 77, and 78 shall be ignored and shall be set to zero. At least 15 channels shall be enabled.
|
||||
The most significant bit (bit 79) is reserved for future use
|
||||
*/
|
||||
uint8_t channel_map[ESP_BLE_CS_CHAN_MAP_LEN]; /*!< This parameter contains 80 1-bit fields.
|
||||
The nth such field (in the range 0 to 78) contains the value for the CS channel index n.
|
||||
Channel n is enabled for CS procedure = 1
|
||||
Channel n is disabled for CS procedure = 0
|
||||
Channels n = 0, 1, 23, 24, 25, 77, and 78 shall be ignored and shall be set to zero. At least 15 channels shall be enabled.
|
||||
The most significant bit (bit 79) is reserved for future use
|
||||
*/
|
||||
uint8_t channel_map_repetition; /*!< The number of times the map represented by the Channel_Map field is to be cycled through for non-mode-0 steps within a CS procedure. Range: 0x01 to 0xFF */
|
||||
esp_ble_cs_channel_select_type_opt_t channel_selection_type;/*!< 0x00: Use Channel Selection Algorithm #3b for non-mode-0 CS steps
|
||||
0x01: Use Channel Selection Algorithm #3c for non-mode-0 CS steps
|
||||
@@ -2642,13 +2635,13 @@ typedef union {
|
||||
0x02: LE 2M PHY
|
||||
0x03: LE 2M 2BT PHY
|
||||
*/
|
||||
uint8_t channel_map[10]; /*!< This parameter contains 80 1-bit fields.
|
||||
The nth such field (in the range 0 to 78) contains the value for the CS channel index n.
|
||||
Channel n is enabled for CS procedure = 1
|
||||
Channel n is disabled for CS procedure = 0
|
||||
Channels n = 0, 1, 23, 24, 25, 77, and 78 shall be ignored and shall be set to zero. At least 15 channels shall be enabled.
|
||||
The most significant bit (bit 79) is reserved for future use.
|
||||
*/
|
||||
uint8_t channel_map[ESP_BLE_CS_CHAN_MAP_LEN]; /*!< This parameter contains 80 1-bit fields.
|
||||
The nth such field (in the range 0 to 78) contains the value for the CS channel index n.
|
||||
Channel n is enabled for CS procedure = 1
|
||||
Channel n is disabled for CS procedure = 0
|
||||
Channels n = 0, 1, 23, 24, 25, 77, and 78 shall be ignored and shall be set to zero. At least 15 channels shall be enabled.
|
||||
The most significant bit (bit 79) is reserved for future use.
|
||||
*/
|
||||
uint8_t channel_map_repetition; /*!< The number of times the Channel_Map field will be cycled through for non-mode-0 steps within a CS procedure*/
|
||||
uint8_t channel_selection_type; /*!< 0x00: Use Channel Selection Algorithm #3b for non-mode-0 CS steps
|
||||
0x01: Use Channel Selection Algorithm #3c for non-mode-0 CS steps
|
||||
@@ -2689,7 +2682,7 @@ typedef union {
|
||||
uint8_t state; /*!< 0x00: CS procedures are disabled
|
||||
0x01: CS procedures are enabled
|
||||
*/
|
||||
uint8_t tone_Ant_config_select; /*!< Antenna Configuration Index. Range:0x00 to 0x07*/
|
||||
uint8_t tone_ant_config_select; /*!< Antenna Configuration Index. Range:0x00 to 0x07*/
|
||||
int8_t select_tx_power; /*!< Transmit power level used for CS procedure. Range: -127 to 20. Units: dBm */
|
||||
uint32_t subevent_Len; /*!< Duration for each CS subevent in microseconds. Range: 1250 μs to 4 s */
|
||||
uint8_t subevents_per_event; /*!< Number of CS subevents anchored off the same ACL connection event. Range: 0x01 to 0x20 */
|
||||
|
||||
@@ -3269,27 +3269,6 @@ void BTA_DmBleGapWriteCachedRemoteSupportedCaps(tBTA_DM_CS_WRITE_CACHED_REMOTE_S
|
||||
if ((p_msg = (tBTA_DM_API_CS_WRITE_CACHED_REMOTE_SUPP_CAPS *)osi_malloc(sizeof(tBTA_DM_API_CS_WRITE_CACHED_REMOTE_SUPP_CAPS))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPS;
|
||||
memcpy(&p_msg->conn_handle, &write_cachedremote_supp_caps->conn_handle, sizeof(tBTA_DM_CS_WRITE_CACHED_REMOTE_SUPP_CAPS));
|
||||
// p_msg->conn_handle = write_cachedremote_supp_caps->conn_handle;
|
||||
// p_msg->num_config_supported = write_cachedremote_supp_caps->num_config_supported;
|
||||
// p_msg->max_consecutive_proc_supported = write_cachedremote_supp_caps->max_consecutive_proc_supported;
|
||||
// p_msg->num_ant_supported = write_cachedremote_supp_caps->num_ant_supported;
|
||||
// p_msg->max_ant_paths_supported = write_cachedremote_supp_caps->max_ant_paths_supported;
|
||||
// p_msg->roles_supported = write_cachedremote_supp_caps->roles_supported;
|
||||
// p_msg->modes_supported = write_cachedremote_supp_caps->modes_supported;
|
||||
// p_msg->rtt_capability = write_cachedremote_supp_caps->rtt_capability;
|
||||
// p_msg->rtt_aa_only_n = write_cachedremote_supp_caps->rtt_aa_only_n;
|
||||
// p_msg->rtt_sounding_n = write_cachedremote_supp_caps->rtt_sounding_n;
|
||||
// p_msg->rtt_random_payload_n = write_cachedremote_supp_caps->rtt_random_payload_n;
|
||||
// p_msg->NADM_sounding_capability = write_cachedremote_supp_caps->NADM_sounding_capability;
|
||||
// p_msg->NADM_random_capability = write_cachedremote_supp_caps->NADM_random_capability;
|
||||
// p_msg->cs_sync_phys_supported = write_cachedremote_supp_caps->cs_sync_phys_supported;
|
||||
// p_msg->subfeatures_supported = write_cachedremote_supp_caps->subfeatures_supported;
|
||||
// p_msg->T_IP1_times_supported = write_cachedremote_supp_caps->T_IP1_times_supported;
|
||||
// p_msg->T_IP2_times_supported = write_cachedremote_supp_caps->T_IP2_times_supported;
|
||||
// p_msg->T_FCS_times_supported = write_cachedremote_supp_caps->T_FCS_times_supported;
|
||||
// p_msg->T_PM_times_supported = write_cachedremote_supp_caps->T_PM_times_supported;
|
||||
// p_msg->T_SW_times_supported = write_cachedremote_supp_caps->T_SW_times_supported;
|
||||
// p_msg->TX_SNR_capability = write_cachedremote_supp_caps->TX_SNR_capability;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1409,7 +1409,7 @@ void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
|
||||
param.cs_proc_enable.conn_handle = params->cs_proc_en.conn_handle;
|
||||
param.cs_proc_enable.config_id = params->cs_proc_en.config_id;
|
||||
param.cs_proc_enable.state = params->cs_proc_en.state;
|
||||
param.cs_proc_enable.tone_Ant_config_select = params->cs_proc_en.tone_Ant_config_select;
|
||||
param.cs_proc_enable.tone_ant_config_select = params->cs_proc_en.tone_ant_config_select;
|
||||
param.cs_proc_enable.select_tx_power = params->cs_proc_en.select_tx_power;
|
||||
param.cs_proc_enable.subevent_Len = params->cs_proc_en.subevent_Len;
|
||||
param.cs_proc_enable.subevents_per_event = params->cs_proc_en.subevents_per_event;
|
||||
|
||||
@@ -3207,28 +3207,30 @@ static void btu_ble_pa_response_report_evt(UINT8 *p)
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.tx_status, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.num_rsp, p);
|
||||
|
||||
pa_rsp_rpt_evt.rsp_data_info = osi_malloc(pa_rsp_rpt_evt.num_rsp * sizeof(tBTM_BLE_PA_RSP_DATA_INFO));
|
||||
if (pa_rsp_rpt_evt.rsp_data_info)
|
||||
{
|
||||
for (UINT8 i = 0; i < pa_rsp_rpt_evt.num_rsp; i++)
|
||||
if (pa_rsp_rpt_evt.num_rsp) {
|
||||
pa_rsp_rpt_evt.rsp_data_info = osi_malloc(pa_rsp_rpt_evt.num_rsp * sizeof(tBTM_BLE_PA_RSP_DATA_INFO));
|
||||
if (pa_rsp_rpt_evt.rsp_data_info)
|
||||
{
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].tx_power, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].rssi, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].cte_type, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].rsp_slot, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].data_status, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].data_len, p);
|
||||
if (pa_rsp_rpt_evt.rsp_data_info[i].data_len) {
|
||||
pa_rsp_rpt_evt.rsp_data_info[i].data = osi_malloc(pa_rsp_rpt_evt.rsp_data_info[i].data_len);
|
||||
if (pa_rsp_rpt_evt.rsp_data_info[i].data) {
|
||||
STREAM_TO_ARRAY(pa_rsp_rpt_evt.rsp_data_info[i].data, p, pa_rsp_rpt_evt.rsp_data_info[i].data_len);
|
||||
} else {
|
||||
HCI_TRACE_ERROR("%s, no enough memory.", __func__);
|
||||
for (UINT8 i = 0; i < pa_rsp_rpt_evt.num_rsp; i++)
|
||||
{
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].tx_power, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].rssi, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].cte_type, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].rsp_slot, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].data_status, p);
|
||||
STREAM_TO_UINT8(pa_rsp_rpt_evt.rsp_data_info[i].data_len, p);
|
||||
if (pa_rsp_rpt_evt.rsp_data_info[i].data_len) {
|
||||
pa_rsp_rpt_evt.rsp_data_info[i].data = osi_malloc(pa_rsp_rpt_evt.rsp_data_info[i].data_len);
|
||||
if (pa_rsp_rpt_evt.rsp_data_info[i].data) {
|
||||
STREAM_TO_ARRAY(pa_rsp_rpt_evt.rsp_data_info[i].data, p, pa_rsp_rpt_evt.rsp_data_info[i].data_len);
|
||||
} else {
|
||||
HCI_TRACE_ERROR("%s, no enough memory.", __func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HCI_TRACE_ERROR("%s, no memory.", __func__);
|
||||
}
|
||||
} else {
|
||||
HCI_TRACE_ERROR("%s, no memory.", __func__);
|
||||
}
|
||||
|
||||
btm_ble_pa_rsp_rpt_evt(&pa_rsp_rpt_evt);
|
||||
@@ -3357,7 +3359,7 @@ static void btu_ble_cs_proc_enable_cmpl_evt(UINT8 *p)
|
||||
STREAM_TO_UINT16(proc_en.conn_handle, p);
|
||||
STREAM_TO_UINT8(proc_en.config_id, p);
|
||||
STREAM_TO_UINT8(proc_en.state, p);
|
||||
STREAM_TO_UINT8(proc_en.tone_Ant_config_select, p);
|
||||
STREAM_TO_UINT8(proc_en.tone_ant_config_select, p);
|
||||
STREAM_TO_UINT8(proc_en.select_tx_power, p);
|
||||
STREAM_TO_UINT24(proc_en.subevent_Len, p);
|
||||
STREAM_TO_UINT8(proc_en.subevents_per_event, p);
|
||||
|
||||
@@ -93,7 +93,7 @@ typedef struct {
|
||||
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#define GAP_MAX_CHAR_NUM 4
|
||||
#define GAP_MAX_CHAR_NUM 5
|
||||
|
||||
typedef struct {
|
||||
UINT16 handle;
|
||||
|
||||
@@ -3099,7 +3099,7 @@ UINT8 btsnd_hcic_ble_cs_read_remote_supported_capabilities(UINT16 conn_handle)
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
HCI_TRACE_ERROR("cs read remote supported caps, conn_handle %d", conn_handle);
|
||||
HCI_TRACE_DEBUG("cs read remote supported caps, conn_handle %d", conn_handle);
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_READ_REMOTE_SUPP_CAPS_PARAMS_LEN);
|
||||
|
||||
@@ -3297,7 +3297,7 @@ UINT8 btsnd_hcic_ble_cs_remove_config(UINT16 conn_handle, UINT8 config_id)
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
HCI_TRACE_ERROR("cs remove config, conn_handle %d config_id %d", conn_handle, config_id);
|
||||
HCI_TRACE_DEBUG("cs remove config, conn_handle %d config_id %d", conn_handle, config_id);
|
||||
|
||||
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_REMOVE_CONFIG_PARAMS_LEN);
|
||||
|
||||
|
||||
@@ -1618,7 +1618,7 @@ typedef struct {
|
||||
UINT16 conn_handle;
|
||||
UINT8 config_id;
|
||||
UINT8 state;
|
||||
UINT8 tone_Ant_config_select;
|
||||
UINT8 tone_ant_config_select;
|
||||
INT8 select_tx_power;
|
||||
UINT32 subevent_Len;
|
||||
UINT8 subevents_per_event;
|
||||
|
||||
Reference in New Issue
Block a user