mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-25 09:02:30 +00:00
chipset/intel: fix warnings
This commit is contained in:
parent
d85825d49a
commit
ce9d10fbb0
@ -38,7 +38,6 @@
|
|||||||
#define BTSTACK_FILE__ "btstack_chipset_intel_firmware.c"
|
#define BTSTACK_FILE__ "btstack_chipset_intel_firmware.c"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "btstack_chipset_intel_firmware.h"
|
#include "btstack_chipset_intel_firmware.h"
|
||||||
@ -52,6 +51,11 @@
|
|||||||
#include "hci_cmd.h"
|
#include "hci_cmd.h"
|
||||||
#include "hci_dump.h"
|
#include "hci_dump.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// ignore deprecated warning for fopen
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
// assert outgoing and incoming hci packet buffers can hold max hci command resp. event packet
|
// assert outgoing and incoming hci packet buffers can hold max hci command resp. event packet
|
||||||
#if HCI_OUTGOING_PACKET_BUFFER_SIZE < (HCI_CMD_HEADER_SIZE + 255)
|
#if HCI_OUTGOING_PACKET_BUFFER_SIZE < (HCI_CMD_HEADER_SIZE + 255)
|
||||||
#error "HCI_OUTGOING_PACKET_BUFFER_SIZE to small. Outgoing HCI packet buffer to small for largest HCI Command packet. Please set HCI_ACL_PAYLOAD_SIZE to 258 or higher."
|
#error "HCI_OUTGOING_PACKET_BUFFER_SIZE to small. Outgoing HCI packet buffer to small for largest HCI Command packet. Please set HCI_ACL_PAYLOAD_SIZE to 258 or higher."
|
||||||
@ -131,7 +135,7 @@ static uint8_t hw_variant;
|
|||||||
static uint16_t dev_revid;
|
static uint16_t dev_revid;
|
||||||
|
|
||||||
static FILE * fw_file;
|
static FILE * fw_file;
|
||||||
static uint32_t fw_offset;
|
static size_t fw_offset;
|
||||||
|
|
||||||
static void (*done)(int result);
|
static void (*done)(int result);
|
||||||
|
|
||||||
@ -156,7 +160,7 @@ static int transport_send_cmd(const hci_cmd_t *cmd, ...){
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int transport_send_intel_secure(uint8_t fragment_type, const uint8_t * data, uint16_t len){
|
static int transport_send_intel_secure(uint8_t fragment_type, const uint8_t * data, uint8_t len){
|
||||||
little_endian_store_16(hci_outgoing, 0, 0xfc09);
|
little_endian_store_16(hci_outgoing, 0, 0xfc09);
|
||||||
hci_outgoing[2] = 1 + len;
|
hci_outgoing[2] = 1 + len;
|
||||||
hci_outgoing[3] = fragment_type;
|
hci_outgoing[3] = fragment_type;
|
||||||
@ -165,7 +169,7 @@ static int transport_send_intel_secure(uint8_t fragment_type, const uint8_t * da
|
|||||||
return transport_send_packet(HCI_ACL_DATA_PACKET, hci_outgoing, size);
|
return transport_send_packet(HCI_ACL_DATA_PACKET, hci_outgoing, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int transport_send_intel_ddc(const uint8_t * data, uint16_t len){
|
static int transport_send_intel_ddc(const uint8_t * data, uint8_t len){
|
||||||
little_endian_store_16(hci_outgoing, 0, 0xfc8b);
|
little_endian_store_16(hci_outgoing, 0, 0xfc8b);
|
||||||
hci_outgoing[2] = len;
|
hci_outgoing[2] = len;
|
||||||
memcpy(&hci_outgoing[3], data, len);
|
memcpy(&hci_outgoing[3], data, len);
|
||||||
@ -176,8 +180,8 @@ static int transport_send_intel_ddc(const uint8_t * data, uint16_t len){
|
|||||||
static void state_machine(uint8_t * packet);
|
static void state_machine(uint8_t * packet);
|
||||||
|
|
||||||
// read data from fw file and send it via intel_secure + update state
|
// read data from fw file and send it via intel_secure + update state
|
||||||
static int intel_send_fragment(uint8_t fragment_type, uint16_t len){
|
static int intel_send_fragment(uint8_t fragment_type, uint8_t len){
|
||||||
int res = fread(fw_buffer, 1, len, fw_file);
|
size_t res = fread(fw_buffer, 1, len, fw_file);
|
||||||
log_info("offset %6u, read %3u -> res %d", fw_offset, len, res);
|
log_info("offset %6u, read %3u -> res %d", fw_offset, len, res);
|
||||||
fw_offset += res;
|
fw_offset += res;
|
||||||
state++;
|
state++;
|
||||||
@ -187,7 +191,7 @@ static int intel_send_fragment(uint8_t fragment_type, uint16_t len){
|
|||||||
// read data from ddc file and send iva intel ddc command
|
// read data from ddc file and send iva intel ddc command
|
||||||
// @returns -1 on eof
|
// @returns -1 on eof
|
||||||
static int intel_send_ddc(void){
|
static int intel_send_ddc(void){
|
||||||
int res;
|
size_t res;
|
||||||
// read len
|
// read len
|
||||||
res = fread(fw_buffer, 1, 1, fw_file);
|
res = fread(fw_buffer, 1, 1, fw_file);
|
||||||
log_info("offset %6u, read 1 -> res %d", fw_offset, res);
|
log_info("offset %6u, read 1 -> res %d", fw_offset, res);
|
||||||
@ -230,8 +234,8 @@ static int waiting_for_command_complete;
|
|||||||
static void state_machine(uint8_t * packet){
|
static void state_machine(uint8_t * packet){
|
||||||
intel_version_t * version;
|
intel_version_t * version;
|
||||||
intel_boot_params_t * boot_params;
|
intel_boot_params_t * boot_params;
|
||||||
int res;
|
size_t res;
|
||||||
uint16_t buffer_offset;
|
size_t buffer_offset;
|
||||||
bd_addr_t addr;
|
bd_addr_t addr;
|
||||||
char fw_path[300];
|
char fw_path[300];
|
||||||
|
|
||||||
@ -364,7 +368,7 @@ static void state_machine(uint8_t * packet){
|
|||||||
if (buffer_offset == 0) break;
|
if (buffer_offset == 0) break;
|
||||||
|
|
||||||
waiting_for_command_complete = 1;
|
waiting_for_command_complete = 1;
|
||||||
transport_send_intel_secure(0x01, fw_buffer, buffer_offset);
|
transport_send_intel_secure(0x01, fw_buffer, (uint8_t) buffer_offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user