h5 ports: use uart slip wrapper for posix-h5, posix-h5-bcm, raspi, wiced-h5, pic32-harmony

This commit is contained in:
Matthias Ringwald 2021-02-26 18:30:22 +01:00
parent a48f52afac
commit 08b9cddccb
15 changed files with 127 additions and 77 deletions

File diff suppressed because one or more lines are too long

View File

@ -292,6 +292,7 @@
<itemPath>../../../src/btstack_tlv.c</itemPath>
<itemPath>../../../src/btstack_crypto.c</itemPath>
<itemPath>../../../src/btstack_hid_parser.c</itemPath>
<itemPath>../../../src/btstack_uart_slip_wrapper.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="f2" displayName="framework" projectFiles="true">
@ -357,7 +358,7 @@
<targetDevice>PIC32MX450F256L</targetDevice>
<targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard>
<platformTool>noID</platformTool>
<platformTool></platformTool>
<languageToolchain>XC32</languageToolchain>
<languageToolchainVersion>2.40</languageToolchainVersion>
<platform>4</platform>

View File

@ -7,8 +7,11 @@
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/port/pic32-harmony/src/btstack_config.h</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/port/pic32-harmony/src/btstack_port.c</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/src/ble/sm.c</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/platform/embedded/btstack_uart_block_embedded.c</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/system/ports/src/sys_ports.c</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/port/pic32-harmony/src/main.c</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/port/pic32-harmony/src/app.c</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/src/ble/sm.h</file>
<file>file:/Users/mringwal/microchip/harmony/v1_07/framework/btstack/src/btstack_uart_slip_wrapper.c</file>
</group>
</open-files>
</project-private>

View File

@ -11,6 +11,7 @@
#include "btstack_event.h"
#include "btstack_run_loop.h"
#include "btstack_run_loop_embedded.h"
#include "btstack_uart_slip_wrapper.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_transport.h"
@ -235,7 +236,11 @@ void BTSTACK_Initialize ( void )
hci_dump_open(NULL, HCI_DUMP_STDOUT);
const hci_transport_t * transport = hci_transport_h5_instance(btstack_uart_block_embedded_instance());
// setup uart driver
const btstack_uart_block_t * uart_block_driver = btstack_uart_block_embedded_instance();
const btstack_uart_t * uart_slip_driver = btstack_uart_slip_wrapper_instance(uart_block_driver);
const hci_transport_t * transport = hci_transport_h5_instance(uart_slip_driver);
hci_init(transport, &config);
hci_set_chipset(btstack_chipset_csr_instance());

View File

@ -8,6 +8,7 @@ CORE += \
btstack_run_loop_posix.c \
btstack_tlv_posix.c \
btstack_uart_block_posix.c \
btstack_uart_slip_wrapper.c \
btstack_slip.c \
hci_transport_h5.c \
le_device_db_tlv.c \

View File

@ -16,6 +16,7 @@
#define ENABLE_ATT_DELAYED_RESPONSE
#define ENABLE_BLE
#define ENABLE_CLASSIC
#define ENABLE_H5
#define ENABLE_HFP_WIDE_BAND_SPEECH
#define ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
#define ENABLE_LE_CENTRAL
@ -33,7 +34,8 @@
// BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof BNEP header, avoid memcpy
#define HCI_OUTGOING_PRE_BUFFER_SIZE 4
#define NVM_NUM_DEVICE_DB_ENTRIES 16
#define NVM_NUM_LINK_KEYS 16

View File

