Mistake on this page?
Report an issue in GitHub or email us
ll_defs.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Link layer constant definitions.
6  *
7  * Copyright (c) 2013-2019 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef LL_DEFS_H
26 #define LL_DEFS_H
27 
28 #include "wsf_types.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /**************************************************************************************************
35  Constants
36 **************************************************************************************************/
37 
38 /*** Version ***/
39 
40 #define LL_VER_BT_CORE_SPEC_4_0 0x06 /*!< Bluetooth core specification 4.0 */
41 #define LL_VER_BT_CORE_SPEC_4_1 0x07 /*!< Bluetooth core specification 4.1 */
42 #define LL_VER_BT_CORE_SPEC_4_2 0x08 /*!< Bluetooth core specification 4.2 */
43 #define LL_VER_BT_CORE_SPEC_5_0 0x09 /*!< Bluetooth core specification 5.0 */
44 #define LL_VER_BT_CORE_SPEC_5_1 0x0A /*!< Bluetooth core specification 5.1 */
45 #define LL_VER_BT_CORE_SPEC_5_2 0x0B /*!< Bluetooth core specification 5.2 */
46 #define LL_VER_BT_CORE_SPEC_SYDNEY 0x0C /*!< Bluetooth core specification Sydney */
47 
48 #define LL_COMP_ID_ARM 0x005F /*!< ARM Ltd. company ID. */
49 
50 /*** Common ***/
51 
52 #define LL_RSSI_MIN -127 /*!< Minimum RSSI value. */
53 #define LL_RSSI_MAX 20 /*!< Maximum RSSI value. */
54 #define LL_RSSI_NOT_AVAIL 127 /*!< RSSI is not available. */
55 
56 #define LL_CRC_LEN 3 /*!< CRC length. */
57 #define LL_AA_LEN 4 /*!< Access address length. */
58 #define LL_PREAMBLE_LEN_1M 1 /*!< Preamble length (LE 1M PHY). */
59 #define LL_PREAMBLE_LEN_2M 2 /*!< Preamble length (LE 2M PHY). */
60 #define LL_PREAMBLE_LEN_CODED_BITS 10 /*!< Preamble length (LE Coded PHY). */
61 #define LL_CI_LEN_BITS 2 /*!< Coding indicator length (LE Coded PHY). */
62 #define LL_TERM1_LEN_BITS 3 /*!< TERM1 length (LE Coded PHY). */
63 #define LL_TERM2_LEN_BITS 3 /*!< TERM2 length (LE Coded PHY). */
64 
65 #define LL_RAND_ADDR_TYPE_MASK UINT64_C(0xC00000000000) /*!< BD Random Address type mask. */
66 #define LL_RAND_ADDR_TYPE_STATIC UINT64_C(0xC00000000000) /*!< Static Random Address type. */
67 #define LL_RAND_ADDR_TYPE_RPA UINT64_C(0x400000000000) /*!< Resolvable Private Address type. */
68 #define LL_RAND_ADDR_TYPE_NRPA UINT64_C(0x000000000000) /*!< Non-Resolvable Private Address type. */
69 
70 /*** Advertising PDU ***/
71 
72 /*! \brief Advertising channel PDU types. */
73 enum
74 {
75  /* --- Core Spec 4.0 --- */
76  LL_PDU_ADV_IND = 0, /*!< Connectable undirected advertising PDU. */
77  LL_PDU_ADV_DIRECT_IND = 1, /*!< Connectable directed advertising PDU. */
78  LL_PDU_ADV_NONCONN_IND = 2, /*!< Non-connectable undirected advertising PDU. */
79  LL_PDU_SCAN_REQ = 3, /*!< Scan request PDU. */
80  LL_PDU_SCAN_RSP = 4, /*!< Scan response PDU. */
81  LL_PDU_CONNECT_IND = 5, /*!< Connect indication PDU. */
82  LL_PDU_ADV_SCAN_IND = 6, /*!< Scannable undirected advertising PDU. */
83  /* --- Core Spec 5.0 --- */
84  LL_PDU_AUX_SCAN_REQ = 3, /*!< Auxiliary scan request PDU. */
85  LL_PDU_AUX_CONNECT_REQ = 5, /*!< Auxiliary connect request PDU. */
86  LL_PDU_ADV_EXT_IND = 7, /*!< Extended advertising PDU. */
87  LL_PDU_AUX_ADV_IND = 7, /*!< Auxiliary advertising PDU. */
88  LL_PDU_AUX_SCAN_RSP = 7, /*!< Auxiliary scan response PDU. */
89  LL_PDU_AUX_SYNC_IND = 7, /*!< Auxiliary synchronize PDU. */
90  LL_PDU_AUX_CHAIN_IND = 7, /*!< Auxiliary chain PDU. */
91  LL_PDU_AUX_CONNECT_RSP = 8, /*!< Auxiliary connect response PDU. */
92 };
93 
94 #define LL_SCAN_REQ_PDU_LEN 12 /*!< Size of a scan request PDU. */
95 #define LL_CONN_IND_PDU_LEN 34 /*!< Size of a connect indication PDU. */
96 #define LL_CONN_RSP_PDU_LEN 14 /*!< Size of an auxiliary connect response PDU. */
97 
98 #define LL_CHAN_ADV_MIN_IDX 37 /*!< Minimum advertising channel index. */
99 #define LL_CHAN_ADV_MAX_IDX 39 /*!< Maximum advertising channel index. */
100 #define LL_NUM_CHAN_ADV 3 /*!< Total number of advertising channels. */
101 
102 #define LL_ADVBU_MAX_LEN 31 /*!< Maximum advertising channel host data length. */
103 #define LL_ADVB_MAX_LEN 39 /*!< Maximum advertising channel PDU length. */
104 #define LL_ADVB_MIN_LEN (LL_ADVB_MAX_LEN - LL_ADVBU_MAX_LEN) /*!< Minimum advertising channel packet length. */
105 #define LL_ADVB_MAX_TIME_1M ((LL_BLE_US_PER_BYTE_1M * (LL_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_1M)
106  /*!< Maximum time for a 1M advertising channel PDU. */
107 #define LL_ADVB_MAX_TIME_2M ((LL_BLE_US_PER_BYTE_2M * (LL_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_2M)
108  /*!< Maximum time for a 2M advertising channel PDU. */
109 #define LL_ADVB_MAX_TIME_S2 ((LL_BLE_US_PER_BYTE_CODED_S2 * (LL_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_CODED_S2)
110  /*!< Maximum time for a Coded S2 advertising channel PDU. */
111 #define LL_ADVB_MAX_TIME_S8 ((LL_BLE_US_PER_BYTE_CODED_S8 * (LL_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_CODED_S8)
112  /*!< Maximum time for a Coded S8 advertising channel PDU. */
113 
114 #define LL_ADV_PKT_MAX_USEC LL_ADVB_MAX_TIME_1M /*!< Maximum time in microseconds for an advertising packet. */
115 #define LL_SCAN_REQ_MAX_USEC ((8 * (LL_ADV_PREFIX_LEN + LL_SCAN_PREFIX_LEN)) + LL_MIN_PKT_TIME_US_1M)
116  /*!< Maximum time in microseconds for a scan request packet. */
117 #define LL_SCAN_RSP_MAX_USEC LL_ADVB_MAX_TIME_1M /*!< Maximum time in microseconds for a scan response packet. */
118 
119 #define LL_ADV_HDR_LEN 2 /*!< Advertising channel header length. */
120 #define LL_ADV_HDR_TYPE_OFFS 0 /*!< Advertising header type offset. */
121 #define LL_ADV_HDR_TYPE_MSK 0x0F /*!< Advertising header type mask. */
122 #define LL_ADV_HDR_LEN_OFFS 1 /*!< Advertising header length offset. */
123 #define LL_ADV_HDR_LEN_MSK 0x3F /*!< Advertising header length mask for 4.2. */
124 #define LL_ADV_HDR_CP_MSK 0x40 /*!< Advertising header CP Mask for 5.1. */
125 #define LL_ADV_EXT_HDR_LEN_MSK 0xFF /*!< Advertising extension header length mask for 5.0. */
126 #define LL_ADV_PREFIX_LEN 6 /*!< Advertising PDU payload prefix length (AdvA). */
127 #define LL_SCAN_PREFIX_LEN 6 /*!< Scan request/response PDU payload prefix length (AdvA). */
128 
129 #define LL_ADV_ACCESS_ADDR UINT32_C(0x8E89BED6) /*!< Advertising channel access address. */
130 #define LL_ADV_CRC_INIT UINT32_C(0x555555) /*!< Advertising CRC initial value. */
131 
132 #define LL_DIR_ADV_INTER_TICKS 6 /*!< Advertising interval between directed advertising events (3.75 ms). */
133 #define LL_DIR_ADV_DUR_TICKS 2048 /*!< Maximum high duty cycle directed advertising duration (1.28 seconds). */
134 
135 /*! \brief Extended header bit definition. */
136 enum
137 {
138  LL_EXT_HDR_ADV_ADDR_BIT = (1 << 0), /*!< Extended header AdvA bit. */
139  LL_EXT_HDR_TGT_ADDR_BIT = (1 << 1), /*!< Extended header TargetA bit. */
140  LL_EXT_HDR_CTE_INFO_BIT = (1 << 2), /*!< Extended header CTEInfo bit. */
141  LL_EXT_HDR_ADI_BIT = (1 << 3), /*!< Extended header AdvDataInfo bit. */
142  LL_EXT_HDR_AUX_PTR_BIT = (1 << 4), /*!< Extended header AuxPtr bit. */
143  LL_EXT_HDR_SYNC_INFO_BIT = (1 << 5), /*!< Extended header SyncInfo bit. */
144  LL_EXT_HDR_TX_PWR_BIT = (1 << 6), /*!< Extended header TxPower bit. */
145 };
146 
147 #define LL_MAX_ADV_HANDLE 0xEF /*!< Maximum advertising handle. */
148 #define LL_MAX_ADV_SID 0x0F /*!< Maximum advertising SID */
149 
150 #define LL_EXT_ADV_HDR_MIN_LEN 1 /*!< Minimum extended advertising header length (ExtHdrLen and AdvMode fields). */
151 #define LL_EXT_ADV_HDR_MAX_LEN 64 /*!< Maximum extended advertising header length (ExtHdrLen, AdvMode fields and Extended header). */
152 #define LL_EXT_HDR_FLAG_LEN 1 /*!< Length of extended header flag field */
153 #define LL_EXT_ADVBU_MAX_LEN 251 /*!< Maximum extended advertising channel PDU host data length. */
154 #define LL_EXT_ADVB_MAX_LEN 257 /*!< Maximum extended advertising channel PDU length. */
155 #define LL_EXT_ADVB_NORMAL_LEN 50 /*!< Normal extended advertising channel PDU length. */
156 
157 #define LL_EXT_HDR_ACAD_MAX_LEN LL_EXT_ADV_HDR_MAX_LEN - LL_EXT_ADV_HDR_MIN_LEN - LL_EXT_HDR_FLAG_LEN /*!< Maximum possible ACAD length (Max extended header minus ExtHdrLen, AdvMode, and extended header flag field. */
158 
159 #define LL_EXT_ADVB_MAX_TIME_1M ((LL_BLE_US_PER_BYTE_1M * (LL_EXT_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_1M)
160  /*!< Maximum time for a 1M advertising channel PDU. */
161 #define LL_EXT_ADVB_MAX_TIME_2M ((LL_BLE_US_PER_BYTE_2M * (LL_EXT_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_2M)
162  /*!< Maximum time for a 2M advertising channel PDU. */
163 #define LL_EXT_ADVB_MAX_TIME_S2 ((LL_BLE_US_PER_BYTE_CODED_S2 * (LL_EXT_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_CODED_S2)
164  /*!< Maximum time for a Coded S2 advertising channel PDU. */
165 #define LL_EXT_ADVB_MAX_TIME_S8 ((LL_BLE_US_PER_BYTE_CODED_S8 * (LL_EXT_ADVB_MAX_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_CODED_S8)
166  /*!< Maximum time for a Coded S8 advertising channel PDU. */
167 #define LL_EXT_ADVB_NORMAL_TIME_S8 ((LL_BLE_US_PER_BYTE_CODED_S8 * (LL_EXT_ADVB_NORMAL_LEN - LL_ADV_HDR_LEN)) + LL_MIN_PKT_TIME_US_CODED_S8)
168  /*!< Time for a Coded S8 advertising channel PDU with normal length. */
169 
170 #define LL_AUX_PTR_MAX_USEC 2457600 /*!< Maximum AuxPtr offset value in microseconds. */
171 
172 #define LL_SYNC_MIN_TIMEOUT 0x000A /*!< Minimum synchronization timeout. */
173 #define LL_SYNC_MAX_TIMEOUT 0x4000 /*!< Maximum synchronization timeout. */
174 #define LL_SYNC_MAX_SKIP 0x01F3 /*!< Maximum synchronization skip. */
175 #define LL_SYNC_MAX_HANDLE 0x0EFF /*!< Maximum synchronization handle. */
176 
177 #define LL_PER_ADV_INT_MIN 0x0006 /*!< Minimum periodic advertising interval. */
178 
179 #define LL_SYNC_OFFS_ADJUST_USEC LL_AUX_PTR_MAX_USEC /*!< Sync offset adjust of 2.4576 seconds. */
180 #define LL_SYNC_INFO_LEN 18 /*!< Size of SyncInfo field. */
181 
182 /*! \brief Periodic sync transfer receive mode. */
183 enum
184 {
185  LL_SYNC_TRSF_MODE_OFF = 0, /*!< Periodic sync transfer receive is disabled. */
186  LL_SYNC_TRSF_MODE_REP_DISABLED = 1, /*!< Periodic sync transfer receive is enabled, report event is disabled. */
187  LL_SYNC_TRSF_MODE_REP_ENABLED = 2, /*!< Periodic sync transfer receive is enabled, report event is enabled. */
188  LL_SYNC_TRSF_MAX_MODE = LL_SYNC_TRSF_MODE_REP_ENABLED
189 };
190 
191 /*** Data PDU ***/
192 
193 /*! \brief Data channel LL Control PDU types. */
194 enum
195 {
196  /* --- Core Spec 4.0 --- */
197  LL_PDU_CONN_UPDATE_IND = 0x00, /*!< Connection update indication PDU. */
198  LL_PDU_CHANNEL_MAP_IND = 0x01, /*!< Channel map indication PDU. */
199  LL_PDU_TERMINATE_IND = 0x02, /*!< Terminate indication PDU. */
200  LL_PDU_ENC_REQ = 0x03, /*!< Encryption request PDU. */
201  LL_PDU_ENC_RSP = 0x04, /*!< Encryption response PDU. */
202  LL_PDU_START_ENC_REQ = 0x05, /*!< Start encryption request PDU. */
203  LL_PDU_START_ENC_RSP = 0x06, /*!< Start encryption response PDU. */
204  LL_PDU_UNKNOWN_RSP = 0x07, /*!< Unknown response PDU. */
205  LL_PDU_FEATURE_REQ = 0x08, /*!< Feature request PDU. */
206  LL_PDU_FEATURE_RSP = 0x09, /*!< Feature response PDU. */
207  LL_PDU_PAUSE_ENC_REQ = 0x0A, /*!< Pause encryption request PDU. */
208  LL_PDU_PAUSE_ENC_RSP = 0x0B, /*!< Pause encryption response PDU. */
209  LL_PDU_VERSION_IND = 0x0C, /*!< Version indication PDU. */
210  LL_PDU_REJECT_IND = 0x0D, /*!< Reject indication PDU. */
211  /* --- Core Spec 4.2 --- */
212  LL_PDU_SLV_FEATURE_REQ = 0x0E, /*!< Slave feature request PDU. */
213  LL_PDU_CONN_PARAM_REQ = 0x0F, /*!< Connection parameter request PDU. */
214  LL_PDU_CONN_PARAM_RSP = 0x10, /*!< Connection parameter response PDU. */
215  LL_PDU_REJECT_EXT_IND = 0x11, /*!< Reject extended indication PDU. */
216  LL_PDU_PING_REQ = 0x12, /*!< Ping request PDU. */
217  LL_PDU_PING_RSP = 0x13, /*!< Ping response PDU. */
218  LL_PDU_LENGTH_REQ = 0x14, /*!< Data length request PDU. */
219  LL_PDU_LENGTH_RSP = 0x15, /*!< Data length response PDU. */
220  /* --- Core Spec 5.0 --- */
221  LL_PDU_PHY_REQ = 0x16, /*!< PHY request PDU. */
222  LL_PDU_PHY_RSP = 0x17, /*!< PHY response PDU. */
223  LL_PDU_PHY_UPDATE_IND = 0x18, /*!< PHY update indication PDU. */
224  LL_PDU_MIN_USED_CHAN_IND = 0x19, /*!< Minimum used channels indication PDU. */
225  /* --- Core Spec 5.1 --- */
226  /* 0x1A 0x1B for AOA AOD, 0x1C for PAST 0x20 RFU */
227  LL_PDU_PERIODIC_SYNC_IND = 0x1C, /*!< Periodic sync indication PDU. */
228  /* --- Core Spec 5.2 --- */
229  LL_PDU_PEER_SCA_REQ = 0x1D, /*!< Peer SCA request PDU. */
230  LL_PDU_PEER_SCA_RSP = 0x1E, /*!< Peer SCA response PDU. */
231  LL_PDU_CIS_REQ = 0x1F, /*!< CIS request PDU. */
232  LL_PDU_CIS_RSP = 0x20, /*!< CIS response PDU. */
233  LL_PDU_CIS_IND = 0x21, /*!< CIS indication PDU. */
234  LL_PDU_CIS_TERM_IND = 0x22, /*!< CIS terminate indication PDU. */
235  LL_PDU_PWR_CTRL_REQ = 0x23, /*!< Power Control request. */
236  LL_PDU_PWR_CTRL_RSP = 0x24, /*!< Power Control response. */
237  LL_PDU_PWR_CHNG_IND = 0x25, /*!< Transmit power change indication PDU. */
238 
239  LL_PDU_UNSPECIFIED = 0xFF /*!< Unspecified PDU. */
240 };
241 
242 /* Data PDU length */
243 
244 /* --- Core Spec 4.0 --- */
245 #define LL_CONN_UPD_IND_PDU_LEN 12 /*!< Connection update indication PDU length. */
246 #define LL_CHAN_MAP_IND_PDU_LEN 8 /*!< Channel map indication PDU length. */
247 #define LL_TERMINATE_IND_PDU_LEN 2 /*!< Terminate indication PDU length. */
248 #define LL_ENC_REQ_LEN 23 /*!< Encryption request PDU length. */
249 #define LL_ENC_RSP_LEN 13 /*!< Encryption response PDU length. */
250 #define LL_START_ENC_LEN 1 /*!< Start encryption request/response PDU length. */
251 #define LL_UNKNOWN_RSP_LEN 2 /*!< Unknown response PDU length. */
252 #define LL_FEATURE_PDU_LEN 9 /*!< Feature request/response PDU length. */
253 #define LL_PAUSE_ENC_LEN 1 /*!< Pause encryption request/response PDU length. */
254 #define LL_VERSION_IND_PDU_LEN 6 /*!< Version indication PDU length. */
255 #define LL_REJECT_IND_PDU_LEN 2 /*!< Reject indication PDU length. */
256 /* --- Core Spec 4.2 --- */
257 #define LL_CONN_PARAM_PDU_LEN 24 /*!< Connection parameter request or response PDU length. */
258 #define LL_REJECT_EXT_IND_PDU_LEN 3 /*!< Reject extended indication PDU length. */
259 #define LL_PING_PDU_LEN 1 /*!< Ping request/response PDU length. */
260 #define LL_DATA_LEN_PDU_LEN 9 /*!< Data length request or response PDU length. */
261 /* --- Core Spec 5.0 --- */
262 #define LL_PHY_PDU_LEN 3 /*!< PHY request/response PDU length. */
263 #define LL_PHY_UPD_IND_PDU_LEN 5 /*!< PHY update indication PDU length. */
264 #define LL_MIN_USED_CHAN_PDU_LEN 3 /*!< Minimum used channels indication PDU length. */
265 /* --- Core Spec 5.1 --- */
266 #define LL_PERIODIC_SYNC_PDU_LEN 35 /*!< Periodic sync indication PDU length. */
267 /* --- Core Spec 5.2 --- */
268 #define LL_PEER_SCA_REQ_LEN 2 /*!< Peer SCA request PDU length. */
269 #define LL_PEER_SCA_RSP_LEN 2 /*!< Peer SCA response PDU length. */
270 #define LL_CIS_REQ_LEN 36 /*!< CIS request PDU length. */
271 #define LL_CIS_RSP_LEN 9 /*!< CIS response PDU length. */
272 #define LL_CIS_IND_LEN 16 /*!< CIS indication PDU length. */
273 #define LL_CIS_TERM_LEN 4 /*!< CIS termination PDU length. */
274 #define LL_CIS_SDU_CONFIG_REQ_LEN 13 /*!< CIS SDU config request PDU length. */
275 #define LL_CIS_SDU_CONFIG_RSP_LEN 4 /*!< CIS SDU config response PDU length. */
276 #define LL_PWR_CTRL_REQ_LEN 4 /*!< Power Control request PDU length. */
277 #define LL_PWR_CTRL_RSP_LEN 5 /*!< Power Control response PDU length. */
278 #define LL_PWR_CHNG_IND_LEN 5 /*!< Power Indication PDU length. */
279 
280 #define LL_EMPTY_PDU_LEN 2 /*!< Length of an empty data PDU. */
281 
282 #define LL_DATA_HDR_LEN 2 /*!< Data channel header length. */
283 #define LL_DATA_HDR_MAX_LEN 4 /*!< Data channel header max length (with CTE field). */
284 #define LL_DATA_MIC_LEN 4 /*!< Data channel PDU MIC length. */
285 
286 #define LL_DATA_HDR_LLID_MSK 0x03 /*!< Data PDU LLID mask. */
287 #define LL_DATA_HDR_LEN_MSK 0xFF /*!< Data header length mask. BLE 4.2 data len extension allows 8 bits. */
288 
289 #define LL_MAX_NUM_CHAN_DATA 37 /*!< Maximum number of used data channels. */
290 #define LL_MIN_NUM_CHAN_DATA 2 /*!< Minimum number of used data channels. */
291 
292 /*! \brief Data PDU LLID types. */
293 enum
294 {
295  LL_LLID_VS_PDU = 0x00, /*!< Vendor specific PDU. */
296  /* N.B. next two enumerations intentionally use identical values. */
297  LL_LLID_EMPTY_PDU = 0x01, /*!< Empty PDU. */
298  LL_LLID_CONT_PDU = 0x01, /*!< Data PDU: continuation fragment of an L2CAP message. */
299  LL_LLID_START_PDU = 0x02, /*!< Data PDU: start of an L2CAP message or a complete L2CAP message with no fragmentation. */
300  LL_LLID_CTRL_PDU = 0x03, /*!< Control PDU. */
301 };
302 
303 /*** Encryption ***/
304 
305 #define LL_ECC_KEY_LEN 32 /*!< ECC key length. */
306 
307 #define LL_DEF_RES_ADDR_TO_SEC 900 /*!< Default resolvable address timeout in seconds. */
308 
309 #define LL_RAND_LEN 8 /*!< Length of random number */
310 #define LL_KEY_LEN 16 /*!< Encryption key length. */
311 #define LL_SKD_LEN LL_KEY_LEN /*!< Session key diversifier length. */
312 #define LL_IV_LEN 8 /*!< Initialization vector length. */
313 #define LL_BC_LEN LL_KEY_LEN /*!< Broadcast code length. */
314 #define LL_GIV_LEN 8 /*!< GIV length. */
315 #define LL_GSKD_LEN 16 /*!< GSKD code length. */
316 
317 #define LL_DEF_AUTH_TO_MS 30000 /*!< Default authentication timeout in milliseconds. */
318 
319 /*** LLCP ***/
320 
321 #define LL_DATA_LEN_TO_TIME_1M(len, enc) ((LL_BLE_US_PER_BYTE_1M * ((len) + ((enc) ? LL_DATA_MIC_LEN : 0))) + LL_MIN_PKT_TIME_US_1M)
322  /*!< Convert data length to time. */
323 #define LL_DATA_LEN_TO_TIME_2M(len, enc) ((LL_BLE_US_PER_BYTE_2M * ((len) + ((enc) ? LL_DATA_MIC_LEN : 0))) + LL_MIN_PKT_TIME_US_2M)
324  /*!< Convert data length to time. */
325 #define LL_DATA_LEN_TO_TIME_CODED_S8(len, enc) ((LL_BLE_US_PER_BYTE_CODED_S8 * ((len) + ((enc) ? LL_DATA_MIC_LEN : 0))) + LL_MIN_PKT_TIME_US_CODED_S8)
326  /*!< Convert data length to time. */
327 #define LL_DATA_LEN_TO_TIME_CODED_S2(len, enc) ((LL_BLE_US_PER_BYTE_CODED_S2 * ((len) + ((enc) ? LL_DATA_MIC_LEN : 0))) + LL_MIN_PKT_TIME_US_CODED_S2)
328  /*!< Convert data length to time. */
329 
330 #define LL_MIN_INSTANT 6 /*!< Minimum number of CE to apply a CONN_UPD or CHAN_MAP. */
331 
332 #define LL_MAX_ADV_DATA_LEN 1650 /*!< Maximum advertising data length. */
333 
334 #define LL_MAX_DATA_LEN_MIN 27 /*!< Minimum value for maximum Data PDU length */
335 #define LL_MAX_DATA_LEN_ABS_MAX 251 /*!< Absolute maximum limit for maximum Data PDU length */
337 #define LL_MAX_DATA_TIME_MIN 328 /*!< Minimum value for maximum Data PDU time */
338 #define LL_MAX_DATA_TIME_ABS_MAX 17040 /*!< Absolute maximum limit for maximum Data PDU time */
339 #define LL_MAX_DATA_TIME_ABS_MAX_1M 2128 /*!< Absolute maximum limit for maximum Data PDU time (LE 1M PHY) */
340 #define LL_MAX_DATA_TIME_ABS_MIN_CODED 2704 /*!< Absolute minimum limit for maximum Data PDU time (CODED PHY) */
342 #define LL_T_PRT_SEC 40 /*!< LLCP procedure response timeout in seconds. */
344 #define LL_MAX_ADV_DLY_MS 10 /*!< Maximum advertising delay in milliseconds. */
345 
346 #define LL_MIN_CONN_INTERVAL 6 /*!< Minimum value for connection interval. */
347 #define LL_MAX_CONN_INTERVAL 3200 /*!< Maximum value for connection interval. */
349 #define LL_MIN_TX_WIN_SIZE 1 /*!< Minimum value for transmit window size. */
350 #define LL_MAX_TX_WIN_SIZE 8 /*!< Maximum value for transmit window size. */
352 #define LL_MAX_CONN_LATENCY 499 /*!< Maximum value for connection slave latency. */
354 #define LL_MIN_SUP_TIMEOUT 10 /*!< Minimum value for connection supervision timeout. */
355 #define LL_MAX_SUP_TIMEOUT 3200 /*!< Maximum value for connection supervision timeout. */
357 #define LL_MIN_POWER_THRESHOLD -128 /*!< Minimum value for power threshold. */
358 #define LL_MAX_POWER_THRESHOLD 127 /*!< Maximum value for power threshold. */
360 #define LL_MAX_PHYS 3 /*!< Number of LE PHYs. */
361 #define LL_ALL_PHYS_MSK 0x7 /*!< All supported LE PHYs mask. */
363 /*** ISO ***/
365 #define LL_ISO_DATA_HDR_LEN 2 /*!< ISO Data PDU header length. */
366 #define LL_ISO_DATA_PLD_MAX_LEN 251 /*!< Maximum ISO Data PDU payload length */
367 #define LL_ISO_PDU_MAX_LEN (HCI_ISO_HDR_LEN + BB_DATA_PLD_MAX_LEN + BB_DATA_PDU_TAILROOM)
368  /*!< Maximum ISO Data PDU length. */
370 #define LL_ISO_SEG_HDR_LEN 2 /*!< Segmentation header length. */
371 #define LL_ISO_SEG_TO_LEN 3 /*!< Segmentation Time Offset length. */
372 
373 #define LL_MAX_CIS_COUNT 0x10 /*!< Maximum count for CIS. */
375 #define LL_MIN_CIG_ID 0x00 /*!< Minimum value for CIG ID. */
376 #define LL_MAX_CIG_ID 0xEF /*!< Maximum value for CIG ID. */
378 #define LL_MIN_CIS_ID 0x00 /*!< Minimum value for CIS ID. */
379 #define LL_MAX_CIS_ID 0xEF /*!< Maximum value for CIS ID. */
381 #define LL_MIN_ISO_INTERV 0x0004 /*!< Minimum value for ISO interval. */
382 #define LL_MAX_ISO_INTERV 0x0C80 /*!< Maximum value for ISO interval. */
384 #define LL_MIN_ISOAL_PDU_TYPE 0x00 /*!< Minimum value for ISOAL PDU type. */
385 #define LL_MAX_ISOAL_PDU_TYPE 0x01 /*!< Maximum value for ISOAL PDU type. */
387 #define LL_MIN_SDU_SIZE 0x000 /*!< Minimum value for SDU size. */
388 #define LL_MAX_SDU_SIZE 0xFFF /*!< Maximum value for SDU size. */
390 #define LL_MIN_SDU_INTERV 0x000FF /*!< Minimum value for SDU interval. */
391 #define LL_MAX_SDU_INTERV 0xFFFFF /*!< Maximum value for SDU interval. */
393 #define LL_MIN_CIS_NSE 0x01 /*!< Minimum value for CIS number of subevent. */
394 #define LL_MAX_CIS_NSE 0x1F /*!< Maximum value for CIS number of subevent. */
396 #define LL_MIN_CIS_PL 0x0000 /*!< Minimum value for CIS payload. */
397 #define LL_MAX_CIS_PL 0x0FFB /*!< Maximum value for CIS payload. */
399 #define LL_MIN_CIS_TRANS_LAT 0x0005 /*!< Minimum value for CIS transport latency. */
400 #define LL_MAX_CIS_TRANS_LAT 0x0FA0 /*!< Maximum value for CIS transport latency. */
402 #define LL_MIN_CIS_PHY_BIT 0x00 /*!< Minimum value for CIS PHY bit. */
403 #define LL_MAX_CIS_PHY_BIT 0x02 /*!< Maximum value for CIS PHY bit. */
405 #define LL_MIN_CIS_FT 0x01 /*!< Minimum value for CIS flush time. */
406 #define LL_MAX_CIS_FT 0x1F /*!< Maximum value for CIS flush time. */
408 #define LL_MIN_CIS_BN 0x00 /*!< Minimum value for CIS burst number. */
409 #define LL_MAX_CIS_BN 0x10 /*!< Maximum value for CIS burst number. */
411 #define LL_MIN_CIS_RTN 0x00 /*!< Minimum value for CIS retransmission number. */
412 #define LL_MAX_CIS_RTN 0x0F /*!< Maximum value for CIS retransmission number. */
414 /*! \brief ISO PDU LLID types. */
415 typedef enum
416 {
417  /* ISO */
418  LL_LLID_ISO_UNF_END_PDU = 0x00, /*!< Unframed ISO Data PDU; end fragment of a SDU. */
419  LL_LLID_ISO_UNF_CONT_PDU = 0x01, /*!< Unframed ISO Data PDU; start or continuation fragment of a SDU. */
420  LL_LLID_ISO_FRA_PDU = 0x02, /*!< Framed ISO Data PDU; one or more segments of a SDU. */
421  LL_LLID_ISO_EMPTY_PDU = 0x01, /*!< ISO Empty PDU. */
423  /* BIS */
424  LL_LLID_BIG_CTRL_PDU = 0x03 /*!< BIG Control PDU. */
426 
427 /*! \brief ISO PDU type. */
428 typedef enum
429 {
430  LL_ISO_PDU_TYPE_UNFRAMED = 0x00, /*!< Unframed PDU type. */
431  LL_ISO_PDU_TYPE_FRAMED = 0x01 /*!< Framed PDU type. */
433 
434 /*! \brief ISO test payload types. */
435 enum
436 {
437  LL_ISO_TEST_PL_LEN_ZERO = 0x00, /*!< Zero length test payload */
438  LL_ISO_TEST_PL_LEN_VAR = 0x01, /*!< Variable length test payload */
439  LL_ISO_TEST_PL_LEN_MAX = 0x02 /*!< Maximum length test payload */
440 };
442 /*! \brief ISOAL SDU assembly states. */
443 enum
444 {
445  LL_ISO_SDU_STATE_NEW = 0x00, /*!< New SDU state. */
446  LL_ISO_SDU_STATE_CONT = 0x01 /*!< SDU pending state. */
447 };
448 
449 #define LL_ISO_TEST_VAR_MIN_LEN 4 /*!< Minimum length test payload. */
451 #define LL_ISO_TRANSPORT_LAT_MIN 0x0000EA /*!< Minimum transport latency. */
452 
453 /*** DTM ***/
454 
455 #define LL_DTM_HDR_LEN 2 /*!< Direct Test Mode PDU header length. */
456 #define LL_DTM_SYNC_WORD UINT32_C(0x71764129) /*!< Direct Test Mode sync word. */
457 #define LL_DTM_CRC_INIT UINT32_C(0x555555) /*!< Direct Test Mode CRC initial value. */
458 #define LL_DTM_MAX_INT_US 12500 /*!< Maximum time interval between packets in microseconds. */
459 #define LL_DTM_PDU_ABS_MAX_LEN 255 /*!< Absolute maximum DTM PDU length. */
460 #define LL_DTM_MAX_CHAN_IDX 39 /*!< Maximum channel index. */
462 /*** Baseband ***/
464 #define LL_CHAN_DATA_MIN_IDX 0 /*!< Minimum data channel index. */
465 #define LL_CHAN_DATA_MAX_IDX 36 /*!< Maximum data channel index. */
466 #define LL_CHAN_DATA_ALL UINT64_C(0x0000001FFFFFFFFF) /*!< Maximum data channel index. */
467 
468 #define LL_BLE_BIT_PER_US 1 /*!< BLE PHY rate. */
469 #define LL_BLE_US_PER_BYTE_1M 8 /*!< BLE PHY speed (LE 1M PHY). */
470 #define LL_BLE_US_PER_BYTE_2M 4 /*!< BLE PHY speed (LE 2M PHY). */
471 #define LL_BLE_US_PER_BYTE_CODED_S8 64 /*!< BLE PHY speed (LE Coded PHY, S=8). */
472 #define LL_BLE_US_PER_BIT_CODED_S8 8 /*!< BLE PHY speed (LE Coded PHY, S=8). */
473 #define LL_BLE_US_PER_BYTE_CODED_S2 16 /*!< BLE PHY speed (LE Coded PHY, S=2). */
474 #define LL_BLE_US_PER_BIT_CODED_S2 2 /*!< BLE PHY speed (LE Coded PHY, S=2). */
475 #define LL_BLE_TIFS_US 150 /*!< BLE inter-frame space. */
476 #define LL_BLE_MAFS_US 300 /*!< BLE minimum AUX frame space. */
477 #define LL_BLE_US_PER_TICK 625 /*!< Microseconds per BLE tick. */
478 #define LL_BLE_TMSS_US 150 /*!< BLE minimum subevent space. */
480 #define LL_MIN_PKT_TIME_US_1M 80 /*!< Minimum packet time (i.e. empty PDU) on LE 1M PHY. */
481 #define LL_MIN_PKT_TIME_US_2M 44 /*!< Minimum packet time (i.e. empty PDU) on LE 2M PHY. */
482 #define LL_MIN_PKT_TIME_US_CODED_S8 720 /*!< Minimum packet time (i.e. empty PDU) on LE Coded PHY, S=8. */
483 #define LL_MIN_PKT_TIME_US_CODED_S2 462 /*!< Minimum packet time (i.e. empty PDU) on LE Coded PHY, S=2. */
485 #define LL_MIN_ADV_TX_PWR_LVL -20 /*!< Minimum Tx power level for advertising. */
486 #define LL_MAX_ADV_TX_PWR_LVL 10 /*!< Maximum Tx power level for advertising. */
488 #define LL_MIN_TX_PWR_LVL -30 /*!< Minimum Tx power level for connections. */
489 #define LL_MAX_TX_PWR_LVL 20 /*!< Maximum Tx power level for connections. */
491 #define LL_MAX_TIFS_DEVIATION 2 /*!< Maximum TIFS deviation in microseconds. */
493 #define LL_WW_RX_DEVIATION_USEC 16 /*!< RX deviation in microseconds for window widening. */
494 
495 #define LL_30_USEC_OFFS_MAX_USEC 245730 /*!< Maximum value for 30 microseconds offset unit in microseconds. */
496 
497 /*** ACAD ***/
498 
499 /*! \brief ACAD opcodes. */
500 enum
501 {
502  LL_ACAD_OPCODE_CHAN_MAP_UPD = 0x28, /*!< Opcode for ACAD Channel Map Update Indication. */
503  LL_ACAD_OPCODE_BIG_INFO = 0x2C /*!< Opcode for ACAD BIG Info. */
504 };
505 
506 #define LL_ACAD_OPCODE_LEN 1 /*!< Length of a single ACAD opcode. */
507 #define LL_ACAD_LEN_FIELD_LEN 1 /*!< Length of ACAD length field */
508 #define LL_ACAD_DATA_FIELD_MAX_LEN (LL_EXT_HDR_ACAD_MAX_LEN - LL_ACAD_OPCODE_LEN - LL_ACAD_LEN_FIELD_LEN)
509  /*!< Length of max ACAD field length without opcode and length field */
510 #define LL_ACAD_CHAN_MAP_UPD_LEN 8 /*!< Length of ACAD update periodic channel map data field. */
511 #define LL_ACAD_BIG_INFO_UNENCRPT_LEN 33 /*!< Length of ACAD for an unencrypted BIG Info. */
512 #define LL_ACAD_BIG_INFO_ENCRPT_LEN 57 /*!< Length of ACAD for an encrypted BIG Info. */
513 
514 /*** BIG Control PDUs ***/
516 /*! \brief BIG Control opcodes. */
517 enum
518 {
519  LL_BIG_OPCODE_CHAN_MAP_IND = 0x00, /*!< Opcode for BIG Channel Map Indication. */
520  LL_BIG_OPCODE_BIG_TERM_IND = 0x01, /*!< Opcode for BIG Terminate Indication. */
521  LL_BIG_OPCODE_MAX /*!< Maximum number of BIG opcodes. */
522 };
524 #define LL_BIG_OPCODE_LEN 1 /*!< Length of a BIG Control PDU opcode. */
526 #define LL_BIG_CHAN_MAP_IND_PDU_LEN 7 /*!< BIG Channel Map indication PDU length. */
527 #define LL_BIG_TERMINATE_IND_PDU_LEN 3 /*!< BIG Terminate indication PDU length. */
529 #define LL_BIG_MIN_INSTANT 6 /*!< Minimum number of BIG Events to apply a BIG Control PDU. */
531 #define LL_BIG_CONTROL_ACCESS_ADDR UINT32_C(0x7A412493)
532  /*!< BIG Control access address. */
534 /*** Modify Sleep Clock Accuracy ***/
536 /*! \brief Action parameter. */
537 enum
538 {
539  LL_MODIFY_SCA_MORE_ACCURATE = 0x00, /*!< Modify to more accurate clock accuracy. */
540  LL_MODIFY_SCA_LESS_ACCURATE = 0x01, /*!< Modify to less accurate clock accuracy. */
541  LL_MODIFY_SCA_NO_ACTION /*!< No action (Used for request sca tester command). */
542 };
544 #define LL_SCA_MIN_INDEX 0 /*!< Index for lowest accuracy clock. */
545 #define LL_SCA_MAX_INDEX 7 /*!< Index for highest accuracy clock. */
546 
547 /*** Power Control ***/
549 /*! \brief Power control Limit field. */
550 #define LL_PWR_CONTROL_LIMIT_MIN_BIT (1 << 0) /*!< txPower is at it's minimum limit. */
551 #define LL_PWR_CONTROL_LIMIT_MAX_BIT (1 << 1) /*!< txPower is at it's maximum limit. */
552 
553 /*! \brief Power control APR field. */
554 #define LL_PWR_CTRL_APR_UNDEF 0xFF /*!< Undefined power reduction limit. */
556 /*! \brief Power control txPower field. */
557 #define LL_PWR_CTRL_TXPOWER_MAX 0x7F /*!< txPower symbol for maximum txPower. */
558 #define LL_PWR_CTRL_TXPOWER_MIN 0x7E /*!< txPower symbol for minimum txPower. */
559 #define LL_PWR_CTRL_TXPOWER_UNAVAILABLE 127 /*!< Power is unavailable for this PHY. */
560 #define LL_PWR_CTRL_TXPOWER_UNMANAGED 126 /*!< Power is unmanaged for this PHY. */
562 /*! \brief Path loss monitoring zones. */
563 enum
564 {
565  LL_PATH_LOSS_ZONE_LOW = 0x00, /*!< Low path loss zone. */
566  LL_PATH_LOSS_ZONE_MID, /*!< Medium path loss zone. */
567  LL_PATH_LOSS_ZONE_HIGH /*!< High path loss zone. */
568 };
570 /*! brief Power control reporting reasons table. */
571 enum
572 {
573  LL_POWER_REPORT_REASON_LOCAL, /*!< Local power change report. */
574  LL_POWER_REPORT_REASON_REMOTE, /*!< Remote power change report. */
575  LL_POWER_REPORT_REASON_READ_REMOTE /*!< Remote transmit power read report. */
576 };
578 /*** ISO ***/
580 #define LL_ISOAL_SEG_HDR_MASK_SC 0x01 /*!< Mask for segmentation header start/continuation bit. */
581 #define LL_ISOAL_SEG_HDR_MASK_CMPLT 0x02 /*!< Mask for segmentation header complete bit. */
582 
583 /*! \brief Codec transport types. */
584 enum
585 {
586  LL_CODEC_TRANS_CIS_BIT = (1 << 2), /*!< Codec supported over LE CIS. */
587  LL_CODEC_TRANS_BIS_BIT = (1 << 3) /*!< Codec supported over LE BIS. */
588 };
589 
590 #ifdef __cplusplus
591 };
592 #endif
593 
594 #endif /* LL_DEFS_H */
LlFraming_t
ISO PDU type.
Definition: ll_defs.h:432
Platform-independent data types.
LlIsoLlid_t
ISO PDU LLID types.
Definition: ll_defs.h:419
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.