1 /******************************************************************************
2  * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
3  * All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************/
18 #ifndef HCI_CMD_H_
19 #define HCI_CMD_H_
20 
21 
22 #include "stack/ble/ble_format.h"
23 
24 
25 
26 
27 /**
28  *  @brief  Command Parameters for "7.1.6 Disconnect command"
29  */
30 typedef struct {
31 	u16	connection_handle;
32 	u8	reason;
33 } hci_disconnect_cmdParam_t;
34 
35 
36 
37 /**
38  *  @brief  Return Parameters for "7.4.6 Read BD_ADDR command"
39  */
40 typedef struct {
41 	u8	status;
42 	u8	bd_addr[6];
43 } hci_readBdAddr_retParam_t;
44 
45 
46 
47 
48 /**
49  *  @brief  Return Parameters for "7.8.2 LE Read Buffer Size command"
50  */
51 typedef struct {
52 	u8	status;
53 	u16	acl_data_pkt_len;  // LE_ACL_Data_Packet_Length
54 	u8	num_le_data_pkt;   // Total_Num_LE_ACL_Data_Packets
55 } hci_le_readBufSize_v1_retParam_t;
56 
57 
58 /**
59  *  @brief  Command Parameters for "7.8.5 LE Set Advertising Parameters command"
60  */
61 /* Advertising Parameters structure */
62 typedef struct {
63 	u16 intervalMin;      // Minimum advertising interval for non-directed advertising, time = N * 0.625ms
64 	u16 intervalMax;      // Maximum advertising interval for non-directed advertising, time = N * 0.625ms
65 	u8  advType;          // Advertising
66 	u8  ownAddrType;
67 	u8  peerAddrType;
68 	u8  peerAddr[6];//BLE_ADDR_LEN];
69 	u8  advChannelMap;
70 	u8  advFilterPolicy;
71 } hci_le_setAdvParam_cmdParam_t;
72 
73 
74 /* Advertising_Interval, Time = N * 0.625 ms,
75  * Notice that these are just part of but not all Advertising_Interval value */
76 typedef enum{
77 	ADV_INTERVAL_3_125MS     =                   5,
78 	ADV_INTERVAL_3_75MS      =                   6,
79 	ADV_INTERVAL_10MS        =                   16,
80 	ADV_INTERVAL_15MS        =                   24,
81 	ADV_INTERVAL_20MS        =                   32,
82 	ADV_INTERVAL_25MS        =                   40,
83 	ADV_INTERVAL_30MS        =                   48,
84 	ADV_INTERVAL_35MS        =                   56,
85 	ADV_INTERVAL_40MS        =                   64,
86 	ADV_INTERVAL_45MS        =                   72,
87 	ADV_INTERVAL_50MS        =                   80,
88 	ADV_INTERVAL_60MS        =                   96,
89 	ADV_INTERVAL_70MS        =                   112,
90 	ADV_INTERVAL_80MS        =                   128,
91 	ADV_INTERVAL_90MS		 =					 144,
92 	ADV_INTERVAL_100MS       =                   160,
93 	ADV_INTERVAL_150MS       =                   240,
94 	ADV_INTERVAL_195MS       =                   312,
95 	ADV_INTERVAL_200MS       =                   320,
96 	ADV_INTERVAL_250MS       =                   400,
97 	ADV_INTERVAL_300MS       =                   480,
98 	ADV_INTERVAL_350MS       =                   560,
99 	ADV_INTERVAL_400MS       =                   640,
100 	ADV_INTERVAL_450MS       =                   720,
101 	ADV_INTERVAL_500MS       =                   800,
102 	ADV_INTERVAL_600MS       =                   960,
103 	ADV_INTERVAL_700MS       =                  1120,
104 	ADV_INTERVAL_800MS       =                  1280,
105 	ADV_INTERVAL_900MS       =                  1440,
106 	ADV_INTERVAL_1S          =                	1600,
107 	ADV_INTERVAL_1S5         =                 	2400,
108 	ADV_INTERVAL_2S          =                	3200,
109 	ADV_INTERVAL_1_28_S      =                  2048,
110 	ADV_INTERVAL_10_24S      =                 16384,
111 }adv_inter_t;
112 
113 
114 /* Advertisement Type */
115 typedef enum{
116   ADV_TYPE_CONNECTABLE_UNDIRECTED             = 0x00,  // ADV_IND
117   ADV_TYPE_CONNECTABLE_DIRECTED_HIGH_DUTY     = 0x01,  // ADV_INDIRECT_IND (high duty cycle)
118   ADV_TYPE_SCANNABLE_UNDIRECTED               = 0x02 , // ADV_SCAN_IND
119   ADV_TYPE_NONCONNECTABLE_UNDIRECTED          = 0x03 , // ADV_NONCONN_IND
120   ADV_TYPE_CONNECTABLE_DIRECTED_LOW_DUTY      = 0x04,  // ADV_INDIRECT_IND (low duty cycle)
121 }adv_type_t;
122 
123 /* Own Address Type */
124 typedef enum{
125 	OWN_ADDRESS_PUBLIC = 0,
126 	OWN_ADDRESS_RANDOM = 1,
127 	OWN_ADDRESS_RESOLVE_PRIVATE_PUBLIC = 2,
128 	OWN_ADDRESS_RESOLVE_PRIVATE_RANDOM = 3,
129 }own_addr_type_t;
130 
131 /* Advertising_Channel_Map */
132 typedef enum{
133 	BLT_ENABLE_ADV_37	=		BIT(0),
134 	BLT_ENABLE_ADV_38	=		BIT(1),
135 	BLT_ENABLE_ADV_39	=		BIT(2),
136 	BLT_ENABLE_ADV_ALL	=		(BLT_ENABLE_ADV_37 | BLT_ENABLE_ADV_38 | BLT_ENABLE_ADV_39),
137 }adv_chn_map_t;
138 
139 /* Advertising_Filter_Policy */
140 typedef enum {
141 	ADV_FP_ALLOW_SCAN_ANY_ALLOW_CONN_ANY        =		0x00,  // Process scan and connection requests from all devices
142 	ADV_FP_ALLOW_SCAN_WL_ALLOW_CONN_ANY         =		0x01,  // Process connection requests from all devices and only scan requests from devices that are in the White List.
143 	ADV_FP_ALLOW_SCAN_ANY_ALLOW_CONN_WL         =		0x02,  // Process scan requests from all devices and only connection requests from devices that are in the White List..
144 	ADV_FP_ALLOW_SCAN_WL_ALLOW_CONN_WL          =		0x03,  // Process scan and connection requests only from devices in the White List.
145 
146 	ADV_FP_NONE									=		ADV_FP_ALLOW_SCAN_ANY_ALLOW_CONN_ANY, //adv filter policy set to zero, not use whitelist
147 } adv_fp_type_t;  //adv_filterPolicy_type_t
148 
149 
150 #define 	ALLOW_SCAN_WL								BIT(0)
151 #define 	ALLOW_CONN_WL								BIT(1)
152 
153 
154 
155 
156 /**
157  *  @brief  Command Parameters for "7.8.9 LE Set Advertising Enable command"
158  */
159 typedef enum {
160 	BLC_ADV_DISABLE = 0x00,
161 	BLC_ADV_ENABLE  = 0x01,
162 } adv_en_t;
163 
164 
165 
166 
167 /**
168  *  @brief  Command Parameters for "7.8.10 LE Set Scan Parameters command"
169  */
170 typedef enum {
171 	SCAN_TYPE_PASSIVE = 0x00,
172 	SCAN_TYPE_ACTIVE  = 0x01,
173 } scan_type_t;
174 
175 
176 /* Scannning_Interval, Time = N * 0.625 ms,
177  * Notice that these are just part of but not all Scannning_Interval value */
178 typedef enum{
179 	SCAN_INTERVAL_10MS              =            16,
180 	SCAN_INTERVAL_20MS              =            32,
181 	SCAN_INTERVAL_30MS              =            48,
182 	SCAN_INTERVAL_40MS              =            64,
183 	SCAN_INTERVAL_50MS              =            80,
184 	SCAN_INTERVAL_60MS              =            96,
185 	SCAN_INTERVAL_70MS              =            112,
186 	SCAN_INTERVAL_80MS              =            128,
187 	SCAN_INTERVAL_90MS              =            144,
188 	SCAN_INTERVAL_100MS             =            160,
189 	SCAN_INTERVAL_150MS             =            240,
190 	SCAN_INTERVAL_200MS             =            320,
191 	SCAN_INTERVAL_250MS             =            400,
192 	SCAN_INTERVAL_300MS             =            480,
193 	SCAN_INTERVAL_350MS             =            560,
194 	SCAN_INTERVAL_400MS             =            640,
195 	SCAN_INTERVAL_450MS             =            720,
196 	SCAN_INTERVAL_500MS             =            800,
197 	SCAN_INTERVAL_600MS             =            960,
198 	SCAN_INTERVAL_700MS             =            1120,
199 	SCAN_INTERVAL_800MS             =            1280,
200 	SCAN_INTERVAL_900MS             =            1440,
201 	SCAN_INTERVAL_1000MS            =            1600,
202 }scan_inter_t;
203 
204 /* Scannning_Window, Time = N * 0.625 ms,
205  * Notice that these are just part of but not all Scannning_Window value */
206 typedef enum{
207 	SCAN_WINDOW_10MS                =            16,
208 	SCAN_WINDOW_20MS                =            32,
209 	SCAN_WINDOW_30MS                =            48,
210 	SCAN_WINDOW_40MS                =            64,
211 	SCAN_WINDOW_50MS                =            80,
212 	SCAN_WINDOW_60MS                =            96,
213 	SCAN_WINDOW_70MS                =            112,
214 	SCAN_WINDOW_80MS                =            128,
215 	SCAN_WINDOW_90MS                =            144,
216 	SCAN_WINDOW_100MS               =            160,
217 	SCAN_WINDOW_150MS               =            240,
218 	SCAN_WINDOW_200MS               =            320,
219 	SCAN_WINDOW_250MS               =            400,
220 	SCAN_WINDOW_300MS               =            480,
221 	SCAN_WINDOW_350MS               =            560,
222 	SCAN_WINDOW_400MS               =            640,
223 	SCAN_WINDOW_450MS               =            720,
224 	SCAN_WINDOW_500MS               =            800,
225 	SCAN_WINDOW_600MS               =            960,
226 	SCAN_WINDOW_700MS               =            1120,
227 	SCAN_WINDOW_800MS               =            1280,
228 	SCAN_WINDOW_900MS               =            1440,
229 	SCAN_WINDOW_1000MS              =            1600,
230 }scan_wind_t;
231 
232 /* Scanning_Filter_Policy */
233 typedef enum {
234 	SCAN_FP_ALLOW_ADV_ANY						=		0x00,  //except direct adv address not match
235 	SCAN_FP_ALLOW_ADV_WL        				=		0x01,  //except direct adv address not match
236 	SCAN_FP_ALLOW_UNDIRECT_ADV      			=		0x02,  //and direct adv address match initiator's resolvable private MAC
237 	SCAN_FP_ALLOW_ADV_WL_DIRECT_ADV_MACTH		=		0x03,  //and direct adv address match initiator's resolvable private MAC
238 
239 } scan_fp_type_t;
240 
241 
242 
243 /**
244  *  @brief  Command Parameters for "7.8.11 LE Set Scan Enable command"
245  */
246 /* LE_Scan_Enable */
247 typedef enum {
248 	BLC_SCAN_DISABLE = 0x00,
249 	BLC_SCAN_ENABLE  = 0x01,
250 } scan_en_t;
251 
252 /* Filter_Duplicates */
253 typedef enum {
254 	DUP_FILTER_DISABLE = 0x00,
255 	DUP_FILTER_ENABLE  = 0x01,
256 } dupFilter_en_t;
257 
258 
259 
260 
261 /**
262  *  @brief  Command Parameters for "7.8.12 LE Create Connection command"
263  */
264 typedef struct{
265 	u16		scan_inter;
266 	u16		scan_wind;
267 	u8		fp; //init_filter_policy
268   	u8		peerAddr_type;
269 	u8		peer_addr[6];
270 	u8		ownAddr_type;
271   	u16		conn_min;
272   	u16		conn_max;
273   	u16 	connLatency;
274   	u16		timeout;
275   	u16		ceLen_min;
276   	u16		ceLen_max;
277 } hci_le_createConn_cmdParam_t;
278 
279 
280 
281 /* Initiator_Filter_Policy */
282 typedef enum {
283 	INITIATE_FP_ADV_SPECIFY        				=		0x00,  //connect ADV specified by host
284 	INITIATE_FP_ADV_WL         					=		0x01,  //connect ADV in whiteList
285 } init_fp_t;
286 
287 
288 /* Connection_Interval, Time = N * 1.25 ms,
289  * Notice that these are just part of but not all Connection_Interval value */
290 typedef enum{
291 	CONN_INTERVAL_7P5MS              =            6,
292 	CONN_INTERVAL_8P75MS             =            7,
293 	CONN_INTERVAL_10MS               =            8,
294 	CONN_INTERVAL_11P25MS            =            9,
295 	CONN_INTERVAL_12P5MS             =            10,
296 	CONN_INTERVAL_13P75MS            =            11,
297 	CONN_INTERVAL_15MS               =            12,
298 	CONN_INTERVAL_16P25MS            =            13,
299 	CONN_INTERVAL_17P5MS             =            14,
300 	CONN_INTERVAL_18P75MS            =            15,
301 	CONN_INTERVAL_20MS               =            16,
302 	CONN_INTERVAL_21P25MS            =            17,
303 	CONN_INTERVAL_22P5MS             =            18,
304 	CONN_INTERVAL_23P75MS            =            19,
305 	CONN_INTERVAL_25MS               =            20,
306 	CONN_INTERVAL_26P25MS            =            21,
307 	CONN_INTERVAL_27P5MS             =            22,
308 	CONN_INTERVAL_28P75MS            =            23,
309 	CONN_INTERVAL_30MS               =            24,
310 	CONN_INTERVAL_31P25MS            =            25,
311 	CONN_INTERVAL_32P5MS             =            26,
312 	CONN_INTERVAL_33P75MS            =            27,
313 	CONN_INTERVAL_35MS             	 =            28,
314 	CONN_INTERVAL_36P25MS            =            29,
315 	CONN_INTERVAL_37P5MS             =            30,
316 	CONN_INTERVAL_38P75MS            =            31,
317 	CONN_INTERVAL_40MS               =            32,
318 	CONN_INTERVAL_41P25MS            =            33,
319 	CONN_INTERVAL_42P5MS             =            34,
320 	CONN_INTERVAL_43P75MS            =            35,
321 	CONN_INTERVAL_45MS               =            36,
322 	CONN_INTERVAL_46P25MS            =            37,
323 	CONN_INTERVAL_47P5MS             =            38,
324 	CONN_INTERVAL_48P75MS            =            39,
325 	CONN_INTERVAL_50MS               =            40,
326 	CONN_INTERVAL_55MS               =            44,
327 	CONN_INTERVAL_60MS               =            48,
328 	CONN_INTERVAL_62P5MS			 =            50,
329 	CONN_INTERVAL_65MS               =            52,
330 	CONN_INTERVAL_70MS               =            56,
331 	CONN_INTERVAL_75MS               =            60,
332 	CONN_INTERVAL_80MS               =            64,
333 	CONN_INTERVAL_85MS               =            68,
334 	CONN_INTERVAL_90MS               =            72,
335 	CONN_INTERVAL_95MS               =            78,
336 	CONN_INTERVAL_100MS              =            80,
337 	CONN_INTERVAL_110MS              =            88,
338 	CONN_INTERVAL_120MS              =            96,
339 	CONN_INTERVAL_130MS              =            104,
340 	CONN_INTERVAL_140MS              =            112,
341 	CONN_INTERVAL_150MS              =            120,
342 	CONN_INTERVAL_160MS              =            128,
343 	CONN_INTERVAL_170MS              =            136,
344 	CONN_INTERVAL_180MS              =            144,
345 	CONN_INTERVAL_190MS              =            152,
346 	CONN_INTERVAL_200MS              =            160,
347 	CONN_INTERVAL_250MS              =            200,
348 	CONN_INTERVAL_300MS              =            240,
349 	CONN_INTERVAL_320MS              =            256,
350 }conn_inter_t;
351 
352 
353 /* Supervision_Timeout, Time = N * 10 ms,
354  * Notice that these are just part of but not all Supervision_Timeout value */
355 typedef enum{
356 	CONN_TIMEOUT_500MS				 =			  50,
357 	CONN_TIMEOUT_1S					 =		 	  100,
358 	CONN_TIMEOUT_1S5				 =		 	  150,
359 	CONN_TIMEOUT_2S					 =		 	  200,
360 	CONN_TIMEOUT_2S5				 =		 	  250,
361 	CONN_TIMEOUT_3S					 =		 	  300,
362 	CONN_TIMEOUT_3S5				 =		 	  350,
363 	CONN_TIMEOUT_4S					 =		 	  400,
364 	CONN_TIMEOUT_4S5				 =		 	  450,
365 	CONN_TIMEOUT_5S					 =		 	  500,
366 	CONN_TIMEOUT_6S					 =		 	  600,
367 	CONN_TIMEOUT_7S					 =		 	  700,
368 	CONN_TIMEOUT_8S					 =		 	  800,
369 	CONN_TIMEOUT_9S					 =		 	  900,
370 	CONN_TIMEOUT_10S				 =			  1000,
371 	CONN_TIMEOUT_15S				 =			  1500,
372 	CONN_TIMEOUT_20S				 =			  2000,
373 }conn_tm_t;
374 
375 
376 
377 /**
378  *  @brief  Command Parameters for "7.8.16 LE Add Device To White List command"
379  */
380 typedef struct{
381 	u8		adr_type;
382 	u8		addr[6];
383 } hci_le_addDeviceWhitelist_cmdParam_t;
384 
385 /**
386  *  @brief  Command Parameters for "7.8.17 LE Remove Device From White List command"
387  */
388 typedef struct{
389 	u8		adr_type;
390 	u8		addr[6];
391 } hci_le_removeDeviceWhitelist_cmdParam_t;
392 
393 
394 
395 /**
396  *  @brief  Return Parameters for "7.8.46 LE Read Maximum Data Length command"
397  */
398 typedef struct {
399 	u8         status;
400 	u16        support_max_tx_oct;
401 	u16        support_max_tx_time;
402 	u16        support_max_rx_oct;
403 	u16        support_max_rx_time;
404 } hci_le_readMaxDataLengthCmd_retParam_t;
405 
406 
407 
408 
409 
410 /**
411  *  @brief  Return Parameters for "7.8.47 LE Read PHY command"
412  */
413 typedef struct {
414 	u8         status;
415 	u8         handle[2];
416 	u8         tx_phy;
417 	u8         rx_phy;
418 } hci_le_readPhyCmd_retParam_t;
419 
420 
421 
422 /**
423  *  @brief  Command Parameters for "7.8.48 LE Set Default PHY command"
424  */
425 
426 
427 /**
428  *  @brief  Command Parameters for "7.8.49 LE Set PHY command"
429  */
430 
431 typedef struct {
432 	u16 connHandle;
433 	u8 	all_phys;
434 	u8 	tx_phys;
435 	u8 	rx_phys;
436 	u16 phy_options;
437 } hci_le_setPhyCmd_param_t;
438 
439 
440 
441 
442 typedef enum {
443 	BLE_PHY_1M 			= 0x01,
444 	BLE_PHY_2M 			= 0x02,
445 	BLE_PHY_CODED	 	= 0x03,
446 } le_phy_type_t;
447 
448 typedef enum {
449 	PHY_PREFER_1M 		= BIT(0),
450 	PHY_PREFER_2M		= BIT(1),
451 	PHY_PREFER_CODED 	= BIT(2),
452 } le_phy_prefer_type_t;
453 
454 typedef enum {
455     PHY_TRX_PREFER		= 0,					//has 	 preference among TX & RX PHYs
456 	PHY_TX_NO_PREFER 	= BIT(0),   			//has no preference among TX PHYs
457 	PHY_RX_NO_PREFER 	= BIT(1),				//has no preference among RX PHYs
458 	PHY_TRX_NO_PREFER 	= (BIT(0) | BIT(1)),	//has no preference among TX & RX PHYs
459 } le_phy_prefer_mask_t;
460 
461 typedef enum {
462 	CODED_PHY_PREFER_NONE 	= 0,
463 	CODED_PHY_PREFER_S2		= 1,
464 	CODED_PHY_PREFER_S8 	= 2,
465 } le_ci_prefer_t;   //LE coding indication prefer
466 
467 
468 
469 
470 
471 
472 
473 /**
474  *  @brief  Command Parameters for "7.8.53 LE Set Extended Advertising Parameters command"
475  */
476 typedef struct {
477 	u8		adv_handle;
478     u16		advEvt_props;
479     u8	 	pri_advIntMin[3];
480 	u8		pri_advIntMax[3];
481     u8 		pri_advChnMap;
482     u8		ownAddrType;
483     u8 		peerAddrType;
484     u8  	peerAddr[6];
485     u8		advFilterPolicy;
486     u8 		adv_tx_pow;
487     u8		pri_adv_phy;
488     u8		sec_adv_max_skip;
489     u8		sec_adv_phy;
490     u8		adv_sid;
491     u8		scan_req_noti_en;
492 }hci_le_setExtAdvParam_cmdParam_t;
493 
494 /* Advertising_Handle */
495 typedef enum{
496 	ADV_HANDLE0		= 0x00,
497 	ADV_HANDLE1		= 0x01,
498 	ADV_HANDLE2		= 0x02,
499 	ADV_HANDLE3		= 0x03,
500 }adv_handle_t;
501 
502 
503 
504 /* Advertising Event Properties mask*/
505 typedef enum{
506 	ADVEVT_PROP_MASK_CONNECTABLE						=	BIT(0),
507 	ADVEVT_PROP_MASK_SCANNABLE     						=	BIT(1),
508 	ADVEVT_PROP_MASK_DIRECTED  							=   BIT(2),
509 	ADVEVT_PROP_MASK_HD_DIRECTED     					=	BIT(3),
510 	ADVEVT_PROP_MASK_LEGACY          					=	BIT(4),
511 	ADVEVT_PROP_MASK_ANON_ADV       		 			=	BIT(5),
512 	ADVEVT_PROP_MASK_INC_TX_PWR      					=	BIT(6),
513 }advEvtProp_mask_t;
514 
515 
516 #define ADVEVT_PROP_MASK_CONNECTABLE_SCANNABLE					(0x0003)  // ADVEVT_PROP_MASK_CONNECTABLE | ADVEVT_PROP_MASK_SCANNABLE
517 #define ADVEVT_PROP_MASK_LEGACY_SCANNABLE						(0x0012)  // ADVEVT_PROP_MASK_LEGACY | ADVEVT_PROP_MASK_SCANNABLE
518 #define	ADVEVT_PROP_MASK_LEGACY_DIRECTED						(0x0014)  // ADVEVT_PROP_MASK_LEGACY | ADVEVT_PROP_MASK_DIRECTED
519 #define	ADVEVT_PROP_MASK_LEGACY_HD_DIRECTED						(0x0018)  // ADVEVT_PROP_MASK_LEGACY | ADVEVT_PROP_MASK_HD_DIRECTED
520 #define ADVEVT_PROP_MASK_LEGACY_CONNECTABLE_SCANNABLE			(0x0013)  // ADVEVT_PROP_MASK_LEGACY | ADVEVT_PROP_MASK_CONNECTABLE | ADVEVT_PROP_MASK_SCANNABLE
521 
522 
523 /* Advertising Event Properties type*/
524 typedef enum{
525   ADV_EVT_PROP_LEGACY_CONNECTABLE_SCANNABLE_UNDIRECTED 				       	= 0x0013,		//  0001 0011'b 	ADV_IND
526   ADV_EVT_PROP_LEGACY_CONNECTABLE_DIRECTED_LOW_DUTY 				       	= 0x0015,		//  0001 0101'b		ADV_DIRECT_IND(low duty cycle)
527   ADV_EVT_PROP_LEGACY_CONNECTABLE_DIRECTED_HIGH_DUTY 	 				    = 0x001D,		//  0001 1101'b		ADV_DIRECT_IND(high duty cycle)
528   ADV_EVT_PROP_LEGACY_SCANNABLE_UNDIRECTED 							       	= 0x0012,		//  0001 0010'b		ADV_SCAN_IND
529   ADV_EVT_PROP_LEGACY_NON_CONNECTABLE_NON_SCANNABLE_UNDIRECTED				= 0x0010,		//  0001 0000'b		ADV_NONCONN_IND
530 
531 
532   ADV_EVT_PROP_EXTENDED_NON_CONNECTABLE_NON_SCANNABLE_UNDIRECTED    	    = 0x0000,		//  0000 0000'b		ADV_EXT_IND + AUX_ADV_IND/AUX_CHAIN_IND
533   ADV_EVT_PROP_EXTENDED_CONNECTABLE_UNDIRECTED       				 	  	= 0x0001,		//  0000 0001'b		ADV_EXT_IND + AUX_ADV_IND/AUX_CHAIN_IND
534   ADV_EVT_PROP_EXTENDED_SCANNABLE_UNDIRECTED						        = 0x0002,		//  0000 0010'b		ADV_EXT_IND + AUX_ADV_IND/AUX_CHAIN_IND
535   ADV_EVT_PROP_EXTENDED_NON_CONNECTABLE_NON_SCANNABLE_DIRECTED				= 0x0004,		//  0000 0100'b		ADV_EXT_IND + AUX_ADV_IND/AUX_CHAIN_IND
536   ADV_EVT_PROP_EXTENDED_CONNECTABLE_DIRECTED			       				= 0x0005,		//  0000 0101'b		ADV_EXT_IND + AUX_ADV_IND/AUX_CHAIN_IND
537   ADV_EVT_PROP_EXTENDED_SCANNABLE_DIRECTED								    = 0x0006,		//  0000 0110'b		ADV_EXT_IND + AUX_ADV_IND/AUX_CHAIN_IND
538 
539 
540   ADV_EVT_PROP_EXTENDED_MASK_ANONYMOUS_ADV 		= 0x0020,  //if this mask on(only extended ADV event can mask it), anonymous advertising
541   ADV_EVT_PROP_EXTENDED_MASK_TX_POWER_INCLUDE	= 0x0040,  //if this mask on(only extended ADV event can mask it), TX power include
542 
543 }advEvtProp_type_t;
544 
545 
546 
547 /* Advertising_TX_Power */
548 typedef enum {
549 	 TX_POWER_0dBm  = 0,
550 	 TX_POWER_1dBm  = 1,
551 	 TX_POWER_2dBm 	= 2,
552 	 TX_POWER_3dBm 	= 3,
553 	 TX_POWER_4dBm 	= 4,
554 	 TX_POWER_5dBm 	= 5,
555 	 TX_POWER_6dBm 	= 6,
556 	 TX_POWER_7dBm 	= 7,
557 	 TX_POWER_8dBm 	= 8,
558 	 TX_POWER_9dBm  = 9,
559 	 TX_POWER_10dBm = 10,
560 } tx_power_t;
561 
562 
563 
564 /* Advertising_SID */
565 typedef enum{
566 	ADV_SID_0		= 0x00,
567 	ADV_SID_1		= 0x01,
568 	ADV_SID_2		= 0x02,
569 	ADV_SID_3		= 0x03,
570 }adv_sid_t;
571 
572 
573 
574 
575 /**
576  *  @brief  Command Parameters for "7.8.54 LE Set Extended Advertising Data command"
577  */
578 
579 /* Operation */
580 typedef enum {
581 	DATA_OPER_INTER      	=	0x00,
582 	DATA_OPER_FIRST      	=	0x01,
583 	DATA_OPER_LAST       	=	0x02,
584 	DATA_OPER_COMPLETE   	=	0x03,
585 	DATA_OPER_UNCHANGEED	=  	0x04,
586 } data_oper_t;
587 
588 
589 /* Fragment_Preference */
590 typedef enum {
591 	DATA_FRAGM_ALLOWED			      	=	0x00,
592 	DATA_FRAGM_NONE_OR_MINIMIZE      	=	0x01,
593 } data_fragm_t;
594 
595 
596 
597 
598 
599 /**
600  *  @brief  Command Parameters for "7.8.56 LE Set Extended Advertising Enable command"
601  */
602 
603 typedef struct{
604 	u8		adv_handle;
605 	u16		duration;
606 	u8      max_ext_adv_evts;
607 } extAdvEn_Cfg_t;
608 
609 typedef struct{
610 	u8		enable;
611 	u8		num_sets;
612 	extAdvEn_Cfg_t		cisCfg[3];  // TSKNUM_EXT_ADV
613 } hci_le_setExtAdvEn_cmdParam_t;
614 
615 
616 
617 /**
618  *  @brief  Command Parameters for "7.8.61 LE Set Periodic Advertising Parameters command"
619  */
620 
621 /* Periodic_adv_Interval, Time = N * 1.25 ms,
622  * Notice that these are just part of but not all Periodic_adv_Interval value */
623 typedef enum{
624 	PERADV_INTERVAL_7P5MS              =            6,
625 	PERADV_INTERVAL_8P75MS             =            7,
626 	PERADV_INTERVAL_10MS               =            8,
627 	PERADV_INTERVAL_11P25MS            =            9,
628 	PERADV_INTERVAL_12P5MS             =            10,
629 	PERADV_INTERVAL_13P75MS            =            11,
630 	PERADV_INTERVAL_15MS               =            12,
631 	PERADV_INTERVAL_16P25MS            =            13,
632 	PERADV_INTERVAL_17P5MS             =            14,
633 	PERADV_INTERVAL_18P75MS            =            15,
634 	PERADV_INTERVAL_20MS               =            16,
635 	PERADV_INTERVAL_21P25MS            =            17,
636 	PERADV_INTERVAL_22P5MS             =            18,
637 	PERADV_INTERVAL_23P75MS            =            19,
638 	PERADV_INTERVAL_25MS               =            20,
639 	PERADV_INTERVAL_26P25MS            =            21,
640 	PERADV_INTERVAL_27P5MS             =            22,
641 	PERADV_INTERVAL_28P75MS            =            23,
642 	PERADV_INTERVAL_30MS               =            24,
643 	PERADV_INTERVAL_31P25MS            =            25,
644 	PERADV_INTERVAL_32P5MS             =            26,
645 	PERADV_INTERVAL_33P75MS            =            27,
646 	PERADV_INTERVAL_35MS               =            28,
647 	PERADV_INTERVAL_36P25MS            =            29,
648 	PERADV_INTERVAL_37P5MS             =            30,
649 	PERADV_INTERVAL_38P75MS            =            31,
650 	PERADV_INTERVAL_40MS               =            32,
651 	PERADV_INTERVAL_41P25MS            =            33,
652 	PERADV_INTERVAL_42P5MS             =            34,
653 	PERADV_INTERVAL_43P75MS            =            35,
654 	PERADV_INTERVAL_45MS               =            36,
655 	PERADV_INTERVAL_46P25MS            =            37,
656 	PERADV_INTERVAL_47P5MS             =            38,
657 	PERADV_INTERVAL_48P75MS            =            39,
658 	PERADV_INTERVAL_50MS               =            40,
659 	PERADV_INTERVAL_55MS               =            44,
660 	PERADV_INTERVAL_60MS               =            48,
661 	PERADV_INTERVAL_62P5MS			   =            50,
662 	PERADV_INTERVAL_65MS               =            52,
663 	PERADV_INTERVAL_70MS               =            56,
664 	PERADV_INTERVAL_75MS               =            60,
665 	PERADV_INTERVAL_80MS               =            64,
666 	PERADV_INTERVAL_85MS               =            68,
667 	PERADV_INTERVAL_90MS               =            72,
668 	PERADV_INTERVAL_95MS               =            78,
669 	PERADV_INTERVAL_100MS              =            80,
670 	PERADV_INTERVAL_110MS              =            88,
671 	PERADV_INTERVAL_120MS              =            96,
672 	PERADV_INTERVAL_130MS              =            104,
673 	PERADV_INTERVAL_140MS              =            112,
674 	PERADV_INTERVAL_150MS              =            120,
675 	PERADV_INTERVAL_180MS              =            144,
676 	PERADV_INTERVAL_200MS              =            160,
677 	PERADV_INTERVAL_250MS              =            200,
678 	PERADV_INTERVAL_300MS              =            240,
679 	PERADV_INTERVAL_400MS              =            320,
680 	PERADV_INTERVAL_500MS              =            400,
681 	PERADV_INTERVAL_600MS              =            480,
682 	PERADV_INTERVAL_700MS              =            560,
683 	PERADV_INTERVAL_800MS              =            640,
684 	PERADV_INTERVAL_900MS              =            720,
685 	PERADV_INTERVAL_1S				   =            800,
686 	PERADV_INTERVAL_1S2				   =            960,
687 	PERADV_INTERVAL_1S4				   =            1120,
688 	PERADV_INTERVAL_1S5				   =            1200,
689 	PERADV_INTERVAL_1S6				   =            1280,
690 	PERADV_INTERVAL_1S8				   =            1440,
691 	PERADV_INTERVAL_2S				   =            1600,
692 	PERADV_INTERVAL_3S				   =            2400,
693 	PERADV_INTERVAL_4S				   =            3200,
694 	PERADV_INTERVAL_5S				   =            4000,
695 	PERADV_INTERVAL_6S				   =            4800,
696 	PERADV_INTERVAL_7S				   =            5600,
697 	PERADV_INTERVAL_8S				   =            6400,
698 	PERADV_INTERVAL_9S				   =            7200,
699 	PERADV_INTERVAL_10S				   =            8000,
700 }periodic_adv_inter_t;
701 
702 typedef enum{
703 
704 	PERD_ADV_PROP_MASK_NONE	= 0,
705 
706 	PERD_ADV_PROP_MASK_TX_POWER_INCLUDE	= BIT(6),
707 
708 }perd_adv_prop_t;
709 
710 
711 
712 /**
713  *  @brief  Command Parameters for "7.8.64 LE Set Extended Scan Parameters command"
714  */
715 typedef struct{
716 	u8		scan_type;
717 	u16		scan_interval;
718   	u16		scan_window;
719 } ext_scan_cfg_t;
720 
721 typedef struct{
722 	u8		ownAddress_type;
723 	u8		scan_filter_policy;
724   	u8		scan_PHYs;
725   	ext_scan_cfg_t		scanCfg[2];  //at most 2 kind of PHY: 1M and Coded
726 } hci_le_setExtScanParam_cmdParam_t;
727 
728 
729 /* Scanning_PHYs */
730 typedef enum {
731 	SCAN_PHY_1M 		= BIT(0),
732 	SCAN_PHY_CODED		= BIT(2),
733 	SCAN_PHY_1M_CODED 	= (SCAN_PHY_1M | SCAN_PHY_CODED),
734 } scan_phy_t;
735 
736 
737 
738 
739 /**
740  *  @brief  Command Parameters for "7.8.65 LE Set Extended Scan Enable command"
741  */
742 typedef struct{
743 	u8		Enable;
744 	u8		Filter_Duplicates;
745 	u16		Duration;
746 	u16		Period;
747 } hci_le_setExtScanEnable_cmdParam_t;
748 
749 /* Filter_Duplicates for Extended Scan*/
750 typedef enum {
751 	DUPE_FLTR_DISABLE 				= 0x00,
752 	DUPE_FLTR_ENABLE				= 0x01,
753 	DUPE_FLTR_ENABLE_RST_PERIOD		= 0x02,
754 } dupe_fltr_en_t;
755 
756 
757 /* Scan duration, Range: 0x0001 to 0xFFFF, Time = N * 10 ms, Time Range: 10 ms to 655.35 s,
758  * Notice that these are just part of but not all Scan duration value */
759 typedef enum{
760 	SCAN_DURATION_CONTINUOUS         =             0,
761 	SCAN_DURATION_50MS				 =			   5,
762 	SCAN_DURATION_100MS				 =			  10,
763 	SCAN_DURATION_150MS				 =			  15,
764 	SCAN_DURATION_200MS				 =			  20,
765 	SCAN_DURATION_250MS				 =			  25,
766 	SCAN_DURATION_300MS				 =			  30,
767 	SCAN_DURATION_350MS				 =			  35,
768 	SCAN_DURATION_400MS				 =			  40,
769 	SCAN_DURATION_450MS				 =			  45,
770 	SCAN_DURATION_500MS				 =			  50,
771 	SCAN_DURATION_550MS				 =			  55,
772 	SCAN_DURATION_600MS				 =			  60,
773 	SCAN_DURATION_650MS				 =			  65,
774 	SCAN_DURATION_700MS				 =			  70,
775 	SCAN_DURATION_750MS				 =			  75,
776 	SCAN_DURATION_800MS				 =			  80,
777 	SCAN_DURATION_850MS				 =			  85,
778 	SCAN_DURATION_900MS				 =			  90,
779 	SCAN_DURATION_950MS				 =			  96,
780 	SCAN_DURATION_1S				 =		 	  100,
781 	SCAN_DURATION_1S2			 	 =		 	  120,
782 	SCAN_DURATION_1S5				 =		 	  150,
783 	SCAN_DURATION_1S6				 =		 	  160,
784 	SCAN_DURATION_1S8				 =		 	  180,
785 	SCAN_DURATION_2S				 =		 	  200,
786 	SCAN_DURATION_3S				 =		 	  300,
787 	SCAN_DURATION_4S				 =		 	  400,
788 	SCAN_DURATION_5S				 =		 	  500,
789 	SCAN_DURATION_6S				 =		 	  600,
790 	SCAN_DURATION_7S				 =		 	  700,
791 	SCAN_DURATION_8S				 =		 	  800,
792 	SCAN_DURATION_9S				 =		 	  900,
793 	SCAN_DURATION_10S				 =		 	  1000,
794 }scan_durn_t;
795 
796 /* Scan period, Range: 0x0001 to 0xFFFF, Time = N * 1.28 sec, Time Range: 1.28 s to 83,884.8 s
797  * Notice that these are just part of but not all Scan period value */
798 typedef enum{
799 	SCAN_WINDOW_CONTINUOUS           =             0,
800 	SCAN_WINDOW_1S28				 =			   1,
801 	SCAN_WINDOW_2S56				 =			   2,
802 	SCAN_WINDOW_3S84				 =			   3,
803 	SCAN_WINDOW_5S12				 =			   4,
804 	SCAN_WINDOW_6S4 				 =			   5,
805 	SCAN_WINDOW_7S68				 =			   6,
806 	SCAN_WINDOW_8S92				 =			   7,
807 	SCAN_WINDOW_10S24				 =			   8,
808 	SCAN_WINDOW_11S52				 =			   9,
809 	SCAN_WINDOW_12S8				 =			  10,
810 }scan_period_t;
811 
812 
813 
814 /**
815  *  @brief  Command Parameters for "7.8.66 LE Extended Create Connection command"
816  */
817 typedef struct{
818 	u16		scan_inter;
819 	u16		scan_wind;
820   	u16		conn_min;
821   	u16		conn_max;
822   	u16 	connLatency;
823   	u16		timeout;
824   	u16		ceLen_min;
825   	u16		ceLen_max;
826 } ext_init_cfg_t;
827 
828 typedef struct{
829 	u8		fp; //init_filter_policy
830 	u8		ownAddr_type;
831   	u8		peerAddr_type;
832 	u8		peer_addr[6];
833 	u8		init_PHYs;
834   	ext_init_cfg_t		initCfg[3];
835 } hci_le_ext_createConn_cmdParam_t;
836 
837 #define EXT_CREATE_CONN_CMD_PARAM_MAX_LENGTH		(10 + 16 * 3)   //10 + sizeof(ext_init_cfg_t) * 3
838 
839 /* Initiating_PHYs */
840 typedef enum {
841 	INIT_PHY_1M 			= BIT(0),
842 	INIT_PHY_2M 			= BIT(1),	//can not use this, at least one bit set for a PHY allowed for scanning on the primary advertising physical channel
843 	INIT_PHY_CODED			= BIT(2),
844 	INIT_PHY_1M_2M 			= (INIT_PHY_1M | INIT_PHY_2M),
845 	INIT_PHY_1M_CODED 		= (INIT_PHY_1M | INIT_PHY_CODED),
846 	INIT_PHY_2M_CODED 		= (INIT_PHY_2M | INIT_PHY_CODED),
847 	INIT_PHY_1M_2M_CODED 	= (INIT_PHY_1M | INIT_PHY_2M | INIT_PHY_1M_CODED),
848 } init_phy_t;
849 
850 
851 
852 
853 
854 /**
855  *  @brief  Command Parameters for "7.8.67 LE Periodic Advertising Create Sync command"
856  */
857 typedef struct{
858 	u8		Options;
859 	u8		Advertising_SID;
860 	u8		Advertiser_Address_Type;
861 	u8		Advertiser_Address[6];
862 	u16		Skip;
863 	u16		Sync_Timeout;
864 	u16		Sync_CTE_Type;
865 } hci_le_periodicAdvCreateSync_cmdParam_t;
866 
867 /**
868  * @brief  Command Parameters for "7.8.80 LE Set Connectionless CTE Transmit Parameters command"
869  */
870 typedef struct{
871 	u8		Advertising_Handle;
872 	u8		CTE_length;
873 	u8		CTE_type;
874 	u8		CTE_count;
875 
876 	u8		Switch_pattern_len;
877 	u8		Antenna_IDs[1];
878 }hci_le_setConnectionless_CTETransmitParam_t;
879 
880 
881 typedef struct{
882 	adv_handle_t	adv_handle;
883 	u8 				CTE_enable;
884 }hci_le_CTE_enable_type;
885 
886 typedef struct{
887 	u16		Sync_Handle;
888 	u8		Sampling_Enable;
889 	u8		Slot_Duration;
890 
891 	u8		Max_Sampled_CTEs;
892 	u8		Switching_pattern_len;
893 	u8		Antenna_IDs[1];
894 }hci_le_setConnectionless_IQsampleEn_t;
895 
896 
897 typedef struct{
898 	u8		conn_handle;
899 	u8		sampling_en;
900 	u8		slot_duration;
901 	u8		switch_pattern_len;
902 
903 	u8		antenna_ids[1];
904 }hci_le_setConnection_CTERevParams_t;
905 
906 typedef struct{
907 	u8		conn_handle;
908 	u8		CTE_type;
909 	u8		switching_pattern_len;
910 	u8		antenna_IDs[1];
911 }hci_le_setConnection_CTETransmitParams_t;
912 
913 typedef struct{
914 	u8	status;
915 	u8	support_switch_sample_rate;
916 	u8	antenna_num;
917 	u8	max_switch_pattern_len;
918 
919 	u8	max_cte_len;
920 
921 }cte_antenna_infor_t;
922 
923 typedef struct{
924 	u8		conn_handle;
925 	u8		cte_req_en;
926 	u16		cte_req_intvl;
927 
928 	u8		req_cte_len;
929 	u8		req_cte_type;
930 }hci_le_cteReqEn_t;
931 
932 typedef struct{
933 	u8		conn_handle;
934 	u8		rsp_enable;
935 }hci_le_cteRspEn_t;
936 
937 
938 /* Options */
939 typedef enum {
940 
941 	/* BIT(0)
942 	 * 0: Use the adv_sid, adv_addr_type, and adv_address parameters to determine which advertiser to listen to.
943 	 * 1: Use the Periodic Advertiser List to determine which advertiser to listen to. */
944 	SYNC_ADV_SPECIFY	 = 0,
945 	SYNC_ADV_FROM_LIST	 = BIT(0),
946 
947 	/* BIT(1)
948 	   whether HCI_Periodic_Advertising_Report events for this periodic advertising train are initially enabled
949 	   0: enabled
950 	   1: disabled
951 	*/
952 	REPORTING_INITIALLY_EN	 = 0,
953 	REPORTING_INITIALLY_DIS	 = BIT(1),
954 
955 	/* BIT(2) ~ BIT(7) reserved */
956 } option_msk_t;
957 
958 
959 /* Synchronization timeout, Time = N * 10 ms,
960  * Notice that these are just part of but not all Synchronization timeout value */
961 typedef enum{
962 	SYNC_TIMEOUT_100MS				 =			  10,
963 	SYNC_TIMEOUT_200MS				 =			  20,
964 	SYNC_TIMEOUT_300MS				 =			  30,
965 	SYNC_TIMEOUT_400MS				 =			  40,
966 	SYNC_TIMEOUT_500MS				 =			  50,
967 	SYNC_TIMEOUT_1S					 =		 	  100,
968 	SYNC_TIMEOUT_1S5				 =		 	  150,
969 	SYNC_TIMEOUT_2S					 =		 	  200,
970 	SYNC_TIMEOUT_2S5				 =		 	  250,
971 	SYNC_TIMEOUT_3S					 =		 	  300,
972 	SYNC_TIMEOUT_3S5				 =		 	  350,
973 	SYNC_TIMEOUT_4S					 =		 	  400,
974 	SYNC_TIMEOUT_4S5				 =		 	  450,
975 	SYNC_TIMEOUT_5S					 =		 	  500,
976 	SYNC_TIMEOUT_6S					 =		 	  600,
977 	SYNC_TIMEOUT_7S					 =		 	  700,
978 	SYNC_TIMEOUT_8S					 =		 	  800,
979 	SYNC_TIMEOUT_9S					 =		 	  900,
980 	SYNC_TIMEOUT_10S				 =			  1000,
981 	SYNC_TIMEOUT_15S				 =			  1500,
982 	SYNC_TIMEOUT_20S				 =			  2000,
983 }sync_tm_t;
984 
985 
986 
987 
988 
989 /**
990  *  @brief  Command Parameters for "7.8.97 LE Set CIG Parameters command"
991  */
992 typedef struct {
993 	u8  	cig_id;
994 	u8		sdu_int_m2s[3];
995 	u8		sdu_int_s2m[3];
996 	u8		sca;
997 	u8		packing;
998 	u8	    framing;
999 	u16 	max_trans_lat_m2s;
1000 	u16 	max_trans_lat_s2m;
1001 	u8		cis_count;
1002 	u8		restparam[1];
1003 } hci_le_setCigParam_cmdParam_t;
1004 
1005 typedef struct{
1006 	u8		cis_id;
1007 	u8		nse;
1008 	u16		max_sdu_m2s;
1009 	u16		max_sdu_s2m;
1010 	u16		max_pdu_m2s;
1011 	u16		max_pdu_s2m;
1012   	u8  	phy_m2s;
1013   	u8		phy_s2m;
1014   	u8		bn_m2s;
1015   	u8		bn_s2m;
1016 } cigParamTest_cisCfg_t;
1017 
1018 /* Slaves_Clock_Accuracy */
1019 typedef enum {
1020 	PPM_251_500     =	0x00,
1021 	PPM_151_250     =	0x01,
1022 	PPM_101_150     =	0x02,
1023 	PPM_76_100      =	0x03,
1024 	PPM_51_75      	=	0x04,
1025 	PPM_31_50      	=	0x05,
1026 	PPM_21_30      	=	0x06,
1027 	PPM_0_20      	=	0x07,
1028 } slv_clk_accuracy_t;
1029 
1030 
1031 /* Packing */
1032 typedef enum {
1033 	PACK_SEQUENTIAL     =	0x00,
1034 	PACK_INTERLEAVED     =	0x01,
1035 } packing_type_t;
1036 
1037 /* Framing */
1038 typedef enum {
1039 	UNFRAMED   =	0x00,
1040 	FRAMED     =	0x01,
1041 } framing_t;
1042 
1043 
1044 
1045 /**
1046  *  @brief  Command Parameters for "7.8.98 LE Set CIG Parameters Test command"
1047  */
1048 typedef struct{
1049 	u8		cig_id;
1050 	u8		sdu_int_m2s[3];
1051   	u8		sdu_int_s2m[3];
1052 	u8		ft_m2s;
1053 	u8		ft_s2m;
1054 	u16 	iso_intvl;
1055 	u8		sca;
1056 	u8		packing;
1057 	u8	    framing;
1058   	u8		cis_count;   //15 B above
1059   	cigParamTest_cisCfg_t		cisCfg[1];  //14 B for one CIS configuration
1060 } hci_le_setCigParamTest_cmdParam_t;
1061 
1062 
1063 
1064 /**
1065  *  @brief  Return Parameters for "LE Set CIG Parameters command" and "LE Set CIG Parameters Test command"
1066  */
1067 typedef struct {
1068 	u8  	status;
1069 	u8		cig_id;
1070 	u8		cis_count;
1071 	u16		cis_connHandle[1];  //not 4 byte aligned, but no problem
1072 } hci_le_setCigParam_retParam_t;
1073 
1074 
1075 /* ISO_Interval, Time = N * 1.25 ms,
1076  * Notice that these are just part of but not all ISO_Interval value */
1077 typedef enum{
1078 	ISO_INTERVAL_5MS                  =        	 4,
1079 	ISO_INTERVAL_6P75MS               =          5,
1080 	ISO_INTERVAL_7P5MS                =          6,
1081 	ISO_INTERVAL_8P75MS               =          7,
1082 	ISO_INTERVAL_10MS                 =          8,
1083 	ISO_INTERVAL_11P25MS              =          9,
1084 	ISO_INTERVAL_12P5MS               =          10,
1085 	ISO_INTERVAL_15MS                 =          12,
1086 	ISO_INTERVAL_18P75MS              =          15,
1087 	ISO_INTERVAL_20MS                 =          16,
1088 	ISO_INTERVAL_25MS                 =          20,
1089 	ISO_INTERVAL_27P5MS               =          22,
1090 	ISO_INTERVAL_30MS                 =          24,
1091 	ISO_INTERVAL_31P25MS              =          25,
1092 	ISO_INTERVAL_38P75MS              =          31,
1093 	ISO_INTERVAL_40MS                 =          32,
1094 	ISO_INTERVAL_48P75MS              =          39,
1095 	ISO_INTERVAL_50MS                 =          40,
1096 	ISO_INTERVAL_100MS                =          80,
1097 }iso_inter_t;
1098 
1099 
1100 
1101 
1102 /**
1103  *	@brief  Command Parameters for "7.8.99 LE Create CIS command"
1104  */
1105 typedef struct
1106 {
1107 	u16		cis_handle;
1108 	u16		acl_handle;
1109 } cisConnParams_t;
1110 
1111 typedef struct
1112 {
1113 	u8		cis_count;
1114 	cisConnParams_t	cisConn[1];
1115 }hci_le_CreateCisParams_t;
1116 
1117 
1118 
1119 #if 0
1120 /**
1121  *	@brief  Command Parameters for "7.8.102 LE Reject CIS Request command"
1122  */
1123 typedef struct
1124 {
1125 	u16		cis_handle;
1126 	u8		reason;
1127 } hci_le_rejectCisReqParams_t;
1128 #endif
1129 
1130 
1131 
1132 /**
1133  *	@brief  Command Parameters for "7.8.103 LE Create BIG command"
1134  */
1135 typedef struct
1136 {
1137   	u8  	big_handle;			/* Used to identify the BIG */
1138 	u8		adv_handle;			/* Used to identify the periodic advertising train */
1139 	u8		num_bis;			/* Total number of BISes in the BIG */
1140   	u8  	sdu_intvl[3];		/* The interval, in microseconds, of BIS SDUs */
1141   	u16		max_sdu;			/* Maximum size of an SDU, in octets */
1142   	u16		max_trans_lat; 		/* Maximum time, in milliseconds, for transmitting an SDU */
1143   	u8  	rtn; 				/* The maximum number of times that every BIS Data PDU should be retransmitted */
1144   	u8		phy;				/* The transmitter PHY of packets */
1145 	packing_type_t		packing;//type same as u8
1146 	framing_t	    	framing;//type same as u8
1147 	u8		enc;				/* Encryption flag */
1148 	u8      broadcast_code[16]; /* The code used to derive the session key that is used to encrypt and decrypt BIS payloads */
1149 } hci_le_createBigParams_t;
1150 
1151 
1152 
1153 
1154 /**
1155  *	@brief  Command Parameters for "7.8.104 LE Create BIG Test command"
1156  */
1157 typedef struct
1158 {
1159   	u8  	big_handle;			/* Used to identify the BIG */
1160 	u8		adv_handle;			/* Used to identify the periodic advertising train */
1161 	u8		num_bis;			/* Total number of BISes in the BIG */
1162   	u8  	sdu_intvl[3];		/* The interval, in microseconds, of periodic SDUs */
1163   	u16     iso_intvl;			/* The time between consecutive BIG anchor points, Time = N * 1.25 ms */
1164   	u8		nse;				/* The total number of subevents in each interval of each BIS in the BIG */
1165   	u16		max_sdu;			/* Maximum size of an SDU, in octets */
1166   	u16		max_pdu; 			/* Maximum size, in octets, of payload */
1167   	u8		phy;				/* The transmitter PHY of packets, BIT(0): LE 1M; BIT(1): LE 2M; BIT(3): LE Coded PHY */
1168 	u8		packing;
1169 	u8		framing;
1170 	u8		bn;					/* The number of new payloads in each interval for each BIS */
1171 	u8		irc;				/* The number of times the scheduled payload(s) are transmitted in a given event*/
1172 	u8		pto;				/* Offset used for pre-transmissions */
1173 	u8		enc;				/* Encryption flag */
1174 	u8      broadcast_code[16]; /* The code used to derive the session key that is used to encrypt and decrypt BIS payloads */
1175 } hci_le_createBigParamsTest_t;
1176 
1177 
1178 
1179 
1180 /**
1181  *	@brief  Command Parameters for "7.8.105 LE Terminate BIG command"
1182  */
1183 typedef struct
1184 {
1185 	u8		big_handle;
1186 	u8		reason;
1187 } hci_le_terminateBigParams_t;
1188 
1189 
1190 
1191 
1192 typedef struct
1193 {
1194   	u8  	big_handle;			/* Used to identify the BIG */
1195 	u16		sync_handle;		/* Identifier of the periodic advertising train */
1196 	u8		enc;				/* Encryption flag */
1197 	u8      broadcast_code[16]; /* The code used to derive the session key that is used to encrypt and decrypt BIS payloads */
1198 	u8		mse;				/* The Controller can schedule reception of any number of subevents up to NSE */
1199   	u16		big_sync_timeout;	/* Synchronization timeout for the BIG, Time = N*10 ms, Time Range: 100 ms to 163.84 s */
1200   	u8  	num_bis; 			/* Total number of BISes to synchronize */
1201   	u8      bis[1];				/* List of indices of BISes */
1202 } hci_le_bigCreateSyncParams_t;
1203 
1204 
1205 
1206 
1207 /**
1208  *	@brief  Command Parameters for "7.8.109 LE Setup ISO Data Path command"
1209  */
1210 typedef struct
1211 {
1212 	u16 conn_handle;
1213 	u8  data_path_direction;
1214 	u8  data_path_id;
1215 	u8  codec_id[5];
1216 
1217 	u32 controller_delay 		  :24;
1218 	u32 codec_configration_length :8;
1219 
1220 	u8	codec_config[1];
1221 
1222 }hci_le_setupIsoDataPathCmdParams_t;
1223 
1224 
1225 /**
1226  * @brief Command Parameters for "7.8.111 LE ISO Transmit Test command"
1227  */
1228 typedef struct
1229 {
1230 	u16 handle;
1231 	u8  payload_type;
1232 }hci_le_isoTransmitTestCmdParams_t;
1233 
1234 /**
1235  * @brief Command Parameters for "7.8.112 LE ISO Receive Test command"
1236  */
1237 typedef struct
1238 {
1239 	u16 handle;
1240 	u8  payload_type;
1241 }hci_le_isoReceiveTestCmdParams_t;
1242 
1243 #endif /* HCI_CMD_H_ */
1244