Skip to content

Commit eca0ae4

Browse files
committed
Bluetooth: Add initial implementation of BIS connections
This adds initial support for BIS/BIG which includes: == Broadcaster role: Setup a periodic advertising and create a BIG == > tools/isotest -s 00:00:00:00:00:00 isotest[63]: Connected [00:00:00:00:00:00] isotest[63]: QoS BIG 0x00 BIS 0x00 Packing 0x00 Framing 0x00] isotest[63]: Output QoS [Interval 10000 us Latency 10 ms SDU 40 PHY 0x02 RTN 2] isotest[63]: Sending ... isotest[63]: Number of packets: 1 isotest[63]: Socket jitter buffer: 80 buffer < HCI Command: LE Set Perio.. (0x08|0x003e) plen 7 ... > HCI Event: Command Complete (0x0e) plen 4 LE Set Periodic Advertising Parameters (0x08|0x003e) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Perio.. (0x08|0x003f) plen 7 ... > HCI Event: Command Complete (0x0e) plen 4 LE Set Periodic Advertising Data (0x08|0x003f) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Perio.. (0x08|0x0040) plen 2 ... > HCI Event: Command Complete (0x0e) plen 4 LE Set Periodic Advertising Enable (0x08|0x0040) ncmd 1 Status: Success (0x00) < HCI Command: LE Create B.. (0x08|0x0068) plen 31 ... > HCI Event: Command Status (0x0f) plen 4 LE Create Broadcast Isochronous Group (0x08|0x0068) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 21 LE Broadcast Isochronous Group Complete (0x1b) ... == Broadcast Receiver role: Create a PA Sync and BIG Sync == > tools/isotest -i hci1 -d 00:AA:01:00:00:00 isotest[66]: Waiting for connection 00:AA:01:00:00:00... < HCI Command: LE Periodic Advert.. (0x08|0x0044) plen 14 ... > HCI Event: Command Status (0x0f) plen 4 LE Periodic Advertising Create Sync (0x08|0x0044) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Extended Sca.. (0x08|0x0041) plen 8 ... > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Extended Sca.. (0x08|0x0042) plen 6 ... > HCI Event: Command Complete (0x0e) plen 4 LE Set Extended Scan Enable (0x08|0x0042) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 29 LE Extended Advertising Report (0x0d) ... > HCI Event: LE Meta Event (0x3e) plen 16 LE Periodic Advertising Sync Established (0x0e) ... < HCI Command: LE Broadcast Isoch.. (0x08|0x006b) plen 25 ... > HCI Event: Command Status (0x0f) plen 4 LE Broadcast Isochronous Group Create Sync (0x08|0x006b) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 17 LE Broadcast Isochronous Group Sync Estabilished (0x1d) ... Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent ccf74f2 commit eca0ae4

File tree

13 files changed

+1333
-126
lines changed

13 files changed

+1333
-126
lines changed