@ -51,21 +51,24 @@
#include "btstack_config.h"
#include "bluetooth_company_id.h"
#include "ble/le_device_db_tlv.h"
#include "btstack_chipset_bcm.h"
#include "btstack_chipset_bcm_download_firmware.h"
#include "btstack_debug.h"
#include "btstack_event.h"
#include "ble/le_device_db_tlv.h"
#include "classic/btstack_link_key_db_tlv.h"
#include "btstack_memory.h"
#include "btstack_run_loop.h"
#include "btstack_run_loop_posix.h"
#include "bluetooth_company_id.h"
#include "btstack_stdin.h"
#include "btstack_uart.h"
#include "btstack_uart_block.h"
#include "btstack_uart_slip_wrapper.h"
#include "btstack_tlv_posix.h"
#include "classic/btstack_link_key_db_tlv.h"
#include "hci.h"
#include "hci_dump.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
#include "btstack_chipset_bcm.h"
#include "btstack_chipset_bcm_download_firmware.h"
int btstack_main(int argc, const char * argv[]);
@ -162,17 +165,19 @@ int main(int argc, const char * argv[]){
btstack_chipset_bcm_set_device_name("BCM43430A1");
// setup UART driver
const btstack_uart_block_t * uart_driver = btstack_uart_block_posix_instance();
const btstack_uart_t * uart_block_driver = (const btstack_uart_t *) btstack_uart_block_posix_instance();
const btstack_uart_t * uart_slip_driver = btstack_uart_slip_wrapper_instance(uart_block_driver);
// extract UART config from transport config
uart_config.baudrate = transport_config.baudrate_init;
uart_config.flowcontrol = transport_config.flowcontrol;
uart_config.device_name = transport_config.device_name;
uart_driver->init(&uart_config);
uart_block_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 hci_transport_t * transport = hci_transport_h5_instance(uart_slip_driver);
hci_init(transport, (void*) &transport_config);
hci_set_chipset(btstack_chipset_bcm_instance());
@ -190,7 +195,7 @@ int main(int argc, const char * argv[]){
printf("Phase 1: Download firmware\n");
// phase #2 start main app
btstack_chipset_bcm_download_firmware(uart_driver, transport_config.baudrate_main, &phase2);
btstack_chipset_bcm_download_firmware(uart_block_driver, transport_config.baudrate_main, &phase2);
// go
btstack_run_loop_execute();

View File

@ -12,6 +12,7 @@ CORE += \
btstack_run_loop_posix.c \
btstack_tlv_posix.c \
btstack_uart_block_posix.c \
btstack_uart_slip_wrapper.c \
btstack_slip.c \
hci_transport_h5.c \
le_device_db_tlv.c \

View File

@ -15,6 +15,7 @@
// BTstack features that can be enabled
#define ENABLE_BLE
#define ENABLE_CLASSIC
#define ENABLE_H5
#define ENABLE_HFP_WIDE_BAND_SPEECH
#define ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
#define ENABLE_LE_CENTRAL
@ -32,6 +33,7 @@
// BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
#define HCI_OUTGOING_PRE_BUFFER_SIZE 4
#define NVM_NUM_DEVICE_DB_ENTRIES 16
#define NVM_NUM_LINK_KEYS 16

View File

@ -63,6 +63,9 @@
#include "hci_dump.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
#include "btstack_uart.h"
#include "btstack_uart_block.h"
#include "btstack_uart_slip_wrapper.h"
#include "btstack_chipset_csr.h"
#include "btstack_chipset_cc256x.h"
@ -220,8 +223,9 @@ int main(int argc, const char * argv[]){
printf("H5 device: %s\n", config.device_name);
// init HCI
const btstack_uart_block_t * uart_driver = btstack_uart_block_posix_instance();
const hci_transport_t * transport = hci_transport_h5_instance(uart_driver);
const btstack_uart_t * uart_block_driver = (const btstack_uart_t *) btstack_uart_block_posix_instance();
const btstack_uart_t * uart_slip_driver = btstack_uart_slip_wrapper_instance(uart_block_driver);
const hci_transport_t * transport = hci_transport_h5_instance(uart_slip_driver);
hci_init(transport, (void*) &config);
// enable BCSP mode for CSR chipsets - auto detect might not work

View File

@ -9,6 +9,7 @@ CORE += \
btstack_run_loop_posix.c \
btstack_tlv_posix.c \
btstack_uart_block_posix.c \
btstack_uart_slip_wrapper.c \
btstack_slip.c \
hci_transport_h4.c \
hci_transport_h5.c \

View File

@ -14,6 +14,7 @@
// BTstack features that can be enabled
#define ENABLE_BLE
#define ENABLE_CLASSIC
#define ENABLE_H5
#define ENABLE_HFP_WIDE_BAND_SPEECH
#define ENABLE_L2CAP_ENHANCED_RETRANSMISSION_MODE
#define ENABLE_LE_CENTRAL
@ -34,7 +35,8 @@
// BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof BNEP header, avoid memcpy
#define HCI_OUTGOING_PRE_BUFFER_SIZE 4
#define NVM_NUM_DEVICE_DB_ENTRIES 16
#define NVM_NUM_LINK_KEYS 16

View File

@ -69,11 +69,15 @@
#include "hci_dump.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
#include "btstack_uart.h"
#include "btstack_uart_block.h"
#include "btstack_uart_slip_wrapper.h"
#include "btstack_chipset_bcm.h"
#include "btstack_chipset_bcm_download_firmware.h"
#include "btstack_control_raspi.h"
#include "raspi_get_model.h"
int btstack_main(int argc, const char * argv[]);
@ -367,20 +371,21 @@ int main(int argc, const char * argv[]){
btstack_chipset_bcm_set_hcd_folder_path("/lib/firmware/brcm");
// setup UART driver
const btstack_uart_block_t * uart_driver = btstack_uart_block_posix_instance();
const btstack_uart_block_t * uart_block_driver = btstack_uart_block_posix_instance();
// extract UART config from transport config
uart_config.baudrate = transport_config.baudrate_init;
uart_config.flowcontrol = transport_config.flowcontrol;
uart_config.device_name = transport_config.device_name;
uart_driver->init(&uart_config);
uart_block_driver->init(&uart_config);
// HW with FlowControl -> we can use regular h4 mode
const hci_transport_t * transport;
if (transport_config.flowcontrol){
transport = hci_transport_h4_instance(uart_driver);
transport = hci_transport_h4_instance(uart_block_driver);
} else {
transport = hci_transport_h5_instance(uart_driver);
const btstack_uart_t * uart_slip_driver = btstack_uart_slip_wrapper_instance(uart_block_driver);
transport = hci_transport_h5_instance(uart_slip_driver);
}
// setup HCI (to be able to use bcm chipset driver)
@ -427,7 +432,7 @@ int main(int argc, const char * argv[]){
printf("Phase 1: Download firmware\n");
// phase #2 start main app
btstack_chipset_bcm_download_firmware(uart_driver, transport_config.baudrate_main, &phase2);
btstack_chipset_bcm_download_firmware(uart_block_driver, transport_config.baudrate_main, &phase2);
}
// go

View File

@ -25,7 +25,11 @@
#define ENABLE_PRINTF_HEXDUMP
// BTstack configuration. buffers, sizes, ...
#define HCI_ACL_PAYLOAD_SIZE 100
#define HCI_ACL_PAYLOAD_SIZE (1691 + 4)
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof BNEP header, avoid memcpy
#define HCI_OUTGOING_PRE_BUFFER_SIZE 4
// BTstack configuration. buffers, sizes, ...
#define MAX_NR_BNEP_CHANNELS 0
#define MAX_NR_BNEP_SERVICES 0
#define MAX_NR_BTSTACK_LINK_KEY_DB_MEMORY_ENTRIES 2

View File

@ -43,6 +43,7 @@
#include "btstack_run_loop_wiced.h"
#include "btstack_link_key_db_wiced_dct.h"
#include "le_device_db_wiced_dct.h"
#include "btstack_uart_slip_wrapper.h"
#include "generated_mac_address.txt"
@ -119,16 +120,17 @@ void application_start(void){
chipset->init(&transport_config);
// setup uart driver
const btstack_uart_block_t * uart_driver = btstack_uart_block_wiced_instance();
const btstack_uart_block_t * uart_block_driver = btstack_uart_block_wiced_instance();
const btstack_uart_t * uart_slip_driver = btstack_uart_slip_wrapper_instance(uart_block_driver);
// extract UART config from transport config
uart_config.baudrate = transport_config.baudrate_init;
uart_config.flowcontrol = transport_config.flowcontrol;
uart_config.device_name = transport_config.device_name;
uart_driver->init(&uart_config);
uart_block_driver->init(&uart_config);
// init HCI
const hci_transport_t * transport = hci_transport_h5_instance(uart_driver);
const hci_transport_t * transport = hci_transport_h5_instance(uart_slip_driver);
hci_init(transport, (void*) &transport_config);
hci_set_link_key_db(btstack_link_key_db_wiced_dct_instance());
hci_set_chipset(chipset);
@ -151,7 +153,7 @@ void application_start(void){
printf("Phase 1: Download firmware\n");
// phase #2 start main app
btstack_chipset_bcm_download_firmware(uart_driver, transport_config.baudrate_main, &phase2);
btstack_chipset_bcm_download_firmware(uart_block_driver, transport_config.baudrate_main, &phase2);
// go
btstack_run_loop_execute();