1 /*
2  * Copyright (c) 2016 Nordic Semiconductor ASA
3  * Copyright (c) 2016 Vinayak Kariappa Chettimada
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 
9 #include <zephyr/types.h>
10 #include <zephyr/ztest.h>
11 
12 #include <zephyr/bluetooth/hci_types.h>
13 
14 #include "util/mem.h"
15 #include "util/memq.h"
16 #include "pdu_df.h"
17 #include "lll/pdu_vendor.h"
18 #include "pdu.h"
19 
20 #include "lll.h"
21 #include "lll_scan.h"
22 
23 #include "ull_scan_types.h"
24 #include "ull_scan_internal.h"
25 
26 #define BT_CTLR_SCAN_MAX 1
27 static struct ll_scan_set ll_scan[BT_CTLR_SCAN_MAX];
28 
ll_scan_params_set(uint8_t type,uint16_t interval,uint16_t window,uint8_t own_addr_type,uint8_t filter_policy)29 uint8_t ll_scan_params_set(uint8_t type, uint16_t interval, uint16_t window, uint8_t own_addr_type,
30 			   uint8_t filter_policy)
31 {
32 	struct ll_scan_set *scan;
33 
34 	scan = ull_scan_is_disabled_get(0);
35 	if (!scan) {
36 		return BT_HCI_ERR_CMD_DISALLOWED;
37 	}
38 
39 	scan->own_addr_type = own_addr_type;
40 
41 	return 0;
42 }
43 
ull_scan_set_get(uint8_t handle)44 struct ll_scan_set *ull_scan_set_get(uint8_t handle)
45 {
46 	if (handle >= BT_CTLR_SCAN_MAX) {
47 		return NULL;
48 	}
49 
50 	return &ll_scan[handle];
51 }
52 
ull_scan_is_enabled_get(uint8_t handle)53 struct ll_scan_set *ull_scan_is_enabled_get(uint8_t handle)
54 {
55 	struct ll_scan_set *scan;
56 
57 	scan = ull_scan_set_get(handle);
58 	if (!scan || !scan->is_enabled) {
59 		return NULL;
60 	}
61 
62 	return scan;
63 }
64 
ull_scan_is_disabled_get(uint8_t handle)65 struct ll_scan_set *ull_scan_is_disabled_get(uint8_t handle)
66 {
67 	struct ll_scan_set *scan;
68 
69 	scan = ull_scan_set_get(handle);
70 	if (!scan || scan->is_enabled) {
71 		return NULL;
72 	}
73 
74 	return scan;
75 }
76 
ull_scan_enable(struct ll_scan_set * scan)77 uint8_t ull_scan_enable(struct ll_scan_set *scan)
78 {
79 	return 0;
80 }
81 
ull_scan_params_set(struct lll_scan * lll,uint8_t type,uint16_t interval,uint16_t window,uint8_t filter_policy)82 uint32_t ull_scan_params_set(struct lll_scan *lll, uint8_t type,
83 			     uint16_t interval, uint16_t window,
84 			     uint8_t filter_policy)
85 {
86 	return 0;
87 }
88 
ull_scan_disable(uint8_t handle,struct ll_scan_set * scan)89 uint8_t ull_scan_disable(uint8_t handle, struct ll_scan_set *scan)
90 {
91 	return 0;
92 }
93