1 /*
2  * Copyright (c) 2017-2019 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
8 struct lll_df_adv_cfg;
9 #endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
10 
11 struct ll_adv_set {
12 	struct ull_hdr ull;
13 	struct lll_adv lll;
14 
15 #if defined(CONFIG_BT_CTLR_AD_DATA_BACKUP)
16 	/* Legacy AD Data backup when switching to legacy directed advertising
17 	 * or to Extended Advertising.
18 	 */
19 	struct {
20 		uint8_t len;
21 		uint8_t data[PDU_AC_LEG_DATA_SIZE_MAX];
22 	} ad_data_backup;
23 #endif /* CONFIG_BT_CTLR_AD_DATA_BACKUP */
24 
25 #if defined(CONFIG_BT_PERIPHERAL)
26 	memq_link_t        *link_cc_free;
27 	struct node_rx_pdu *node_rx_cc_free;
28 #endif /* CONFIG_BT_PERIPHERAL */
29 
30 #if defined(CONFIG_BT_CTLR_ADV_EXT)
31 	uint32_t interval;
32 	uint8_t  rnd_addr[BDADDR_SIZE];
33 	uint8_t  sid:4;
34 	uint8_t  is_created:1;
35 	uint8_t  is_ad_data_cmplt:1;
36 #if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING)
37 	uint8_t  hci_handle;
38 #endif
39 	uint16_t event_counter;
40 	uint16_t max_events;
41 	uint32_t remain_duration_us;
42 #else /* !CONFIG_BT_CTLR_ADV_EXT */
43 	uint16_t interval;
44 #endif /* !CONFIG_BT_CTLR_ADV_EXT */
45 
46 	uint8_t is_enabled:1;
47 
48 #if defined(CONFIG_BT_CTLR_PRIVACY)
49 	uint8_t  own_addr_type:2;
50 	uint8_t  peer_addr_type:1;
51 	uint8_t  peer_addr[BDADDR_SIZE];
52 #endif /* CONFIG_BT_CTLR_PRIVACY */
53 
54 #if defined(CONFIG_BT_CTLR_CHECK_SAME_PEER_CONN)
55 	uint8_t  own_id_addr[BDADDR_SIZE];
56 #endif /* CONFIG_BT_CTLR_CHECK_SAME_PEER_CONN */
57 
58 #if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX)
59 	struct lll_df_adv_cfg *df_cfg;
60 #endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */
61 
62 
63 #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING) || \
64 	(defined(CONFIG_BT_CTLR_ADV_EXT) && \
65 	 (CONFIG_BT_CTLR_ADV_AUX_SET > 0) && \
66 	 !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO))
67 #if defined(CONFIG_BT_CTLR_JIT_SCHEDULING)
68 	uint32_t delay;
69 	uint32_t delay_at_expire;
70 #endif /* CONFIG_BT_CTLR_JIT_SCHEDULING */
71 
72 	uint32_t ticks_at_expire;
73 #endif /* CONFIG_BT_CTLR_JIT_SCHEDULING ||
74 	* (CONFIG_BT_CTLR_ADV_EXT &&
75 	*  (CONFIG_BT_CTLR_ADV_AUX_SET > 0) &&
76 	*  !CONFIG_BT_TICKER_EXT_EXPIRE_INFO)
77 	*/
78 };
79 
80 struct ll_adv_aux_set {
81 	struct ull_hdr     ull;
82 	struct lll_adv_aux lll;
83 
84 	uint16_t interval;
85 
86 	uint16_t data_chan_id;
87 	struct {
88 		uint8_t data_chan_map[PDU_CHANNEL_MAP_SIZE];
89 		uint8_t data_chan_count:6;
90 	} chm[DOUBLE_BUFFER_SIZE];
91 	uint8_t  chm_first;
92 	uint8_t  chm_last;
93 
94 	uint8_t is_started:1;
95 };
96 
97 struct ll_adv_sync_set {
98 	struct ull_hdr      ull;
99 	struct lll_adv_sync lll;
100 
101 	uint16_t interval;
102 
103 	uint8_t is_enabled:1;
104 	uint8_t is_started:1;
105 	uint8_t is_data_cmplt:1;
106 
107 #if !defined(CONFIG_BT_TICKER_EXT_EXPIRE_INFO)
108 	uint32_t aux_remainder;
109 #endif /* !CONFIG_BT_TICKER_EXT_EXPIRE_INFO */
110 };
111 
112 struct ll_adv_iso_set {
113 	struct ull_hdr        ull;
114 	struct lll_adv_iso    lll;
115 
116 	uint32_t big_ref_point; /* Previously elapsed BIG reference point in
117 				 * microseconds of the free running Controller
118 				 * clock.
119 				 */
120 
121 	struct node_rx_pdu node_rx_complete;
122 
123 	struct {
124 		struct node_rx_pdu rx;
125 		/* Dummy declaration to ensure space allocated to hold one pdu bytes */
126 		uint8_t  dummy;
127 	} node_rx_terminate;
128 
129 #if defined(CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING)
130 	uint8_t  hci_handle;
131 #endif /* CONFIG_BT_CTLR_HCI_ADV_HANDLE_MAPPING */
132 };
133