1 /* 2 * Copyright (c) 2017-2021 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 struct lll_adv_iso { 8 struct lll_hdr hdr; 9 struct lll_adv *adv; 10 }; 11 12 struct lll_adv_sync { 13 struct lll_hdr hdr; 14 struct lll_adv *adv; 15 16 uint8_t access_addr[4]; 17 uint8_t crc_init[3]; 18 19 uint16_t latency_prepare; 20 uint16_t latency_event; 21 uint16_t event_counter; 22 23 uint16_t data_chan_id; 24 struct { 25 uint8_t data_chan_map[PDU_CHANNEL_MAP_SIZE]; 26 uint8_t data_chan_count:6; 27 } chm[DOUBLE_BUFFER_SIZE]; 28 uint8_t chm_first; 29 uint8_t chm_last; 30 uint16_t chm_instant; 31 32 uint32_t ticks_offset; 33 34 struct lll_adv_pdu data; 35 #if defined(CONFIG_BT_CTLR_ADV_PDU_LINK) 36 struct pdu_adv *last_pdu; 37 #endif /* CONFIG_BT_CTLR_ADV_PDU_LINK */ 38 39 #if defined(CONFIG_BT_CTLR_ADV_ISO) 40 struct lll_adv_iso *iso; 41 #endif /* CONFIG_BT_CTLR_ADV_ISO */ 42 43 #if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX) 44 /* This flag is used only by LLL. It holds information if CTE 45 * transmission was started by LLL. 46 */ 47 uint8_t cte_started:1; 48 #endif /* CONFIG_BT_CTLR_DF_ADV_CTE_TX */ 49 50 #if defined(CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL) 51 int8_t tx_pwr_lvl; 52 #endif /* CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL */ 53 }; 54 55 struct lll_adv_aux { 56 struct lll_hdr hdr; 57 struct lll_adv *adv; 58 59 /* Implementation defined radio event counter to calculate auxiliary 60 * PDU channel index. 61 */ 62 uint16_t data_chan_counter; 63 64 /* Temporary stored use by primary channel PDU event to fill the 65 * auxiliary offset to this auxiliary PDU event. 66 */ 67 uint32_t ticks_offset; 68 69 struct lll_adv_pdu data; 70 71 #if defined(CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL) 72 int8_t tx_pwr_lvl; 73 #endif /* CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL */ 74 }; 75 76 struct lll_adv { 77 struct lll_hdr hdr; 78 79 #if defined(CONFIG_BT_PERIPHERAL) 80 /* NOTE: conn context SHALL be after lll_hdr, 81 * check ull_conn_setup how it access the connection LLL 82 * context. 83 */ 84 struct lll_conn *conn; 85 uint8_t is_hdcd:1; 86 #endif /* CONFIG_BT_PERIPHERAL */ 87 88 uint8_t chan_map:3; 89 uint8_t chan_map_curr:3; 90 uint8_t filter_policy:2; 91 92 #if defined(CONFIG_BT_CTLR_ADV_EXT) 93 uint8_t phy_p:3; 94 uint8_t phy_s:3; 95 uint8_t phy_flags:1; 96 #endif /* CONFIG_BT_CTLR_ADV_EXT */ 97 98 #if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY) 99 uint8_t scan_req_notify:1; 100 #endif 101 102 #if defined(CONFIG_BT_HCI_MESH_EXT) 103 uint8_t is_mesh:1; 104 #endif /* CONFIG_BT_HCI_MESH_EXT */ 105 106 #if defined(CONFIG_BT_CTLR_PRIVACY) 107 uint8_t rl_idx; 108 #endif /* CONFIG_BT_CTLR_PRIVACY */ 109 110 struct lll_adv_pdu adv_data; 111 struct lll_adv_pdu scan_rsp; 112 113 #if defined(CONFIG_BT_CTLR_ADV_EXT) 114 struct node_rx_hdr *node_rx_adv_term; 115 struct lll_adv_aux *aux; 116 117 #if defined(CONFIG_BT_CTLR_ADV_PERIODIC) 118 struct lll_adv_sync *sync; 119 #endif /* CONFIG_BT_CTLR_ADV_PERIODIC */ 120 #endif /* CONFIG_BT_CTLR_ADV_EXT */ 121 122 #if defined(CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL) 123 int8_t tx_pwr_lvl; 124 #endif /* CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL */ 125 }; 126 127 int lll_adv_init(void); 128 int lll_adv_reset(void); 129 void lll_adv_prepare(void *param); 130 131 extern uint16_t ull_adv_lll_handle_get(struct lll_adv *lll); 132