Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for Bosch XDK110 implementation #269

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions chipset/em9301/EM9301_Patch_V0x0A.c

Large diffs are not rendered by default.

384 changes: 264 additions & 120 deletions chipset/em9301/btstack_chipset_em9301.c

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions chipset/em9301/btstack_chipset_em9301.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ extern const hci_cmd_t hci_vendor_em_transmitter_test_end;
extern const hci_cmd_t hci_vendor_em_patch_query;
extern const hci_cmd_t hci_vendor_em_set_memory_mode;
extern const hci_cmd_t hci_vendor_em_set_sleep_options;
extern const hci_cmd_t hci_vendor_em_set_operating_state;

#define HCI_SUBEVENT_EM_STANDBY_STATE 0x01
#define HCI_SUBEVENT_EM_BLE_IDLE_ENTERED 0x02

#if defined __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion platform/embedded/btstack_em9304_spi_embedded.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static void btstack_em9304_spi_embedded_set_transfer_done_callback(void (*callba
/**
* @brief Poll READY state
*/
static int btstack_em9304_spi_embedded_get_ready(){
static int btstack_em9304_spi_embedded_get_ready(void){
return hal_em9304_spi_get_ready();
}

Expand Down
2 changes: 1 addition & 1 deletion platform/embedded/hal_em9304_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void hal_em9304_spi_disable_ready_interrupt(void);
/**
* @brief Poll READY state
*/
int hal_em9304_spi_get_ready();
int hal_em9304_spi_get_ready(void);

/**
* @brief Set Chip Selet
Expand Down
5 changes: 5 additions & 0 deletions platform/embedded/hal_uart_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ extern "C" {
*/
void hal_uart_dma_init(void);

/**
* @brief Deinit and close device
*/
void hal_uart_dma_deinit(void);

/**
* @brief Set callback for block received - can be called from ISR context
* @param callback
Expand Down
2 changes: 1 addition & 1 deletion platform/freertos/btstack_run_loop_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include "btstack_linked_list.h"
#include "btstack_debug.h"
#include "btstack_util.h"
#include "hal_time_ms.h"
#include <platform/embedded/hal_time_ms.h>

// some SDKs, e.g. esp-idf, place FreeRTOS headers into an 'freertos' folder to avoid name collisions (e.g. list.h, queue.h, ..)
// wih this flag, the headers are properly found
Expand Down
6 changes: 4 additions & 2 deletions platform/freertos/btstack_uart_block_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include "btstack_debug.h"
#include "btstack_uart_block.h"
#include "btstack_run_loop_freertos.h"
#include "hal_uart_dma.h"
#include <platform/embedded/hal_uart_dma.h>

#ifdef HAVE_FREERTOS_INCLUDE_PREFIX
#include "freertos/FreeRTOS.h"
Expand Down Expand Up @@ -126,9 +126,11 @@ static int btstack_uart_block_freertos_open(void){
}

static int btstack_uart_block_freertos_close(void){

// close device
// ...
#ifdef HAL_UART_DMA_DEINIT
hal_uart_dma_deinit();
#endif
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ typedef enum {
#define OGF_LE_CONTROLLER 0x08
#define OGF_VENDOR 0x3f


#define HCI_CMD_OPCODE(ogf, ocf) ((ocf) | ((ogf) << 10))


/**
Expand Down
10 changes: 10 additions & 0 deletions src/hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,16 @@ static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){
}
}

#ifdef HAVE_EM9301_PATCH_CONTAINER
// EM9301 is in ISP mode
if ((hci_stack->substate == HCI_INIT_W4_CUSTOM_INIT)
&& (hci_event_packet_get_type(packet) == HCI_EVENT_HARDWARE_ERROR)
&& (packet[2] == 0x80)){
// continue processing due normal behavior
command_completed = 1;
}
#endif

#if !defined(HAVE_PLATFORM_IPHONE_OS) && !defined (HAVE_HOST_CONTROLLER_API)

// Vendor == CSR
Expand Down
2 changes: 1 addition & 1 deletion src/hci_transport_h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ static void hci_transport_h5_read_next_byte(void){

// track time receiving SLIP frame
static uint32_t hci_transport_h5_receive_start;
static void hci_transport_h5_block_received(){
static void hci_transport_h5_block_received(void){
if (hci_transport_h5_active == 0) return;

// track start time when receiving first byte // a bit hackish
Expand Down