wiced: fixed port

This commit is contained in:
Matthias Ringwald 2016-02-26 21:16:32 +01:00
parent 03858e25c4
commit 281f819cb8
4 changed files with 27 additions and 15 deletions

View File

@ -29,7 +29,7 @@
#define MAX_NO_RFCOMM_MULTIPLEXERS MAX_SPP_CONNECTIONS
#define MAX_NO_RFCOMM_SERVICES 1
#define MAX_NO_RFCOMM_CHANNELS MAX_SPP_CONNECTIONS
#define MAX_NO_DB_MEM_DEVICE_LINK_KEYS 2
#define MAX_NO_BTSTACK_LINK_KEY_DB_MEMORYS 2
#define MAX_NO_DB_MEM_DEVICE_NAMES 0
#define MAX_NO_DB_MEM_SERVICES 1
#define MAX_NO_BNEP_SERVICES 0

View File

@ -82,6 +82,7 @@ typedef struct hci_transport_h4 {
// single instance
static hci_transport_h4_t * hci_transport_h4 = NULL;
static hci_transport_config_uart_t * hci_transport_config_uart = NULL;
static void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size) = dummy_handler;
@ -227,7 +228,20 @@ static int h4_set_baudrate(uint32_t baudrate){
return 0;
}
static int h4_open(const void *transport_config){
static void h4_init(const void * transport_config){
// check for hci_transport_config_uart_t
if (!transport_config) {
log_error("hci_transport_h4_posix: no config!");
return;
}
if (((hci_transport_config_t*)transport_config)->type != HCI_TRANSPORT_CONFIG_UART) {
log_error("hci_transport_h4_posix: config not of type != HCI_TRANSPORT_CONFIG_UART!");
return;
}
hci_transport_config_uart = (hci_transport_config_uart_t*) transport_config;
}
static int h4_open(void){
// UART config
wiced_uart_config_t uart_config =
@ -285,7 +299,7 @@ static int h4_open(const void *transport_config){
return 0;
}
static int h4_close(const void *transport_config){
static int h4_close(void){
// not implementd
return 0;
}
@ -312,25 +326,23 @@ static int h4_can_send_packet_now(uint8_t packet_type){
return tx_worker_data_size == 0;
}
static const char * h4_get_transport_name(void){
return "H4";
}
static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
}
// get h4 singleton
hci_transport_t * hci_transport_h4_instance() {
const hci_transport_t * hci_transport_h4_instance() {
if (hci_transport_h4 == NULL) {
hci_transport_h4 = (hci_transport_h4_t*)malloc( sizeof(hci_transport_h4_t));
memset(hci_transport_h4, 0, sizeof(hci_transport_h4_t));
hci_transport_h4->ds = NULL;
hci_transport_h4->transport.name = "H4_WICED";
hci_transport_h4->transport.init = h4_init;
hci_transport_h4->transport.open = h4_open;
hci_transport_h4->transport.close = h4_close;
hci_transport_h4->transport.send_packet = h4_send_packet;
hci_transport_h4->transport.register_packet_handler = h4_register_packet_handler;
hci_transport_h4->transport.get_transport_name = h4_get_transport_name;
hci_transport_h4->transport.set_baudrate = h4_set_baudrate;
hci_transport_h4->transport.can_send_packet_now = h4_can_send_packet_now;
hci_transport_h4->transport.send_packet = h4_send_packet;
hci_transport_h4->transport.set_baudrate = h4_set_baudrate;
}
return (hci_transport_t *) hci_transport_h4;
return (const hci_transport_t *) hci_transport_h4;
}

View File

@ -36,7 +36,7 @@
*/
#include "btstack.h"
#include "btstack_control_bcm.h"
#include "btstack_chipset_bcm.h"
#include "btstack_run_loop_wiced.h"
#include "generated_mac_address.txt"

View File

@ -18,7 +18,7 @@ $(NAME)_SOURCES += \
../../src/ble/le_device_db_memory.c \
../../src/ble/sm.c \
../../src/classic/hsp_hs.c \
../../src/classic/remote_device_db_memory.c \
../../src/classic/btstack_link_key_db_memory.c \
../../src/classic/rfcomm.c \
../../src/classic/sdp_server.c \
../../src/classic/sdp_client.c \
@ -40,5 +40,5 @@ $(NAME)_SOURCES += \
main.c \
btstack_run_loop_wiced.c \
hci_transport_h4_wiced.c \
../../chipset/bcm/bt_control_bcm.c \
../../chipset/bcm/btstack_chipset_bcm.c \
../../../drivers/bluetooth/firmware/$(BT_CHIP)$(BT_CHIP_REVISION)/bt_firmware_image.c \