prefix POSIX related HAVE_ defines

This commit is contained in:
Matthias Ringwald 2016-03-30 10:59:47 +02:00
parent 55bdd63de7
commit d0755cd68c
18 changed files with 63 additions and 48 deletions

View File

@ -26,21 +26,36 @@ The file *btstack_config.h* contains three parts:
<!-- a name "lst:platformConfiguration"></a-->
<!-- -->
General features:
#define | Description
-----------------------------------|-------------------------------------
HAVE_EHCILL | TI CC256x/WL18xx with eHCILL is used
HAVE_MALLOC | Use dynamic memory
Embedded platform features:
#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
-----------------------------------|--------------|------------------------------------
HAVE_TIME_MS | embedded | System provides time in milliseconds
HAVE_TICK | embedded | 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
<!-- a name "lst:btstackFeatureConfiguration"></a-->
<!-- -->
BTstack features:
#define | Description
------------------|---------------------------------------------
ENABLE_CLASSIC | Enable Classic related code in HCI and L2CAP
@ -213,7 +228,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)
@ -221,7 +236,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

View File

@ -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!

View File

@ -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!

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -50,7 +50,7 @@
#include <stdint.h>
#ifdef HAVE_TIME
#ifdef HAVE_POSIX_TIME
#include <sys/time.h>
#endif
@ -81,7 +81,7 @@ 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)

View File

@ -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) {
@ -232,7 +232,7 @@ 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

View File

@ -386,7 +386,7 @@ typedef struct {
btstack_timer_source_t timeout;
#ifdef HAVE_TIME
#ifdef HAVE_POSIX_TIME
// timer
struct timeval timestamp;
#endif

View File

@ -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

View File

@ -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