mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-28 16:11:24 +00:00
prefix embedded HAVE_
This commit is contained in:
parent
e71d840791
commit
aec7654d98
@ -36,35 +36,35 @@ HAVE_MALLOC | Use dynamic memory
|
||||
|
||||
Embedded platform features:
|
||||
|
||||
#define | Platform | Description
|
||||
-----------------------------------|--------------|------------------------------------
|
||||
HAVE_TIME_MS | embedded | System provides time in milliseconds
|
||||
HAVE_TICK | embedded | System provides tick interrupt
|
||||
#define | Description
|
||||
-----------------------------------|------------------------------------
|
||||
HAVE_EMBEDDED_TIME_MS | System provides time in milliseconds
|
||||
HAVE_EMBEDDED_TICK | System provides tick interrupt
|
||||
|
||||
POSIX platform features:
|
||||
|
||||
#define | Platform | Description
|
||||
-----------------------------------|--------------|------------------------------------
|
||||
HAVE_POSIX_B300_MAPPED_TO_2000000 | posix | Hack to use serial port with 2 mbps
|
||||
HAVE_POSIX_B600_MAPPED_TO_3000000 | posix | Hack to use serial port with 3 mpbs
|
||||
HAVE_POSIX_FILE_IO | posix | POSIX File i/o used for hci dump
|
||||
HAVE_POSIX_STDIN | | STDIN is available for examples
|
||||
HAVE_POSIX_TIME | posix | System provides time function
|
||||
#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-->
|
||||
<!-- -->
|
||||
|
||||
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
|
||||
#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}
|
||||
@ -219,7 +219,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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -84,8 +84,8 @@ typedef struct btstack_timer_source {
|
||||
#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);
|
||||
|
10
src/hci.c
10
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
|
||||
|
||||
@ -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);
|
||||
@ -235,10 +235,10 @@ static void hci_connection_timestamp(hci_connection_t *connection){
|
||||
#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
|
||||
}
|
||||
|
@ -390,10 +390,10 @@ typedef struct {
|
||||
// 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
|
||||
|
@ -25,6 +25,8 @@ s/GATT_MTU/GATT_EVENT_MTU/g
|
||||
s/GATT_NOTIFICATION/GATT_EVENT_NOTIFICATION/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
|
||||
|
Loading…
x
Reference in New Issue
Block a user