bcm/h5: allow to use higher main baud rate when fully booted

This commit is contained in:
Matthias Ringwald 2017-04-25 16:12:55 +02:00
parent 99e8f095f5
commit 646a1850c2
4 changed files with 35 additions and 11 deletions

View File

@ -291,7 +291,7 @@ static btstack_chipset_result_t chipset_next_command(uint8_t * hci_cmd_buffer){
#endif
static const btstack_chipset_t btstack_chipset_bcm = {
static btstack_chipset_t btstack_chipset_bcm = {
"BCM",
chipset_init,
chipset_next_command,
@ -303,3 +303,15 @@ static const btstack_chipset_t btstack_chipset_bcm = {
const btstack_chipset_t * btstack_chipset_bcm_instance(void){
return &btstack_chipset_bcm;
}
/**
* @brief Enable init file - needed by btstack_chipset_bcm_download_firmware when using h5
* @param enabled
*/
void btstack_chipset_bcm_enable_init_script(int enabled){
if (enabled){
btstack_chipset_bcm.next_command = &chipset_next_command;
} else {
btstack_chipset_bcm.next_command = NULL;
}
}

View File

@ -73,6 +73,12 @@ void btstack_chipset_bcm_set_hcd_folder_path(const char * path);
*/
void btstack_chipset_bcm_set_device_name(const char * path);
/**
* @brief Enable init file - needed by btstack_chipset_bcm_download_firmware when using h5
* @param enabled
*/
void btstack_chipset_bcm_enable_init_script(int enabled);
#if defined __cplusplus
}
#endif

View File

@ -116,7 +116,11 @@ static void bcm_send_next_init_script_command(void){
break;
case BTSTACK_CHIPSET_DONE:
log_info("bcm: init script done");
// disable init script for main startup
btstack_chipset_bcm_enable_init_script(0);
// reset baudreate to default
uart_driver->set_baudrate(115200);
// notify main
download_complete(0);
break;
default:

View File

@ -151,6 +151,18 @@ int main(int argc, const char * argv[]){
uart_config.device_name = transport_config.device_name;
uart_driver->init(&uart_config);
// setup HCI (to be able to use bcm chipset driver)
// init HCI
const hci_transport_t * transport = hci_transport_h5_instance(uart_driver);
const btstack_link_key_db_t * link_key_db = btstack_link_key_db_fs_instance();
hci_init(transport, (void*) &transport_config);
hci_set_link_key_db(link_key_db);
hci_set_chipset(btstack_chipset_bcm_instance());
// inform about BTstack state
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);
// handle CTRL-c
signal(SIGINT, sigint_handler);
@ -177,16 +189,6 @@ static void phase2(int status){
printf("Phase 2: Main app\n");
// init HCI
const hci_transport_t * transport = hci_transport_h5_instance(uart_driver);
const btstack_link_key_db_t * link_key_db = btstack_link_key_db_fs_instance();
hci_init(transport, (void*) &transport_config);
hci_set_link_key_db(link_key_db);
// inform about BTstack state
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);
// setup app
btstack_main(main_argc, main_argv);
}