Skip to content

Commit 708951e

Browse files
cvinayakcfriedt
authored andcommitted
Bluetooth: Controller: Use defines for scanning state types
Use defines for scanning state types of passive, active, initiator and synchronization state. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent ad2b77e commit 708951e

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

subsys/bluetooth/controller/ll_sw/ull_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static int rl_access_check(bool check_ar)
10191019
*/
10201020
return ((IS_ENABLED(CONFIG_BT_BROADCASTER) && ull_adv_is_enabled(0)) ||
10211021
(IS_ENABLED(CONFIG_BT_OBSERVER) &&
1022-
(ull_scan_is_enabled(0) & ~BIT(0))))
1022+
(ull_scan_is_enabled(0) & ~ULL_SCAN_IS_PASSIVE)))
10231023
? 0 : 1;
10241024
}
10251025

subsys/bluetooth/controller/ll_sw/ull_scan.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -618,31 +618,25 @@ uint32_t ull_scan_is_enabled(uint8_t handle)
618618
{
619619
struct ll_scan_set *scan;
620620

621-
/* NOTE: BIT(0) - passive scanning enabled
622-
* BIT(1) - active scanning enabled
623-
* BIT(2) - initiator enabled
624-
* BIT(3) - periodic sync create active
625-
*/
626-
627621
scan = ull_scan_is_enabled_get(handle);
628622
if (!scan) {
629623
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
630624
scan = ull_scan_set_get(handle);
631625

632-
return scan->per_scan.sync ? BIT(3) : 0;
626+
return scan->per_scan.sync ? ULL_SCAN_IS_SYNC : 0U;
633627
#else
634-
return 0;
628+
return 0U;
635629
#endif
636630
}
637631

638632
return (((uint32_t)scan->is_enabled << scan->lll.type) |
639633
#if defined(CONFIG_BT_CENTRAL)
640-
(scan->lll.conn ? BIT(2) : 0) |
634+
(scan->lll.conn ? ULL_SCAN_IS_INITIATOR : 0U) |
641635
#endif
642636
#if defined(CONFIG_BT_CTLR_SYNC_PERIODIC)
643-
(scan->per_scan.sync ? BIT(3) : 0) |
637+
(scan->per_scan.sync ? ULL_SCAN_IS_SYNC : 0U) |
644638
#endif
645-
0);
639+
0U);
646640
}
647641

648642
uint32_t ull_scan_filter_pol_get(uint8_t handle)

subsys/bluetooth/controller/ll_sw/ull_scan_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ struct ll_scan_set *ull_scan_is_enabled_get(uint8_t handle);
6262
struct ll_scan_set *ull_scan_is_disabled_get(uint8_t handle);
6363

6464
/* Return flags if enabled */
65+
#define ULL_SCAN_IS_PASSIVE BIT(0)
66+
#define ULL_SCAN_IS_ACTIVE BIT(1)
67+
#define ULL_SCAN_IS_INITIATOR BIT(2)
68+
#define ULL_SCAN_IS_SYNC BIT(3)
6569
uint32_t ull_scan_is_enabled(uint8_t handle);
6670

6771
/* Return filter policy used */

0 commit comments

Comments
 (0)