feat(ble/bluedroid): Add bluedroid host PAwR feature

This commit is contained in:
zhiweijian
2025-12-30 10:23:37 +08:00
parent 32762bcc04
commit a52993a7eb
20 changed files with 1162 additions and 28 deletions
@@ -808,7 +808,14 @@ typedef struct {
typedef struct {
UINT16 interval_min;
UINT16 interval_max;
UINT8 properties;
UINT16 properties;
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
UINT8 num_subevents;
UINT8 subevent_interval;
UINT8 rsp_slot_delay;
UINT8 rsp_slot_spacing;
UINT8 num_rsp_slots;
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
} tBTM_BLE_Periodic_Adv_Params;
typedef struct {
@@ -1090,7 +1097,14 @@ typedef void (tBTM_SET_VENDOR_EVT_MASK_CBACK) (tBTM_STATUS status);
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#define BTM_BLE_GAP_SET_HOST_FEATURE_EVT 51
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#define BTM_BLE_5_GAP_UNKNOWN_EVT 52
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
#define BTM_BLE_GAP_SET_PERIODIC_ADV_SUBEVT_DATA_EVT 52
#define BTM_BLE_GAP_SET_PERIODIC_ADV_RESPONSE_DATA_EVT 53
#define BTM_BLE_GAP_SET_PERIODIC_SYNC_SUBEVT_EVT 54
#define BTM_BLE_GAP_PERIODIC_ADV_SUBEVT_DATA_REQUEST_EVT 55
#define BTM_BLE_GAP_PERIODIC_ADV_RESPONSE_REPORT_EVT 56
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#define BTM_BLE_5_GAP_UNKNOWN_EVT 57
typedef UINT8 tBTM_BLE_5_GAP_EVENT;
#if (BLE_FEAT_ISO_EN == TRUE)
@@ -1332,6 +1346,10 @@ typedef struct {
UINT8 tx_power;
INT8 rssi;
UINT8 cte_type;
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
UINT16 periodic_evt_cnt;
UINT8 subevt;
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
tBTM_BLE_EXT_ADV_DATA_STATUS data_status;
UINT8 data_length;
UINT8 *data;
@@ -1350,6 +1368,12 @@ typedef struct {
UINT8 adv_phy;
UINT16 period_adv_interval;
UINT8 adv_clk_accuracy;
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
UINT8 num_subevt;
UINT8 subevt_interval;
UINT8 rsp_slot_delay;
UINT8 rsp_slot_spacing;
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
} tBTM_BLE_PERIOD_ADV_SYNC_ESTAB;
typedef struct {
@@ -1453,6 +1477,44 @@ typedef struct {
} __attribute__((packed)) tBTM_BLE_SUBRATE_CHANGE_EVT;
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
typedef struct {
UINT8 status;
UINT8 adv_handle;
} __attribute__((packed)) tBTM_BLE_PA_SUBEVT_DATA_EVT;
typedef struct {
UINT8 status;
UINT16 sync_handle;
} __attribute__((packed)) tBTM_BLE_PA_RSP_DATA_EVT;
typedef struct {
UINT8 status;
UINT16 sync_handle;
} __attribute__((packed)) tBTM_BLE_PA_SYNC_SUBEVT_DATA_EVT;
typedef struct {
UINT8 adv_handle;
UINT8 subevt_start;
UINT8 subevt_data_count;
} __attribute__((packed)) tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT;
typedef struct {
INT8 tx_power;
INT8 rssi;
UINT8 cte_type;
UINT8 rsp_slot;
UINT8 data_status;
UINT8 data_len;
UINT8 *data;
} __attribute__((packed)) tBTM_BLE_PA_RSP_DATA_INFO;
typedef struct {
UINT8 adv_handle;
UINT8 subevt;
UINT8 tx_status;
UINT8 num_rsp;
tBTM_BLE_PA_RSP_DATA_INFO *rsp_data_info;
} __attribute__((packed)) tBTM_BLE_PA_RSP_REPORT_EVT;
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
typedef struct {
@@ -1819,6 +1881,13 @@ typedef union {
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
tBTM_BLE_SUBRATE_CHANGE_EVT subrate_change_evt;
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
tBTM_BLE_PA_SUBEVT_DATA_EVT pa_subevt_data_evt;
tBTM_BLE_PA_RSP_DATA_EVT pa_rsp_data_evt;
tBTM_BLE_PA_SYNC_SUBEVT_DATA_EVT pa_sync_subevt_evt;
tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT pa_subevent_data_req_evt;
tBTM_BLE_PA_RSP_REPORT_EVT pa_rsp_rpt_evt;
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
} tBTM_BLE_5_GAP_CB_PARAMS;
typedef struct {
@@ -3371,7 +3440,15 @@ void BTM_BleSetDefaultSubrate(UINT16 subrate_min, UINT16 subrate_max, UINT16 max
void BTM_BleSubrateRequest(UINT16 conn_handle, UINT16 subrate_min, UINT16 subrate_max,
UINT16 max_latency, UINT16 continuation_number, UINT16 supervision_timeout);
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE)
tBTM_STATUS BTM_BleSetHostFeature(uint16_t bit_num, uint8_t bit_val);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
void BTM_BleSetPaSubeventData(UINT8 adv_handle, UINT8 num_subevents_with_data, uint8_t *subevent_params);
void BTM_BleSetPaResponseData(UINT16 sync_handle, UINT16 req_evt, UINT8 req_subevt, UINT8 rsp_subevt, UINT8 rsp_slot, UINT8 rsp_data_len, UINT8 *rsp_data);
void BTM_BleSetPaSyncSubevt(UINT16 sync_handle, UINT16 periodic_adv_properties, UINT8 num_subevents_to_sync, UINT8 *subevt);
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#endif
@@ -443,6 +443,13 @@
#define HCI_BLE_SUBRATE_REQUEST (0x007E | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
#define HCI_BLE_SET_PERIOD_ADV_SUBEVT_DATA (0x0082 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PERIOD_ADV_RSP_DATA (0x0083 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PERIOD_SYNC_SUBEVT (0x0084 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PERIOD_ADV_PARAMS_V2 (0x0086 | HCI_GRP_BLE_CMDS)
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
// Vendor OGF define
#define HCI_VENDOR_OGF 0x3F
@@ -918,6 +925,14 @@
#define HCI_BLE_SUBRATE_CHANGE_EVT 0x23
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#define HCI_BLE_PERIOD_ADV_SYNC_ESTAB_EVT_V2 0x24
#define HCI_BLE_PERIOD_ADV_REPORT_EVT_V2 0x25
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
#define HCI_BLE_PA_SUBEVT_DATA_REQUEST_EVT 0x27
#define HCI_BLE_PA_RESPONSE_REPORT_EVT 0x28
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
/* Definitions for LE Channel Map */
#define HCI_BLE_CHNL_MAP_SIZE 5
@@ -1013,7 +1013,7 @@ UINT8 btsnd_hcic_ble_clear_adv_set(void);
UINT8 btsnd_hcic_ble_set_periodic_adv_params(UINT8 adv_handle,
UINT16 interval_min,
UINT16 interval_max,
UINT8 propertics);
UINT16 propertics);
UINT8 btsnd_hcic_ble_set_periodic_adv_data(UINT8 adv_handle,
UINT8 operation,
@@ -1243,4 +1243,26 @@ UINT8 btsnd_hcic_ble_subrate_request(UINT16 conn_handle, UINT16 subrate_min, UIN
UINT8 btsnd_hcic_ble_set_host_feature(uint16_t bit_num, uint8_t bit_val);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
typedef struct {
uint8_t subevent;
uint8_t response_slot_start;
uint8_t response_slot_count;
uint8_t subevent_data_len;
uint8_t data[251];
} ble_subevent_params;
#define HCIC_PARAM_SIZE_SET_PA_SUBEVT_DATA_PARAMS_LEN 2
#define HCIC_PARAM_SIZE_SET_PA_RESPONSE_DATA_PARAMS_LEN 8
#define HCIC_PARAM_SIZE_SET_PA_SYNC_SUBEVT_PARAMS_LEN 5
#define HCIC_PARAM_SIZE_SET_PERIODIC_ADV_PARAMS_V2 12
UINT8 btsnd_hcic_ble_set_periodic_adv_params_v2(UINT8 adv_handle, UINT16 interval_min, UINT16 interval_max,
UINT16 propertics, UINT8 num_subevents, UINT8 subevent_interval,
UINT8 rsp_slot_delay, UINT8 rsp_slot_spacing, UINT8 num_rsp_slots);
UINT8 btsnd_hcic_ble_set_periodic_adv_subevt_data(UINT8 adv_handle, UINT8 num_subevents_with_data, ble_subevent_params *subevent_params);
UINT8 btsnd_hcic_ble_set_periodic_adv_rsp_data(UINT16 sync_handle, UINT16 req_evt, UINT8 req_subevt, UINT8 rsp_subevt, UINT8 rsp_slot, UINT8 rsp_data_len, UINT8 *rsp_data);
UINT8 btsnd_hcic_ble_set_periodic_sync_subevt(UINT16 sync_handle, UINT16 periodic_adv_properties, UINT8 num_subevents_to_sync, UINT8 *subevt);
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
#endif