From 1c877be609e0e3ba94f0bbdc2a9f2f53f348f8a0 Mon Sep 17 00:00:00 2001 From: Tian Hao Date: Fri, 7 Oct 2016 10:47:25 +0800 Subject: [PATCH] component/bt : modify some files adapt to new master 1. fix some header files include 2. modify demo --- components/bt/bluedroid/hci/hci_hal_h4.c | 2 +- components/bt/bluedroid/hci/hci_layer.c | 2 +- components/bt/bluedroid/include/bt_defs.h | 12 +- components/bt/bluedroid/include/bt_trace.h | 2 + components/bt/include/bt.h | 1 + examples/05_bluedroid_demos/sdkconfig | 123 ------------------ .../Makefile | 0 .../README.rst | 0 .../app_client_profiles/battery_c/battery_c.c | 0 .../bluedroid_demos/app_core/bt_app.c | 0 .../bluedroid_demos/app_core/bt_app_core.c | 0 .../app_sample_button/app_button.c | 0 .../app_project/SampleClientProject.c | 0 .../app_project/SampleServerProject.c} | 0 .../components/bluedroid_demos/component.mk | 0 .../bluedroid_demos/include/app_button.h | 0 .../bluedroid_demos/include/bt_app_common.h | 0 .../bluedroid_demos/include/bt_app_defs.h | 0 .../bluedroid_demos/include/gattc_profile.h | 0 .../main/component.mk | 0 .../main/demo_main.c | 7 +- 21 files changed, 13 insertions(+), 136 deletions(-) delete mode 100644 examples/05_bluedroid_demos/sdkconfig rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/Makefile (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/README.rst (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/app_core/bt_app.c (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/app_core/bt_app_core.c (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/app_project/SampleClientProject.c (100%) rename examples/{05_bluedroid_demos/components/bluedroid_demos/app_project/SamleServerProject.c => 06_bluedroid_demos/components/bluedroid_demos/app_project/SampleServerProject.c} (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/component.mk (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/include/app_button.h (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/include/bt_app_common.h (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/include/bt_app_defs.h (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/components/bluedroid_demos/include/gattc_profile.h (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/main/component.mk (100%) rename examples/{05_bluedroid_demos => 06_bluedroid_demos}/main/demo_main.c (80%) diff --git a/components/bt/bluedroid/hci/hci_hal_h4.c b/components/bt/bluedroid/hci/hci_hal_h4.c index 2a9ee3e331..19e5a4ba5b 100755 --- a/components/bt/bluedroid/hci/hci_hal_h4.c +++ b/components/bt/bluedroid/hci/hci_hal_h4.c @@ -24,8 +24,8 @@ #include "hci_hal.h" #include "hci_internals.h" #include "hci_layer.h" - #include "thread.h" +#include "bt.h" #define HCI_HAL_SERIAL_BUFFER_SIZE 1026 #define HCI_BLE_EVENT 0x3e diff --git a/components/bt/bluedroid/hci/hci_layer.c b/components/bt/bluedroid/hci/hci_layer.c index 9f368f8325..4ee3df2445 100755 --- a/components/bt/bluedroid/hci/hci_layer.c +++ b/components/bt/bluedroid/hci/hci_layer.c @@ -16,7 +16,7 @@ * ******************************************************************************/ #include - +#include "bt.h" #include "bt_defs.h" #include "bt_trace.h" #include "hcidefs.h" diff --git a/components/bt/bluedroid/include/bt_defs.h b/components/bt/bluedroid/include/bt_defs.h index 283270ba9e..556123632b 100755 --- a/components/bt/bluedroid/include/bt_defs.h +++ b/components/bt/bluedroid/include/bt_defs.h @@ -69,7 +69,7 @@ inline uint32_t swap_byte_32(uint32_t x) { ((x & 0x00ff0000UL) >> 8) | ((x & 0xff000000UL) >> 24)); } - +#ifndef ntohs inline uint16_t ntohs(uint16_t x) { #ifdef CPU_LITTLE_ENDIAN return swap_byte_16(x); @@ -77,14 +77,6 @@ inline uint16_t ntohs(uint16_t x) { return x; #endif } - -typedef struct vhci_host_callback { - void (*notify_host_send_available)(void); - int (*notify_host_recv)(uint8_t *data, uint16_t len); -} vhci_host_callback_t; - -bool API_vhci_host_check_send_available(void); -void API_vhci_host_send_packet(uint8_t *data, uint16_t len); -void API_vhci_host_register_callback(const vhci_host_callback_t *callback); +#endif #endif /* _BT_DEFS_H_ */ diff --git a/components/bt/bluedroid/include/bt_trace.h b/components/bt/bluedroid/include/bt_trace.h index 17cfe51916..06b25e60a2 100755 --- a/components/bt/bluedroid/include/bt_trace.h +++ b/components/bt/bluedroid/include/bt_trace.h @@ -24,7 +24,9 @@ #include "rom/ets_sys.h" //extern void ets_printf(const char *fmt, ...); +#ifndef assert #define assert(x) do { if (!(x)) ets_printf("bt host error %s %u\n", __FILE__, __LINE__); } while (0) +#endif inline void trc_dump_buffer(uint8_t *prefix, uint8_t *data, uint16_t len) { diff --git a/components/bt/include/bt.h b/components/bt/include/bt.h index 1e89f96aa1..62a3e60f7e 100644 --- a/components/bt/include/bt.h +++ b/components/bt/include/bt.h @@ -16,6 +16,7 @@ #define __BT_H__ #include +#include #include "esp_err.h" #ifdef __cplusplus diff --git a/examples/05_bluedroid_demos/sdkconfig b/examples/05_bluedroid_demos/sdkconfig deleted file mode 100644 index 3d1d31d0b8..0000000000 --- a/examples/05_bluedroid_demos/sdkconfig +++ /dev/null @@ -1,123 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Espressif IoT Development Framework Configuration -# - -# -# SDK tool configuration -# -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" -CONFIG_PYTHON="python" - -# -# Bootloader config -# -# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y -# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=2 - -# -# Serial flasher config -# -CONFIG_ESPTOOLPY_PORT="/dev/tty.usbserial-AK05BX2L" -# CONFIG_ESPTOOLPY_BAUD_115200B is not set -# CONFIG_ESPTOOLPY_BAUD_230400B is not set -CONFIG_ESPTOOLPY_BAUD_921600B=y -# CONFIG_ESPTOOLPY_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 -CONFIG_ESPTOOLPY_BAUD=921600 -CONFIG_ESPTOOLPY_COMPRESSED=y -# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE="dio" -# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set -CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ="40m" - -# -# Partition Table -# -CONFIG_PARTITION_TABLE_SINGLE_APP=y -# CONFIG_PARTITION_TABLE_TWO_OTA is not set -# CONFIG_PARTITION_TABLE_CUSTOM is not set -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET=0x10000 -CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" -CONFIG_APP_OFFSET=0x10000 - -# -# Component config -# - -# -# BT config -# -CONFIG_BT_ENABLED=y - -# -# ESP32-specific config -# -CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set -# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=80 -# CONFIG_ESP32_ENABLE_STACK_WIFI is not set -CONFIG_ESP32_ENABLE_STACK_BT=y -# CONFIG_ESP32_ENABLE_STACK_NONE is not set -CONFIG_MEMMAP_BT=y -CONFIG_MEMMAP_SMP=y -# CONFIG_MEMMAP_TRACEMEM is not set -# CONFIG_MEMMAP_SPISRAM is not set -CONFIG_NEWLIB_STDOUT_ADDCR=y - -# -# FreeRTOS -# -# CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_CORETIMER_0=y -# CONFIG_FREERTOS_CORETIMER_1 is not set -# CONFIG_FREERTOS_CORETIMER_2 is not set -CONFIG_FREERTOS_HZ=100 -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE=y -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY is not set -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -# CONFIG_FREERTOS_PANIC_PRINT_HALT is not set -CONFIG_FREERTOS_PANIC_PRINT_REBOOT=y -# CONFIG_FREERTOS_PANIC_SILENT_REBOOT is not set -# CONFIG_FREERTOS_PANIC_GDBSTUB is not set -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -# CONFIG_FREERTOS_ASSERT_DISABLE is not set -CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG=y -# CONFIG_ENABLE_MEMORY_DEBUG is not set -# CONFIG_FREERTOS_DEBUG_INTERNALS is not set - -# -# Log output -# -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 -CONFIG_LOG_COLORS=y - -# -# LWIP -# -CONFIG_LWIP_MAX_SOCKETS=4 -CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX=0 -# CONFIG_LWIP_SO_REUSE is not set diff --git a/examples/05_bluedroid_demos/Makefile b/examples/06_bluedroid_demos/Makefile similarity index 100% rename from examples/05_bluedroid_demos/Makefile rename to examples/06_bluedroid_demos/Makefile diff --git a/examples/05_bluedroid_demos/README.rst b/examples/06_bluedroid_demos/README.rst similarity index 100% rename from examples/05_bluedroid_demos/README.rst rename to examples/06_bluedroid_demos/README.rst diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c b/examples/06_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c rename to examples/06_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c b/examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c rename to examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c b/examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c rename to examples/06_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c b/examples/06_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c rename to examples/06_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c b/examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c rename to examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SamleServerProject.c b/examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleServerProject.c similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SamleServerProject.c rename to examples/06_bluedroid_demos/components/bluedroid_demos/app_project/SampleServerProject.c diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/component.mk b/examples/06_bluedroid_demos/components/bluedroid_demos/component.mk similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/component.mk rename to examples/06_bluedroid_demos/components/bluedroid_demos/component.mk diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/include/app_button.h b/examples/06_bluedroid_demos/components/bluedroid_demos/include/app_button.h similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/include/app_button.h rename to examples/06_bluedroid_demos/components/bluedroid_demos/include/app_button.h diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h b/examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h rename to examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h b/examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h rename to examples/06_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h b/examples/06_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h similarity index 100% rename from examples/05_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h rename to examples/06_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h diff --git a/examples/05_bluedroid_demos/main/component.mk b/examples/06_bluedroid_demos/main/component.mk similarity index 100% rename from examples/05_bluedroid_demos/main/component.mk rename to examples/06_bluedroid_demos/main/component.mk diff --git a/examples/05_bluedroid_demos/main/demo_main.c b/examples/06_bluedroid_demos/main/demo_main.c similarity index 80% rename from examples/05_bluedroid_demos/main/demo_main.c rename to examples/06_bluedroid_demos/main/demo_main.c index b8b6296296..4c9e71a16a 100644 --- a/examples/05_bluedroid_demos/main/demo_main.c +++ b/examples/06_bluedroid_demos/main/demo_main.c @@ -1,6 +1,10 @@ #include +#include +#include +#include "bt.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "string.h" extern void bte_main_boot_entry(void *); @@ -15,8 +19,9 @@ void pingTask(void *pvParameters) } } -void bt_app_main() +void app_main() { + bt_controller_init(); xTaskCreatePinnedToCore(&pingTask, "pingTask", 2048, NULL, 5, NULL, 0); bt_app_task_start_up(); bte_main_boot_entry(bt_app_core_start); -- 2.40.0