static void local_version_information_callback(uint8_t * packet){ printf("Local version information:\n"); uint16_t hci_version = little_endian_read_16(packet, 4); uint16_t hci_revision = little_endian_read_16(packet, 6); uint16_t lmp_version = little_endian_read_16(packet, 8); uint16_t manufacturer = little_endian_read_16(packet, 10); uint16_t lmp_subversion = little_endian_read_16(packet, 12); printf("- HCI Version 0x%04x\n", hci_version); printf("- HCI Revision 0x%04x\n", hci_revision); printf("- LMP Version 0x%04x\n", lmp_version); printf("- LMP Revision 0x%04x\n", lmp_subversion); printf("- Manufacturer 0x%04x\n", manufacturer); switch (manufacturer){ case COMPANY_ID_CAMBRIDGE_SILICON_RADIO: printf("Cambridge Silicon Radio CSR chipset.\n"); use_fast_uart(); hci_set_chipset(btstack_chipset_csr_instance()); break; case COMPANY_ID_TEXAS_INSTRUMENTS_INC: printf("Texas Instruments - CC256x compatible chipset.\n"); use_fast_uart(); hci_set_chipset(btstack_chipset_cc256x_instance()); #ifdef ENABLE_EHCILL printf("eHCILL enabled.\n"); #endif break; case COMPANY_ID_BROADCOM_CORPORATION: printf("Broadcom chipset. Not supported yet\n"); // hci_set_chipset(btstack_chipset_bcm_instance()); break; case COMPANY_ID_ST_MICROELECTRONICS: printf("ST Microelectronics - using STLC2500d driver.\n"); use_fast_uart(); hci_set_chipset(btstack_chipset_stlc2500d_instance()); break; case COMPANY_ID_EM_MICROELECTRONICS_MARIN: printf("EM Microelectronics - using EM9301 driver.\n"); hci_set_chipset(btstack_chipset_em9301_instance()); break; default: printf("Unknown manufacturer / manufacturer not supported yet.\n"); break; } }
void BTSTACK_Initialize ( void ) { printf("\n\nBTstack_Initialize()\n"); btstack_memory_init(); btstack_run_loop_init(btstack_run_loop_embedded_get_instance()); hci_dump_open(NULL, HCI_DUMP_STDOUT); const hci_transport_t * transport = hci_transport_h4_instance(); hci_init(transport, &config); hci_set_chipset(btstack_chipset_csr_instance()); // inform about BTstack state hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); btstack_main(0, NULL); }
static void local_version_information_handler(uint8_t * packet){ printf("Local version information:\n"); uint16_t hci_version = packet[6]; uint16_t hci_revision = little_endian_read_16(packet, 7); uint16_t lmp_version = packet[9]; uint16_t manufacturer = little_endian_read_16(packet, 10); uint16_t lmp_subversion = little_endian_read_16(packet, 12); printf("- HCI Version 0x%04x\n", hci_version); printf("- HCI Revision 0x%04x\n", hci_revision); printf("- LMP Version 0x%04x\n", lmp_version); printf("- LMP Revision 0x%04x\n", lmp_subversion); printf("- Manufacturer 0x%04x\n", manufacturer); switch (manufacturer){ case BLUETOOTH_COMPANY_ID_CAMBRIDGE_SILICON_RADIO: printf("Cambridge Silicon Radio CSR chipset.\n"); use_fast_uart(); hci_set_chipset(btstack_chipset_csr_instance()); break; case BLUETOOTH_COMPANY_ID_TEXAS_INSTRUMENTS_INC: printf("Texas Instruments - CC256x compatible chipset.\n"); use_fast_uart(); hci_set_chipset(btstack_chipset_cc256x_instance()); break; case BLUETOOTH_COMPANY_ID_BROADCOM_CORPORATION: printf("Broadcom chipset. Not supported by posix-h5 port, please use port/posix-h5-bcm\n"); exit(10); break; case BLUETOOTH_COMPANY_ID_ST_MICROELECTRONICS: printf("ST Microelectronics - using STLC2500d driver.\n"); use_fast_uart(); hci_set_chipset(btstack_chipset_stlc2500d_instance()); break; case BLUETOOTH_COMPANY_ID_EM_MICROELECTRONIC_MARIN_SA: printf("EM Microelectronics - using EM9301 driver.\n"); hci_set_chipset(btstack_chipset_em9301_instance()); break; default: printf("Unknown manufacturer / manufacturer not supported yet.\n"); break; } }