xref: /btstack/src/hci_cmd.c (revision 8b22c04ddc425565c8e4002a6d4d26a53426a31f)
156042629SMatthias Ringwald /*
256042629SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
356042629SMatthias Ringwald  *
456042629SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
556042629SMatthias Ringwald  * modification, are permitted provided that the following conditions
656042629SMatthias Ringwald  * are met:
756042629SMatthias Ringwald  *
856042629SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
956042629SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
1056042629SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
1156042629SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
1256042629SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
1356042629SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
1456042629SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
1556042629SMatthias Ringwald  *    from this software without specific prior written permission.
1656042629SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
1756042629SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
1856042629SMatthias Ringwald  *    monetary gain.
1956042629SMatthias Ringwald  *
2056042629SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
2156042629SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2256042629SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2356042629SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
2456042629SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2556042629SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2656042629SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
2756042629SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
2856042629SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2956042629SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
3056042629SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3156042629SMatthias Ringwald  * SUCH DAMAGE.
3256042629SMatthias Ringwald  *
3356042629SMatthias Ringwald  * Please inquire about commercial licensing options at
3456042629SMatthias Ringwald  * [email protected]
3556042629SMatthias Ringwald  *
3656042629SMatthias Ringwald  */
3756042629SMatthias Ringwald 
38ab2c6ae4SMatthias Ringwald #define __BTSTACK_FILE__ "hci_cmd.c"
39ab2c6ae4SMatthias Ringwald 
4056042629SMatthias Ringwald /*
4156042629SMatthias Ringwald  *  hci_cmd.c
4256042629SMatthias Ringwald  *
4356042629SMatthias Ringwald  *  Created by Matthias Ringwald on 7/23/09.
4456042629SMatthias Ringwald  */
4556042629SMatthias Ringwald 
467907f069SMatthias Ringwald #include "btstack_config.h"
4756042629SMatthias Ringwald 
4856042629SMatthias Ringwald #include "classic/sdp_util.h"
4956042629SMatthias Ringwald #include "hci.h"
5056042629SMatthias Ringwald #include "hci_cmd.h"
51f9f2075cSMatthias Ringwald #include "btstack_debug.h"
5256042629SMatthias Ringwald 
5356042629SMatthias Ringwald #include <string.h>
5456042629SMatthias Ringwald 
5556042629SMatthias Ringwald // calculate combined ogf/ocf value
5656042629SMatthias Ringwald #define OPCODE(ogf, ocf) (ocf | ogf << 10)
5756042629SMatthias Ringwald 
5856042629SMatthias Ringwald /**
5956042629SMatthias Ringwald  * construct HCI Command based on template
6056042629SMatthias Ringwald  *
6156042629SMatthias Ringwald  * Format:
6256042629SMatthias Ringwald  *   1,2,3,4: one to four byte value
6356042629SMatthias Ringwald  *   H: HCI connection handle
6456042629SMatthias Ringwald  *   B: Bluetooth Baseband Address (BD_ADDR)
6556042629SMatthias Ringwald  *   D: 8 byte data block
6656042629SMatthias Ringwald  *   E: Extended Inquiry Result
6756042629SMatthias Ringwald  *   N: Name up to 248 chars, \0 terminated
68237daac5SMatthias Ringwald  *   P: 16 byte data block. Pairing code, Simple Pairing Hash and Randomizer
6956042629SMatthias Ringwald  *   A: 31 bytes advertising data
7056042629SMatthias Ringwald  *   S: Service Record (Data Element Sequence)
7182180fcaSMatthias Ringwald  *   Q: 32 byte data block, e.g. for X and Y coordinates of P-256 public key
7256042629SMatthias Ringwald  */
7356042629SMatthias Ringwald uint16_t hci_cmd_create_from_template(uint8_t *hci_cmd_buffer, const hci_cmd_t *cmd, va_list argptr){
7456042629SMatthias Ringwald 
7556042629SMatthias Ringwald     hci_cmd_buffer[0] = cmd->opcode & 0xff;
7656042629SMatthias Ringwald     hci_cmd_buffer[1] = cmd->opcode >> 8;
7756042629SMatthias Ringwald     int pos = 3;
7856042629SMatthias Ringwald 
7956042629SMatthias Ringwald     const char *format = cmd->format;
8056042629SMatthias Ringwald     uint16_t word;
8156042629SMatthias Ringwald     uint32_t longword;
8256042629SMatthias Ringwald     uint8_t * ptr;
8356042629SMatthias Ringwald     while (*format) {
8456042629SMatthias Ringwald         switch(*format) {
8556042629SMatthias Ringwald             case '1': //  8 bit value
8656042629SMatthias Ringwald             case '2': // 16 bit value
8756042629SMatthias Ringwald             case 'H': // hci_handle
8856042629SMatthias Ringwald                 word = va_arg(argptr, int);  // minimal va_arg is int: 2 bytes on 8+16 bit CPUs
8956042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = word & 0xff;
9056042629SMatthias Ringwald                 if (*format == '2') {
9156042629SMatthias Ringwald                     hci_cmd_buffer[pos++] = word >> 8;
9256042629SMatthias Ringwald                 } else if (*format == 'H') {
9356042629SMatthias Ringwald                     // TODO implement opaque client connection handles
9456042629SMatthias Ringwald                     //      pass module handle for now
9556042629SMatthias Ringwald                     hci_cmd_buffer[pos++] = word >> 8;
9656042629SMatthias Ringwald                 }
9756042629SMatthias Ringwald                 break;
9856042629SMatthias Ringwald             case '3':
9956042629SMatthias Ringwald             case '4':
10056042629SMatthias Ringwald                 longword = va_arg(argptr, uint32_t);
10156042629SMatthias Ringwald                 // longword = va_arg(argptr, int);
10256042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = longword;
10356042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = longword >> 8;
10456042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = longword >> 16;
10556042629SMatthias Ringwald                 if (*format == '4'){
10656042629SMatthias Ringwald                     hci_cmd_buffer[pos++] = longword >> 24;
10756042629SMatthias Ringwald                 }
10856042629SMatthias Ringwald                 break;
10956042629SMatthias Ringwald             case 'B': // bt-addr
11056042629SMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
11156042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = ptr[5];
11256042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = ptr[4];
11356042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = ptr[3];
11456042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = ptr[2];
11556042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = ptr[1];
11656042629SMatthias Ringwald                 hci_cmd_buffer[pos++] = ptr[0];
11756042629SMatthias Ringwald                 break;
11856042629SMatthias Ringwald             case 'D': // 8 byte data block
11956042629SMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
12056042629SMatthias Ringwald                 memcpy(&hci_cmd_buffer[pos], ptr, 8);
12156042629SMatthias Ringwald                 pos += 8;
12256042629SMatthias Ringwald                 break;
12356042629SMatthias Ringwald             case 'E': // Extended Inquiry Information 240 octets
12456042629SMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
12556042629SMatthias Ringwald                 memcpy(&hci_cmd_buffer[pos], ptr, 240);
12656042629SMatthias Ringwald                 pos += 240;
12756042629SMatthias Ringwald                 break;
12856042629SMatthias Ringwald             case 'N': { // UTF-8 string, null terminated
12956042629SMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
13056042629SMatthias Ringwald                 uint16_t len = strlen((const char*) ptr);
13156042629SMatthias Ringwald                 if (len > 248) {
13256042629SMatthias Ringwald                     len = 248;
13356042629SMatthias Ringwald                 }
13456042629SMatthias Ringwald                 memcpy(&hci_cmd_buffer[pos], ptr, len);
13556042629SMatthias Ringwald                 if (len < 248) {
13656042629SMatthias Ringwald                     // fill remaining space with zeroes
13756042629SMatthias Ringwald                     memset(&hci_cmd_buffer[pos+len], 0, 248-len);
13856042629SMatthias Ringwald                 }
13956042629SMatthias Ringwald                 pos += 248;
14056042629SMatthias Ringwald                 break;
14156042629SMatthias Ringwald             }
14256042629SMatthias Ringwald             case 'P': // 16 byte PIN code or link key
14356042629SMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
14456042629SMatthias Ringwald                 memcpy(&hci_cmd_buffer[pos], ptr, 16);
14556042629SMatthias Ringwald                 pos += 16;
14656042629SMatthias Ringwald                 break;
147a9a4c409SMatthias Ringwald #ifdef ENABLE_BLE
14856042629SMatthias Ringwald             case 'A': // 31 bytes advertising data
14956042629SMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
15056042629SMatthias Ringwald                 memcpy(&hci_cmd_buffer[pos], ptr, 31);
15156042629SMatthias Ringwald                 pos += 31;
15256042629SMatthias Ringwald                 break;
15356042629SMatthias Ringwald #endif
154a9a4c409SMatthias Ringwald #ifdef ENABLE_SDP
15556042629SMatthias Ringwald             case 'S': { // Service Record (Data Element Sequence)
15656042629SMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
15756042629SMatthias Ringwald                 uint16_t len = de_get_len(ptr);
15856042629SMatthias Ringwald                 memcpy(&hci_cmd_buffer[pos], ptr, len);
15956042629SMatthias Ringwald                 pos += len;
16056042629SMatthias Ringwald                 break;
16156042629SMatthias Ringwald             }
16256042629SMatthias Ringwald #endif
16382180fcaSMatthias Ringwald #ifdef ENABLE_LE_SECURE_CONNECTIONS
16482180fcaSMatthias Ringwald             case 'Q':
16582180fcaSMatthias Ringwald                 ptr = va_arg(argptr, uint8_t *);
16682180fcaSMatthias Ringwald                 reverse_bytes(ptr, &hci_cmd_buffer[pos], 32);
16782180fcaSMatthias Ringwald                 pos += 32;
16882180fcaSMatthias Ringwald                 break;
16982180fcaSMatthias Ringwald #endif
17056042629SMatthias Ringwald             default:
17156042629SMatthias Ringwald                 break;
17256042629SMatthias Ringwald         }
17356042629SMatthias Ringwald         format++;
17456042629SMatthias Ringwald     };
17556042629SMatthias Ringwald     hci_cmd_buffer[2] = pos - 3;
17656042629SMatthias Ringwald     return pos;
17756042629SMatthias Ringwald }
17856042629SMatthias Ringwald 
17956042629SMatthias Ringwald /**
18056042629SMatthias Ringwald  *  Link Control Commands
18156042629SMatthias Ringwald  */
18256042629SMatthias Ringwald 
18356042629SMatthias Ringwald /**
18456042629SMatthias Ringwald  * @param lap
18556042629SMatthias Ringwald  * @param inquiry_length
18656042629SMatthias Ringwald  * @param num_responses
18756042629SMatthias Ringwald  */
18856042629SMatthias Ringwald const hci_cmd_t hci_inquiry = {
18956042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x01), "311"
19056042629SMatthias Ringwald };
19156042629SMatthias Ringwald 
19256042629SMatthias Ringwald /**
19356042629SMatthias Ringwald  */
19456042629SMatthias Ringwald const hci_cmd_t hci_inquiry_cancel = {
19556042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x02), ""
19656042629SMatthias Ringwald };
19756042629SMatthias Ringwald 
19856042629SMatthias Ringwald /**
19956042629SMatthias Ringwald  * @param bd_addr
20056042629SMatthias Ringwald  * @param packet_type
20156042629SMatthias Ringwald  * @param page_scan_repetition_mode
20256042629SMatthias Ringwald  * @param reserved
20356042629SMatthias Ringwald  * @param clock_offset
20456042629SMatthias Ringwald  * @param allow_role_switch
20556042629SMatthias Ringwald  */
20656042629SMatthias Ringwald const hci_cmd_t hci_create_connection = {
20756042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x05), "B21121"
20856042629SMatthias Ringwald };
20956042629SMatthias Ringwald 
21056042629SMatthias Ringwald /**
21156042629SMatthias Ringwald  * @param handle
21256042629SMatthias Ringwald  * @param reason (0x05, 0x13-0x15, 0x1a, 0x29, see Errors Codes in BT Spec Part D)
21356042629SMatthias Ringwald  */
21456042629SMatthias Ringwald const hci_cmd_t hci_disconnect = {
21556042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x06), "H1"
21656042629SMatthias Ringwald };
21756042629SMatthias Ringwald 
21856042629SMatthias Ringwald /**
21956042629SMatthias Ringwald  * @param bd_addr
22056042629SMatthias Ringwald  */
22156042629SMatthias Ringwald const hci_cmd_t hci_create_connection_cancel = {
22256042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x08), "B"
22356042629SMatthias Ringwald };
22456042629SMatthias Ringwald 
22556042629SMatthias Ringwald /**
22656042629SMatthias Ringwald  * @param bd_addr
22756042629SMatthias Ringwald  * @param role (become master, stay slave)
22856042629SMatthias Ringwald  */
22956042629SMatthias Ringwald const hci_cmd_t hci_accept_connection_request = {
23056042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x09), "B1"
23156042629SMatthias Ringwald };
23256042629SMatthias Ringwald 
23356042629SMatthias Ringwald /**
23456042629SMatthias Ringwald  * @param bd_addr
23556042629SMatthias Ringwald  * @param reason (e.g. CONNECTION REJECTED DUE TO LIMITED RESOURCES (0x0d))
23656042629SMatthias Ringwald  */
23756042629SMatthias Ringwald const hci_cmd_t hci_reject_connection_request = {
23856042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0a), "B1"
23956042629SMatthias Ringwald };
24056042629SMatthias Ringwald 
24156042629SMatthias Ringwald /**
24256042629SMatthias Ringwald  * @param bd_addr
24356042629SMatthias Ringwald  * @param link_key
24456042629SMatthias Ringwald  */
24556042629SMatthias Ringwald const hci_cmd_t hci_link_key_request_reply = {
24656042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0b), "BP"
24756042629SMatthias Ringwald };
24856042629SMatthias Ringwald 
24956042629SMatthias Ringwald /**
25056042629SMatthias Ringwald  * @param bd_addr
25156042629SMatthias Ringwald  */
25256042629SMatthias Ringwald const hci_cmd_t hci_link_key_request_negative_reply = {
25356042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0c), "B"
25456042629SMatthias Ringwald };
25556042629SMatthias Ringwald 
25656042629SMatthias Ringwald /**
25756042629SMatthias Ringwald  * @param bd_addr
25856042629SMatthias Ringwald  * @param pin_length
25956042629SMatthias Ringwald  * @param pin (c-string)
26056042629SMatthias Ringwald  */
26156042629SMatthias Ringwald const hci_cmd_t hci_pin_code_request_reply = {
26256042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0d), "B1P"
26356042629SMatthias Ringwald };
26456042629SMatthias Ringwald 
26556042629SMatthias Ringwald /**
26656042629SMatthias Ringwald  * @param bd_addr
26756042629SMatthias Ringwald  */
26856042629SMatthias Ringwald const hci_cmd_t hci_pin_code_request_negative_reply = {
26956042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0e), "B"
27056042629SMatthias Ringwald };
27156042629SMatthias Ringwald 
27256042629SMatthias Ringwald /**
27356042629SMatthias Ringwald  * @param handle
27456042629SMatthias Ringwald  * @param packet_type
27556042629SMatthias Ringwald  */
27656042629SMatthias Ringwald const hci_cmd_t hci_change_connection_packet_type = {
27756042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0f), "H2"
27856042629SMatthias Ringwald };
27956042629SMatthias Ringwald 
28056042629SMatthias Ringwald /**
28156042629SMatthias Ringwald  * @param handle
28256042629SMatthias Ringwald  */
28356042629SMatthias Ringwald const hci_cmd_t hci_authentication_requested = {
28456042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x11), "H"
28556042629SMatthias Ringwald };
28656042629SMatthias Ringwald 
28756042629SMatthias Ringwald /**
28856042629SMatthias Ringwald  * @param handle
28956042629SMatthias Ringwald  * @param encryption_enable
29056042629SMatthias Ringwald  */
29156042629SMatthias Ringwald const hci_cmd_t hci_set_connection_encryption = {
29256042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x13), "H1"
29356042629SMatthias Ringwald };
29456042629SMatthias Ringwald 
29556042629SMatthias Ringwald /**
29656042629SMatthias Ringwald  * @param handle
29756042629SMatthias Ringwald  */
29856042629SMatthias Ringwald const hci_cmd_t hci_change_connection_link_key = {
29956042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x15), "H"
30056042629SMatthias Ringwald };
30156042629SMatthias Ringwald 
30256042629SMatthias Ringwald /**
30356042629SMatthias Ringwald  * @param bd_addr
30456042629SMatthias Ringwald  * @param page_scan_repetition_mode
30556042629SMatthias Ringwald  * @param reserved
30656042629SMatthias Ringwald  * @param clock_offset
30756042629SMatthias Ringwald  */
30856042629SMatthias Ringwald const hci_cmd_t hci_remote_name_request = {
30956042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x19), "B112"
31056042629SMatthias Ringwald };
31156042629SMatthias Ringwald 
31256042629SMatthias Ringwald 
31356042629SMatthias Ringwald /**
31456042629SMatthias Ringwald  * @param bd_addr
31556042629SMatthias Ringwald  */
31656042629SMatthias Ringwald const hci_cmd_t hci_remote_name_request_cancel = {
31756042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x1A), "B"
31856042629SMatthias Ringwald };
31956042629SMatthias Ringwald 
32056042629SMatthias Ringwald  /**
32156042629SMatthias Ringwald  * @param handle
32256042629SMatthias Ringwald  */
32356042629SMatthias Ringwald const hci_cmd_t hci_read_remote_supported_features_command = {
32456042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x1B), "H"
325*8b22c04dSMatthias Ringwald };
326*8b22c04dSMatthias Ringwald 
327*8b22c04dSMatthias Ringwald /**
328*8b22c04dSMatthias Ringwald  * @param handle
329*8b22c04dSMatthias Ringwald  */
330*8b22c04dSMatthias Ringwald const hci_cmd_t hci_read_remote_version_information = {
331*8b22c04dSMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x1D), "H"
33256042629SMatthias Ringwald };
33356042629SMatthias Ringwald 
33456042629SMatthias Ringwald /**
33556042629SMatthias Ringwald  * @param handle
33656042629SMatthias Ringwald  * @param transmit_bandwidth 8000(64kbps)
33756042629SMatthias Ringwald  * @param receive_bandwidth  8000(64kbps)
33856042629SMatthias Ringwald  * @param max_latency        >= 7ms for eSCO, 0xFFFF do not care
33956042629SMatthias Ringwald  * @param voice_settings     e.g. CVSD, Input Coding: Linear, Input Data Format: 2’s complement, data 16bit: 00011000000 == 0x60
34056042629SMatthias Ringwald  * @param retransmission_effort  e.g. 0xFF do not care
34156042629SMatthias Ringwald  * @param packet_type        at least EV3 for eSCO
34256042629SMatthias Ringwald  */
34356042629SMatthias Ringwald const hci_cmd_t hci_setup_synchronous_connection = {
34456042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0028), "H442212"
34556042629SMatthias Ringwald };
34656042629SMatthias Ringwald 
34756042629SMatthias Ringwald /**
34856042629SMatthias Ringwald  * @param bd_addr
34956042629SMatthias Ringwald  * @param transmit_bandwidth
35056042629SMatthias Ringwald  * @param receive_bandwidth
35156042629SMatthias Ringwald  * @param max_latency
35256042629SMatthias Ringwald  * @param voice_settings
35356042629SMatthias Ringwald  * @param retransmission_effort
35456042629SMatthias Ringwald  * @param packet_type
35556042629SMatthias Ringwald  */
35656042629SMatthias Ringwald const hci_cmd_t hci_accept_synchronous_connection = {
35756042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x0029), "B442212"
35856042629SMatthias Ringwald };
35956042629SMatthias Ringwald 
36056042629SMatthias Ringwald /**
36156042629SMatthias Ringwald  * @param bd_addr
36256042629SMatthias Ringwald  * @param IO_capability
36356042629SMatthias Ringwald  * @param OOB_data_present
36456042629SMatthias Ringwald  * @param authentication_requirements
36556042629SMatthias Ringwald  */
36656042629SMatthias Ringwald const hci_cmd_t hci_io_capability_request_reply = {
36756042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x2b), "B111"
36856042629SMatthias Ringwald };
36956042629SMatthias Ringwald 
37056042629SMatthias Ringwald /**
37156042629SMatthias Ringwald  * @param bd_addr
37256042629SMatthias Ringwald  */
37356042629SMatthias Ringwald const hci_cmd_t hci_user_confirmation_request_reply = {
37456042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x2c), "B"
37556042629SMatthias Ringwald };
37656042629SMatthias Ringwald 
37756042629SMatthias Ringwald /**
37856042629SMatthias Ringwald  * @param bd_addr
37956042629SMatthias Ringwald  */
38056042629SMatthias Ringwald const hci_cmd_t hci_user_confirmation_request_negative_reply = {
38156042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x2d), "B"
38256042629SMatthias Ringwald };
38356042629SMatthias Ringwald 
38456042629SMatthias Ringwald /**
38556042629SMatthias Ringwald  * @param bd_addr
38656042629SMatthias Ringwald  * @param numeric_value
38756042629SMatthias Ringwald  */
38856042629SMatthias Ringwald const hci_cmd_t hci_user_passkey_request_reply = {
38956042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x2e), "B4"
39056042629SMatthias Ringwald };
39156042629SMatthias Ringwald 
39256042629SMatthias Ringwald /**
39356042629SMatthias Ringwald  * @param bd_addr
39456042629SMatthias Ringwald  */
39556042629SMatthias Ringwald const hci_cmd_t hci_user_passkey_request_negative_reply = {
39656042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x2f), "B"
39756042629SMatthias Ringwald };
39856042629SMatthias Ringwald 
39956042629SMatthias Ringwald /**
40056042629SMatthias Ringwald  * @param bd_addr
401237daac5SMatthias Ringwald  * @param c Simple Pairing Hash C
402237daac5SMatthias Ringwald  * @param r Simple Pairing Randomizer R
403237daac5SMatthias Ringwald  */
404237daac5SMatthias Ringwald const hci_cmd_t hci_remote_oob_data_request_reply = {
405237daac5SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x30), "BPP"
406237daac5SMatthias Ringwald };
407237daac5SMatthias Ringwald 
408237daac5SMatthias Ringwald /**
409237daac5SMatthias Ringwald  * @param bd_addr
41056042629SMatthias Ringwald  */
41156042629SMatthias Ringwald const hci_cmd_t hci_remote_oob_data_request_negative_reply = {
41256042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x33), "B"
41356042629SMatthias Ringwald };
41456042629SMatthias Ringwald 
41556042629SMatthias Ringwald /**
41656042629SMatthias Ringwald  * @param bd_addr
41756042629SMatthias Ringwald  * @param reason (Part D, Error codes)
41856042629SMatthias Ringwald  */
41956042629SMatthias Ringwald const hci_cmd_t hci_io_capability_request_negative_reply = {
42056042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x34), "B1"
42156042629SMatthias Ringwald };
42256042629SMatthias Ringwald 
42356042629SMatthias Ringwald /**
42456042629SMatthias Ringwald  * @param handle
42556042629SMatthias Ringwald  * @param transmit_bandwidth
42656042629SMatthias Ringwald  * @param receive_bandwidth
42756042629SMatthias Ringwald  * @param transmit_coding_format_type
42856042629SMatthias Ringwald  * @param transmit_coding_format_company
42956042629SMatthias Ringwald  * @param transmit_coding_format_codec
43056042629SMatthias Ringwald  * @param receive_coding_format_type
43156042629SMatthias Ringwald  * @param receive_coding_format_company
43256042629SMatthias Ringwald  * @param receive_coding_format_codec
43356042629SMatthias Ringwald  * @param transmit_coding_frame_size
43456042629SMatthias Ringwald  * @param receive_coding_frame_size
43556042629SMatthias Ringwald  * @param input_bandwidth
43656042629SMatthias Ringwald  * @param output_bandwidth
43756042629SMatthias Ringwald  * @param input_coding_format_type
43856042629SMatthias Ringwald  * @param input_coding_format_company
43956042629SMatthias Ringwald  * @param input_coding_format_codec
44056042629SMatthias Ringwald  * @param output_coding_format_type
44156042629SMatthias Ringwald  * @param output_coding_format_company
44256042629SMatthias Ringwald  * @param output_coding_format_codec
44356042629SMatthias Ringwald  * @param input_coded_data_size
44456042629SMatthias Ringwald  * @param outupt_coded_data_size
44556042629SMatthias Ringwald  * @param input_pcm_data_format
44656042629SMatthias Ringwald  * @param output_pcm_data_format
44756042629SMatthias Ringwald  * @param input_pcm_sample_payload_msb_position
44856042629SMatthias Ringwald  * @param output_pcm_sample_payload_msb_position
44956042629SMatthias Ringwald  * @param input_data_path
45056042629SMatthias Ringwald  * @param output_data_path
45156042629SMatthias Ringwald  * @param input_transport_unit_size
45256042629SMatthias Ringwald  * @param output_transport_unit_size
45356042629SMatthias Ringwald  * @param max_latency
45456042629SMatthias Ringwald  * @param packet_type
45556042629SMatthias Ringwald  * @param retransmission_effort
45656042629SMatthias Ringwald  */
45756042629SMatthias Ringwald const hci_cmd_t hci_enhanced_setup_synchronous_connection = {
45856042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x3d), "H4412212222441221222211111111221"
45956042629SMatthias Ringwald };
46056042629SMatthias Ringwald 
46156042629SMatthias Ringwald /**
46256042629SMatthias Ringwald  * @param bd_addr
46356042629SMatthias Ringwald  * @param transmit_bandwidth
46456042629SMatthias Ringwald  * @param receive_bandwidth
46556042629SMatthias Ringwald  * @param transmit_coding_format_type
46656042629SMatthias Ringwald  * @param transmit_coding_format_company
46756042629SMatthias Ringwald  * @param transmit_coding_format_codec
46856042629SMatthias Ringwald  * @param receive_coding_format_type
46956042629SMatthias Ringwald  * @param receive_coding_format_company
47056042629SMatthias Ringwald  * @param receive_coding_format_codec
47156042629SMatthias Ringwald  * @param transmit_coding_frame_size
47256042629SMatthias Ringwald  * @param receive_coding_frame_size
47356042629SMatthias Ringwald  * @param input_bandwidth
47456042629SMatthias Ringwald  * @param output_bandwidth
47556042629SMatthias Ringwald  * @param input_coding_format_type
47656042629SMatthias Ringwald  * @param input_coding_format_company
47756042629SMatthias Ringwald  * @param input_coding_format_codec
47856042629SMatthias Ringwald  * @param output_coding_format_type
47956042629SMatthias Ringwald  * @param output_coding_format_company
48056042629SMatthias Ringwald  * @param output_coding_format_codec
48156042629SMatthias Ringwald  * @param input_coded_data_size
48256042629SMatthias Ringwald  * @param outupt_coded_data_size
48356042629SMatthias Ringwald  * @param input_pcm_data_format
48456042629SMatthias Ringwald  * @param output_pcm_data_format
48556042629SMatthias Ringwald  * @param input_pcm_sample_payload_msb_position
48656042629SMatthias Ringwald  * @param output_pcm_sample_payload_msb_position
48756042629SMatthias Ringwald  * @param input_data_path
48856042629SMatthias Ringwald  * @param output_data_path
48956042629SMatthias Ringwald  * @param input_transport_unit_size
49056042629SMatthias Ringwald  * @param output_transport_unit_size
49156042629SMatthias Ringwald  * @param max_latency
49256042629SMatthias Ringwald  * @param packet_type
49356042629SMatthias Ringwald  * @param retransmission_effort
49456042629SMatthias Ringwald  */
49556042629SMatthias Ringwald const hci_cmd_t hci_enhanced_accept_synchronous_connection = {
49656042629SMatthias Ringwald OPCODE(OGF_LINK_CONTROL, 0x3e), "B4412212222441221222211111111221"
49756042629SMatthias Ringwald };
49856042629SMatthias Ringwald 
49956042629SMatthias Ringwald /**
50056042629SMatthias Ringwald  *  Link Policy Commands
50156042629SMatthias Ringwald  */
50256042629SMatthias Ringwald 
50356042629SMatthias Ringwald /**
50456042629SMatthias Ringwald  * @param handle
50556042629SMatthias Ringwald  * @param sniff_max_interval
50656042629SMatthias Ringwald  * @param sniff_min_interval
50756042629SMatthias Ringwald  * @param sniff_attempt
50856042629SMatthias Ringwald  * @param sniff_timeout
50956042629SMatthias Ringwald  */
51056042629SMatthias Ringwald const hci_cmd_t hci_sniff_mode = {
51156042629SMatthias Ringwald OPCODE(OGF_LINK_POLICY, 0x03), "H2222"
51256042629SMatthias Ringwald };
51356042629SMatthias Ringwald 
51456042629SMatthias Ringwald /**
51556042629SMatthias Ringwald  * @param handle
5167cd21895SMatthias Ringwald  */
5177cd21895SMatthias Ringwald const hci_cmd_t hci_exit_sniff_mode = {
5187cd21895SMatthias Ringwald OPCODE(OGF_LINK_POLICY, 0x04), "H"
5197cd21895SMatthias Ringwald };
5207cd21895SMatthias Ringwald 
5217cd21895SMatthias Ringwald /**
5227cd21895SMatthias Ringwald  * @param handle
52356042629SMatthias Ringwald  * @param flags
52456042629SMatthias Ringwald  * @param service_type
52556042629SMatthias Ringwald  * @param token_rate (bytes/s)
52656042629SMatthias Ringwald  * @param peak_bandwith (bytes/s)
52756042629SMatthias Ringwald  * @param latency (us)
52856042629SMatthias Ringwald  * @param delay_variation (us)
52956042629SMatthias Ringwald  */
53056042629SMatthias Ringwald const hci_cmd_t hci_qos_setup = {
53156042629SMatthias Ringwald OPCODE(OGF_LINK_POLICY, 0x07), "H114444"
53256042629SMatthias Ringwald };
53356042629SMatthias Ringwald 
53456042629SMatthias Ringwald /**
53556042629SMatthias Ringwald  * @param handle
53656042629SMatthias Ringwald  */
53756042629SMatthias Ringwald const hci_cmd_t hci_role_discovery = {
53856042629SMatthias Ringwald OPCODE(OGF_LINK_POLICY, 0x09), "H"
53956042629SMatthias Ringwald };
54056042629SMatthias Ringwald 
54156042629SMatthias Ringwald /**
54256042629SMatthias Ringwald  * @param bd_addr
54356042629SMatthias Ringwald  * @param role (0=master,1=slave)
54456042629SMatthias Ringwald  */
54556042629SMatthias Ringwald const hci_cmd_t hci_switch_role_command= {
54656042629SMatthias Ringwald OPCODE(OGF_LINK_POLICY, 0x0b), "B1"
54756042629SMatthias Ringwald };
54856042629SMatthias Ringwald 
54956042629SMatthias Ringwald /**
55056042629SMatthias Ringwald  * @param handle
55156042629SMatthias Ringwald  */
55256042629SMatthias Ringwald const hci_cmd_t hci_read_link_policy_settings = {
55356042629SMatthias Ringwald OPCODE(OGF_LINK_POLICY, 0x0c), "H"
55456042629SMatthias Ringwald };
55556042629SMatthias Ringwald 
55656042629SMatthias Ringwald /**
55756042629SMatthias Ringwald  * @param handle
55856042629SMatthias Ringwald  * @param settings
55956042629SMatthias Ringwald  */
56056042629SMatthias Ringwald const hci_cmd_t hci_write_link_policy_settings = {
56156042629SMatthias Ringwald OPCODE(OGF_LINK_POLICY, 0x0d), "H2"
56256042629SMatthias Ringwald };
56356042629SMatthias Ringwald 
564c4c88f1bSJakob Krantz /**
565c4c88f1bSJakob Krantz  * @param policy
566c4c88f1bSJakob Krantz  */
56753138e7aSMatthias Ringwald const hci_cmd_t hci_write_default_link_policy_setting = {
568c4c88f1bSJakob Krantz     OPCODE(OGF_LINK_POLICY, 0x0F), "2"
569c4c88f1bSJakob Krantz };
570c4c88f1bSJakob Krantz 
57156042629SMatthias Ringwald 
57256042629SMatthias Ringwald /**
57356042629SMatthias Ringwald  *  Controller & Baseband Commands
57456042629SMatthias Ringwald  */
57556042629SMatthias Ringwald 
5769119d792SMilanka Ringwald 
57756042629SMatthias Ringwald /**
57856042629SMatthias Ringwald  * @param event_mask_lover_octets
57956042629SMatthias Ringwald  * @param event_mask_higher_octets
58056042629SMatthias Ringwald  */
58156042629SMatthias Ringwald const hci_cmd_t hci_set_event_mask = {
58256042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x01), "44"
58356042629SMatthias Ringwald };
58456042629SMatthias Ringwald 
58556042629SMatthias Ringwald /**
58656042629SMatthias Ringwald  */
58756042629SMatthias Ringwald const hci_cmd_t hci_reset = {
58856042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x03), ""
58956042629SMatthias Ringwald };
59056042629SMatthias Ringwald 
59156042629SMatthias Ringwald /**
592e49d496aSMatthias Ringwald  * @param handle
593e49d496aSMatthias Ringwald  */
594e49d496aSMatthias Ringwald const hci_cmd_t hci_flush = {
595e49d496aSMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x09), "H"
596e49d496aSMatthias Ringwald };
597e49d496aSMatthias Ringwald 
598e49d496aSMatthias Ringwald /**
59956042629SMatthias Ringwald  * @param bd_addr
60056042629SMatthias Ringwald  * @param delete_all_flags
60156042629SMatthias Ringwald  */
60256042629SMatthias Ringwald const hci_cmd_t hci_delete_stored_link_key = {
60356042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x12), "B1"
60456042629SMatthias Ringwald };
60556042629SMatthias Ringwald 
606f9f2075cSMatthias Ringwald #ifdef ENABLE_CLASSIC
60756042629SMatthias Ringwald /**
60856042629SMatthias Ringwald  * @param local_name (UTF-8, Null Terminated, max 248 octets)
60956042629SMatthias Ringwald  */
61056042629SMatthias Ringwald const hci_cmd_t hci_write_local_name = {
61156042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x13), "N"
61256042629SMatthias Ringwald };
613f9f2075cSMatthias Ringwald #endif
61456042629SMatthias Ringwald 
61556042629SMatthias Ringwald /**
616e90bae01SMatthias Ringwald  */
617e90bae01SMatthias Ringwald const hci_cmd_t hci_read_local_name = {
618e90bae01SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x14), ""
619e90bae01SMatthias Ringwald };
620e90bae01SMatthias Ringwald 
621e90bae01SMatthias Ringwald /**
62256042629SMatthias Ringwald  * @param page_timeout (* 0.625 ms)
62356042629SMatthias Ringwald  */
62456042629SMatthias Ringwald const hci_cmd_t hci_write_page_timeout = {
62556042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x18), "2"
62656042629SMatthias Ringwald };
62756042629SMatthias Ringwald 
62856042629SMatthias Ringwald /**
62956042629SMatthias Ringwald  * @param scan_enable (no, inq, page, inq+page)
63056042629SMatthias Ringwald  */
63156042629SMatthias Ringwald const hci_cmd_t hci_write_scan_enable = {
63256042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x1A), "1"
63356042629SMatthias Ringwald };
63456042629SMatthias Ringwald 
63556042629SMatthias Ringwald /**
63656042629SMatthias Ringwald  * @param authentication_enable
63756042629SMatthias Ringwald  */
63856042629SMatthias Ringwald const hci_cmd_t hci_write_authentication_enable = {
63956042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x20), "1"
64056042629SMatthias Ringwald };
64156042629SMatthias Ringwald 
64256042629SMatthias Ringwald /**
64356042629SMatthias Ringwald  * @param class_of_device
64456042629SMatthias Ringwald  */
64556042629SMatthias Ringwald const hci_cmd_t hci_write_class_of_device = {
64656042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x24), "3"
64756042629SMatthias Ringwald };
64856042629SMatthias Ringwald 
64956042629SMatthias Ringwald /**
65056042629SMatthias Ringwald  */
65156042629SMatthias Ringwald const hci_cmd_t hci_read_num_broadcast_retransmissions = {
65256042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x29), ""
65356042629SMatthias Ringwald };
65456042629SMatthias Ringwald 
65556042629SMatthias Ringwald /**
65656042629SMatthias Ringwald  * @param num_broadcast_retransmissions (e.g. 0 for a single broadcast)
65756042629SMatthias Ringwald  */
65856042629SMatthias Ringwald const hci_cmd_t hci_write_num_broadcast_retransmissions = {
65956042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x2a), "1"
66056042629SMatthias Ringwald };
66156042629SMatthias Ringwald 
66256042629SMatthias Ringwald /**
66356042629SMatthias Ringwald  * @param synchronous_flow_control_enable - if yes, num completed packet everts are sent for SCO packets
66456042629SMatthias Ringwald  */
66556042629SMatthias Ringwald const hci_cmd_t hci_write_synchronous_flow_control_enable = {
66656042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x2f), "1"
66756042629SMatthias Ringwald };
66856042629SMatthias Ringwald 
6692b838201SMatthias Ringwald #ifdef ENABLE_HCI_CONTROLLER_TO_HOST_FLOW_CONTROL
6702b838201SMatthias Ringwald 
6712b838201SMatthias Ringwald /**
6722b838201SMatthias Ringwald  * @param flow_control_enable - 0: off, 1: ACL only, 2: SCO only, 3: ACL + SCO
6732b838201SMatthias Ringwald  */
6742b838201SMatthias Ringwald const hci_cmd_t hci_set_controller_to_host_flow_control = {
6752b838201SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x31), "1"
6762b838201SMatthias Ringwald };
6772b838201SMatthias Ringwald 
67856042629SMatthias Ringwald /**
67956042629SMatthias Ringwald  * @param host_acl_data_packet_length
68056042629SMatthias Ringwald  * @param host_synchronous_data_packet_length
68156042629SMatthias Ringwald  * @param host_total_num_acl_data_packets
68256042629SMatthias Ringwald  * @param host_total_num_synchronous_data_packets
68356042629SMatthias Ringwald  */
68456042629SMatthias Ringwald const hci_cmd_t hci_host_buffer_size = {
68556042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x33), "2122"
68656042629SMatthias Ringwald };
68756042629SMatthias Ringwald 
6889119d792SMilanka Ringwald 
6892b838201SMatthias Ringwald #if 0
6902b838201SMatthias Ringwald //
6912b838201SMatthias Ringwald // command sent manually sent by hci_host_num_completed_packets
6922b838201SMatthias Ringwald //
6932b838201SMatthias Ringwald /**
6942b838201SMatthias Ringwald  * @note only single handle supported by BTstack command generator
6952b838201SMatthias Ringwald  * @param number_of_handles must be 1
6962b838201SMatthias Ringwald  * @param connection_handle
6972b838201SMatthias Ringwald  * @param host_num_of_completed_packets for the given connection handle
6982b838201SMatthias Ringwald  */
6992b838201SMatthias Ringwald const hci_cmd_t hci_host_number_of_completed_packets = {
7002b838201SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x35), "1H2"
7012b838201SMatthias Ringwald };
7022b838201SMatthias Ringwald #endif
7032b838201SMatthias Ringwald 
7042b838201SMatthias Ringwald #endif
7052b838201SMatthias Ringwald 
70656042629SMatthias Ringwald /**
70756042629SMatthias Ringwald  * @param handle
70856042629SMatthias Ringwald  */
70956042629SMatthias Ringwald const hci_cmd_t hci_read_link_supervision_timeout = {
71056042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x36), "H"
71156042629SMatthias Ringwald };
71256042629SMatthias Ringwald 
71356042629SMatthias Ringwald /**
71456042629SMatthias Ringwald  * @param handle
71556042629SMatthias Ringwald  * @param timeout (0x0001 - 0xFFFF Time -> Range: 0.625ms - 40.9 sec)
71656042629SMatthias Ringwald  */
71756042629SMatthias Ringwald const hci_cmd_t hci_write_link_supervision_timeout = {
71856042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x37), "H2"
71956042629SMatthias Ringwald };
72056042629SMatthias Ringwald 
72156042629SMatthias Ringwald /**
7229119d792SMilanka Ringwald  * @param num_current_iac must be 2
7239119d792SMilanka Ringwald  * @param iac_lap1
7249119d792SMilanka Ringwald  * @param iac_lap2
7259119d792SMilanka Ringwald  */
7269119d792SMilanka Ringwald const hci_cmd_t hci_write_current_iac_lap_two_iacs = {
7279119d792SMilanka Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x3A), "133"
7289119d792SMilanka Ringwald };
7299119d792SMilanka Ringwald 
7309119d792SMilanka Ringwald /**
73156042629SMatthias Ringwald  * @param inquiry_mode (0x00 = standard, 0x01 = with RSSI, 0x02 = extended)
73256042629SMatthias Ringwald  */
73356042629SMatthias Ringwald const hci_cmd_t hci_write_inquiry_mode = {
73456042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x45), "1"
73556042629SMatthias Ringwald };
73656042629SMatthias Ringwald 
73756042629SMatthias Ringwald /**
73856042629SMatthias Ringwald  * @param fec_required
73956042629SMatthias Ringwald  * @param exstended_inquiry_response
74056042629SMatthias Ringwald  */
74156042629SMatthias Ringwald const hci_cmd_t hci_write_extended_inquiry_response = {
74256042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x52), "1E"
74356042629SMatthias Ringwald };
74456042629SMatthias Ringwald 
74556042629SMatthias Ringwald /**
74656042629SMatthias Ringwald  * @param mode (0 = off, 1 = on)
74756042629SMatthias Ringwald  */
74856042629SMatthias Ringwald const hci_cmd_t hci_write_simple_pairing_mode = {
74956042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x56), "1"
75056042629SMatthias Ringwald };
75156042629SMatthias Ringwald 
752237daac5SMatthias Ringwald /**
753237daac5SMatthias Ringwald  */
754237daac5SMatthias Ringwald const hci_cmd_t hci_read_local_oob_data = {
755237daac5SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x57), ""
756237daac5SMatthias Ringwald // return status, C, R
757237daac5SMatthias Ringwald };
758483c5078SMatthias Ringwald 
759483c5078SMatthias Ringwald /**
760483c5078SMatthias Ringwald  * @param mode (0 = off, 1 = on)
761483c5078SMatthias Ringwald  */
762483c5078SMatthias Ringwald const hci_cmd_t hci_write_default_erroneous_data_reporting = {
763483c5078SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x5B), "1"
764483c5078SMatthias Ringwald };
765483c5078SMatthias Ringwald 
76656042629SMatthias Ringwald /**
76756042629SMatthias Ringwald  */
76856042629SMatthias Ringwald const hci_cmd_t hci_read_le_host_supported = {
76956042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x6c), ""
77056042629SMatthias Ringwald // return: status, le supported host, simultaneous le host
77156042629SMatthias Ringwald };
77256042629SMatthias Ringwald 
77356042629SMatthias Ringwald /**
77456042629SMatthias Ringwald  * @param le_supported_host
77556042629SMatthias Ringwald  * @param simultaneous_le_host
77656042629SMatthias Ringwald  */
77756042629SMatthias Ringwald const hci_cmd_t hci_write_le_host_supported = {
77856042629SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x6d), "11"
77956042629SMatthias Ringwald // return: status
78056042629SMatthias Ringwald };
78156042629SMatthias Ringwald 
78256042629SMatthias Ringwald /**
783237daac5SMatthias Ringwald  */
784237daac5SMatthias Ringwald const hci_cmd_t hci_read_local_extended_ob_data = {
785237daac5SMatthias Ringwald OPCODE(OGF_CONTROLLER_BASEBAND, 0x7d), ""
786237daac5SMatthias Ringwald // return status, C_192, R_192, R_256, C_256
787237daac5SMatthias Ringwald };
788237daac5SMatthias Ringwald 
789237daac5SMatthias Ringwald 
790237daac5SMatthias Ringwald /**
79156042629SMatthias Ringwald  * Testing Commands
79256042629SMatthias Ringwald  */
79356042629SMatthias Ringwald 
79456042629SMatthias Ringwald 
79556042629SMatthias Ringwald /**
79656042629SMatthias Ringwald  */
79756042629SMatthias Ringwald const hci_cmd_t hci_read_loopback_mode = {
79856042629SMatthias Ringwald OPCODE(OGF_TESTING, 0x01), ""
79956042629SMatthias Ringwald // return: status, loopback mode (0 = off, 1 = local loopback, 2 = remote loopback)
80056042629SMatthias Ringwald };
80156042629SMatthias Ringwald 
80256042629SMatthias Ringwald /**
80356042629SMatthias Ringwald  * @param loopback_mode
80456042629SMatthias Ringwald  */
80556042629SMatthias Ringwald const hci_cmd_t hci_write_loopback_mode = {
80656042629SMatthias Ringwald OPCODE(OGF_TESTING, 0x02), "1"
80756042629SMatthias Ringwald // return: status
80856042629SMatthias Ringwald };
80956042629SMatthias Ringwald 
81084ca9bd8SMatthias Ringwald /**
81184ca9bd8SMatthias Ringwald  */
81284ca9bd8SMatthias Ringwald const hci_cmd_t hci_enable_device_under_test_mode = {
81384ca9bd8SMatthias Ringwald OPCODE(OGF_TESTING, 0x03), ""
81484ca9bd8SMatthias Ringwald // return: status
81584ca9bd8SMatthias Ringwald };
81684ca9bd8SMatthias Ringwald 
81784ca9bd8SMatthias Ringwald /**
81884ca9bd8SMatthias Ringwald  * @param simple_pairing_debug_mode
81984ca9bd8SMatthias Ringwald  */
82084ca9bd8SMatthias Ringwald const hci_cmd_t hci_write_simple_pairing_debug_mode = {
82184ca9bd8SMatthias Ringwald OPCODE(OGF_TESTING, 0x04), "1"
82284ca9bd8SMatthias Ringwald // return: status
82384ca9bd8SMatthias Ringwald };
82484ca9bd8SMatthias Ringwald 
82584ca9bd8SMatthias Ringwald /**
82684ca9bd8SMatthias Ringwald  * @param handle
82784ca9bd8SMatthias Ringwald  * @param dm1_acl_u_mode
82884ca9bd8SMatthias Ringwald  * @param esco_loopback_mode
82984ca9bd8SMatthias Ringwald  */
83084ca9bd8SMatthias Ringwald const hci_cmd_t hci_write_secure_connections_test_mode = {
83184ca9bd8SMatthias Ringwald OPCODE(OGF_TESTING, 0x0a), "H11"
83284ca9bd8SMatthias Ringwald // return: status
83384ca9bd8SMatthias Ringwald };
83484ca9bd8SMatthias Ringwald 
83556042629SMatthias Ringwald 
83656042629SMatthias Ringwald /**
83756042629SMatthias Ringwald  * Informational Parameters
83856042629SMatthias Ringwald  */
83956042629SMatthias Ringwald 
84056042629SMatthias Ringwald const hci_cmd_t hci_read_local_version_information = {
84156042629SMatthias Ringwald OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x01), ""
84256042629SMatthias Ringwald };
84356042629SMatthias Ringwald const hci_cmd_t hci_read_local_supported_commands = {
84456042629SMatthias Ringwald OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x02), ""
84556042629SMatthias Ringwald };
84656042629SMatthias Ringwald const hci_cmd_t hci_read_local_supported_features = {
84756042629SMatthias Ringwald OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x03), ""
84856042629SMatthias Ringwald };
84956042629SMatthias Ringwald const hci_cmd_t hci_read_buffer_size = {
85056042629SMatthias Ringwald OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x05), ""
85156042629SMatthias Ringwald };
85256042629SMatthias Ringwald const hci_cmd_t hci_read_bd_addr = {
85356042629SMatthias Ringwald OPCODE(OGF_INFORMATIONAL_PARAMETERS, 0x09), ""
85456042629SMatthias Ringwald };
85556042629SMatthias Ringwald 
85656042629SMatthias Ringwald /**
85756042629SMatthias Ringwald  * Status Paramters
85856042629SMatthias Ringwald  */
85956042629SMatthias Ringwald 
86056042629SMatthias Ringwald /**
86156042629SMatthias Ringwald  * @param handle
86256042629SMatthias Ringwald  */
86356042629SMatthias Ringwald const hci_cmd_t hci_read_rssi = {
86456042629SMatthias Ringwald OPCODE(OGF_STATUS_PARAMETERS, 0x05), "H"
86556042629SMatthias Ringwald // no params
86656042629SMatthias Ringwald };
86756042629SMatthias Ringwald 
86856042629SMatthias Ringwald 
86956042629SMatthias Ringwald 
870a9a4c409SMatthias Ringwald #ifdef ENABLE_BLE
87156042629SMatthias Ringwald /**
87256042629SMatthias Ringwald  * Low Energy Commands
87356042629SMatthias Ringwald  */
87456042629SMatthias Ringwald 
87556042629SMatthias Ringwald /**
87656042629SMatthias Ringwald  * @param event_mask_lower_octets
87756042629SMatthias Ringwald  * @param event_mask_higher_octets
87856042629SMatthias Ringwald  */
87956042629SMatthias Ringwald const hci_cmd_t hci_le_set_event_mask = {
88056042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x01), "44"
88156042629SMatthias Ringwald // return: status
88256042629SMatthias Ringwald };
88356042629SMatthias Ringwald 
88456042629SMatthias Ringwald const hci_cmd_t hci_le_read_buffer_size = {
88556042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x02), ""
88656042629SMatthias Ringwald // return: status, le acl data packet len (16), total num le acl data packets(8)
88756042629SMatthias Ringwald };
88856042629SMatthias Ringwald const hci_cmd_t hci_le_read_supported_features = {
88956042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x03), ""
89056042629SMatthias Ringwald // return: LE_Features See [Vol 6] Part B, Section 4.6
89156042629SMatthias Ringwald };
89256042629SMatthias Ringwald 
89356042629SMatthias Ringwald /**
89456042629SMatthias Ringwald  * @param random_bd_addr
89556042629SMatthias Ringwald  */
89656042629SMatthias Ringwald const hci_cmd_t hci_le_set_random_address = {
89756042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x05), "B"
89856042629SMatthias Ringwald // return: status
89956042629SMatthias Ringwald };
90056042629SMatthias Ringwald 
90156042629SMatthias Ringwald /**
90256042629SMatthias Ringwald  * @param advertising_interval_min ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec)
90356042629SMatthias Ringwald  * @param advertising_interval_max ([0x0020,0x4000], default: 0x0800, unit: 0.625 msec)
90456042629SMatthias Ringwald  * @param advertising_type (enum from 0: ADV_IND, ADC_DIRECT_IND, ADV_SCAN_IND, ADV_NONCONN_IND)
90556042629SMatthias Ringwald  * @param own_address_type (enum from 0: public device address, random device address)
90656042629SMatthias Ringwald  * @param direct_address_type ()
90756042629SMatthias Ringwald  * @param direct_address (public or random address of device to be connecteed)
90856042629SMatthias Ringwald  * @param advertising_channel_map (flags: chan_37(1), chan_38(2), chan_39(4))
90956042629SMatthias Ringwald  * @param advertising_filter_policy (enum from 0: scan any conn any, scan whitelist, con any, scan any conn whitelist, scan whitelist, con whitelist)
91056042629SMatthias Ringwald  */
91156042629SMatthias Ringwald const hci_cmd_t hci_le_set_advertising_parameters = {
91256042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x06), "22111B11"
91356042629SMatthias Ringwald // return: status
91456042629SMatthias Ringwald };
91556042629SMatthias Ringwald 
91656042629SMatthias Ringwald const hci_cmd_t hci_le_read_advertising_channel_tx_power = {
91756042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x07), ""
91856042629SMatthias Ringwald // return: status, level [-20,10] signed int (8), units dBm
91956042629SMatthias Ringwald };
92056042629SMatthias Ringwald 
92156042629SMatthias Ringwald /**
92256042629SMatthias Ringwald  * @param advertising_data_length
92356042629SMatthias Ringwald  * @param advertising_data (31 bytes)
92456042629SMatthias Ringwald  */
92556042629SMatthias Ringwald const hci_cmd_t hci_le_set_advertising_data= {
92656042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x08), "1A"
92756042629SMatthias Ringwald // return: status
92856042629SMatthias Ringwald };
92956042629SMatthias Ringwald 
93056042629SMatthias Ringwald /**
93156042629SMatthias Ringwald  * @param scan_response_data_length
93256042629SMatthias Ringwald  * @param scan_response_data (31 bytes)
93356042629SMatthias Ringwald  */
93456042629SMatthias Ringwald const hci_cmd_t hci_le_set_scan_response_data= {
93556042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x09), "1A"
93656042629SMatthias Ringwald // return: status
93756042629SMatthias Ringwald };
93856042629SMatthias Ringwald 
93956042629SMatthias Ringwald /**
94056042629SMatthias Ringwald  * @param advertise_enable (off: 0, on: 1)
94156042629SMatthias Ringwald  */
94256042629SMatthias Ringwald const hci_cmd_t hci_le_set_advertise_enable = {
94356042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x0a), "1"
94456042629SMatthias Ringwald // return: status
94556042629SMatthias Ringwald };
94656042629SMatthias Ringwald 
94756042629SMatthias Ringwald /**
94856042629SMatthias Ringwald  * @param le_scan_type (passive (0), active (1))
94956042629SMatthias Ringwald  * @param le_scan_interval ([0x0004,0x4000], unit: 0.625 msec)
95056042629SMatthias Ringwald  * @param le_scan_window   ([0x0004,0x4000], unit: 0.625 msec)
95156042629SMatthias Ringwald  * @param own_address_type (public (0), random (1))
95256042629SMatthias Ringwald  * @param scanning_filter_policy (any (0), only whitelist (1))
95356042629SMatthias Ringwald  */
95456042629SMatthias Ringwald const hci_cmd_t hci_le_set_scan_parameters = {
95556042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x0b), "12211"
95656042629SMatthias Ringwald // return: status
95756042629SMatthias Ringwald };
95856042629SMatthias Ringwald 
95956042629SMatthias Ringwald /**
96056042629SMatthias Ringwald  * @param le_scan_enable  (disabled (0), enabled (1))
96156042629SMatthias Ringwald  * @param filter_duplices (disabled (0), enabled (1))
96256042629SMatthias Ringwald  */
96356042629SMatthias Ringwald const hci_cmd_t hci_le_set_scan_enable = {
96456042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x0c), "11"
96556042629SMatthias Ringwald // return: status
96656042629SMatthias Ringwald };
96756042629SMatthias Ringwald 
96856042629SMatthias Ringwald /**
96956042629SMatthias Ringwald  * @param le_scan_interval ([0x0004, 0x4000], unit: 0.625 msec)
97056042629SMatthias Ringwald  * @param le_scan_window ([0x0004, 0x4000], unit: 0.625 msec)
97156042629SMatthias Ringwald  * @param initiator_filter_policy (peer address type + peer address (0), whitelist (1))
97256042629SMatthias Ringwald  * @param peer_address_type (public (0), random (1))
97356042629SMatthias Ringwald  * @param peer_address
97456042629SMatthias Ringwald  * @param own_address_type (public (0), random (1))
97556042629SMatthias Ringwald  * @param conn_interval_min ([0x0006, 0x0c80], unit: 1.25 msec)
97656042629SMatthias Ringwald  * @param conn_interval_max ([0x0006, 0x0c80], unit: 1.25 msec)
97756042629SMatthias Ringwald  * @param conn_latency (number of connection events [0x0000, 0x01f4])
97856042629SMatthias Ringwald  * @param supervision_timeout ([0x000a, 0x0c80], unit: 10 msec)
97956042629SMatthias Ringwald  * @param minimum_CE_length ([0x0000, 0xffff], unit: 0.625 msec)
98056042629SMatthias Ringwald  * @param maximum_CE_length ([0x0000, 0xffff], unit: 0.625 msec)
98156042629SMatthias Ringwald  */
98256042629SMatthias Ringwald const hci_cmd_t hci_le_create_connection= {
98356042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x0d), "2211B1222222"
98456042629SMatthias Ringwald // return: none -> le create connection complete event
98556042629SMatthias Ringwald };
98656042629SMatthias Ringwald 
98756042629SMatthias Ringwald const hci_cmd_t hci_le_create_connection_cancel = {
98856042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x0e), ""
98956042629SMatthias Ringwald // return: status
99056042629SMatthias Ringwald };
99156042629SMatthias Ringwald 
99256042629SMatthias Ringwald const hci_cmd_t hci_le_read_white_list_size = {
99356042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x0f), ""
99456042629SMatthias Ringwald // return: status, number of entries in controller whitelist
99556042629SMatthias Ringwald };
99656042629SMatthias Ringwald 
99756042629SMatthias Ringwald const hci_cmd_t hci_le_clear_white_list = {
99856042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x10), ""
99956042629SMatthias Ringwald // return: status
100056042629SMatthias Ringwald };
100156042629SMatthias Ringwald 
100256042629SMatthias Ringwald /**
100356042629SMatthias Ringwald  * @param address_type (public (0), random (1))
100456042629SMatthias Ringwald  * @param bd_addr
100556042629SMatthias Ringwald  */
100656042629SMatthias Ringwald const hci_cmd_t hci_le_add_device_to_white_list = {
100756042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x11), "1B"
100856042629SMatthias Ringwald // return: status
100956042629SMatthias Ringwald };
101056042629SMatthias Ringwald 
101156042629SMatthias Ringwald /**
101256042629SMatthias Ringwald  * @param address_type (public (0), random (1))
101356042629SMatthias Ringwald  * @param bd_addr
101456042629SMatthias Ringwald  */
101556042629SMatthias Ringwald const hci_cmd_t hci_le_remove_device_from_white_list = {
101656042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x12), "1B"
101756042629SMatthias Ringwald // return: status
101856042629SMatthias Ringwald };
101956042629SMatthias Ringwald 
102056042629SMatthias Ringwald /**
102156042629SMatthias Ringwald  * @param conn_handle
102256042629SMatthias Ringwald  * @param conn_interval_min ([0x0006,0x0c80], unit: 1.25 msec)
102356042629SMatthias Ringwald  * @param conn_interval_max ([0x0006,0x0c80], unit: 1.25 msec)
102456042629SMatthias Ringwald  * @param conn_latency ([0x0000,0x03e8], number of connection events)
102556042629SMatthias Ringwald  * @param supervision_timeout ([0x000a,0x0c80], unit: 10 msec)
102656042629SMatthias Ringwald  * @param minimum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
102756042629SMatthias Ringwald  * @param maximum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
102856042629SMatthias Ringwald  */
102956042629SMatthias Ringwald const hci_cmd_t hci_le_connection_update = {
103056042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x13), "H222222"
103156042629SMatthias Ringwald // return: none -> le connection update complete event
103256042629SMatthias Ringwald };
103356042629SMatthias Ringwald 
103456042629SMatthias Ringwald /**
103556042629SMatthias Ringwald  * @param channel_map_lower_32bits
103656042629SMatthias Ringwald  * @param channel_map_higher_5bits
103756042629SMatthias Ringwald  */
103856042629SMatthias Ringwald const hci_cmd_t hci_le_set_host_channel_classification = {
103956042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x14), "41"
104056042629SMatthias Ringwald // return: status
104156042629SMatthias Ringwald };
104256042629SMatthias Ringwald 
104356042629SMatthias Ringwald /**
104456042629SMatthias Ringwald  * @param conn_handle
104556042629SMatthias Ringwald  */
104656042629SMatthias Ringwald const hci_cmd_t hci_le_read_channel_map = {
104756042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x15), "H"
104856042629SMatthias Ringwald // return: status, connection handle, channel map (5 bytes, 37 used)
104956042629SMatthias Ringwald };
105056042629SMatthias Ringwald 
105156042629SMatthias Ringwald /**
105256042629SMatthias Ringwald  * @param conn_handle
105356042629SMatthias Ringwald  */
105456042629SMatthias Ringwald const hci_cmd_t hci_le_read_remote_used_features = {
105556042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x16), "H"
105656042629SMatthias Ringwald // return: none -> le read remote used features complete event
105756042629SMatthias Ringwald };
105856042629SMatthias Ringwald 
105956042629SMatthias Ringwald /**
106056042629SMatthias Ringwald  * @param key ((128) for AES-128)
106156042629SMatthias Ringwald  * @param plain_text (128)
106256042629SMatthias Ringwald  */
106356042629SMatthias Ringwald const hci_cmd_t hci_le_encrypt = {
106456042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x17), "PP"
106556042629SMatthias Ringwald // return: status, encrypted data (128)
106656042629SMatthias Ringwald };
106756042629SMatthias Ringwald 
106856042629SMatthias Ringwald const hci_cmd_t hci_le_rand = {
106956042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x18), ""
107056042629SMatthias Ringwald // return: status, random number (64)
107156042629SMatthias Ringwald };
107256042629SMatthias Ringwald 
107356042629SMatthias Ringwald /**
107456042629SMatthias Ringwald  * @param conn_handle
107556042629SMatthias Ringwald  * @param random_number_lower_32bits
107656042629SMatthias Ringwald  * @param random_number_higher_32bits
107756042629SMatthias Ringwald  * @param encryption_diversifier (16)
107856042629SMatthias Ringwald  * @param long_term_key (128)
107956042629SMatthias Ringwald  */
108056042629SMatthias Ringwald const hci_cmd_t hci_le_start_encryption = {
108156042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x19), "H442P"
108256042629SMatthias Ringwald // return: none -> encryption changed or encryption key refresh complete event
108356042629SMatthias Ringwald };
108456042629SMatthias Ringwald 
108556042629SMatthias Ringwald /**
108656042629SMatthias Ringwald  * @param connection_handle
108756042629SMatthias Ringwald  * @param long_term_key (128)
108856042629SMatthias Ringwald  */
108956042629SMatthias Ringwald const hci_cmd_t hci_le_long_term_key_request_reply = {
109056042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x1a), "HP"
109156042629SMatthias Ringwald // return: status, connection handle
109256042629SMatthias Ringwald };
109356042629SMatthias Ringwald 
109456042629SMatthias Ringwald /**
109556042629SMatthias Ringwald  * @param conn_handle
109656042629SMatthias Ringwald  */
109756042629SMatthias Ringwald const hci_cmd_t hci_le_long_term_key_negative_reply = {
109856042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x1b), "H"
109956042629SMatthias Ringwald // return: status, connection handle
110056042629SMatthias Ringwald };
110156042629SMatthias Ringwald 
110256042629SMatthias Ringwald /**
110356042629SMatthias Ringwald  * @param conn_handle
110456042629SMatthias Ringwald  */
110556042629SMatthias Ringwald const hci_cmd_t hci_le_read_supported_states = {
110656042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x1c), "H"
110756042629SMatthias Ringwald // return: status, LE states (64)
110856042629SMatthias Ringwald };
110956042629SMatthias Ringwald 
111056042629SMatthias Ringwald /**
111156042629SMatthias Ringwald  * @param rx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2)
111256042629SMatthias Ringwald  */
111356042629SMatthias Ringwald const hci_cmd_t hci_le_receiver_test = {
111456042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x1d), "1"
111556042629SMatthias Ringwald // return: status
111656042629SMatthias Ringwald };
111756042629SMatthias Ringwald 
111856042629SMatthias Ringwald /**
111956042629SMatthias Ringwald  * @param tx_frequency ([0x00 0x27], frequency (MHz): 2420 + N*2)
112056042629SMatthias Ringwald  * @param test_payload_lengh ([0x00,0x25])
112156042629SMatthias Ringwald  * @param packet_payload ([0,7] different patterns)
112256042629SMatthias Ringwald  */
112356042629SMatthias Ringwald const hci_cmd_t hci_le_transmitter_test = {
112456042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x1e), "111"
112556042629SMatthias Ringwald // return: status
112656042629SMatthias Ringwald };
112756042629SMatthias Ringwald 
112856042629SMatthias Ringwald /**
112956042629SMatthias Ringwald  * @param end_test_cmd
113056042629SMatthias Ringwald  */
113156042629SMatthias Ringwald const hci_cmd_t hci_le_test_end = {
113256042629SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x1f), "1"
113356042629SMatthias Ringwald // return: status, number of packets (8)
113456042629SMatthias Ringwald };
113582180fcaSMatthias Ringwald 
113682180fcaSMatthias Ringwald /**
1137fe704c95SMatthias Ringwald  * @param conn_handle
1138fe704c95SMatthias Ringwald  * @param conn_interval_min ([0x0006,0x0c80], unit: 1.25 msec)
1139fe704c95SMatthias Ringwald  * @param conn_interval_max ([0x0006,0x0c80], unit: 1.25 msec)
1140fe704c95SMatthias Ringwald  * @param conn_latency ([0x0000,0x03e8], number of connection events)
1141fe704c95SMatthias Ringwald  * @param supervision_timeout ([0x000a,0x0c80], unit: 10 msec)
1142fe704c95SMatthias Ringwald  * @param minimum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
1143fe704c95SMatthias Ringwald  * @param maximum_CE_length ([0x0000,0xffff], unit: 0.625 msec)
1144fe704c95SMatthias Ringwald  */
1145fe704c95SMatthias Ringwald const hci_cmd_t hci_le_remote_connection_parameter_request_reply = {
1146fe704c95SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x20), "H222222"
1147fe704c95SMatthias Ringwald // return: status, connection handle
1148fe704c95SMatthias Ringwald };
1149fe704c95SMatthias Ringwald 
1150fe704c95SMatthias Ringwald /**
1151fe704c95SMatthias Ringwald  * @param con_handle
1152fe704c95SMatthias Ringwald  * @param reason
1153fe704c95SMatthias Ringwald  */
1154fe704c95SMatthias Ringwald const hci_cmd_t hci_le_remote_connection_parameter_request_negative_reply = {
1155fe704c95SMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x21), "H1"
1156fe704c95SMatthias Ringwald // return: status, connection handle
1157fe704c95SMatthias Ringwald };
1158fe704c95SMatthias Ringwald 
1159fe704c95SMatthias Ringwald /**
11600ea2847fSMatthias Ringwald  * @param con_handle
11610ea2847fSMatthias Ringwald  * @param tx_octets
11620ea2847fSMatthias Ringwald  * @param tx_time
11630ea2847fSMatthias Ringwald  */
11640ea2847fSMatthias Ringwald const hci_cmd_t hci_le_set_data_length = {
11650ea2847fSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x22), "H22"
11660ea2847fSMatthias Ringwald // return: status, connection handle
11670ea2847fSMatthias Ringwald };
11680ea2847fSMatthias Ringwald 
11690ea2847fSMatthias Ringwald /**
11700ea2847fSMatthias Ringwald  */
11710ea2847fSMatthias Ringwald const hci_cmd_t hci_le_read_suggested_default_data_length = {
11720ea2847fSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x23), ""
11730ea2847fSMatthias Ringwald // return: status, suggested max tx octets, suggested max tx time
11740ea2847fSMatthias Ringwald };
11750ea2847fSMatthias Ringwald 
11760ea2847fSMatthias Ringwald /**
11770ea2847fSMatthias Ringwald  * @param suggested_max_tx_octets
11780ea2847fSMatthias Ringwald  * @param suggested_max_tx_time
11790ea2847fSMatthias Ringwald  */
11800ea2847fSMatthias Ringwald const hci_cmd_t hci_le_write_suggested_default_data_length = {
1181dcd678baSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x24), "22"
11820ea2847fSMatthias Ringwald // return: status
11830ea2847fSMatthias Ringwald };
11840ea2847fSMatthias Ringwald 
11850ea2847fSMatthias Ringwald /**
118682180fcaSMatthias Ringwald  */
118782180fcaSMatthias Ringwald const hci_cmd_t hci_le_read_local_p256_public_key = {
118882180fcaSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x25), ""
118982180fcaSMatthias Ringwald //  LE Read Local P-256 Public Key Complete is generated on completion
119082180fcaSMatthias Ringwald };
119182180fcaSMatthias Ringwald 
119282180fcaSMatthias Ringwald /**
1193fcae305fSMatthias Ringwald  * @param public key
1194fcae305fSMatthias Ringwald  * @param private key
119582180fcaSMatthias Ringwald  */
119682180fcaSMatthias Ringwald const hci_cmd_t hci_le_generate_dhkey = {
119782180fcaSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x26), "QQ"
119882180fcaSMatthias Ringwald // LE Generate DHKey Complete is generated on completion
119982180fcaSMatthias Ringwald };
120082180fcaSMatthias Ringwald 
12010ea2847fSMatthias Ringwald /**
12020ea2847fSMatthias Ringwald  */
12030ea2847fSMatthias Ringwald const hci_cmd_t hci_le_read_maximum_data_length = {
12040ea2847fSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x2F), ""
12050ea2847fSMatthias Ringwald // return: status, supported max tx octets, supported max tx time, supported max rx octets, supported max rx time
12060ea2847fSMatthias Ringwald };
12070ea2847fSMatthias Ringwald 
1208ca13daefSMatthias Ringwald /**
1209ca13daefSMatthias Ringwald  * @param con_handle
1210ca13daefSMatthias Ringwald  */
1211ca13daefSMatthias Ringwald const hci_cmd_t hci_le_read_phy = {
1212ca13daefSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x30), "H"
1213ca13daefSMatthias Ringwald // return: status, connection handler, tx phy, rx phy
1214ca13daefSMatthias Ringwald };
1215ca13daefSMatthias Ringwald 
1216ca13daefSMatthias Ringwald /**
1217ca13daefSMatthias Ringwald  * @param all_phys
1218ca13daefSMatthias Ringwald  * @param tx_phys
1219ca13daefSMatthias Ringwald  * @param rx_phys
1220ca13daefSMatthias Ringwald  */
1221ca13daefSMatthias Ringwald const hci_cmd_t hci_le_set_default_phy = {
1222ca13daefSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x31), "111"
1223ca13daefSMatthias Ringwald // return: status
1224ca13daefSMatthias Ringwald };
1225ca13daefSMatthias Ringwald 
1226ca13daefSMatthias Ringwald /**
1227ca13daefSMatthias Ringwald  * @param con_handle
1228ca13daefSMatthias Ringwald  * @param all_phys
1229ca13daefSMatthias Ringwald  * @param tx_phys
1230ca13daefSMatthias Ringwald  * @param rx_phys
1231ca13daefSMatthias Ringwald  * @param phy_options
1232ca13daefSMatthias Ringwald  */
1233ca13daefSMatthias Ringwald const hci_cmd_t hci_le_set_phy = {
1234ca13daefSMatthias Ringwald OPCODE(OGF_LE_CONTROLLER, 0x32), "H1111"
1235ca13daefSMatthias Ringwald // LE PHY Update Complete is generated on completion
1236ca13daefSMatthias Ringwald };
1237ca13daefSMatthias Ringwald 
1238ca13daefSMatthias Ringwald 
123956042629SMatthias Ringwald #endif
1240a42798c3SMatthias Ringwald 
1241a42798c3SMatthias Ringwald // Broadcom / Cypress specific HCI commands
1242a42798c3SMatthias Ringwald 
1243a42798c3SMatthias Ringwald /**
1244a42798c3SMatthias Ringwald  * @brief Configure SCO Routing (BCM)
1245a42798c3SMatthias Ringwald  * @param sco_routing is 0 for PCM, 1 for Transport, 2 for Codec and 3 for I2S
1246a42798c3SMatthias Ringwald  * @param pcm_interface_rate is 0 for 128KBps, 1 for 256 KBps, 2 for 512KBps, 3 for 1024KBps, and 4 for 2048Kbps
1247a42798c3SMatthias Ringwald  * @param frame_type is 0 for short and 1 for long
1248a42798c3SMatthias Ringwald  * @param sync_mode is 0 for slave and 1 for master
1249a42798c3SMatthias Ringwald  * @param clock_mode is 0 for slabe and 1 for master
1250a42798c3SMatthias Ringwald  */
1251a42798c3SMatthias Ringwald const hci_cmd_t hci_bcm_write_sco_pcm_int = {
1252a42798c3SMatthias Ringwald OPCODE(0x3f, 0x1c), "11111"
1253a42798c3SMatthias Ringwald // return: status
1254a42798c3SMatthias Ringwald };
1255