csr: change local baudrate before sending warm reset command

This commit is contained in:
Matthias Ringwald 2016-01-14 21:54:48 +01:00
parent 7b90e0b281
commit 772a36d34e

View File

@ -848,6 +848,11 @@ static void hci_initialization_timeout_handler(timer_source_t * ds){
case HCI_INIT_W4_SEND_BAUD_CHANGE:
log_info("Local baud rate change to %"PRIu32, ((hci_uart_config_t *)hci_stack->config)->baudrate_main);
hci_stack->hci_transport->set_baudrate(((hci_uart_config_t *)hci_stack->config)->baudrate_main);
// For CSR, HCI Reset is sent on new baud rate
if (hci_stack->manufacturer == 0x000a){
hci_stack->substate = HCI_INIT_SEND_RESET_CSR_WARM_BOOT;
hci_run();
}
break;
default:
break;
@ -932,7 +937,16 @@ static void hci_initializing_run(void){
run_loop_set_timer(&hci_stack->timeout, 100);
run_loop_set_timer_handler(&hci_stack->timeout, hci_initialization_timeout_handler);
run_loop_add_timer(&hci_stack->timeout);
hci_stack->substate = HCI_INIT_W4_CUSTOM_INIT_CSR_WARM_BOOT;
if (hci_stack->manufacturer == 0x000a
&& hci_stack->config
&& hci_stack->control
// && hci_stack->control->baudrate_cmd -- there's no such command
&& hci_stack->hci_transport->set_baudrate
&& ((hci_uart_config_t *)hci_stack->config)->baudrate_main){
hci_stack->substate = HCI_INIT_W4_SEND_BAUD_CHANGE;
} else {
hci_stack->substate = HCI_INIT_W4_CUSTOM_INIT_CSR_WARM_BOOT;
}
break;
}
hci_stack->hci_transport->send_packet(HCI_COMMAND_DATA_PACKET, hci_stack->hci_packet_buffer, size);