include/net/bluetooth/bluetooth.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ struct bt_voice {
160160
#define BT_ISO_QOS_CIG_UNSET 0xff
161161
#define BT_ISO_QOS_CIS_UNSET 0xff
162162

163+
#define BT_ISO_QOS_BIG_UNSET 0xff
164+
#define BT_ISO_QOS_BIS_UNSET 0xff
165+
163166
struct bt_iso_io_qos {
164167
__u32 interval;
165168
__u16 latency;
@@ -169,9 +172,18 @@ struct bt_iso_io_qos {
169172
};
170173

171174
struct bt_iso_qos {
172-
__u8 cig;
173-
__u8 cis;
174-
__u8 sca;
175+
union {
176+
__u8 cig;
177+
__u8 big;
178+
};
179+
union {
180+
__u8 cis;
181+
__u8 bis;
182+
};
183+
union {
184+
__u8 sca;
185+
__u8 sync_interval;
186+
};
175187
__u8 packing;
176188
__u8 framing;
177189
struct bt_iso_io_qos in;

include/net/bluetooth/hci.h

Lines changed: 155 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ enum {
316316
HCI_USER_CHANNEL,
317317
HCI_EXT_CONFIGURED,
318318
HCI_LE_ADV,
319+
HCI_LE_PER_ADV,
319320
HCI_LE_SCAN,
320321
HCI_SSP_ENABLED,
321322
HCI_SC_ENABLED,
@@ -338,6 +339,7 @@ enum {
338339
HCI_LE_SCAN_INTERRUPTED,
339340
HCI_WIDEBAND_SPEECH_ENABLED,
340341
HCI_EVENT_FILTER_CONFIGURED,
342+
HCI_PA_SYNC,
341343

342344
HCI_DUT_MODE,
343345
HCI_VENDOR_DIAG,
@@ -519,9 +521,11 @@ enum {
519521
#define HCI_LE_PHY_2M 0x01
520522
#define HCI_LE_PHY_CODED 0x08
521523
#define HCI_LE_EXT_ADV 0x10
524+
#define HCI_LE_PERIODIC_ADV 0x20
522525
#define HCI_LE_CHAN_SEL_ALG2 0x40
523526
#define HCI_LE_CIS_CENTRAL 0x10
524527
#define HCI_LE_CIS_PERIPHERAL 0x20
528+
#define HCI_LE_ISO_BROADCASTER 0x40
525529

526530
/* Connection modes */
527531
#define HCI_CM_ACTIVE 0x0000
@@ -1865,6 +1869,22 @@ struct hci_cp_le_ext_conn_param {
18651869
__le16 max_ce_len;
18661870
} __packed;
18671871

1872+
#define HCI_OP_LE_PA_CREATE_SYNC 0x2044
1873+
struct hci_cp_le_pa_create_sync {
1874+
__u8 options;
1875+
__u8 sid;
1876+
__u8 addr_type;
1877+
bdaddr_t addr;
1878+
__le16 skip;
1879+
__le16 sync_timeout;
1880+
__u8 sync_cte_type;
1881+
} __packed;
1882+
1883+
#define HCI_OP_LE_PA_TERM_SYNC 0x2046
1884+
struct hci_cp_le_pa_term_sync {
1885+
__le16 handle;
1886+
} __packed;
1887+
18681888
#define HCI_OP_LE_READ_NUM_SUPPORTED_ADV_SETS 0x203b
18691889
struct hci_rp_le_read_num_supported_adv_sets {
18701890
__u8 status;
@@ -1899,13 +1919,6 @@ struct hci_rp_le_set_ext_adv_params {
18991919
__u8 tx_power;
19001920
} __packed;
19011921

1902-
#define HCI_OP_LE_SET_EXT_ADV_ENABLE 0x2039
1903-
struct hci_cp_le_set_ext_adv_enable {
1904-
__u8 enable;
1905-
__u8 num_of_sets;
1906-
__u8 data[];
1907-
} __packed;
1908-
19091922
struct hci_cp_ext_adv_set {
19101923
__u8 handle;
19111924
__le16 duration;
@@ -1932,6 +1945,37 @@ struct hci_cp_le_set_ext_scan_rsp_data {
19321945
__u8 data[];
19331946
} __packed;
19341947

1948+
#define HCI_OP_LE_SET_EXT_ADV_ENABLE 0x2039
1949+
struct hci_cp_le_set_ext_adv_enable {
1950+
__u8 enable;
1951+
__u8 num_of_sets;
1952+
__u8 data[];
1953+
} __packed;
1954+
1955+
#define HCI_OP_LE_SET_PER_ADV_PARAMS 0x203e
1956+
struct hci_cp_le_set_per_adv_params {
1957+
__u8 handle;
1958+
__le16 min_interval;
1959+
__le16 max_interval;
1960+
__le16 periodic_properties;
1961+
} __packed;
1962+
1963+
#define HCI_MAX_PER_AD_LENGTH 252
1964+
1965+
#define HCI_OP_LE_SET_PER_ADV_DATA 0x203f
1966+
struct hci_cp_le_set_per_adv_data {
1967+
__u8 handle;
1968+
__u8 operation;
1969+
__u8 length;
1970+
__u8 data[];
1971+
} __packed;
1972+
1973+
#define HCI_OP_LE_SET_PER_ADV_ENABLE 0x2040
1974+
struct hci_cp_le_set_per_adv_enable {
1975+
__u8 enable;
1976+
__u8 handle;
1977+
} __packed;
1978+
19351979
#define LE_SET_ADV_DATA_OP_COMPLETE 0x03
19361980

19371981
#define LE_SET_ADV_DATA_NO_FRAG 0x01
@@ -2043,6 +2087,49 @@ struct hci_cp_le_reject_cis {
20432087
__u8 reason;
20442088
} __packed;
20452089

2090+
#define HCI_OP_LE_CREATE_BIG 0x2068
2091+
struct hci_bis {
2092+
__u8 sdu_interval[3];
2093+
__le16 sdu;
2094+
__le16 latency;
2095+
__u8 rtn;
2096+
__u8 phy;
2097+
__u8 packing;
2098+
__u8 framing;
2099+
__u8 encryption;
2100+
__u8 bcode[16];
2101+
} __packed;
2102+
2103+
struct hci_cp_le_create_big {
2104+
__u8 handle;
2105+
__u8 adv_handle;
2106+
__u8 num_bis;
2107+
struct hci_bis bis;
2108+
} __packed;
2109+
2110+
#define HCI_OP_LE_TERM_BIG 0x206a
2111+
struct hci_cp_le_term_big {
2112+
__u8 handle;
2113+
__u8 reason;
2114+
} __packed;
2115+
2116+
#define HCI_OP_LE_BIG_CREATE_SYNC 0x206b
2117+
struct hci_cp_le_big_create_sync {
2118+
__u8 handle;
2119+
__le16 sync_handle;
2120+
__u8 encryption;
2121+
__u8 bcode[16];
2122+
__u8 mse;
2123+
__le16 timeout;
2124+
__u8 num_bis;
2125+
__u8 bis[0];
2126+
} __packed;
2127+
2128+
#define HCI_OP_LE_BIG_TERM_SYNC 0x206c
2129+
struct hci_cp_le_big_term_sync {
2130+
__u8 handle;
2131+
} __packed;
2132+
20462133
#define HCI_OP_LE_SETUP_ISO_PATH 0x206e
20472134
struct hci_cp_le_setup_iso_path {
20482135
__le16 handle;
@@ -2595,6 +2682,18 @@ struct hci_ev_le_ext_adv_report {
25952682
struct hci_ev_le_ext_adv_info info[];
25962683
} __packed;
25972684

2685+
#define HCI_EV_LE_PA_SYNC_ESTABLISHED 0x0e
2686+
struct hci_ev_le_pa_sync_established {
2687+
__u8 status;
2688+
__le16 handle;
2689+
__u8 sid;
2690+
__u8 bdaddr_type;
2691+
bdaddr_t bdaddr;
2692+
__u8 phy;
2693+
__le16 interval;
2694+
__u8 clock_accuracy;
2695+
} __packed;
2696+
25982697
#define HCI_EV_LE_ENHANCED_CONN_COMPLETE 0x0a
25992698
struct hci_ev_le_enh_conn_complete {
26002699
__u8 status;
@@ -2646,6 +2745,55 @@ struct hci_evt_le_cis_req {
26462745
__u8 cis_id;
26472746
} __packed;
26482747

2748+
#define HCI_EVT_LE_CREATE_BIG_COMPLETE 0x1b
2749+
struct hci_evt_le_create_big_complete {
2750+
__u8 status;
2751+
__u8 handle;
2752+
__u8 sync_delay[3];
2753+
__u8 transport_delay[3];
2754+
__u8 phy;
2755+
__u8 nse;
2756+
__u8 bn;
2757+
__u8 pto;
2758+
__u8 irc;
2759+
__le16 max_pdu;
2760+
__le16 interval;
2761+
__u8 num_bis;
2762+
__le16 bis_handle[];
2763+
} __packed;
2764+
2765+
#define HCI_EVT_LE_BIG_SYNC_ESTABILISHED 0x1d
2766+
struct hci_evt_le_big_sync_estabilished {
2767+
__u8 status;
2768+
__u8 handle;
2769+
__u8 latency[3];
2770+
__u8 nse;
2771+
__u8 bn;
2772+
__u8 pto;
2773+
__u8 irc;
2774+
__le16 max_pdu;
2775+
__le16 interval;
2776+
__u8 num_bis;
2777+
__le16 bis[];
2778+
} __packed;
2779+
2780+
#define HCI_EVT_LE_BIG_INFO_ADV_REPORT 0x22
2781+
struct hci_evt_le_big_info_adv_report {
2782+
__le16 sync_handle;
2783+
__u8 num_bis;
2784+
__u8 nse;
2785+
__le16 iso_interval;
2786+
__u8 bn;
2787+
__u8 pto;
2788+
__u8 irc;
2789+
__le16 max_pdu;
2790+
__u8 sdu_interval[3];
2791+
__le16 max_sdu;
2792+
__u8 phy;
2793+
__u8 framing;
2794+
__u8 encryption;
2795+
} __packed;
2796+
26492797
#define HCI_EV_VENDOR 0xff
26502798

26512799
/* Internal events generated by Bluetooth stack */

0 commit comments

Comments
 (0)