/****************************************************************************** ** ** Function bte_main_boot_entry ** ** Description BTE MAIN API - Entry point for BTE chip/stack initialization ** ** Returns None ** ******************************************************************************/ int bte_main_boot_entry(bluedroid_init_done_cb_t cb) { hci = hci_layer_get_interface(); if (!hci) { APPL_TRACE_ERROR("%s could not get hci layer interface.\n", __func__); return -2; } bluedroid_init_done_cb = cb; osi_init(); //Enbale HCI bte_main_enable(); return 0; }
/******************************************************************************* ** ** Function BTM_EnableTestMode ** ** Description Send HCI the enable device under test command. ** ** Note: Controller can only be taken out of this mode by ** resetting the controller. ** ** Returns ** BTM_SUCCESS Command sent. ** BTM_NO_RESOURCES If out of resources to send the command. ** ** *******************************************************************************/ tBTM_STATUS BTM_EnableTestMode(void) { UINT8 cond; BTM_TRACE_EVENT ("BTM: BTM_EnableTestMode"); /* set auto accept connection as this is needed during test mode */ /* Allocate a buffer to hold HCI command */ cond = HCI_DO_AUTO_ACCEPT_CONNECT; if (!btsnd_hcic_set_event_filter(HCI_FILTER_CONNECTION_SETUP, HCI_FILTER_COND_NEW_DEVICE, &cond, sizeof(cond))) { return (BTM_NO_RESOURCES); } /* put device to connectable mode */ if (!BTM_SetConnectability(BTM_CONNECTABLE, BTM_DEFAULT_CONN_WINDOW, BTM_DEFAULT_CONN_INTERVAL) == BTM_SUCCESS) { return BTM_NO_RESOURCES; } /* put device to discoverable mode */ if (!BTM_SetDiscoverability(BTM_GENERAL_DISCOVERABLE, BTM_DEFAULT_DISC_WINDOW, BTM_DEFAULT_DISC_INTERVAL) == BTM_SUCCESS) { return BTM_NO_RESOURCES; } /* mask off all of event from controller */ hci_layer_get_interface()->transmit_command( hci_packet_factory_get_interface()->make_set_event_mask((const bt_event_mask_t *)("\x00\x00\x00\x00\x00\x00\x00\x00")), NULL, NULL, NULL); /* Send the HCI command */ if (btsnd_hcic_enable_test_mode ()) return (BTM_SUCCESS); else return (BTM_NO_RESOURCES); }
/****************************************************************************** ** ** Function bte_main_boot_entry ** ** Description BTE MAIN API - Entry point for BTE chip/stack initialization ** ** Returns None ** ******************************************************************************/ int bte_main_boot_entry(bluedroid_init_done_cb_t cb) { #ifdef CONFIG_BLUEDROID_MEM_DEBUG osi_mem_dbg_init(); #endif if (gki_init()) { LOG_ERROR("%s: Init GKI Module Failure.\n", __func__); return -1; } hci = hci_layer_get_interface(); if (!hci) { LOG_ERROR("%s could not get hci layer interface.\n", __func__); return -2; } btu_hci_msg_queue = fixed_queue_new(SIZE_MAX); if (btu_hci_msg_queue == NULL) { LOG_ERROR("%s unable to allocate hci message queue.\n", __func__); return -3; } bluedroid_init_done_cb = cb; //Caution: No event dispatcher defined now in hci layer //data_dispatcher_register_default(hci->event_dispatcher, btu_hci_msg_queue); hci->set_data_queue(btu_hci_msg_queue); #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) //bte_load_ble_conf(BTE_BLE_STACK_CONF_FILE); #endif //Enbale HCI bte_main_enable(); return 0; }