mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-29 03:32:49 +00:00
chipset/da14581: fix compile
This commit is contained in:
parent
dd0cd63ed3
commit
874802b5cc
@ -50,7 +50,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stddef.h> /* NULL */
|
#include <stddef.h> /* NULL */
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h> /* memcpy */
|
#include <string.h> /* memcpy */
|
||||||
#include "hci.h"
|
#include "hci.h"
|
||||||
|
|
||||||
@ -76,8 +75,8 @@ static const btstack_uart_block_t * the_uart_driver;
|
|||||||
static int download_count;
|
static int download_count;
|
||||||
static uint8_t response_buffer[1];
|
static uint8_t response_buffer[1];
|
||||||
static uint8_t command_buffer[3];
|
static uint8_t command_buffer[3];
|
||||||
static const uint8_t * fw_data;
|
static const uint8_t * chipset_fw_data;
|
||||||
static uint16_t fw_size;
|
static uint16_t chipset_fw_size;
|
||||||
|
|
||||||
static void da14581_start(void){
|
static void da14581_start(void){
|
||||||
// start to read
|
// start to read
|
||||||
@ -93,8 +92,8 @@ static void da14581_w4_stx(void){
|
|||||||
log_info("da14581_w4_stx: send download command");
|
log_info("da14581_w4_stx: send download command");
|
||||||
// setup download config message
|
// setup download config message
|
||||||
command_buffer[0] = SOH;
|
command_buffer[0] = SOH;
|
||||||
little_endian_store_16(command_buffer, 1, fw_size);
|
little_endian_store_16(command_buffer, 1, chipset_fw_size);
|
||||||
the_uart_driver->set_block_sent(da14581_w4_command_sent);
|
the_uart_driver->set_block_sent(da14581_w4_command_sent);
|
||||||
the_uart_driver->send_block(command_buffer, 3);
|
the_uart_driver->send_block(command_buffer, 3);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -118,8 +117,8 @@ static void da14581_w4_ack(void){
|
|||||||
// calc crc
|
// calc crc
|
||||||
// send file
|
// send file
|
||||||
log_info("da14581_w4_ack: ACK received, send firmware");
|
log_info("da14581_w4_ack: ACK received, send firmware");
|
||||||
the_uart_driver->set_block_sent(da14581_w4_fw_sent);
|
the_uart_driver->set_block_sent(da14581_w4_fw_sent);
|
||||||
the_uart_driver->send_block(fw_data, fw_size);
|
the_uart_driver->send_block(chipset_fw_data, chipset_fw_size);
|
||||||
break;
|
break;
|
||||||
case NACK:
|
case NACK:
|
||||||
// denied
|
// denied
|
||||||
@ -153,8 +152,8 @@ static void da14581_w4_crc(void){
|
|||||||
// calculate crc
|
// calculate crc
|
||||||
int i;
|
int i;
|
||||||
uint8_t fcrc = CRC_INIT;
|
uint8_t fcrc = CRC_INIT;
|
||||||
for (i = 0; i < fw_size; i++){
|
for (i = 0; i < chipset_fw_size; i++){
|
||||||
fcrc ^= fw_data[i];
|
fcrc ^= chipset_fw_data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// check crc
|
// check crc
|
||||||
@ -174,18 +173,18 @@ static void da14581_w4_final_ack_sent(void){
|
|||||||
download_complete(0);
|
download_complete(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void btstack_chipset_da14581_download_firmware_with_uart(const btstack_uart_t * uart_driver, const uint8_t * da_fw_data, uint16_t da_fw_size, void (*done)(int result)){
|
void btstack_chipset_da14581_download_firmware_with_uart(const btstack_uart_t * uart_driver, const uint8_t * fw_data, uint16_t fw_size, void (*done)(int result)){
|
||||||
|
|
||||||
the_uart_driver = uart_driver;
|
the_uart_driver = uart_driver;
|
||||||
download_complete = done;
|
download_complete = done;
|
||||||
fw_data = da_fw_data;
|
chipset_fw_data = fw_data;
|
||||||
fw_size = da_fw_size;
|
chipset_fw_size = fw_size;
|
||||||
|
|
||||||
int res = the_uart_driver->open();
|
int res = the_uart_driver->open();
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
log_error("uart_block init failed %u", res);
|
log_error("uart_block init failed %u", res);
|
||||||
download_complete(res);
|
download_complete(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
download_count = 0;
|
download_count = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user