mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-18 19:21:54 +00:00
Merge branch 'develop' of https://github.com/bluekitchen/btstack into develop
This commit is contained in:
commit
62edc0d3d5
@ -28,30 +28,45 @@ The file *btstack_config.h* contains three parts:
|
||||
<!-- a name "lst:platformConfiguration"></a-->
|
||||
<!-- -->
|
||||
|
||||
#define | Platform | Description
|
||||
-----------------------------|-------|------------------------------------
|
||||
HAVE_B300_MAPPED_TO_2000000 | posix | Hack to use serial port with 2 mbps
|
||||
HAVE_B600_MAPPED_TO_3000000 | posix | Hack to use serial port with 3 mpbs
|
||||
HAVE_EHCILL | cc256x radio | TI CC256x/WL18xx with eHCILL is used
|
||||
HAVE_MALLOC | | dynamic memory used
|
||||
HAVE_POSIX_FILE_IO | posix | POSIX File i/o used for hci dump
|
||||
HAVE_STDIO | | STDIN is available for examples
|
||||
HAVE_TICK | embedded | System provides tick interrupt
|
||||
HAVE_TIME | posix | System provides time function
|
||||
HAVE_TIME_MS | embedded | System provides time in milliseconds
|
||||
General features:
|
||||
|
||||
#define | Description
|
||||
-----------------------------------|-------------------------------------
|
||||
HAVE_EHCILL | TI CC256x/WL18xx with eHCILL is used
|
||||
HAVE_MALLOC | Use dynamic memory
|
||||
|
||||
|
||||
Embedded platform features:
|
||||
|
||||
#define | Description
|
||||
-----------------------------------|------------------------------------
|
||||
HAVE_EMBEDDED_TIME_MS | System provides time in milliseconds
|
||||
HAVE_EMBEDDED_TICK | System provides tick interrupt
|
||||
|
||||
POSIX platform features:
|
||||
|
||||
#define | Description
|
||||
-----------------------------------|------------------------------------
|
||||
HAVE_POSIX_B300_MAPPED_TO_2000000 | Hack to use serial port with 2 mbps
|
||||
HAVE_POSIX_B600_MAPPED_TO_3000000 | Hack to use serial port with 3 mpbs
|
||||
HAVE_POSIX_FILE_IO | POSIX File i/o used for hci dump
|
||||
HAVE_POSIX_STDIN | STDIN is available for CLI interface
|
||||
HAVE_POSIX_TIME | System provides time function
|
||||
|
||||
<!-- a name "lst:btstackFeatureConfiguration"></a-->
|
||||
<!-- -->
|
||||
|
||||
#define | Description
|
||||
------------------|---------------------------------------------
|
||||
ENABLE_CLASSIC | Enable Classic related code in HCI and L2CAP
|
||||
ENABLE_BLE | Enable BLE related code in HCI and L2CAP
|
||||
ENABLE_LOG_DEBUG | Enable log_debug messages
|
||||
ENABLE_LOG_ERROR | Enable log_error messages
|
||||
ENABLE_LOG_INFO | Enable log_info messages
|
||||
BTstack features:
|
||||
|
||||
#define | Description
|
||||
-------------------------|---------------------------------------------
|
||||
ENABLE_CLASSIC | Enable Classic related code in HCI and L2CAP
|
||||
ENABLE_BLE | Enable BLE related code in HCI and L2CAP
|
||||
ENABLE_LOG_DEBUG | Enable log_debug messages
|
||||
ENABLE_LOG_ERROR | Enable log_error messages
|
||||
ENABLE_LOG_INFO | Enable log_info messages
|
||||
ENABLE_LOG_INTO_HCI_DUMP | Log debug messages as part of packet log
|
||||
ENABLE_SCO_OVER_HCI | Enable SCO over HCI for chipsets that support it (only CC256x ones currently)
|
||||
ENABLE_SCO_OVER_HCI | Enable SCO over HCI for chipsets (only CC256x/WL18xx currently)
|
||||
|
||||
|
||||
## Memory configuration {#sec:memoryConfigurationHowTo}
|
||||
@ -206,7 +221,7 @@ enters sleep mode, an interrupt-driven data source has to call the
|
||||
internal flag that is checked in the critical section just before
|
||||
entering sleep mode causing another round of callbacks.
|
||||
|
||||
To enable the use of timers, make sure that you defined HAVE_TICK or HAVE_TIME_MS in the
|
||||
To enable the use of timers, make sure that you defined HAVE_EMBEDDED_TICK or HAVE_EMBEDDED_TIME_MS in the
|
||||
config file.
|
||||
|
||||
### Run loop POSIX
|
||||
@ -215,7 +230,7 @@ The data sources are standard File Descriptors. In the run loop execute implemen
|
||||
select() call is used to wait for file descriptors to become ready to read or write,
|
||||
while waiting for the next timeout.
|
||||
|
||||
To enable the use of timers, make sure that you defined HAVE_TIME in the config file.
|
||||
To enable the use of timers, make sure that you defined HAVE_POSIX_TIME in the config file.
|
||||
|
||||
### Run loop CoreFoundation (OS X/iOS)
|
||||
|
||||
@ -223,7 +238,7 @@ This run loop directly maps BTstack's data source and timer source with CoreFoun
|
||||
It supports ready to read and write similar to the POSIX implementation. The call to
|
||||
*btstack_run_loop_execute()* then just calls *CFRunLoopRun()*.
|
||||
|
||||
To enable the use of timers, make sure that you defined HAVE_TIME in the config file.
|
||||
To enable the use of timers, make sure that you defined HAVE_POSIX_TIME in the config file.
|
||||
|
||||
### Run loop WICED
|
||||
|
||||
|
@ -19,9 +19,9 @@ system tick (as it is the default with CMSIS on ARM Cortex devices), you
|
||||
can use that to implement BTstack’s time abstraction in
|
||||
*include/btstack/hal_tick.h\>*.
|
||||
|
||||
For this, you need to define *HAVE_TICK* in *btstack_config.h*:
|
||||
For this, you need to define *HAVE_EMBEDDED_TICK* in *btstack_config.h*:
|
||||
|
||||
#define HAVE_TICK
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
|
||||
Then, you need to implement the functions *hal_tick_init* and
|
||||
*hal_tick_set_handler*, which will be called during the
|
||||
@ -44,9 +44,9 @@ If your platform already has a system clock or it is more convenient to
|
||||
provide such a clock, you can use the Time MS Hardware Abstraction in
|
||||
*include/btstack/hal_time_ms.h*.
|
||||
|
||||
For this, you need to define *HAVE_TIME_MS* in *btstack_config.h*:
|
||||
For this, you need to define *HAVE_EMBEDDED_TIME_MS* in *btstack_config.h*:
|
||||
|
||||
#define HAVE_TIME_MS
|
||||
#define HAVE_EMBEDDED_TIME_MS
|
||||
|
||||
Then, you need to implement the function *hal_time_ms()*, which will
|
||||
be called from BTstack’s run loop and when setting a timer for the
|
||||
|
@ -44,7 +44,7 @@
|
||||
*
|
||||
* @text This HFP Audio Gateway example demonstrates how to receive
|
||||
* an output from a remote HFP Hands-Free (HF) unit, and,
|
||||
* if HAVE_STDIO is defined, how to control the HFP HF.
|
||||
* if HAVE_POSIX_STDIN is defined, how to control the HFP HF.
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
#include "stdin_support.h"
|
||||
#endif
|
||||
|
||||
@ -126,7 +126,7 @@ static int getDeviceIndexForAddress( bd_addr_t addr){
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
static void start_scan(void){
|
||||
printf("Starting inquiry scan..\n");
|
||||
hci_send_cmd(&hci_inquiry, HCI_INQUIRY_LAP, INQUIRY_INTERVAL, 0);
|
||||
@ -252,7 +252,7 @@ static void inquiry_packet_handler (uint8_t packet_type, uint8_t *packet, uint16
|
||||
}
|
||||
}
|
||||
// GAP INQUIRY END
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
|
||||
// prototypes
|
||||
static void show_usage(void);
|
||||
@ -671,7 +671,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
printf("SDP service record size: %u\n", de_get_len( hfp_service_buffer));
|
||||
sdp_register_service(hfp_service_buffer);
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
btstack_stdin_setup(stdin_process);
|
||||
#endif
|
||||
// turn on!
|
||||
|
@ -45,7 +45,7 @@
|
||||
*
|
||||
* @text This HFP Hands-Free example demonstrates how to receive
|
||||
* an output from a remote HFP audio gateway (AG), and,
|
||||
* if HAVE_STDIO is defined, how to control the HFP AG.
|
||||
* if HAVE_POSIX_STDIN is defined, how to control the HFP AG.
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
#include "stdin_support.h"
|
||||
#endif
|
||||
|
||||
@ -67,7 +67,7 @@ uint8_t hfp_service_buffer[150];
|
||||
const uint8_t rfcomm_channel_nr = 1;
|
||||
const char hfp_hf_service_name[] = "BTstack HFP HF Demo";
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
static bd_addr_t device_addr = {0xD8,0xBb,0x2C,0xDf,0xF1,0x08};
|
||||
// prototypes
|
||||
static void show_usage(void);
|
||||
@ -78,7 +78,7 @@ static uint16_t indicators[1] = {0x01};
|
||||
|
||||
char cmd;
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
|
||||
// Testig User Interface
|
||||
static void show_usage(void){
|
||||
@ -534,7 +534,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
printf("SDP service record size: %u\n", de_get_len(hfp_service_buffer));
|
||||
sdp_register_service(hfp_service_buffer);
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
btstack_stdin_setup(stdin_process);
|
||||
#endif
|
||||
// turn on!
|
||||
|
@ -45,7 +45,7 @@
|
||||
* @text This example implements a HSP Audio Gateway device that sends and receives
|
||||
* audio signal over HCI SCO. It demonstrates how to receive
|
||||
* an output from a remote headset (HS), and,
|
||||
* if HAVE_STDIO is defined, how to control the HS.
|
||||
* if HAVE_POSIX_STDIN is defined, how to control the HS.
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
#include "stdin_support.h"
|
||||
#endif
|
||||
|
||||
@ -132,7 +132,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
@ -329,7 +329,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
hsp_ag_init(rfcomm_channel_nr);
|
||||
hsp_ag_register_packet_handler(packet_handler);
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
btstack_stdin_setup(stdin_process);
|
||||
#endif
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
* @text This example implements a HSP Headset device that sends and receives
|
||||
* audio signal over HCI SCO. It demonstrates how to receive
|
||||
* an output from a remote audio gateway (AG), and,
|
||||
* if HAVE_STDIO is defined, how to control the AG.
|
||||
* if HAVE_POSIX_STDIN is defined, how to control the AG.
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "btstack.h"
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
#include "stdin_support.h"
|
||||
#endif
|
||||
|
||||
@ -132,7 +132,7 @@ static void show_usage(void){
|
||||
printf("---\n");
|
||||
}
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){
|
||||
char buffer;
|
||||
read(ds->fd, &buffer, 1);
|
||||
@ -338,7 +338,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
hsp_hs_init(rfcomm_channel_nr);
|
||||
hsp_hs_register_packet_handler(packet_handler);
|
||||
|
||||
#ifdef HAVE_STDIO
|
||||
#ifdef HAVE_POSIX_STDIN
|
||||
btstack_stdin_setup(stdin_process);
|
||||
#endif
|
||||
|
||||
|
@ -63,15 +63,15 @@
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#ifdef HAVE_TIME_MS
|
||||
#ifdef HAVE_EMBEDDED_TIME_MS
|
||||
#include "hal_time_ms.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TICK) && defined(HAVE_TIME_MS)
|
||||
#error "Please specify either HAVE_TICK or HAVE_TIME_MS"
|
||||
#if defined(HAVE_EMBEDDED_TICK) && defined(HAVE_EMBEDDED_TIME_MS)
|
||||
#error "Please specify either HAVE_EMBEDDED_TICK or HAVE_EMBEDDED_TIME_MS"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_TICK) || defined(HAVE_TIME_MS)
|
||||
#if defined(HAVE_EMBEDDED_TICK) || defined(HAVE_EMBEDDED_TIME_MS)
|
||||
#define TIMER_SUPPORT
|
||||
#endif
|
||||
|
||||
@ -84,7 +84,7 @@ static btstack_linked_list_t data_sources;
|
||||
static btstack_linked_list_t timers;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
static volatile uint32_t system_ticks;
|
||||
#endif
|
||||
|
||||
@ -106,13 +106,13 @@ static int btstack_run_loop_embedded_remove_data_source(btstack_data_source_t *d
|
||||
|
||||
// set timer
|
||||
static void btstack_run_loop_embedded_set_timer(btstack_timer_source_t *ts, uint32_t timeout_in_ms){
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
uint32_t ticks = btstack_run_loop_embedded_ticks_for_ms(timeout_in_ms);
|
||||
if (ticks == 0) ticks++;
|
||||
// time until next tick is < hal_tick_get_tick_period_in_ms() and we don't know, so we add one
|
||||
ts->timeout = system_ticks + 1 + ticks;
|
||||
#endif
|
||||
#ifdef HAVE_TIME_MS
|
||||
#ifdef HAVE_EMBEDDED_TIME_MS
|
||||
ts->timeout = hal_time_ms() + timeout_in_ms + 1;
|
||||
#endif
|
||||
}
|
||||
@ -185,10 +185,10 @@ void btstack_run_loop_embedded_execute_once(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
uint32_t now = system_ticks;
|
||||
#endif
|
||||
#ifdef HAVE_TIME_MS
|
||||
#ifdef HAVE_EMBEDDED_TIME_MS
|
||||
uint32_t now = hal_time_ms();
|
||||
#endif
|
||||
#ifdef TIMER_SUPPORT
|
||||
@ -220,7 +220,7 @@ static void btstack_run_loop_embedded_execute(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
static void btstack_run_loop_embedded_tick_handler(void){
|
||||
system_ticks++;
|
||||
trigger_event_received = 1;
|
||||
@ -236,10 +236,10 @@ uint32_t btstack_run_loop_embedded_ticks_for_ms(uint32_t time_in_ms){
|
||||
#endif
|
||||
|
||||
static uint32_t btstack_run_loop_embedded_get_time_ms(void){
|
||||
#ifdef HAVE_TIME_MS
|
||||
#ifdef HAVE_EMBEDDED_TIME_MS
|
||||
return hal_time_ms();
|
||||
#endif
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
return system_ticks * hal_tick_get_tick_period_in_ms();
|
||||
#endif
|
||||
return 0;
|
||||
@ -260,7 +260,7 @@ static void btstack_run_loop_embedded_init(void){
|
||||
timers = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
system_ticks = 0;
|
||||
hal_tick_init();
|
||||
hal_tick_set_handler(&btstack_run_loop_embedded_tick_handler);
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "btstack_linked_list.h"
|
||||
#include "btstack_run_loop.h"
|
||||
|
||||
#ifdef HAVE_TIME
|
||||
#ifdef HAVE_POSIX_TIME
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
@ -62,7 +62,7 @@ extern "C" {
|
||||
const btstack_run_loop_t * btstack_run_loop_embedded_get_instance(void);
|
||||
|
||||
// hack to fix HCI timer handling
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
/**
|
||||
* @brief Sets how many milliseconds has one tick.
|
||||
*/
|
||||
|
@ -132,10 +132,10 @@ static int h4_set_baudrate(uint32_t baudrate){
|
||||
#endif
|
||||
// Hacks to switch to 2/3 mbps on FTDI FT232 chipsets
|
||||
// requires special config in Info.plist or Registry
|
||||
#ifdef HAVE_B300_MAPPED_TO_2000000
|
||||
#ifdef HAVE_POSIX_B300_MAPPED_TO_2000000
|
||||
case 2000000: brate=B300; break;
|
||||
#endif
|
||||
#ifdef HAVE_B600_MAPPED_TO_3000000
|
||||
#ifdef HAVE_POSIX_B600_MAPPED_TO_3000000
|
||||
case 3000000: brate=B600; break;
|
||||
#endif
|
||||
#ifdef HAVE_B1200_MAPPED_TO_2000000
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_TIME_MS
|
||||
#define HAVE_EMBEDDED_TIME_MS
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -126,7 +126,7 @@ echo "#define __BTSTACK_CONFIG" >> btstack_config.h
|
||||
echo >> btstack_config.h
|
||||
|
||||
echo "// Port related features" >> btstack_config.h
|
||||
echo "#define HAVE_TIME" >> btstack_config.h
|
||||
echo "#define HAVE_POSIX_TIME" >> btstack_config.h
|
||||
echo "#define HAVE_MALLOC" >> btstack_config.h
|
||||
echo >> btstack_config.h
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Port related features
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_TICK
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
#define HAVE_EHCILL
|
||||
|
||||
// BTstack features that can be enabled
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_PLATFORM_IPHONE_OS
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_TIME
|
||||
#define HAVE_POSIX_TIME
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_CLASSIC
|
||||
|
@ -8,8 +8,8 @@
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_STDIO
|
||||
#define HAVE_TIME
|
||||
#define HAVE_POSIX_STDIN
|
||||
#define HAVE_POSIX_TIME
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -8,7 +8,7 @@
|
||||
// Port related features
|
||||
#define HAVE_EHCILL
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_TICK
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Port related features
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_TICK
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
|
||||
// #define HAVE_EHCILL
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_TIME
|
||||
#define HAVE_POSIX_TIME
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Port related features
|
||||
#define HAVE_EHCILL
|
||||
#define HAVE_TIME_MS
|
||||
#define HAVE_EMBEDDED_TIME_MS
|
||||
#define WICED_BT_UART_MANUAL_CTS_RTS
|
||||
|
||||
// BTstack features that can be enabled
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_TICK
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -8,8 +8,8 @@
|
||||
// Port related features
|
||||
#define HAVE_MALLOC
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_STDIO
|
||||
#define HAVE_TIME
|
||||
#define HAVE_POSIX_STDIN
|
||||
#define HAVE_POSIX_TIME
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -98,7 +98,7 @@ static void use_fast_uart(void){
|
||||
#if defined(HAVE_B1200_MAPPED_TO_3000000) || defined(HAVE_B300_MAPPED_TO_3000000)
|
||||
printf("Using 3000000 baud.\n");
|
||||
config.baudrate_main = 3000000;
|
||||
#elif defined(HAVE_B1200_MAPPED_TO_2000000) || defined(HAVE_B300_MAPPED_TO_2000000)
|
||||
#elif defined(HAVE_B1200_MAPPED_TO_2000000) || defined(HAVE_POSIX_B300_MAPPED_TO_2000000)
|
||||
printf("Using 2000000 baud.\n");
|
||||
config.baudrate_main = 2000000;
|
||||
#else
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Port related features
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_TICK
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
#define HAVE_EHCILL
|
||||
|
||||
// BTstack features that can be enabled
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Port related features
|
||||
#define HAVE_EHCILL
|
||||
#define HAVE_TIME_MS
|
||||
#define HAVE_EMBEDDED_TIME_MS
|
||||
#define WICED_BT_UART_MANUAL_CTS_RTS
|
||||
|
||||
// BTstack features that can be enabled
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_TIME
|
||||
#ifdef HAVE_POSIX_TIME
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
@ -81,11 +81,11 @@ typedef struct btstack_data_source {
|
||||
|
||||
typedef struct btstack_timer_source {
|
||||
btstack_linked_item_t item;
|
||||
#ifdef HAVE_TIME
|
||||
#ifdef HAVE_POSIX_TIME
|
||||
struct timeval timeout; // <-- next timeout
|
||||
#endif
|
||||
#if defined(HAVE_TICK) || defined(HAVE_TIME_MS)
|
||||
uint32_t timeout; // timeout in system ticks (HAVE_TICK) or millis (HAVE_TIME_MS)
|
||||
#if defined(HAVE_EMBEDDED_TICK) || defined(HAVE_EMBEDDED_TIME_MS)
|
||||
uint32_t timeout; // timeout in system ticks (HAVE_EMBEDDED_TICK) or millis (HAVE_EMBEDDED_TIME_MS)
|
||||
#endif
|
||||
// will be called when timer fired
|
||||
void (*process)(struct btstack_timer_source *ts);
|
||||
|
@ -388,6 +388,7 @@ static int hfp_ag_cmd_via_generator(uint16_t cid, hfp_connection_t * hfp_connect
|
||||
|
||||
// assumes: can send now == true
|
||||
// assumes: num segments > 0
|
||||
// assumes: individual segments are smaller than MTU
|
||||
rfcomm_reserve_packet_buffer();
|
||||
int mtu = rfcomm_get_max_frame_size(cid);
|
||||
uint8_t * data = rfcomm_get_outgoing_buffer();
|
||||
@ -395,11 +396,11 @@ static int hfp_ag_cmd_via_generator(uint16_t cid, hfp_connection_t * hfp_connect
|
||||
int segment = start_segment;
|
||||
while (segment < num_segments){
|
||||
int segment_len = get_segment_len(hfp_connection, segment);
|
||||
if (offset + segment_len <= mtu){
|
||||
store_segment(hfp_connection, segment, data+offset);
|
||||
offset += segment_len;
|
||||
segment++;
|
||||
}
|
||||
if (offset + segment_len > mtu) break;
|
||||
// append segement
|
||||
store_segment(hfp_connection, segment, data+offset);
|
||||
offset += segment_len;
|
||||
segment++;
|
||||
}
|
||||
rfcomm_send_prepared(cid, offset);
|
||||
return segment;
|
||||
|
14
src/hci.c
14
src/hci.c
@ -45,7 +45,7 @@
|
||||
#include "btstack_config.h"
|
||||
|
||||
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
#include "btstack_run_loop_embedded.h"
|
||||
#endif
|
||||
|
||||
@ -207,7 +207,7 @@ hci_connection_t * hci_connection_for_bd_addr_and_type(bd_addr_t addr, bd_addr_
|
||||
|
||||
static void hci_connection_timeout_handler(btstack_timer_source_t *timer){
|
||||
hci_connection_t * connection = (hci_connection_t *) btstack_run_loop_get_timer_context(timer);
|
||||
#ifdef HAVE_TIME
|
||||
#ifdef HAVE_POSIX_TIME
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
if (tv.tv_sec >= connection->timestamp.tv_sec + HCI_CONNECTION_TIMEOUT_MS/1000) {
|
||||
@ -215,13 +215,13 @@ static void hci_connection_timeout_handler(btstack_timer_source_t *timer){
|
||||
hci_emit_l2cap_check_timeout(connection);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
if (btstack_run_loop_embedded_get_ticks() > connection->timestamp + btstack_run_loop_embedded_ticks_for_ms(HCI_CONNECTION_TIMEOUT_MS)){
|
||||
// connections might be timed out
|
||||
hci_emit_l2cap_check_timeout(connection);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TIME_MS
|
||||
#ifdef HAVE_EMBEDDED_TIME_MS
|
||||
if (btstack_run_loop_get_time_ms() > connection->timestamp + HCI_CONNECTION_TIMEOUT_MS){
|
||||
// connections might be timed out
|
||||
hci_emit_l2cap_check_timeout(connection);
|
||||
@ -232,13 +232,13 @@ static void hci_connection_timeout_handler(btstack_timer_source_t *timer){
|
||||
}
|
||||
|
||||
static void hci_connection_timestamp(hci_connection_t *connection){
|
||||
#ifdef HAVE_TIME
|
||||
#ifdef HAVE_POSIX_TIME
|
||||
gettimeofday(&connection->timestamp, NULL);
|
||||
#endif
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
connection->timestamp = btstack_run_loop_embedded_get_ticks();
|
||||
#endif
|
||||
#ifdef HAVE_TIME_MS
|
||||
#ifdef HAVE_EMBEDDED_TIME_MS
|
||||
connection->timestamp = btstack_run_loop_get_time_ms();
|
||||
#endif
|
||||
}
|
||||
|
@ -386,14 +386,14 @@ typedef struct {
|
||||
|
||||
btstack_timer_source_t timeout;
|
||||
|
||||
#ifdef HAVE_TIME
|
||||
#ifdef HAVE_POSIX_TIME
|
||||
// timer
|
||||
struct timeval timestamp;
|
||||
#endif
|
||||
#ifdef HAVE_TICK
|
||||
#ifdef HAVE_EMBEDDED_TICK
|
||||
uint32_t timestamp; // timestamp in system ticks
|
||||
#endif
|
||||
#ifdef HAVE_TIME_MS
|
||||
#ifdef HAVE_EMBEDDED_TIME_MS
|
||||
uint32_t timestamp; // timestamp in ms
|
||||
#endif
|
||||
|
||||
|
@ -238,7 +238,7 @@ void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t
|
||||
}
|
||||
#else
|
||||
|
||||
// #ifdef HAVE_TICK
|
||||
// #ifdef HAVE_EMBEDDED_TICK
|
||||
// uint32_t time_ms = btstack_run_loop_embedded_get_time_ms();
|
||||
// printf("[%06u] ", time_ms);
|
||||
// #endif
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Port related features
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_TIME
|
||||
#define HAVE_POSIX_TIME
|
||||
#define HAVE_MALLOC
|
||||
|
||||
// BTstack features that can be enabled
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Port related features
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_TIME
|
||||
#define HAVE_POSIX_TIME
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -6,10 +6,12 @@ s/ANCS_CLIENT_DISCONNECTED/ANCS_EVENT_CLIENT_DISCONNECTED/g
|
||||
s/ANCS_CLIENT_NOTIFICATION/ANCS_EVENT_CLIENT_NOTIFICATION/g
|
||||
s/ATT_HANDLE_VALUE_INDICATION_COMPLETE/ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE/g
|
||||
s/ATT_MTU_EXCHANGE_COMPLETE/ATT_EVENT_MTU_EXCHANGE_COMPLETE/g
|
||||
s/BTSTACK_EVENT_REMOTE_NAME_CACHED/DAEMON_EVENT_REMOTE_NAME_CACHED/g
|
||||
s/COMMAND_COMPLETE_EVENT/HCI_EVENT_IS_COMMAND_COMPLETE/g
|
||||
s/COMMAND_STATUS_EVENT/HCI_EVENT_IS_COMMAND_STATUS/g
|
||||
s/GAP_LE_ADVERTISING_REPORT/GAP_EVENT_ADVERTISING_REPORT/g
|
||||
s/DAEMON_EVENT_HCI_PACKET_SENT/HCI_EVENT_TRANSPORT_PACKET_SENT/g
|
||||
s/GAP_DEDICATED_BONDING_COMPLETED/GAP_EVENT_DEDICATED_BONDING_COMPLETED/g
|
||||
s/GAP_LE_ADVERTISING_REPORT/GAP_EVENT_ADVERTISING_REPORT/g
|
||||
s/GAP_SECURITY_LEVEL/GAP_EVENT_SECURITY_LEVEL/g
|
||||
s/GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT/GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT/g
|
||||
s/GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT/GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT/g
|
||||
@ -21,9 +23,12 @@ s/GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT/GATT_EVENT_LONG_CHARACTERISTI
|
||||
s/GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT/GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT/g
|
||||
s/GATT_MTU/GATT_EVENT_MTU/g
|
||||
s/GATT_NOTIFICATION/GATT_EVENT_NOTIFICATION/g
|
||||
s/DAEMON_EVENT_HCI_PACKET_SENT/HCI_EVENT_TRANSPORT_PACKET_SENT/g
|
||||
s/GATT_QUERY_COMPLETE/GATT_EVENT_QUERY_COMPLETE/g
|
||||
s/GATT_SERVICE_QUERY_RESULT/GATT_EVENT_SERVICE_QUERY_RESULT/g
|
||||
s/HAVE_TIME_MS/HAVE_EMBEDDED_TIME_MS/g
|
||||
s/HAVE_TICK/HAVE_EMBEDDED_TICK/g
|
||||
s/HAVE_TIME/HAVE_POSIX_TIME/g
|
||||
s/HAVE_STDIO/HAVE_POSIX_STDIN/g
|
||||
s/SDP_QUERY_ATTRIBUTE_BYTE/SDP_EVENT_QUERY_ATTRIBUTE_BYTE/g
|
||||
s/SDP_QUERY_ATTRIBUTE_VALUE/SDP_EVENT_QUERY_ATTRIBUTE_VALUE/g
|
||||
s/SDP_QUERY_COMPLETE/SDP_EVENT_QUERY_COMPLETE/g
|
||||
@ -40,7 +45,6 @@ s/SM_EVENT_PASSKEY_DISPLAY_CANCEL/SM_EVENT_PASSKEY_DISPLAY_CANCEL/g
|
||||
s/SM_EVENT_PASSKEY_DISPLAY_NUMBER/SM_EVENT_PASSKEY_DISPLAY_NUMBER/g
|
||||
s/SM_EVENT_PASSKEY_INPUT_CANCEL/SM_EVENT_PASSKEY_INPUT_CANCEL/g
|
||||
s/SM_EVENT_PASSKEY_INPUT_NUMBER/SM_EVENT_PASSKEY_INPUT_NUMBER/g
|
||||
s/BTSTACK_EVENT_REMOTE_NAME_CACHED/DAEMON_EVENT_REMOTE_NAME_CACHED/g
|
||||
|
||||
# Functions ending with _internal
|
||||
s/l2cap_accept_connection_internal/l2cap_accept_connection/g
|
||||
|
Loading…
x
Reference in New Issue
Block a user