1faa6c1f6SMatthias Ringwald /* 2faa6c1f6SMatthias Ringwald * Copyright (C) 2009-2012 by Matthias Ringwald 3faa6c1f6SMatthias Ringwald * 4faa6c1f6SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5faa6c1f6SMatthias Ringwald * modification, are permitted provided that the following conditions 6faa6c1f6SMatthias Ringwald * are met: 7faa6c1f6SMatthias Ringwald * 8faa6c1f6SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9faa6c1f6SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10faa6c1f6SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11faa6c1f6SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12faa6c1f6SMatthias Ringwald * documentation and/or other materials provided with the distribution. 13faa6c1f6SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14faa6c1f6SMatthias Ringwald * contributors may be used to endorse or promote products derived 15faa6c1f6SMatthias Ringwald * from this software without specific prior written permission. 16faa6c1f6SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 17faa6c1f6SMatthias Ringwald * personal benefit and not for any commercial purpose or for 18faa6c1f6SMatthias Ringwald * monetary gain. 19faa6c1f6SMatthias Ringwald * 20faa6c1f6SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS 21faa6c1f6SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22faa6c1f6SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23faa6c1f6SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24faa6c1f6SMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25faa6c1f6SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26faa6c1f6SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27faa6c1f6SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28faa6c1f6SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29faa6c1f6SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30faa6c1f6SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31faa6c1f6SMatthias Ringwald * SUCH DAMAGE. 32faa6c1f6SMatthias Ringwald * 3351acb414SMatthias Ringwald * Please inquire about commercial licensing options at [email protected] 34faa6c1f6SMatthias Ringwald * 35faa6c1f6SMatthias Ringwald */ 36faa6c1f6SMatthias Ringwald 37e501bae0SMatthias Ringwald #define BTSTACK_FILE__ "btstack_chipset_bcm.c" 38ab2c6ae4SMatthias Ringwald 39faa6c1f6SMatthias Ringwald /* 40faa6c1f6SMatthias Ringwald * bt_control_bcm.c 41faa6c1f6SMatthias Ringwald * 42faa6c1f6SMatthias Ringwald * Adapter to use Broadcom-based chipsets with BTstack 43faa6c1f6SMatthias Ringwald */ 44faa6c1f6SMatthias Ringwald 45faa6c1f6SMatthias Ringwald 46faa6c1f6SMatthias Ringwald #include "btstack_config.h" 47faa6c1f6SMatthias Ringwald 48faa6c1f6SMatthias Ringwald #include <stddef.h> /* NULL */ 49faa6c1f6SMatthias Ringwald #include <stdio.h> 50faa6c1f6SMatthias Ringwald #include <string.h> /* memcpy */ 51faa6c1f6SMatthias Ringwald 52faa6c1f6SMatthias Ringwald #include "btstack_control.h" 53faa6c1f6SMatthias Ringwald #include "btstack_debug.h" 54c0cdcfe7SMatthias Ringwald #include "btstack_chipset_bcm.h" 55*7a4d61a3SMatthias Ringwald #include "hci.h" 56faa6c1f6SMatthias Ringwald 5764eccac7SMatthias Ringwald #ifdef HAVE_POSIX_FILE_IO 5864eccac7SMatthias Ringwald #include <ctype.h> 5964eccac7SMatthias Ringwald #include <dirent.h> 6064eccac7SMatthias Ringwald #include <fcntl.h> 6164eccac7SMatthias Ringwald #include <unistd.h> 6264eccac7SMatthias Ringwald #endif 6364eccac7SMatthias Ringwald 649ed5a9efSMatthias Ringwald #ifdef _WIN32 659ed5a9efSMatthias Ringwald #include <Windows.h> 669ed5a9efSMatthias Ringwald #endif 679ed5a9efSMatthias Ringwald 68*7a4d61a3SMatthias Ringwald // assert outgoing and incoming hci packet buffers can hold max hci command resp. event packet 69*7a4d61a3SMatthias Ringwald #if HCI_OUTGOING_PACKET_BUFFER_SIZE < (HCI_CMD_HEADER_SIZE + 255) 70*7a4d61a3SMatthias Ringwald #error "HCI_OUTGOING_PACKET_BUFFER_SIZE to small. Outgoing HCI packet buffer to small for largest HCI Command packet. Please set HCI_ACL_PAYLOAD_SIZE to 258 or higher." 71*7a4d61a3SMatthias Ringwald #endif 72*7a4d61a3SMatthias Ringwald #if HCI_INCOMING_PACKET_BUFFER_SIZE < (HCI_EVENT_HEADER_SIZE_HEADER_SIZE + 255) 73*7a4d61a3SMatthias Ringwald #error "HCI_INCOMING_PACKET_BUFFER_SIZE to small. Incoming HCI packet buffer to small for largest HCI Event packet. Please set HCI_ACL_PAYLOAD_SIZE to 257 or higher." 74*7a4d61a3SMatthias Ringwald #endif 75*7a4d61a3SMatthias Ringwald 7664eccac7SMatthias Ringwald static int send_download_command; 7764eccac7SMatthias Ringwald static uint32_t init_script_offset; 7864eccac7SMatthias Ringwald 7964eccac7SMatthias Ringwald // Embedded == non posix systems 8064eccac7SMatthias Ringwald 81faa6c1f6SMatthias Ringwald // actual init script provided by separate bt_firmware_image.c from WICED SDK 82faa6c1f6SMatthias Ringwald extern const uint8_t brcm_patchram_buf[]; 83faa6c1f6SMatthias Ringwald extern const int brcm_patch_ram_length; 84faa6c1f6SMatthias Ringwald extern const char brcm_patch_version[]; 85faa6c1f6SMatthias Ringwald 86faa6c1f6SMatthias Ringwald // 87faa6c1f6SMatthias Ringwald // @note: Broadcom chips require higher UART clock for baud rate > 3000000 -> limit baud rate in hci.c 88faa6c1f6SMatthias Ringwald static void chipset_set_baudrate_command(uint32_t baudrate, uint8_t *hci_cmd_buffer){ 89faa6c1f6SMatthias Ringwald hci_cmd_buffer[0] = 0x18; 90faa6c1f6SMatthias Ringwald hci_cmd_buffer[1] = 0xfc; 91faa6c1f6SMatthias Ringwald hci_cmd_buffer[2] = 0x06; 92faa6c1f6SMatthias Ringwald hci_cmd_buffer[3] = 0x00; 93faa6c1f6SMatthias Ringwald hci_cmd_buffer[4] = 0x00; 94f8fbdce0SMatthias Ringwald little_endian_store_32(hci_cmd_buffer, 5, baudrate); 95faa6c1f6SMatthias Ringwald } 96faa6c1f6SMatthias Ringwald 97faa6c1f6SMatthias Ringwald // @note: bd addr has to be set after sending init script (it might just get re-set) 98faa6c1f6SMatthias Ringwald static void chipset_set_bd_addr_command(bd_addr_t addr, uint8_t *hci_cmd_buffer){ 99faa6c1f6SMatthias Ringwald hci_cmd_buffer[0] = 0x01; 100faa6c1f6SMatthias Ringwald hci_cmd_buffer[1] = 0xfc; 101faa6c1f6SMatthias Ringwald hci_cmd_buffer[2] = 0x06; 102a47028edSMatthias Ringwald reverse_bd_addr(addr, &hci_cmd_buffer[3]); 103faa6c1f6SMatthias Ringwald } 104faa6c1f6SMatthias Ringwald 10564eccac7SMatthias Ringwald #ifdef HAVE_POSIX_FILE_IO 10664eccac7SMatthias Ringwald 10764eccac7SMatthias Ringwald static const char * hcd_file_path; 10864eccac7SMatthias Ringwald static const char * hcd_folder_path = "."; 10964eccac7SMatthias Ringwald static int hcd_fd; 11064eccac7SMatthias Ringwald static char matched_file[1000]; 11164eccac7SMatthias Ringwald 11264eccac7SMatthias Ringwald 11364eccac7SMatthias Ringwald static void chipset_init(const void * config){ 11464eccac7SMatthias Ringwald if (hcd_file_path){ 11564eccac7SMatthias Ringwald log_info("chipset-bcm: init file %s", hcd_file_path); 11664eccac7SMatthias Ringwald } else { 11764eccac7SMatthias Ringwald log_info("chipset-bcm: init folder %s", hcd_folder_path); 11864eccac7SMatthias Ringwald } 11964eccac7SMatthias Ringwald send_download_command = 1; 12064eccac7SMatthias Ringwald init_script_offset = 0; 12164eccac7SMatthias Ringwald hcd_fd = -1; 12264eccac7SMatthias Ringwald } 12364eccac7SMatthias Ringwald 12464eccac7SMatthias Ringwald static const uint8_t download_command[] = {0x2e, 0xfc, 0x00}; 12564eccac7SMatthias Ringwald 12664eccac7SMatthias Ringwald static btstack_chipset_result_t chipset_next_command(uint8_t * hci_cmd_buffer){ 12764eccac7SMatthias Ringwald if (hcd_fd < 0){ 12864eccac7SMatthias Ringwald log_info("chipset-bcm: open file %s", hcd_file_path); 12964eccac7SMatthias Ringwald hcd_fd = open(hcd_file_path, O_RDONLY); 13064eccac7SMatthias Ringwald if (hcd_fd < 0){ 13164eccac7SMatthias Ringwald log_error("chipset-bcm: can't open file %s", hcd_file_path); 1321565be94SMatthias Ringwald return BTSTACK_CHIPSET_NO_INIT_SCRIPT; 13364eccac7SMatthias Ringwald } 13464eccac7SMatthias Ringwald } 13564eccac7SMatthias Ringwald 13664eccac7SMatthias Ringwald // send download firmware command 13764eccac7SMatthias Ringwald if (send_download_command){ 13864eccac7SMatthias Ringwald send_download_command = 0; 13964eccac7SMatthias Ringwald memcpy(hci_cmd_buffer, download_command, sizeof(download_command)); 14064eccac7SMatthias Ringwald return BTSTACK_CHIPSET_VALID_COMMAND; 14164eccac7SMatthias Ringwald } 14264eccac7SMatthias Ringwald 14364eccac7SMatthias Ringwald // read next command, but skip download command 14464eccac7SMatthias Ringwald do { 14564eccac7SMatthias Ringwald // read command 14664eccac7SMatthias Ringwald int res = read(hcd_fd, hci_cmd_buffer, 3); 14764eccac7SMatthias Ringwald if (res == 0){ 14864eccac7SMatthias Ringwald log_info("chipset-bcm: end of file, size %u", init_script_offset); 14964eccac7SMatthias Ringwald close(hcd_fd); 15064eccac7SMatthias Ringwald 151100d3ee3SMatthias Ringwald // TODO: should not be needed anymore - fixed for embedded below and tested on RedBear Duo 152100d3ee3SMatthias Ringwald 15364eccac7SMatthias Ringwald // wait for firmware patch to be applied - shorter delay possible 1549ed5a9efSMatthias Ringwald #ifdef _WIN32 1559ed5a9efSMatthias Ringwald Sleep(1000); 1569ed5a9efSMatthias Ringwald #else 15764eccac7SMatthias Ringwald sleep(1); 1589ed5a9efSMatthias Ringwald #endif 15964eccac7SMatthias Ringwald return BTSTACK_CHIPSET_DONE; 16064eccac7SMatthias Ringwald } 16164eccac7SMatthias Ringwald if (res < 0){ 16264eccac7SMatthias Ringwald log_error("chipset-bcm: read error at %u", init_script_offset); 16364eccac7SMatthias Ringwald return BTSTACK_CHIPSET_DONE; 16464eccac7SMatthias Ringwald } 16564eccac7SMatthias Ringwald init_script_offset += 3; 16664eccac7SMatthias Ringwald 16764eccac7SMatthias Ringwald // read parameters 16864eccac7SMatthias Ringwald int param_len = hci_cmd_buffer[2]; 16964eccac7SMatthias Ringwald if (param_len){ 17064eccac7SMatthias Ringwald res = read(hcd_fd, &hci_cmd_buffer[3], param_len); 17164eccac7SMatthias Ringwald } 17264eccac7SMatthias Ringwald if (res < 0){ 17364eccac7SMatthias Ringwald log_error("chipset-bcm: read error at %u", init_script_offset); 17464eccac7SMatthias Ringwald return BTSTACK_CHIPSET_DONE; 17564eccac7SMatthias Ringwald } 17664eccac7SMatthias Ringwald init_script_offset += param_len; 17764eccac7SMatthias Ringwald 1788db5aeedSMatthias Ringwald } while (memcmp(hci_cmd_buffer, download_command, sizeof(download_command)) == 0); 17964eccac7SMatthias Ringwald return BTSTACK_CHIPSET_VALID_COMMAND; 18064eccac7SMatthias Ringwald } 18164eccac7SMatthias Ringwald 18264eccac7SMatthias Ringwald void btstack_chipset_bcm_set_hcd_file_path(const char * path){ 18364eccac7SMatthias Ringwald hcd_file_path = path; 18464eccac7SMatthias Ringwald } 18564eccac7SMatthias Ringwald 18664eccac7SMatthias Ringwald void btstack_chipset_bcm_set_hcd_folder_path(const char * path){ 18764eccac7SMatthias Ringwald hcd_folder_path = path; 18864eccac7SMatthias Ringwald } 18964eccac7SMatthias Ringwald 19064eccac7SMatthias Ringwald static int equal_ignore_case(const char *str1, const char *str2){ 19164eccac7SMatthias Ringwald if (!str1 || !str2) return (1); 19264eccac7SMatthias Ringwald int i = 0; 193ff3cc4a5SMatthias Ringwald while (true){ 19464eccac7SMatthias Ringwald if (!str1[i] && !str2[i]) return 1; 19564eccac7SMatthias Ringwald if (tolower(str1[i]) != tolower(str2[i])) return 0; 19664eccac7SMatthias Ringwald if (!str1[i] || !str2[i]) return 0; 19764eccac7SMatthias Ringwald i++; 19864eccac7SMatthias Ringwald } 19964eccac7SMatthias Ringwald } 20064eccac7SMatthias Ringwald 20164eccac7SMatthias Ringwald // assumption starts with BCM or bcm 20264eccac7SMatthias Ringwald #define MAX_DEVICE_NAME_LEN 15 20364eccac7SMatthias Ringwald void btstack_chipset_bcm_set_device_name(const char * device_name){ 20464eccac7SMatthias Ringwald // ignore if file path already set 20564eccac7SMatthias Ringwald if (hcd_file_path) { 20664eccac7SMatthias Ringwald log_error("chipset-bcm: set device name called %s although path %s already set", device_name, hcd_file_path); 20764eccac7SMatthias Ringwald return; 20864eccac7SMatthias Ringwald } 20964eccac7SMatthias Ringwald // construct filename for long variant 21064eccac7SMatthias Ringwald if (strlen(device_name) > MAX_DEVICE_NAME_LEN){ 21164eccac7SMatthias Ringwald log_error("chipset-bcm: device name %s too long", device_name); 21264eccac7SMatthias Ringwald return; 21364eccac7SMatthias Ringwald } 21464eccac7SMatthias Ringwald char filename_complete[MAX_DEVICE_NAME_LEN+5]; 21564eccac7SMatthias Ringwald strcpy(filename_complete, device_name); 21664eccac7SMatthias Ringwald strcat(filename_complete, ".hcd"); 21764eccac7SMatthias Ringwald 21864eccac7SMatthias Ringwald // construct short variant without revision info 21964eccac7SMatthias Ringwald char filename_short[MAX_DEVICE_NAME_LEN+5]; 22064eccac7SMatthias Ringwald strcpy(filename_short, device_name); 22164eccac7SMatthias Ringwald int len = strlen(filename_short); 22264eccac7SMatthias Ringwald while (len > 3){ 22364eccac7SMatthias Ringwald char c = filename_short[len-1]; 22464eccac7SMatthias Ringwald if (isdigit(c) == 0) break; 22564eccac7SMatthias Ringwald len--; 22664eccac7SMatthias Ringwald } 22764eccac7SMatthias Ringwald if (len > 3){ 22864eccac7SMatthias Ringwald filename_short[len-1] = 0; 22964eccac7SMatthias Ringwald } 23064eccac7SMatthias Ringwald strcat(filename_short, ".hcd"); 23164eccac7SMatthias Ringwald log_info("chipset-bcm: looking for %s and %s", filename_short, filename_complete); 23264eccac7SMatthias Ringwald 23364eccac7SMatthias Ringwald // find in folder 23464eccac7SMatthias Ringwald DIR *dirp = opendir(hcd_folder_path); 23564eccac7SMatthias Ringwald int match_short = 0; 23664eccac7SMatthias Ringwald int match_complete = 0; 23764eccac7SMatthias Ringwald if (!dirp){ 23864eccac7SMatthias Ringwald log_error("chipset-bcm: could not get directory for %s", hcd_folder_path); 23964eccac7SMatthias Ringwald return; 24064eccac7SMatthias Ringwald } 241ff3cc4a5SMatthias Ringwald while (true){ 24264eccac7SMatthias Ringwald struct dirent *dp = readdir(dirp); 24364eccac7SMatthias Ringwald if (!dp) break; 24464eccac7SMatthias Ringwald if (equal_ignore_case(filename_complete, dp->d_name)){ 24564eccac7SMatthias Ringwald match_complete = 1; 24664eccac7SMatthias Ringwald continue; 24764eccac7SMatthias Ringwald } 24864eccac7SMatthias Ringwald if (equal_ignore_case(filename_short, dp->d_name)){ 24964eccac7SMatthias Ringwald match_short = 1; 25064eccac7SMatthias Ringwald } 25164eccac7SMatthias Ringwald } 25264eccac7SMatthias Ringwald closedir(dirp); 25364eccac7SMatthias Ringwald if (match_complete){ 25464eccac7SMatthias Ringwald sprintf(matched_file, "%s/%s", hcd_folder_path, filename_complete); 25564eccac7SMatthias Ringwald hcd_file_path = matched_file; 25664eccac7SMatthias Ringwald return; 25764eccac7SMatthias Ringwald } 25864eccac7SMatthias Ringwald if (match_short){ 25964eccac7SMatthias Ringwald sprintf(matched_file, "%s/%s", hcd_folder_path, filename_short); 26064eccac7SMatthias Ringwald hcd_file_path = matched_file; 26164eccac7SMatthias Ringwald return; 26264eccac7SMatthias Ringwald } 26364eccac7SMatthias Ringwald log_error("chipset-bcm: could not find %s or %s, please provide .hcd file in %s", filename_complete, filename_short, hcd_folder_path); 26464eccac7SMatthias Ringwald } 26564eccac7SMatthias Ringwald 26664eccac7SMatthias Ringwald #else 26764eccac7SMatthias Ringwald 26864eccac7SMatthias Ringwald static void chipset_init(const void * config){ 26964eccac7SMatthias Ringwald log_info("chipset-bcm: init script %s, len %u", brcm_patch_version, brcm_patch_ram_length); 27064eccac7SMatthias Ringwald init_script_offset = 0; 27164eccac7SMatthias Ringwald send_download_command = 1; 27264eccac7SMatthias Ringwald } 27364eccac7SMatthias Ringwald 274faa6c1f6SMatthias Ringwald static btstack_chipset_result_t chipset_next_command(uint8_t * hci_cmd_buffer){ 2751565be94SMatthias Ringwald // no initscript 2761565be94SMatthias Ringwald if (brcm_patch_ram_length == 0) return BTSTACK_CHIPSET_NO_INIT_SCRIPT; 2771565be94SMatthias Ringwald 278faa6c1f6SMatthias Ringwald // send download firmware command 279faa6c1f6SMatthias Ringwald if (send_download_command){ 280faa6c1f6SMatthias Ringwald send_download_command = 0; 281faa6c1f6SMatthias Ringwald hci_cmd_buffer[0] = 0x2e; 282faa6c1f6SMatthias Ringwald hci_cmd_buffer[1] = 0xfc; 283faa6c1f6SMatthias Ringwald hci_cmd_buffer[2] = 0x00; 284faa6c1f6SMatthias Ringwald return BTSTACK_CHIPSET_VALID_COMMAND; 285faa6c1f6SMatthias Ringwald } 286faa6c1f6SMatthias Ringwald 287faa6c1f6SMatthias Ringwald if (init_script_offset >= brcm_patch_ram_length) { 288100d3ee3SMatthias Ringwald 289100d3ee3SMatthias Ringwald // It takes up to 2 ms for the BCM to raise its RTS line 290100d3ee3SMatthias Ringwald // If we send the next command right away, the raise of the RTS will fall happen during 291100d3ee3SMatthias Ringwald // it and causing the next command to fail (at least on RedBear Duo with manual CTS/RTS) 292100d3ee3SMatthias Ringwald // 293100d3ee3SMatthias Ringwald // -> Work around implemented in hci.c 294100d3ee3SMatthias Ringwald 295faa6c1f6SMatthias Ringwald return BTSTACK_CHIPSET_DONE; 296faa6c1f6SMatthias Ringwald } 297faa6c1f6SMatthias Ringwald 298faa6c1f6SMatthias Ringwald int cmd_len = 3 + brcm_patchram_buf[init_script_offset+2]; 299faa6c1f6SMatthias Ringwald memcpy(&hci_cmd_buffer[0], &brcm_patchram_buf[init_script_offset], cmd_len); 300faa6c1f6SMatthias Ringwald init_script_offset += cmd_len; 301faa6c1f6SMatthias Ringwald return BTSTACK_CHIPSET_VALID_COMMAND; 302faa6c1f6SMatthias Ringwald } 30364eccac7SMatthias Ringwald #endif 304faa6c1f6SMatthias Ringwald 305faa6c1f6SMatthias Ringwald 306646a1850SMatthias Ringwald static btstack_chipset_t btstack_chipset_bcm = { 307faa6c1f6SMatthias Ringwald "BCM", 308faa6c1f6SMatthias Ringwald chipset_init, 309faa6c1f6SMatthias Ringwald chipset_next_command, 310faa6c1f6SMatthias Ringwald chipset_set_baudrate_command, 311faa6c1f6SMatthias Ringwald chipset_set_bd_addr_command, 312faa6c1f6SMatthias Ringwald }; 313faa6c1f6SMatthias Ringwald 314faa6c1f6SMatthias Ringwald // MARK: public API 315faa6c1f6SMatthias Ringwald const btstack_chipset_t * btstack_chipset_bcm_instance(void){ 316faa6c1f6SMatthias Ringwald return &btstack_chipset_bcm; 317faa6c1f6SMatthias Ringwald } 318646a1850SMatthias Ringwald 319646a1850SMatthias Ringwald /** 320646a1850SMatthias Ringwald * @brief Enable init file - needed by btstack_chipset_bcm_download_firmware when using h5 321646a1850SMatthias Ringwald * @param enabled 322646a1850SMatthias Ringwald */ 323646a1850SMatthias Ringwald void btstack_chipset_bcm_enable_init_script(int enabled){ 324646a1850SMatthias Ringwald if (enabled){ 325646a1850SMatthias Ringwald btstack_chipset_bcm.next_command = &chipset_next_command; 326646a1850SMatthias Ringwald } else { 327646a1850SMatthias Ringwald btstack_chipset_bcm.next_command = NULL; 328646a1850SMatthias Ringwald } 329646a1850SMatthias Ringwald } 330