hci: add hci_set_chipset and set it for all ports

This commit is contained in:
Matthias Ringwald 2016-01-22 14:55:13 +01:00
parent 58360f586d
commit c67501cb47
14 changed files with 28 additions and 8 deletions

View File

@ -751,7 +751,8 @@ void BTstackManager::setup(void){
hci_transport_t * transport = hci_transport_h4_instance();
bt_control_t * control = bt_control_em9301_instance();
hci_init(transport, NULL, control, NULL);
hci_set_chipset(btstack_chipset_em9301_instance());
if (have_custom_addr){
hci_set_bd_addr(public_bd_addr);
}

View File

@ -102,9 +102,10 @@ int main(void)
bt_control_t * control = bt_control_cc256x_instance();
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
hci_init(transport, &config, control, remote_db);
hci_set_chipset(btstack_chipset_cc256x_instance());
// use eHCILL
bt_control_cc256x_enable_ehcill(1);
btstack_chipset_cc256x_enable_ehcill(1);
// ready - enable irq used in h4 task
__enable_interrupt();

View File

@ -379,9 +379,10 @@ int main(void){
bt_control_t * control = bt_control_cc256x_instance();
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
hci_init(transport, &config, control, remote_db);
hci_set_chipset(btstack_chipset_cc256x_instance());
// use eHCILL
bt_control_cc256x_enable_ehcill(1);
btstack_chipset_cc256x_enable_ehcill(1);
// init L2CAP
l2cap_init();

View File

@ -102,9 +102,10 @@ static void btstack_setup(void){
bt_control_t * control = bt_control_cc256x_instance();
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
hci_init(transport, &config, control, remote_db);
hci_set_chipset(btstack_chipset_cc256x_instance());
// use eHCILL
bt_control_cc256x_enable_ehcill(1);
btstack_chipset_cc256x_enable_ehcill(1);
}
int btstack_main(int argc, const char * argv[]);

View File

@ -109,9 +109,10 @@ static void btstack_setup(void){
bt_control_t * control = bt_control_cc256x_instance();
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
hci_init(transport, &config, control, remote_db);
hci_set_chipset(btstack_chipset_cc256x_instance());
// use eHCILL
// bt_control_cc256x_enable_ehcill(1);
// btstack_chipset_cc256x_enable_ehcill(1);
}
int btstack_main(int argc, const char * argv[]);

View File

@ -228,6 +228,7 @@ void BTSTACK_Initialize ( void )
hci_transport_t * transport = hci_transport_h4_instance();
bt_control_t * control = bt_control_csr_instance();
hci_init(transport, &config, control, NULL);
hci_set_chipset(btstack_chipset_csr_instance());
// hci_power_control(HCI_POWER_ON);
btstack_main(0, NULL);

View File

@ -118,6 +118,7 @@ int main(int argc, const char * argv[]){
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_fs;
hci_init(transport, (void*) &config, control, remote_db);
hci_set_chipset(btstack_chipset_csr_instance());
// handle CTRL-c
signal(SIGINT, sigint_handler);

View File

@ -107,6 +107,7 @@ int main(int argc, const char * argv[]){
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_fs;
hci_init(transport, (void*) &config, control, remote_db);
hci_set_chipset(btstack_chipset_stlc2500d_instance());
// handle CTRL-c
signal(SIGINT, sigint_handler);

View File

@ -104,6 +104,7 @@ int main(int argc, const char * argv[]){
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_fs;
hci_init(transport, (void*) &hci_uart_config, control, remote_db);
hci_set_chipset(btstack_chipset_tc3566x_instance());
// handle CTRL-c
signal(SIGINT, sigint_handler);

View File

@ -108,6 +108,7 @@ int main(int argc, const char * argv[]){
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_fs;
hci_init(transport, (void*) &config, control, remote_db);
hci_set_chipset(btstack_chipset_cc256x_instance());
// handle CTRL-c
signal(SIGINT, sigint_handler);

View File

@ -428,9 +428,10 @@ int main(void)
bt_control_t * control = bt_control_cc256x_instance();
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
hci_init(transport, (void*) &config, control, remote_db);
hci_set_chipset(btstack_chipset_cc256x_instance());
// enable eHCILL
bt_control_cc256x_enable_ehcill(1);
btstack_chipset_cc256x_enable_ehcill(1);
// hand over to btstack embedded code
btstack_main();

View File

@ -96,6 +96,7 @@ void application_start(void){
bt_control_t * control = bt_control_bcm_instance();
remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
hci_init(transport, (void*) &hci_transport_config_uart, control, remote_db);
hci_set_chipset(btstack_chipset_bcm_instance());
// use WIFI Mac address + 1 for Bluetooth
bd_addr_t dummy = { 1,2,3,4,5,6};

View File

@ -1910,6 +1910,8 @@ void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, r
// reference to used config
hci_stack->config = config;
// init used chipset with NULL for now (already done my memset above)
// higher level handler
hci_stack->packet_handler = dummy_handler;

View File

@ -514,8 +514,9 @@ typedef struct {
*/
typedef struct {
// transport component with configuration
hci_transport_t * hci_transport;
void * config;
hci_transport_t * hci_transport;
btstack_chipset_t * chipset;
void * config;
// basic configuration
const char * local_name;
@ -758,6 +759,11 @@ void hci_local_bd_addr(bd_addr_t address_buffer);
*/
void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, remote_device_db_t const* remote_device_db);
/**
* @brief Configure Bluetooth chipset driver. Has to be called before power on, or right after receiving the local version information
*/
void hci_set_chipset(btstack_chipset_t *chipset_driver);
/**
* @brief Set class of device that will be set during Bluetooth init.
*/