diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-12-08 14:55:33 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-12-08 15:02:41 -0500 |
commit | 53b834d2333aec1e60fcbfadfddd4ad472329570 (patch) | |
tree | 4226799dc2cd531f231fffa033c8964b237d672f | |
parent | c6d1649050aa7da42f9c0901dc7fa3971254648f (diff) |
Bluetooth: Use macros for connectionless slave broadcast features
Add the LMP feature constants for connectionless slave broadcast
and use them for capability testing.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | include/net/bluetooth/hci.h | 6 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 1784c48699f0..cc2da73055fa 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -275,6 +275,12 @@ enum { | |||
275 | #define LMP_EXTFEATURES 0x80 | 275 | #define LMP_EXTFEATURES 0x80 |
276 | 276 | ||
277 | /* Extended LMP features */ | 277 | /* Extended LMP features */ |
278 | #define LMP_CSB_MASTER 0x01 | ||
279 | #define LMP_CSB_SLAVE 0x02 | ||
280 | #define LMP_SYNC_TRAIN 0x04 | ||
281 | #define LMP_SYNC_SCAN 0x08 | ||
282 | |||
283 | /* Host features */ | ||
278 | #define LMP_HOST_SSP 0x01 | 284 | #define LMP_HOST_SSP 0x01 |
279 | #define LMP_HOST_LE 0x02 | 285 | #define LMP_HOST_LE 0x02 |
280 | #define LMP_HOST_LE_BREDR 0x04 | 286 | #define LMP_HOST_LE_BREDR 0x04 |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index f8555ad7b104..b796161fb04e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -798,6 +798,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
798 | #define lmp_transp_capable(dev) ((dev)->features[0][2] & LMP_TRANSPARENT) | 798 | #define lmp_transp_capable(dev) ((dev)->features[0][2] & LMP_TRANSPARENT) |
799 | 799 | ||
800 | /* ----- Extended LMP capabilities ----- */ | 800 | /* ----- Extended LMP capabilities ----- */ |
801 | #define lmp_csb_master_capable(dev) ((dev)->features[2][0] & LMP_CSB_MASTER) | ||
802 | #define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE) | ||
803 | #define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN) | ||
804 | #define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN) | ||
805 | |||
806 | /* ----- Host capabilities ----- */ | ||
801 | #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) | 807 | #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) |
802 | #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) | 808 | #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) |
803 | #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) | 809 | #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 03e83558a411..8b8b5f80dd89 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1228,7 +1228,7 @@ static void hci_set_event_mask_page_2(struct hci_request *req) | |||
1228 | /* If Connectionless Slave Broadcast master role is supported | 1228 | /* If Connectionless Slave Broadcast master role is supported |
1229 | * enable all necessary events for it. | 1229 | * enable all necessary events for it. |
1230 | */ | 1230 | */ |
1231 | if (hdev->features[2][0] & 0x01) { | 1231 | if (lmp_csb_master_capable(hdev)) { |
1232 | events[1] |= 0x40; /* Triggered Clock Capture */ | 1232 | events[1] |= 0x40; /* Triggered Clock Capture */ |
1233 | events[1] |= 0x80; /* Synchronization Train Complete */ | 1233 | events[1] |= 0x80; /* Synchronization Train Complete */ |
1234 | events[2] |= 0x10; /* Slave Page Response Timeout */ | 1234 | events[2] |= 0x10; /* Slave Page Response Timeout */ |
@@ -1238,7 +1238,7 @@ static void hci_set_event_mask_page_2(struct hci_request *req) | |||
1238 | /* If Connectionless Slave Broadcast slave role is supported | 1238 | /* If Connectionless Slave Broadcast slave role is supported |
1239 | * enable all necessary events for it. | 1239 | * enable all necessary events for it. |
1240 | */ | 1240 | */ |
1241 | if (hdev->features[2][0] & 0x02) { | 1241 | if (lmp_csb_slave_capable(hdev)) { |
1242 | events[2] |= 0x01; /* Synchronization Train Received */ | 1242 | events[2] |= 0x01; /* Synchronization Train Received */ |
1243 | events[2] |= 0x02; /* CSB Receive */ | 1243 | events[2] |= 0x02; /* CSB Receive */ |
1244 | events[2] |= 0x04; /* CSB Timeout */ | 1244 | events[2] |= 0x04; /* CSB Timeout */ |
@@ -1309,7 +1309,7 @@ static void hci_init4_req(struct hci_request *req, unsigned long opt) | |||
1309 | hci_set_event_mask_page_2(req); | 1309 | hci_set_event_mask_page_2(req); |
1310 | 1310 | ||
1311 | /* Check for Synchronization Train support */ | 1311 | /* Check for Synchronization Train support */ |
1312 | if (hdev->features[2][0] & 0x04) | 1312 | if (lmp_sync_train_capable(hdev)) |
1313 | hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL); | 1313 | hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL); |
1314 | } | 1314 | } |
1315 | 1315 | ||