From 9f805d713bd2b37b925f92f21ead0c0c0bdf57bb Mon Sep 17 00:00:00 2001 From: xushuqun Date: Fri, 22 Nov 2024 22:05:48 +0800 Subject: [PATCH] [eco:matter] add matter support * Integrate code for matter support into sdk * Add new lib_dct.a based on internal SHA:9047d8a5 --- README.md | 3 + component/common/api/wifi/wifi_conf.c | 13 - .../ble_matter_adapter_app.c | 1927 +++++++++++++++++ .../ble_matter_adapter_app.h | 214 ++ .../ble_matter_adapter_app_flags.h | 44 + .../ble_matter_adapter_app_main.c | 333 +++ .../ble_matter_adapter_app_main.h | 59 + .../ble_matter_adapter_app_task.c | 236 ++ .../ble_matter_adapter_app_task.h | 36 + .../ble_matter_adapter_service.c | 278 +++ .../ble_matter_adapter_service.h | 67 + .../realtek/sdk/inc/app/app_common_flags.h | 3 + component/common/file_system/dct/dct.h | 4 - component/common/file_system/dct/dct2.h | 160 ++ .../file_system/littlefs/littlefs_adapter.c | 4 +- .../file_system/littlefs/r2.9.1/lfs_util.h | 2 + component/common/mbed/hal/pwmout_api.h | 6 + component/common/mbed/hal_ext/flash_api.h | 5 +- .../mbed/targets/hal/rtl8710c/flash_api.c | 7 +- .../network/lwip/lwip_v2.1.3/src/core/netif.c | 9 + .../lwip/lwip_v2.1.3/src/include/lwip/inet.h | 4 + .../cmsis/rtl8710c/include/core_tm9_cache.h | 2 +- .../8710c/misc/bsp/lib/common/GCC/lib_dct.a | Bin 44328 -> 76964 bytes .../8710c/misc/utilities/include/strproc.h | 6 +- matter_setup.sh | 79 + .../GCC-RELEASE/Makefile | 24 + .../GCC-RELEASE/application.is.matter.mk | 1117 ++++++++++ .../inc/FreeRTOSConfig.h | 59 +- .../GCC-RELEASE/Makefile | 24 + .../GCC-RELEASE/application.is.matter.mk | 1118 ++++++++++ .../inc/FreeRTOSConfig.h | 59 +- 31 files changed, 5808 insertions(+), 94 deletions(-) create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.c create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.h create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_flags.h create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.c create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.h create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.c create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.h create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.c create mode 100755 component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.h create mode 100644 component/common/file_system/dct/dct2.h create mode 100755 matter_setup.sh create mode 100644 project/realtek_amebaz2_v0_example/GCC-RELEASE/application.is.matter.mk create mode 100644 project/realtek_amebaz2plus_v0_example/GCC-RELEASE/application.is.matter.mk diff --git a/README.md b/README.md index 4e50024..ec4ae01 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ GitHub `ameba-rtos-z2` repository is the development framework for AmebaZ2 and A * :books: [Z2 Datasheet](https://github.com/Ameba-AIoT/ameba-rtos-z2/blob/main/doc/RTL8720Cx-VH2_Datasheet_V1.0_20230224.pdf) * :books: [Z2plus Datasheet](https://github.com/Ameba-AIoT/ameba-rtos-z2/blob/main/doc/Realtek_AmebaZII+_Datasheet_v1.1.pdf) +# Matter Support +Please check out [ameba-rtos-matter](https://github.com/Ameba-AIoT/ameba-rtos-matter) to learn more about Matter support. + # Setup Build Environments ## GCC Environment on Windows diff --git a/component/common/api/wifi/wifi_conf.c b/component/common/api/wifi/wifi_conf.c index 2268ff6..e5e8785 100644 --- a/component/common/api/wifi/wifi_conf.c +++ b/component/common/api/wifi/wifi_conf.c @@ -15,10 +15,6 @@ #include #include -#if defined(CONFIG_MATTER) && CONFIG_MATTER -#include "chip_porting.h" -#endif - #if CONFIG_EXAMPLE_WLAN_FAST_CONNECT #include "wlan_fast_connect/example_wlan_fast_connect.h" #if defined(CONFIG_FAST_DHCP) && CONFIG_FAST_DHCP @@ -196,10 +192,6 @@ extern int rltk_set_mode_posthandle(rtw_mode_t curr_mode, rtw_mode_t next_mode, #ifdef CONFIG_PMKSA_CACHING extern int wifi_set_pmk_cache_enable(unsigned char value); #endif -#if defined(CONFIG_MATTER) && CONFIG_MATTER -extern u8 matter_wifi_trigger; -extern void matter_wifi_autoreconnect_hdl(rtw_security_t security_type, char *ssid, int ssid_len, char *password, int password_len, int key_id); -#endif //----------------------------------------------------------------------------// static int wifi_connect_local(rtw_network_info_t *pWifi) @@ -3604,11 +3596,6 @@ int wifi_config_autoreconnect(__u8 mode, __u8 retry_times, __u16 timeout) if (mode == RTW_AUTORECONNECT_DISABLE) { p_wlan_autoreconnect_hdl = NULL; } -#if defined(CONFIG_MATTER) && CONFIG_MATTER - else if (matter_wifi_trigger) { - p_wlan_autoreconnect_hdl = matter_wifi_autoreconnect_hdl; - } -#endif else { p_wlan_autoreconnect_hdl = wifi_autoreconnect_hdl; } diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.c b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.c new file mode 100755 index 0000000..c376a57 --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.c @@ -0,0 +1,1927 @@ +/** +***************************************************************************************** +* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved. +***************************************************************************************** + * @file central_client_app.c + * @brief This file handles BLE central application routines. + * @author jane + * @date 2017-06-06 + * @version v1.0 + ************************************************************************************** + * @attention + *

© COPYRIGHT 2017 Realtek Semiconductor Corporation

+ ************************************************************************************** + */ + +/*============================================================================* + * Header Files + *============================================================================*/ +#include +#if defined(CONFIG_BLE_MATTER_ADAPTER) && CONFIG_BLE_MATTER_ADAPTER +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gatt_builtin_services.h" +#include "os_mem.h" +#include "os_msg.h" +#include "os_sync.h" +#include "os_queue.h" +#include +#include +#include +#include "ble_matter_adapter_app_main.h" +#include "vendor_cmd_bt.h" +#include "matter_blemgr_common.h" +#include "os_timer.h" +/*============================================================================* + * Constants + *============================================================================*/ +#define BLE_MATTER_ADAPTER_APP_MAX_DEVICE_INFO 6 + +/*============================================================================* + * Variables + *============================================================================*/ +int bt_matter_device_matter_scan_state = 0; +int ble_matter_adapter_peripheral_app_max_links = 0; +int ble_matter_adapter_central_app_max_links = 0; + +T_GAP_DEV_STATE ble_matter_adapter_gap_dev_state = {0, 0, 0, 0, 0}; /**< GAP device state */ +T_APP_LINK ble_matter_adapter_app_link_table[BLE_MATTER_ADAPTER_APP_MAX_LINKS]; + +T_CLIENT_ID ble_matter_adapter_gcs_client_id; /**< General Common Services client client id*/ +T_SERVER_ID ble_matter_adapter_service_id; /**< Matter service id */ + +M_MULTI_ADV_PARAM matter_multi_adv_param_array[MAX_ADV_NUMBER] = {0}; +T_MULTI_ADV_CONCURRENT matter_multi_adapter = {0}; + +uint8_t matter_local_public_addr[6] = {0}; +uint8_t matter_local_static_random_addr[6] = {0}; + +uint8_t link_customer = 0; //1 means connection is matter 2 means connection is customer +#if CONFIG_BLE_MATTER_MULTI_ADV_ON +uint8_t customer_adv_id = 2; +#endif +uint8_t matter_multi_adv_bt_deinit_id = 0xff; +extern uint8_t matter_adv_id; + +extern matter_blemgr_callback matter_blemgr_callback_func; +extern void *matter_blemgr_callback_data; + +extern uint16_t matter_adv_interval; +extern uint16_t matter_adv_int_min; +extern uint16_t matter_adv_int_max; +extern uint8_t customer_adv_data[]; +extern uint8_t customer_rsp_data[]; +extern uint8_t customer_adv_data_length; +extern uint8_t customer_rsp_data_length; +extern uint8_t matter_adv_data[31]; +extern uint8_t matter_adv_data_length; +extern bool matter_server_is_commissioned(); +/*============================================================================* + * Multi ADV Functions + *============================================================================*/ +uint8_t matter_get_unused_adv_index(int type) +{ + if (type == 1) { //matter + if (!matter_multi_adv_param_array[0].is_used) { + return 0; + } + } else if (type == 2) { //customer + if (!matter_multi_adv_param_array[1].is_used) { + return 1; + } + } + return MAX_ADV_NUMBER; +} + +//reserve for future use +bool matter_multi_adv_stop_by_id(uint8_t *adv_id) +{ + if (*adv_id < 0 || *adv_id >= MAX_ADV_NUMBER) { + printf("[%s] wrong input advId:%d\r\n", __func__, *adv_id); + return 1; + } + if (!matter_multi_adv_param_array[*adv_id].is_used) { + printf("[%s] adv id %d is already stop or not start\r\n", __func__, *adv_id); + return 1; + } + + if (matter_multi_adv_param_array[*adv_id].one_shot_timer) { + os_timer_delete(&matter_multi_adv_param_array[*adv_id].one_shot_timer); + } + if (matter_multi_adv_param_array[*adv_id].update_adv_mutex) { + os_mutex_delete(matter_multi_adv_param_array[*adv_id].update_adv_mutex); + } + memset(&matter_multi_adv_param_array[*adv_id], 0, sizeof(M_MULTI_ADV_PARAM)); + *adv_id = MAX_ADV_NUMBER; + + return 0; +} + +bool matter_multi_adv_start_by_id(uint8_t *adv_id, uint8_t *adv_data, uint16_t adv_len, uint8_t *rsp_data, uint16_t rsp_len, uint8_t type) +{ + if (ble_matter_adapter_peripheral_app_max_links != 0) { + printf("[%s] as slave role, BLE is conneted\r\n", __func__); + return 1; + } + + if ((MAX_ADV_NUMBER != *adv_id) && (matter_multi_adv_param_array[*adv_id].is_used == 1)) { + os_timer_stop(&matter_multi_adv_param_array[*adv_id].one_shot_timer); + } else { + + *adv_id = matter_get_unused_adv_index(type); + if (MAX_ADV_NUMBER == *adv_id) { + printf("[%s] Extend the max adv num %d\r\n", __func__, MAX_ADV_NUMBER); + return 1; + } + } + + uint8_t adv_index = *adv_id; + M_MULTI_ADV_PARAM *h_adv_param; + h_adv_param = matter_multi_adv_param_array + adv_index; + + if (!h_adv_param->update_adv_mutex) { + os_mutex_create(&h_adv_param->update_adv_mutex); + } + if (type == 1) { //matter + os_mutex_take(h_adv_param->update_adv_mutex, 0xFFFF); + memcpy(h_adv_param->adv_data, adv_data, adv_len); + h_adv_param->adv_datalen = adv_len; + h_adv_param->adv_int_min = matter_adv_int_min; + h_adv_param->adv_int_max = matter_adv_int_max; + h_adv_param->local_bd_type = GAP_LOCAL_ADDR_LE_RANDOM; + h_adv_param->H_adv_intval = matter_adv_interval; + h_adv_param->is_used = 1; + h_adv_param->type = 1; + h_adv_param->adv_id = 1; + matter_multi_adapter.matter_sta_sto_flag = false; + os_mutex_give(h_adv_param->update_adv_mutex); +#if CONFIG_BLE_MATTER_MULTI_ADV_ON + } else if (type == 2) { //customer + os_mutex_take(h_adv_param->update_adv_mutex, 0xFFFF); + memcpy(h_adv_param->adv_data, adv_data, adv_len); + memcpy(h_adv_param->scanrsp_data, rsp_data, rsp_len); + h_adv_param->adv_datalen = adv_len; + h_adv_param->scanrsp_datalen = rsp_len; + h_adv_param->local_bd_type = GAP_LOCAL_ADDR_LE_PUBLIC; + h_adv_param->H_adv_intval = 320; + h_adv_param->is_used = 1; + h_adv_param->type = 2; + h_adv_param->adv_id = 2; + matter_multi_adapter.customer_sta_sto_flag = false; + os_mutex_give(h_adv_param->update_adv_mutex); +#endif + } + + if (h_adv_param->one_shot_timer == NULL) { + if (os_timer_create(&h_adv_param->one_shot_timer, "start adv_timer", adv_index, (int)(h_adv_param->H_adv_intval * 0.625), 1, + ble_matter_adapter_legacy_start_adv_callback) == false) { + printf("os_timer_create h_adv_param->one_shot_timer fail!\r\n"); + return 1; + } + } + + if (matter_multi_adapter.deinit_flag == true) { // If deinit, return 1 + printf("[%s]device ble deinit flag is set, return 1\r\n", __func__); + return 1; + } + ble_matter_adapter_send_multi_adv_msg(adv_index); + os_timer_start(&h_adv_param->one_shot_timer); + + return 0; +} + +uint8_t ble_matter_adapter_judge_adv_stop(uint8_t adv_id) +{ + uint8_t flag = 0; + if (adv_id == matter_adv_id) { + matter_multi_adapter.adv_id = adv_id; + if (matter_multi_adapter.matter_sta_sto_flag == true) { + flag = 1; + } +#if CONFIG_BLE_MATTER_MULTI_ADV_ON + } else if (adv_id == customer_adv_id) { + matter_multi_adapter.adv_id = adv_id; + if (matter_multi_adapter.customer_sta_sto_flag == true) { + flag = 1; + } +#endif + } + + return flag; +} + +void ble_matter_adapter_multi_adv_task_func(void *arg) +{ + (void)arg; + uint8_t adv_index; + uint8_t adv_stop_flag = 0; + + while (true) { + if (os_msg_recv(matter_multi_adapter.queue_handle, &adv_index, 0xFFFFFFFF) == true) { + if (adv_index == matter_multi_adv_bt_deinit_id) { // If deinit, break the outer while loop + //printf("[%s]device ble deinit flag is set, break\r\n", __func__); + break; +#if CONFIG_BLE_MATTER_MULTI_ADV_ON + } else if (adv_index == customer_adv_id) { + //printf("[%s] adv_index = %d customer_adv_id\r\n", __func__, adv_index); + matter_multi_adapter.adv_id = customer_adv_id; + if (matter_multi_adapter.customer_sta_sto_flag == true) { + printf("[%s]stop customer conn adv flag is set[%d]continue\r\n", __func__, adv_index); + continue; + } +#endif + } else if (adv_index == matter_adv_id) { + //printf("[%s] adv_index = %d matter_adv_id\r\n", __func__, adv_index); + matter_multi_adapter.adv_id = matter_adv_id; + if (matter_multi_adapter.matter_sta_sto_flag == true) { + printf("[%s]stop matter conn adv flag is set[%d], continue\r\n", __func__, adv_index); + continue; + } + } else { + continue; + } + + if (matter_multi_adv_param_array[adv_index].local_bd_type == GAP_LOCAL_ADDR_LE_PUBLIC) { + le_cfg_local_identity_address(matter_local_public_addr, GAP_IDENT_ADDR_PUBLIC); + } else if (matter_multi_adv_param_array[adv_index].local_bd_type == GAP_LOCAL_ADDR_LE_RANDOM) { + le_cfg_local_identity_address(matter_local_static_random_addr, GAP_IDENT_ADDR_RAND); + } + le_adv_set_param(GAP_PARAM_ADV_LOCAL_ADDR_TYPE, sizeof(matter_multi_adv_param_array[adv_index].local_bd_type), + &matter_multi_adv_param_array[adv_index].local_bd_type); + if (matter_multi_adv_param_array[adv_index].update_adv_mutex) { + os_mutex_take(matter_multi_adv_param_array[adv_index].update_adv_mutex, 0xFFFF); + le_adv_set_param(GAP_PARAM_ADV_DATA, matter_multi_adv_param_array[adv_index].adv_datalen, (void *)matter_multi_adv_param_array[adv_index].adv_data); + if (matter_multi_adv_param_array[adv_index].type == 2) { //customer + le_adv_set_param(GAP_PARAM_SCAN_RSP_DATA, matter_multi_adv_param_array[adv_index].scanrsp_datalen, + (void *)matter_multi_adv_param_array[adv_index].scanrsp_data); + } else if (matter_multi_adv_param_array[adv_index].type == 1) { //matter + le_adv_set_param(GAP_PARAM_ADV_INTERVAL_MIN, sizeof(matter_multi_adv_param_array[adv_index].adv_int_min), &matter_multi_adv_param_array[adv_index].adv_int_min); + le_adv_set_param(GAP_PARAM_ADV_INTERVAL_MAX, sizeof(matter_multi_adv_param_array[adv_index].adv_int_max), &matter_multi_adv_param_array[adv_index].adv_int_max); + } + os_mutex_give(matter_multi_adv_param_array[adv_index].update_adv_mutex); + } else { + printf("[%s]update_adv_mutex is NULL[%d]\r\n", __func__, adv_index); + } + if (ble_matter_adapter_app_send_api_msg(0, &matter_multi_adv_param_array[adv_index]) == false) { + printf("[%s]send api msg fail\r\n", __func__); + continue; + } + if (os_sem_take(matter_multi_adapter.sem_handle, 0xFFFFFFFF) == false) { + printf("os_sem_take matter_multi_adapter.sem_handle fail!\r\n"); + } + } + } + printf("delete multi_adv_task\r\n"); + os_sem_delete(matter_multi_adapter.sem_handle); + os_msg_queue_delete(matter_multi_adapter.queue_handle); + memset(&matter_multi_adapter, 0, sizeof(matter_multi_adapter)); + os_task_delete(NULL); +} + +void ble_matter_adapter_multi_adv_init() +{ + memset(&matter_multi_adapter, 0, sizeof(matter_multi_adapter)); + matter_multi_adapter.deinit_flag = false; + matter_multi_adapter.matter_sta_sto_flag = true; + matter_multi_adapter.customer_sta_sto_flag = true; + matter_multi_adapter.adv_id = MAX_ADV_NUMBER; + matter_multi_adv_param_array[0].connect_flag = false; + matter_multi_adv_param_array[1].connect_flag = false; + + if (os_sem_create(&matter_multi_adapter.sem_handle, 0, 1) == false) { + printf("os_sem_create ms_milti_adapter.sem_handle fail!\r\n"); + } + if (os_msg_queue_create(&matter_multi_adapter.queue_handle, MATTER_MULTI_ADV_DATA_QUEUE_SIZE, sizeof(uint8_t)) == false) { + printf("os_msg_queue_create ms_milti_adapter.queue_handle fail!\r\n"); + } + + if (os_task_create(&matter_multi_adapter.task_handle, "multi_adv_task", ble_matter_adapter_multi_adv_task_func, NULL, MATTER_MULTI_TASK_STACK_SIZE, + MATTER_MULTI_TASK_PRIORITY) == false) { + printf("os_task_create ms_milti_adapter.task_handle fail!\r\n"); + } + + memset(matter_multi_adv_param_array, 0, sizeof(M_MULTI_ADV_PARAM) * MAX_ADV_NUMBER); +} + +void ble_matter_adapter_multi_adv_deinit() +{ + for (int i = 0; i < MAX_ADV_NUMBER; i ++) { + if (matter_multi_adv_param_array[i].one_shot_timer) { + os_timer_delete(&matter_multi_adv_param_array[i].one_shot_timer); + } + } + memset(matter_multi_adv_param_array, 0, MAX_ADV_NUMBER * sizeof(M_MULTI_ADV_PARAM)); + matter_multi_adapter.deinit_flag = true; + ble_matter_adapter_send_multi_adv_msg(matter_multi_adv_bt_deinit_id); + + if (matter_multi_adapter.sem_handle) { + if (os_sem_give(matter_multi_adapter.sem_handle) == false) { + printf("[%s]os_sem_give fail\r\n", __func__); + } + } +} + +void ble_matter_adapter_send_multi_adv_msg(uint8_t adv_id) +{ + if (matter_multi_adapter.deinit_flag == true) { + return; + } + if (matter_multi_adapter.queue_handle != NULL) { + if (os_msg_send(matter_multi_adapter.queue_handle, &adv_id, 0) == false) { + printf("Send adv id to adv data queue fail[%d]\r\n", adv_id); + } + } else { + printf("matter_multi_adapter.queue_handle is NULL\r\n"); + } +} + +void ble_matter_adapter_legacy_start_adv_callback(void *data) +{ + int timerID; + os_timer_id_get(&data, &timerID); + if (matter_multi_adapter.deinit_flag == true) { + return; + } + ble_matter_adapter_send_multi_adv_msg(timerID); +} + +void ble_matter_adapter_delete_adv(uint8_t adv_id) +{ + if (matter_multi_adv_param_array[adv_id].one_shot_timer) { + os_timer_delete(&matter_multi_adv_param_array[adv_id].one_shot_timer); + } + if (matter_multi_adv_param_array[adv_id].update_adv_mutex) { + os_mutex_delete(matter_multi_adv_param_array[adv_id].update_adv_mutex); + } + memset(&matter_multi_adv_param_array[adv_id], 0, sizeof(M_MULTI_ADV_PARAM)); + +} +/*============================================================================* + * Functions + *============================================================================*/ +int ble_matter_adapter_app_handle_upstream_msg(uint16_t subtype, void *pdata) +{ + int ret = 0; + + BT_MATTER_SERVER_SEND_DATA *param = (BT_MATTER_SERVER_SEND_DATA *)pdata; + if (param) { + server_send_data(param->conn_id, param->service_id, param->attrib_index, param->p_data, param->data_len, param->type); + os_mem_free(param->p_data); + os_mem_free(param); + } + + return ret; +} + +void ble_matter_adapter_app_handle_callback_msg(T_IO_MSG callback_msg) +{ + uint16_t msg_type = callback_msg.type; + switch (msg_type) { + case BLE_MATTER_MSG_CONNECTED_MULTI_ADV: { + BT_MATTER_CONN_EVENT *connected = callback_msg.u.buf; + T_MATTER_BLEMGR_GAP_CONNECT_CB_ARG gap_connect_cb_arg; + gap_connect_cb_arg.conn_id = connected->conn_id; + if (matter_blemgr_callback_func) { + matter_blemgr_callback_func(matter_blemgr_callback_data, MATTER_BLEMGR_GAP_CONNECT_CB, &gap_connect_cb_arg); + } + os_mem_free(callback_msg.u.buf); + callback_msg.u.buf = NULL; + } + break; + + case BLE_MATTER_MSG_DISCONNECTED_MULTI_ADV: { + BT_MATTER_CONN_EVENT *disconnected = callback_msg.u.buf; + T_MATTER_BLEMGR_GAP_DISCONNECT_CB_ARG gap_disconnect_cb_arg; + gap_disconnect_cb_arg.conn_id = disconnected->conn_id; + gap_disconnect_cb_arg.disc_cause = disconnected->disc_cause; + if (matter_blemgr_callback_func) { + matter_blemgr_callback_func(matter_blemgr_callback_data, MATTER_BLEMGR_GAP_DISCONNECT_CB, &gap_disconnect_cb_arg); + } + os_mem_free(callback_msg.u.buf); + callback_msg.u.buf = NULL; + } + break; + + case BLE_MATTER_MSG_WRITE_CHAR_MULTI_ADV: { + T_MATTER_CALLBACK_DATA *write_char_val = callback_msg.u.buf; + T_MATTER_BLEMGR_RX_CHAR_WRITE_CB_ARG rx_char_write_cb_arg; + rx_char_write_cb_arg.conn_id = write_char_val->conn_id; + rx_char_write_cb_arg.p_value = write_char_val->msg_data.write_read.p_value; + rx_char_write_cb_arg.len = write_char_val->msg_data.write_read.len; + if (matter_blemgr_callback_func) { + matter_blemgr_callback_func(matter_blemgr_callback_data, MATTER_BLEMGR_RX_CHAR_WRITE_CB, &rx_char_write_cb_arg); + } + if (write_char_val->msg_data.write_read.len != 0) { + os_mem_free(write_char_val->msg_data.write_read.p_value); + write_char_val->msg_data.write_read.p_value = NULL; + } + os_mem_free(callback_msg.u.buf); + callback_msg.u.buf = NULL; + } + break; + case BLE_MATTER_MSG_CCCD_RECV_ENABLE_MULTI_ADV: { + matter_blemgr_callback_func(matter_blemgr_callback_data, MATTER_BLEMGR_TX_CHAR_CCCD_WRITE_CB, callback_msg.u.buf); + os_mem_free(callback_msg.u.buf); + } + break; + case BLE_MATTER_MSG_CCCD_RECV_DISABLE_MULTI_ADV: + case BLE_MATTER_MSG_SEND_DATA_COMPLETE_MULTI_ADV: { + matter_blemgr_callback_func(matter_blemgr_callback_data, MATTER_BLEMGR_TX_COMPLETE_CB, callback_msg.u.buf); + os_mem_free(callback_msg.u.buf); + } + break; + + case BT_MATTER_SEND_CB_MSG_IND_NTF_ENABLE: + case BT_MATTER_SEND_CB_MSG_IND_NTF_DISABLE: { + T_MATTER_CALLBACK_DATA *indication_notification_enable = callback_msg.u.buf; + T_MATTER_BLEMGR_TX_CHAR_CCCD_WRITE_CB_ARG tx_char_cccd_write_cb_arg; + tx_char_cccd_write_cb_arg.conn_id = indication_notification_enable->conn_id; + if (msg_type == BT_MATTER_SEND_CB_MSG_IND_NTF_DISABLE) { + tx_char_cccd_write_cb_arg.indicationsEnabled = 0; + } else if (msg_type == BT_MATTER_SEND_CB_MSG_IND_NTF_ENABLE) { + tx_char_cccd_write_cb_arg.indicationsEnabled = 1; + } + tx_char_cccd_write_cb_arg.notificationsEnabled = 0; + if (matter_blemgr_callback_func) { + matter_blemgr_callback_func(matter_blemgr_callback_data, MATTER_BLEMGR_TX_CHAR_CCCD_WRITE_CB, &tx_char_cccd_write_cb_arg); + } + os_mem_free(callback_msg.u.buf); + callback_msg.u.buf = NULL; + } + break; + + default: + printf("[%s] unknow type(%d) callback msg\r\n", __func__, callback_msg.type); + break; + } +} + +void ble_matter_adapter_app_handle_io_msg(T_IO_MSG io_msg) +{ + uint16_t msg_type = io_msg.type; + switch (msg_type) { + case IO_MSG_TYPE_BT_STATUS: { + ble_matter_adapter_app_handle_gap_msg(&io_msg); + } + break; + case IO_MSG_TYPE_UART: { + /* We handle user command informations from Data UART in this branch. */ + //int8_t data = io_msg.subtype; + //mesh_user_cmd_collect(&data, sizeof(data), device_cmd_table); + } + break; + case IO_MSG_TYPE_AT_CMD: { + //uint16_t subtype = io_msg.subtype; + //void *arg = io_msg.u.buf; + //if (ble_central_app_handle_at_cmd(subtype, arg) != 1) { + //ble_peripheral_app_handle_at_cmd(subtype, arg); + //} + } + break; + case IO_MSG_TYPE_QDECODE: { + if (io_msg.subtype == 0) { + M_MULTI_ADV_PARAM *adv_param = io_msg.u.buf; + uint8_t adv_stop_flag = 0; + adv_stop_flag = ble_matter_adapter_judge_adv_stop(adv_param->adv_id); + if (adv_stop_flag) { + printf("stop adv flag[%d] is set, give sem and break\r\n", adv_param->adv_id); + if (matter_multi_adapter.sem_handle) { + os_sem_give(matter_multi_adapter.sem_handle); + } + break; + } + uint8_t cause = le_adv_update_param(); + if (cause != GAP_CAUSE_SUCCESS) { + printf("le_adv_update_param fail! ret = 0x%x\r\n", cause); + } + } else if (io_msg.subtype == 2) { + //gap_sched_scan(false); + } else if (io_msg.subtype == 3) { + //gap_sched_scan(true); + } else if (io_msg.subtype == 4) { + ble_matter_adapter_app_handle_upstream_msg(io_msg.subtype, io_msg.u.buf); + } else if (io_msg.subtype == 5) { + uint8_t conn_id = io_msg.u.buf; + le_disconnect(conn_id); + } + } + break; + default: + break; + } +} + +/** + * @brief Handle msg GAP_MSG_LE_DEV_STATE_CHANGE + * @note All the gap device state events are pre-handled in this function. + * Then the event handling function shall be called according to the new_state + * @param[in] new_state New gap device state + * @param[in] cause GAP device state change cause + * @return void + */ +void ble_matter_adapter_app_handle_dev_state_evt(T_GAP_DEV_STATE new_state, uint16_t cause) +{ + APP_PRINT_INFO3("ble_matter_adapter_dev_state_evt: init state %d, scan state %d, cause 0x%x", + new_state.gap_init_state, + new_state.gap_scan_state, cause); + if (ble_matter_adapter_gap_dev_state.gap_init_state != new_state.gap_init_state) { + if (new_state.gap_init_state == GAP_INIT_STATE_STACK_READY) { + uint8_t bt_addr[6]; + APP_PRINT_INFO0("GAP stack ready"); + /*stack ready*/ + gap_get_param(GAP_PARAM_BD_ADDR, bt_addr); + printf("local bd addr: %02x:%02x:%02x:%02x:%02x:%02x\r\n", + bt_addr[5], + bt_addr[4], + bt_addr[3], + bt_addr[2], + bt_addr[1], + bt_addr[0]); +#if CONFIG_BLE_MATTER_MULTI_ADV_ON + memcpy(matter_local_public_addr, bt_addr, 6); +#endif + } + } + + if (ble_matter_adapter_gap_dev_state.gap_scan_state != new_state.gap_scan_state) { + if (new_state.gap_scan_state == GAP_SCAN_STATE_IDLE) { + APP_PRINT_INFO0("GAP scan stop"); + printf("GAP scan stop\r\n"); + + } else if (new_state.gap_scan_state == GAP_SCAN_STATE_SCANNING) { + APP_PRINT_INFO0("GAP scan start"); + printf("GAP scan start\r\n"); + } + } + + if (ble_matter_adapter_gap_dev_state.gap_adv_state != new_state.gap_adv_state) { + if (new_state.gap_adv_state == GAP_ADV_STATE_IDLE) { + if (new_state.gap_adv_sub_state == GAP_ADV_TO_IDLE_CAUSE_CONN) { + APP_PRINT_INFO0("GAP adv stoped: because connection created"); + printf("GAP adv stoped: because connection created\r\n"); + } else { + APP_PRINT_INFO0("GAP adv stoped"); + printf("GAP adv stopped\r\n"); + } + + } else if (new_state.gap_adv_state == GAP_ADV_STATE_ADVERTISING) { + APP_PRINT_INFO0("GAP adv start"); + printf("GAP adv start\r\n"); + } + } + ble_matter_adapter_gap_dev_state = new_state; +} + +/** + * @brief Handle msg GAP_MSG_LE_CONN_STATE_CHANGE + * @note All the gap conn state events are pre-handled in this function. + * Then the event handling function shall be called according to the new_state + * @param[in] conn_id Connection ID + * @param[in] new_state New gap connection state + * @param[in] disc_cause Use this cause when new_state is GAP_CONN_STATE_DISCONNECTED + * @return void + */ +void ble_matter_adapter_app_handle_conn_state_evt(uint8_t conn_id, T_GAP_CONN_STATE new_state, uint16_t disc_cause) +{ + T_GAP_CONN_INFO conn_info; + if (conn_id >= BLE_MATTER_ADAPTER_APP_MAX_LINKS) { + return; + } + + APP_PRINT_INFO4("ble_matter_adapter_app_handle_conn_state_evt: conn_id %d, conn_state(%d -> %d), disc_cause 0x%x", + conn_id, ble_matter_adapter_app_link_table[conn_id].conn_state, new_state, disc_cause); + ble_matter_adapter_app_link_table[conn_id].conn_state = new_state; + switch (new_state) { + case GAP_CONN_STATE_DISCONNECTED: { + if ((disc_cause != (HCI_ERR | HCI_ERR_REMOTE_USER_TERMINATE)) + && (disc_cause != (HCI_ERR | HCI_ERR_LOCAL_HOST_TERMINATE))) { + APP_PRINT_ERROR2("ble_matter_adapter_app_handle_conn_state_evt: connection lost, conn_id %d, cause 0x%x", conn_id, + disc_cause); + } + printf("Disconnect conn_id %d, cause 0x%x\r\n", conn_id, disc_cause); + + if (ble_matter_adapter_app_link_table[conn_id].role == GAP_LINK_ROLE_MASTER) { + ble_matter_adapter_central_app_max_links --; + } else if (ble_matter_adapter_app_link_table[conn_id].role == GAP_LINK_ROLE_SLAVE) { + ble_matter_adapter_peripheral_app_max_links --; + } + + if (ble_matter_adapter_app_link_table[conn_id].role == GAP_LINK_ROLE_SLAVE) { + printf("As peripheral,recieve disconncect,please start ADV\r\n"); + } + + memset(&ble_matter_adapter_app_link_table[conn_id], 0, sizeof(T_APP_LINK)); + + if (link_customer == 1) { //matter + matter_multi_adv_param_array[0].connect_flag = false; + + /* Matter ADV will be restarted from Matter upper layer */ + //matter_multi_adv_start_by_id(&matter_adv_id, matter_adv_data, matter_adv_data_length, NULL, 0, 1); // the last parameter: 1 for Matter; 2 for Customer + +#if 1 //send data to matter + T_MATTER_BLEMGR_GAP_DISCONNECT_CB_ARG *disconnected_msg_matter = (T_MATTER_BLEMGR_GAP_DISCONNECT_CB_ARG *)os_mem_alloc(0, + sizeof(T_MATTER_BLEMGR_GAP_DISCONNECT_CB_ARG)); + memset(disconnected_msg_matter, 0, sizeof(T_MATTER_BLEMGR_GAP_DISCONNECT_CB_ARG)); + disconnected_msg_matter->conn_id = conn_id; + disconnected_msg_matter->disc_cause = disc_cause; + if (ble_matter_adapter_send_callback_msg(BLE_MATTER_MSG_DISCONNECTED_MULTI_ADV, NULL, disconnected_msg_matter) == false) { + printf("[%s] send callback msg fail\r\n", __func__); + os_mem_free(disconnected_msg_matter); + } +#endif +#if CONFIG_BLE_MATTER_MULTI_ADV_ON + } else if (link_customer == 2) { //customer + matter_multi_adv_param_array[1].connect_flag = false; + + /* Customer ADV can be restarted on customer's application */ + matter_multi_adv_start_by_id(&customer_adv_id, customer_adv_data, customer_adv_data_length, customer_rsp_data, customer_rsp_data_length, + 2); // the last parameter: 1 for Matter; 2 for Customer +#endif + } + + + } + break; + + case GAP_CONN_STATE_CONNECTED: { + uint16_t conn_interval; + uint16_t conn_latency; + uint16_t conn_supervision_timeout; + + le_get_conn_addr(conn_id, ble_matter_adapter_app_link_table[conn_id].bd_addr, + (void *)&ble_matter_adapter_app_link_table[conn_id].bd_type); + + //get device role + if (le_get_conn_info(conn_id, &conn_info)) { + ble_matter_adapter_app_link_table[conn_id].role = conn_info.role; + if (ble_matter_adapter_app_link_table[conn_id].role == GAP_LINK_ROLE_MASTER) { + ble_matter_adapter_central_app_max_links ++; + } else if (ble_matter_adapter_app_link_table[conn_id].role == GAP_LINK_ROLE_SLAVE) { + ble_matter_adapter_peripheral_app_max_links ++; + } + } + printf("Connected success conn_id %d\r\n", conn_id); + + uint8_t local_bd_type; + uint8_t remote_bd_type; + le_get_conn_param(GAP_PARAM_CONN_LOCAL_BD_TYPE, &local_bd_type, conn_id); + le_get_conn_param(GAP_PARAM_CONN_BD_ADDR_TYPE, &remote_bd_type, conn_id); + APP_PRINT_INFO3("GAP_CONN_STATE_CONNECTED: conn_id %d, local_bd_type %d, remote_bd_type %d\n", + conn_id, local_bd_type, remote_bd_type); + printf("GAP_CONN_STATE_CONNECTED: conn_id %d, local_bd_type %d, remote_bd_type %d\n", + conn_id, local_bd_type, remote_bd_type); + + le_get_conn_param(GAP_PARAM_CONN_INTERVAL, &conn_interval, conn_id); + le_get_conn_param(GAP_PARAM_CONN_LATENCY, &conn_latency, conn_id); + le_get_conn_param(GAP_PARAM_CONN_TIMEOUT, &conn_supervision_timeout, conn_id); + le_get_conn_addr(conn_id, ble_matter_adapter_app_link_table[conn_id].bd_addr, + &ble_matter_adapter_app_link_table[conn_id].bd_type); + APP_PRINT_INFO5("GAP_CONN_STATE_CONNECTED:remote_bd %s, remote_addr_type %d, conn_interval 0x%x, conn_latency 0x%x, conn_supervision_timeout 0x%x", + TRACE_BDADDR(ble_matter_adapter_app_link_table[conn_id].bd_addr), ble_matter_adapter_app_link_table[conn_id].bd_type, + conn_interval, conn_latency, conn_supervision_timeout); + printf("Connected success conn_id %d\r\n", conn_id); + + //get local adv bt type + if (local_bd_type == GAP_LOCAL_ADDR_LE_RANDOM) { // matter + link_customer = 1; + T_MATTER_BLEMGR_GAP_CONNECT_CB_ARG *conn_msg_matter = (T_MATTER_BLEMGR_GAP_CONNECT_CB_ARG *)os_mem_alloc(0, sizeof(T_MATTER_BLEMGR_GAP_CONNECT_CB_ARG)); + memset(conn_msg_matter, 0, sizeof(T_MATTER_BLEMGR_GAP_CONNECT_CB_ARG)); + conn_msg_matter->conn_id = conn_id; + if (ble_matter_adapter_send_callback_msg(BLE_MATTER_MSG_CONNECTED_MULTI_ADV, NULL, conn_msg_matter) == false) { + printf("[%s] send callback msg fail\r\n", __func__); + os_mem_free(conn_msg_matter); + } + matter_multi_adv_param_array[0].connect_flag == true; + matter_multi_adv_stop_by_id(&matter_adv_id); // stop matter adv +#if CONFIG_BLE_MATTER_MULTI_ADV_ON + } else if (local_bd_type == GAP_LOCAL_ADDR_LE_PUBLIC) { // customer + link_customer = 2; + matter_multi_adv_param_array[1].connect_flag == true; + matter_multi_adv_stop_by_id(&customer_adv_id); // stop customer adv +#endif + } + +#if F_BT_LE_5_0_SET_PHY_SUPPORT + { + uint8_t tx_phy; + uint8_t rx_phy; + le_get_conn_param(GAP_PARAM_CONN_RX_PHY_TYPE, &rx_phy, conn_id); + le_get_conn_param(GAP_PARAM_CONN_TX_PHY_TYPE, &tx_phy, conn_id); + APP_PRINT_INFO2("GAP_CONN_STATE_CONNECTED: tx_phy %d, rx_phy %d\n", tx_phy, rx_phy); + printf("GAP_CONN_STATE_CONNECTED: tx_phy %d, rx_phy %d\n", tx_phy, rx_phy); + } +#endif + } + break; + + default: + break; + + } +} + +/** + * @brief Handle msg GAP_MSG_LE_AUTHEN_STATE_CHANGE + * @note All the gap authentication state events are pre-handled in this function. + * Then the event handling function shall be called according to the new_state + * @param[in] conn_id Connection ID + * @param[in] new_state New authentication state + * @param[in] cause Use this cause when new_state is GAP_AUTHEN_STATE_COMPLETE + * @return void + */ +void ble_matter_adapter_app_handle_authen_state_evt(uint8_t conn_id, uint8_t new_state, uint16_t cause) +{ + APP_PRINT_INFO2("ble_matter_adapter_app_handle_authen_state_evt:conn_id %d, cause 0x%x", conn_id, cause); + switch (new_state) { + case GAP_AUTHEN_STATE_STARTED: { + APP_PRINT_INFO0("ble_matter_adapter_app_handle_authen_state_evt: GAP_AUTHEN_STATE_STARTED"); + } + break; + + case GAP_AUTHEN_STATE_COMPLETE: { + if (cause == GAP_SUCCESS) { + printf("Pair success\r\n"); + APP_PRINT_INFO0("ble_matter_adapter_app_handle_authen_state_evt: GAP_AUTHEN_STATE_COMPLETE pair success"); + } else { + printf("Pair failed: cause 0x%x\r\n", cause); + APP_PRINT_INFO0("ble_matter_adapter_app_handle_authen_state_evt: GAP_AUTHEN_STATE_COMPLETE pair failed"); + } + } + break; + + default: { + APP_PRINT_ERROR1("ble_matter_adapter_app_handle_authen_state_evt: unknown newstate %d", new_state); + } + break; + } +} + +/** + * @brief Handle msg GAP_MSG_LE_CONN_MTU_INFO + * @note This msg is used to inform APP that exchange mtu procedure is completed. + * @param[in] conn_id Connection ID + * @param[in] mtu_size New mtu size + * @return void + */ +void ble_matter_adapter_app_handle_conn_mtu_info_evt(uint8_t conn_id, uint16_t mtu_size) +{ + APP_PRINT_INFO2("ble_matter_adapter_app_handle_conn_mtu_info_evt: conn_id %d, mtu_size %d", conn_id, mtu_size); +} + +/** + * @brief Handle msg GAP_MSG_LE_CONN_PARAM_UPDATE + * @note All the connection parameter update change events are pre-handled in this function. + * @param[in] conn_id Connection ID + * @param[in] status New update state + * @param[in] cause Use this cause when status is GAP_CONN_PARAM_UPDATE_STATUS_FAIL + * @return void + */ +void ble_matter_adapter_app_handle_conn_param_update_evt(uint8_t conn_id, uint8_t status, uint16_t cause) +{ + switch (status) { + case GAP_CONN_PARAM_UPDATE_STATUS_SUCCESS: { + uint16_t conn_interval; + uint16_t conn_slave_latency; + uint16_t conn_supervision_timeout; + + le_get_conn_param(GAP_PARAM_CONN_INTERVAL, &conn_interval, conn_id); + le_get_conn_param(GAP_PARAM_CONN_LATENCY, &conn_slave_latency, conn_id); + le_get_conn_param(GAP_PARAM_CONN_TIMEOUT, &conn_supervision_timeout, conn_id); + APP_PRINT_INFO4("ble_matter_adapter_app_handle_conn_param_update_evt update success:conn_id %d, conn_interval 0x%x, conn_slave_latency 0x%x, conn_supervision_timeout 0x%x", + conn_id, conn_interval, conn_slave_latency, conn_supervision_timeout); + } + break; + + case GAP_CONN_PARAM_UPDATE_STATUS_FAIL: { + APP_PRINT_ERROR2("ble_matter_adapter_app_handle_conn_param_update_evt update failed: conn_id %d, cause 0x%x", + conn_id, cause); + } + break; + + case GAP_CONN_PARAM_UPDATE_STATUS_PENDING: { + APP_PRINT_INFO1("ble_matter_adapter_app_handle_conn_param_update_evt update pending: conn_id %d", conn_id); + } + break; + + default: + break; + } +} + +/** + * @brief All the BT GAP MSG are pre-handled in this function. + * @note Then the event handling function shall be called according to the + * subtype of T_IO_MSG + * @param[in] p_gap_msg Pointer to GAP msg + * @return void + */ +void ble_matter_adapter_app_handle_gap_msg(T_IO_MSG *p_gap_msg) +{ + T_LE_GAP_MSG gap_msg; + uint8_t conn_id; + memcpy(&gap_msg, &p_gap_msg->u.param, sizeof(p_gap_msg->u.param)); + + APP_PRINT_TRACE1("ble_matter_adapter_app_handle_gap_msg: subtype %d", p_gap_msg->subtype); + switch (p_gap_msg->subtype) { + case GAP_MSG_LE_DEV_STATE_CHANGE: { + ble_matter_adapter_app_handle_dev_state_evt(gap_msg.msg_data.gap_dev_state_change.new_state, + gap_msg.msg_data.gap_dev_state_change.cause); + } + break; + + case GAP_MSG_LE_CONN_STATE_CHANGE: { + ble_matter_adapter_app_handle_conn_state_evt(gap_msg.msg_data.gap_conn_state_change.conn_id, + (T_GAP_CONN_STATE)gap_msg.msg_data.gap_conn_state_change.new_state, + gap_msg.msg_data.gap_conn_state_change.disc_cause); + } + break; + + case GAP_MSG_LE_CONN_MTU_INFO: { + ble_matter_adapter_app_handle_conn_mtu_info_evt(gap_msg.msg_data.gap_conn_mtu_info.conn_id, + gap_msg.msg_data.gap_conn_mtu_info.mtu_size); + } + break; + + case GAP_MSG_LE_CONN_PARAM_UPDATE: { + ble_matter_adapter_app_handle_conn_param_update_evt(gap_msg.msg_data.gap_conn_param_update.conn_id, + gap_msg.msg_data.gap_conn_param_update.status, + gap_msg.msg_data.gap_conn_param_update.cause); + } + break; + + case GAP_MSG_LE_AUTHEN_STATE_CHANGE: { + ble_matter_adapter_app_handle_authen_state_evt(gap_msg.msg_data.gap_authen_state.conn_id, + gap_msg.msg_data.gap_authen_state.new_state, + gap_msg.msg_data.gap_authen_state.status); + } + break; + + case GAP_MSG_LE_BOND_JUST_WORK: { + conn_id = gap_msg.msg_data.gap_bond_just_work_conf.conn_id; + le_bond_just_work_confirm(conn_id, GAP_CFM_CAUSE_ACCEPT); + APP_PRINT_INFO0("GAP_MSG_LE_BOND_JUST_WORK"); + } + break; + + case GAP_MSG_LE_BOND_PASSKEY_DISPLAY: { + uint32_t display_value = 0; + conn_id = gap_msg.msg_data.gap_bond_passkey_display.conn_id; + le_bond_get_display_key(conn_id, &display_value); + APP_PRINT_INFO2("GAP_MSG_LE_BOND_PASSKEY_DISPLAY: conn_id %d, passkey %d", + conn_id, display_value); + le_bond_passkey_display_confirm(conn_id, GAP_CFM_CAUSE_ACCEPT); + printf("GAP_MSG_LE_BOND_PASSKEY_DISPLAY: conn_id %d, passkey %d\r\n", + conn_id, + display_value); + } + break; + + case GAP_MSG_LE_BOND_USER_CONFIRMATION: { + uint32_t display_value = 0; + conn_id = gap_msg.msg_data.gap_bond_user_conf.conn_id; + le_bond_get_display_key(conn_id, &display_value); + APP_PRINT_INFO2("GAP_MSG_LE_BOND_USER_CONFIRMATION: conn_id %d, passkey %d", + conn_id, display_value); + printf("GAP_MSG_LE_BOND_USER_CONFIRMATION: conn_id %d, passkey %d\r\n", + conn_id, + display_value); + //le_bond_user_confirm(conn_id, GAP_CFM_CAUSE_ACCEPT); + } + break; + + case GAP_MSG_LE_BOND_PASSKEY_INPUT: { + //uint32_t passkey = 888888; + conn_id = gap_msg.msg_data.gap_bond_passkey_input.conn_id; + APP_PRINT_INFO1("GAP_MSG_LE_BOND_PASSKEY_INPUT: conn_id %d", conn_id); + printf("GAP_MSG_LE_BOND_PASSKEY_INPUT: conn_id %d\r\n", conn_id); + //le_bond_passkey_input_confirm(conn_id, passkey, GAP_CFM_CAUSE_ACCEPT); + } + break; +#if F_BT_LE_SMP_OOB_SUPPORT + case GAP_MSG_LE_BOND_OOB_INPUT: { + uint8_t oob_data[GAP_OOB_LEN] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + conn_id = gap_msg.msg_data.gap_bond_oob_input.conn_id; + APP_PRINT_INFO1("GAP_MSG_LE_BOND_OOB_INPUT: conn_id %d", conn_id); + le_bond_set_param(GAP_PARAM_BOND_OOB_DATA, GAP_OOB_LEN, oob_data); + le_bond_oob_input_confirm(conn_id, GAP_CFM_CAUSE_ACCEPT); + } + break; +#endif + default: + APP_PRINT_ERROR1("ble_matter_adapter_app_handle_gap_msg: unknown subtype %d", p_gap_msg->subtype); + break; + } +} + +/** @defgroup CENTRAL_CLIENT_GAP_CALLBACK GAP Callback Event Handler + * @brief Handle GAP callback event + * @{ + */ +/** + * @brief Used to parse advertising data and scan response data + * @param[in] scan_info point to scan information data. + * @retval void + */ +void bt_matter_device_matter_app_parse_scan_info(T_LE_SCAN_INFO *scan_info) +{ + uint8_t buffer[32]; + uint8_t pos = 0; + + while (pos < scan_info->data_len) { + /* Length of the AD structure. */ + uint8_t length = scan_info->data[pos++]; + uint8_t type; + + if ((length > 0x01) && ((pos + length) <= 31)) { + /* Copy the AD Data to buffer. */ + memcpy(buffer, scan_info->data + pos + 1, length - 1); + /* AD Type, one octet. */ + type = scan_info->data[pos]; + + APP_PRINT_TRACE2("bt_mesh_device_matter_app_parse_scan_info: AD Structure Info: AD type 0x%x, AD Data Length %d", type, + length - 1); + + switch (type) { + case GAP_ADTYPE_FLAGS: { + /* (flags & 0x01) -- LE Limited Discoverable Mode */ + /* (flags & 0x02) -- LE General Discoverable Mode */ + /* (flags & 0x04) -- BR/EDR Not Supported */ + /* (flags & 0x08) -- Simultaneous LE and BR/EDR to Same Device Capable (Controller) */ + /* (flags & 0x10) -- Simultaneous LE and BR/EDR to Same Device Capable (Host) */ + uint8_t flags = scan_info->data[pos + 1]; + APP_PRINT_INFO1("GAP_ADTYPE_FLAGS: 0x%x", flags); + BLE_PRINT("GAP_ADTYPE_FLAGS: 0x%x\n\r", flags); + + } + break; + + case GAP_ADTYPE_16BIT_MORE: + case GAP_ADTYPE_16BIT_COMPLETE: + case GAP_ADTYPE_SERVICES_LIST_16BIT: { + uint16_t *p_uuid = (uint16_t *)(buffer); + uint8_t i = length - 1; + + while (i >= 2) { + APP_PRINT_INFO1("GAP_ADTYPE_16BIT_XXX: 0x%x", *p_uuid); + BLE_PRINT("GAP_ADTYPE_16BIT_XXX: 0x%x\n\r", *p_uuid); + p_uuid ++; + i -= 2; + } + } + break; + + case GAP_ADTYPE_32BIT_MORE: + case GAP_ADTYPE_32BIT_COMPLETE: { + uint32_t *p_uuid = (uint32_t *)(buffer); + uint8_t i = length - 1; + + while (i >= 4) { + APP_PRINT_INFO1("GAP_ADTYPE_32BIT_XXX: 0x%x", *p_uuid); + BLE_PRINT("GAP_ADTYPE_32BIT_XXX: 0x%x\n\r", (unsigned int)*p_uuid); + p_uuid ++; + + i -= 4; + } + } + break; + + case GAP_ADTYPE_128BIT_MORE: + case GAP_ADTYPE_128BIT_COMPLETE: + case GAP_ADTYPE_SERVICES_LIST_128BIT: { + uint32_t *p_uuid = (uint32_t *)(buffer); + APP_PRINT_INFO4("GAP_ADTYPE_128BIT_XXX: 0x%8.8x%8.8x%8.8x%8.8x", + p_uuid[3], p_uuid[2], p_uuid[1], p_uuid[0]); + BLE_PRINT("GAP_ADTYPE_128BIT_XXX: 0x%8.8x%8.8x%8.8x%8.8x\n\r", + (unsigned int)p_uuid[3], (unsigned int)p_uuid[2], (unsigned int)p_uuid[1], (unsigned int)p_uuid[0]); + + } + break; + + case GAP_ADTYPE_LOCAL_NAME_SHORT: + case GAP_ADTYPE_LOCAL_NAME_COMPLETE: { + buffer[length - 1] = '\0'; + APP_PRINT_INFO1("GAP_ADTYPE_LOCAL_NAME_XXX: %s", TRACE_STRING(buffer)); + BLE_PRINT("GAP_ADTYPE_LOCAL_NAME_XXX: %s\n\r", buffer); + + } + break; + + case GAP_ADTYPE_POWER_LEVEL: { + APP_PRINT_INFO1("GAP_ADTYPE_POWER_LEVEL: 0x%x", scan_info->data[pos + 1]); + BLE_PRINT("GAP_ADTYPE_POWER_LEVEL: 0x%x\n\r", scan_info->data[pos + 1]); + + } + break; + + case GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE: { + uint16_t *p_min = (uint16_t *)(buffer); + uint16_t *p_max = p_min + 1; + APP_PRINT_INFO2("GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE: 0x%x - 0x%x", *p_min, + *p_max); + BLE_PRINT("GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE: 0x%x - 0x%x\n\r", *p_min, *p_max); + + } + break; + + case GAP_ADTYPE_SERVICE_DATA: { + uint16_t *p_uuid = (uint16_t *)(buffer); + uint8_t data_len = length - 3; + + APP_PRINT_INFO3("GAP_ADTYPE_SERVICE_DATA: UUID 0x%x, len %d, data %b", *p_uuid, + data_len, TRACE_BINARY(data_len, &buffer[2])); + BLE_PRINT("GAP_ADTYPE_SERVICE_DATA: UUID 0x%x, len %d\n\r", *p_uuid, data_len); + + } + break; + case GAP_ADTYPE_APPEARANCE: { + uint16_t *p_appearance = (uint16_t *)(buffer); + APP_PRINT_INFO1("GAP_ADTYPE_APPEARANCE: %d", *p_appearance); + BLE_PRINT("GAP_ADTYPE_APPEARANCE: %d\n\r", *p_appearance); + + } + break; + + case GAP_ADTYPE_MANUFACTURER_SPECIFIC: { + uint8_t data_len = length - 3; + uint16_t *p_company_id = (uint16_t *)(buffer); + APP_PRINT_INFO3("GAP_ADTYPE_MANUFACTURER_SPECIFIC: company_id 0x%x, len %d, data %b", + *p_company_id, data_len, TRACE_BINARY(data_len, &buffer[2])); + BLE_PRINT("GAP_ADTYPE_MANUFACTURER_SPECIFIC: company_id 0x%x, len %d\n\r", *p_company_id, data_len); + + } + break; + + default: { + uint8_t i = 0; + + for (i = 0; i < (length - 1); i++) { + APP_PRINT_INFO1(" AD Data: Unhandled Data = 0x%x", scan_info->data[pos + i]); + //BLE_PRINT(" AD Data: Unhandled Data = 0x%x\n\r", scan_info->data[pos + i]); + + } + } + break; + } + } + + pos += length; + } +} + +/** @} */ /* End of group CENTRAL_CLIENT_GAP_CALLBACK */ +/** @defgroup GCS_CLIIENT_CALLBACK GCS Client Callback Event Handler + * @brief Handle profile client callback event + * @{ + */ +void ble_matter_adapter_gcs_handle_discovery_result(uint8_t conn_id, T_GCS_DISCOVERY_RESULT discov_result) +{ + uint16_t i; + T_GCS_DISCOV_RESULT *p_result_table; + uint16_t properties; + switch (discov_result.discov_type) { + case GCS_ALL_PRIMARY_SRV_DISCOV: + APP_PRINT_INFO2("conn_id %d, GCS_ALL_PRIMARY_SRV_DISCOV, is_success %d", + conn_id, discov_result.is_success); + for (i = 0; i < discov_result.result_num; i++) { + p_result_table = &(discov_result.p_result_table[i]); + switch (p_result_table->result_type) { + case DISC_RESULT_ALL_SRV_UUID16: + APP_PRINT_INFO4("ALL SRV UUID16[%d]: service range: 0x%x-0x%x, uuid16 0x%x", + i, p_result_table->result_data.srv_uuid16_disc_data.att_handle, + p_result_table->result_data.srv_uuid16_disc_data.end_group_handle, + p_result_table->result_data.srv_uuid16_disc_data.uuid16); + printf("ALL SRV UUID16[%d]: service range: 0x%x-0x%x, uuid16 0x%x\r\n", + i, p_result_table->result_data.srv_uuid16_disc_data.att_handle, + p_result_table->result_data.srv_uuid16_disc_data.end_group_handle, + p_result_table->result_data.srv_uuid16_disc_data.uuid16); + + break; + case DISC_RESULT_ALL_SRV_UUID128: + APP_PRINT_INFO4("ALL SRV UUID128[%d]: service range: 0x%x-0x%x, service=<%b>", + i, p_result_table->result_data.srv_uuid128_disc_data.att_handle, + p_result_table->result_data.srv_uuid128_disc_data.end_group_handle, + TRACE_BINARY(16, p_result_table->result_data.srv_uuid128_disc_data.uuid128)); + printf("ALL SRV UUID128[%d]: service range: 0x%x-0x%x, service="UUID_128_FORMAT"\n\r", + i, p_result_table->result_data.srv_uuid128_disc_data.att_handle, + p_result_table->result_data.srv_uuid128_disc_data.end_group_handle, + UUID_128(p_result_table->result_data.srv_uuid128_disc_data.uuid128)); + break; + + default: + APP_PRINT_ERROR0("Invalid Discovery Result Type!"); + printf("Invalid Discovery Result Type!\n\r"); + break; + } + } + break; + + case GCS_BY_UUID128_SRV_DISCOV: + APP_PRINT_INFO2("conn_id %d, GCS_BY_UUID128_SRV_DISCOV, is_success %d", + conn_id, discov_result.is_success); + printf("conn_id %d, GCS_BY_UUID128_SRV_DISCOV, is_success %d\n\r", + conn_id, discov_result.is_success); + + for (i = 0; i < discov_result.result_num; i++) { + p_result_table = &(discov_result.p_result_table[i]); + switch (p_result_table->result_type) { + case DISC_RESULT_SRV_DATA: + APP_PRINT_INFO3("SRV DATA[%d]: service range: 0x%x-0x%x", + i, p_result_table->result_data.srv_disc_data.att_handle, + p_result_table->result_data.srv_disc_data.end_group_handle); + printf("SRV DATA[%d]: service range: 0x%x-0x%x\n\r", + i, p_result_table->result_data.srv_disc_data.att_handle, + p_result_table->result_data.srv_disc_data.end_group_handle); + + break; + + default: + APP_PRINT_ERROR0("Invalid Discovery Result Type!"); + printf("Invalid Discovery Result Type!\n\r"); + break; + } + } + break; + + case GCS_BY_UUID_SRV_DISCOV: + APP_PRINT_INFO2("conn_id %d, GCS_BY_UUID_SRV_DISCOV, is_success %d", + conn_id, discov_result.is_success); + printf("conn_id %d, GCS_BY_UUID_SRV_DISCOV, is_success %d\n\r", + conn_id, discov_result.is_success); + + for (i = 0; i < discov_result.result_num; i++) { + p_result_table = &(discov_result.p_result_table[i]); + switch (p_result_table->result_type) { + case DISC_RESULT_SRV_DATA: + APP_PRINT_INFO3("SRV DATA[%d]: service range: 0x%x-0x%x", + i, p_result_table->result_data.srv_disc_data.att_handle, + p_result_table->result_data.srv_disc_data.end_group_handle); + printf("SRV DATA[%d]: service range: 0x%x-0x%x\n\r", + i, p_result_table->result_data.srv_disc_data.att_handle, + p_result_table->result_data.srv_disc_data.end_group_handle); + + break; + + default: + APP_PRINT_ERROR0("Invalid Discovery Result Type!"); + printf("Invalid Discovery Result Type!\n\r"); + break; + } + } + break; + + case GCS_ALL_CHAR_DISCOV: + APP_PRINT_INFO2("conn_id %d, GCS_ALL_CHAR_DISCOV, is_success %d", + conn_id, discov_result.is_success); + printf("conn_id %d, GCS_ALL_CHAR_DISCOV, is_success %d\n\r", + conn_id, discov_result.is_success); + + for (i = 0; i < discov_result.result_num; i++) { + p_result_table = &(discov_result.p_result_table[i]); + switch (p_result_table->result_type) { + case DISC_RESULT_CHAR_UUID16: + properties = p_result_table->result_data.char_uuid16_disc_data.properties; + APP_PRINT_INFO5("CHAR UUID16[%d]: decl_handle 0x%x, properties 0x%x, value_handle 0x%x, uuid16 0x%x", + i, p_result_table->result_data.char_uuid16_disc_data.decl_handle, + p_result_table->result_data.char_uuid16_disc_data.properties, + p_result_table->result_data.char_uuid16_disc_data.value_handle, + p_result_table->result_data.char_uuid16_disc_data.uuid16); + APP_PRINT_INFO5("properties:indicate %d, read %d, write cmd %d, write %d, notify %d\r\n", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY); + printf("CHAR UUID16[%d]: decl_handle 0x%x, properties 0x%x, value_handle 0x%x, uuid16 0x%x\n\r", + i, p_result_table->result_data.char_uuid16_disc_data.decl_handle, + p_result_table->result_data.char_uuid16_disc_data.properties, + p_result_table->result_data.char_uuid16_disc_data.value_handle, + p_result_table->result_data.char_uuid16_disc_data.uuid16); + printf("properties:indicate %d, read %d, write cmd %d, write %d, notify %d\n\r", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY); + + break; + + case DISC_RESULT_CHAR_UUID128: + properties = p_result_table->result_data.char_uuid128_disc_data.properties; + APP_PRINT_INFO5("CHAR UUID128[%d]: decl hndl=0x%x, prop=0x%x, value hndl=0x%x, uuid128=<%b>", + i, p_result_table->result_data.char_uuid128_disc_data.decl_handle, + p_result_table->result_data.char_uuid128_disc_data.properties, + p_result_table->result_data.char_uuid128_disc_data.value_handle, + TRACE_BINARY(16, p_result_table->result_data.char_uuid128_disc_data.uuid128)); + APP_PRINT_INFO5("properties:indicate %d, read %d, write cmd %d, write %d, notify %d", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY + ); + printf("CHAR UUID128[%d]: decl hndl=0x%x, prop=0x%x, value hndl=0x%x, uuid128="UUID_128_FORMAT"\n\r", + i, p_result_table->result_data.char_uuid128_disc_data.decl_handle, + p_result_table->result_data.char_uuid128_disc_data.properties, + p_result_table->result_data.char_uuid128_disc_data.value_handle, + UUID_128(p_result_table->result_data.char_uuid128_disc_data.uuid128)); + printf("properties:indicate %d, read %d, write cmd %d, write %d, notify %d\n\r", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY + ); + break; + default: + APP_PRINT_ERROR0("Invalid Discovery Result Type!"); + printf("Invalid Discovery Result Type!\n\r"); + break; + } + } + break; + + case GCS_BY_UUID_CHAR_DISCOV: + APP_PRINT_INFO2("conn_id %d, GCS_BY_UUID_CHAR_DISCOV, is_success %d", + conn_id, discov_result.is_success); + printf("conn_id %d, GCS_BY_UUID_CHAR_DISCOV, is_success %d\n\r", + conn_id, discov_result.is_success); + + for (i = 0; i < discov_result.result_num; i++) { + p_result_table = &(discov_result.p_result_table[i]); + switch (p_result_table->result_type) { + case DISC_RESULT_BY_UUID16_CHAR: + properties = p_result_table->result_data.char_uuid16_disc_data.properties; + APP_PRINT_INFO5("UUID16 CHAR[%d]: Characteristics by uuid16, decl hndl=0x%x, prop=0x%x, value hndl=0x%x, uuid16=<0x%x>", + i, p_result_table->result_data.char_uuid16_disc_data.decl_handle, + p_result_table->result_data.char_uuid16_disc_data.properties, + p_result_table->result_data.char_uuid16_disc_data.value_handle, + p_result_table->result_data.char_uuid16_disc_data.uuid16); + APP_PRINT_INFO5("properties:indicate %d, read %d, write cmd %d, write %d, notify %d", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY + ); + printf("UUID16 CHAR[%d]: Characteristics by uuid16, decl hndl=0x%x, prop=0x%x, value hndl=0x%x, uuid16=<0x%x>\n\r", + i, p_result_table->result_data.char_uuid16_disc_data.decl_handle, + p_result_table->result_data.char_uuid16_disc_data.properties, + p_result_table->result_data.char_uuid16_disc_data.value_handle, + p_result_table->result_data.char_uuid16_disc_data.uuid16); + printf("properties:indicate %d, read %d, write cmd %d, write %d, notify %d\n\r", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY + ); + + break; + + default: + APP_PRINT_ERROR0("Invalid Discovery Result Type!"); + printf("Invalid Discovery Result Type!"); + break; + } + } + break; + + case GCS_BY_UUID128_CHAR_DISCOV: + APP_PRINT_INFO2("conn_id %d, GCS_BY_UUID128_CHAR_DISCOV, is_success %d", + conn_id, discov_result.is_success); + printf("conn_id %d, GCS_BY_UUID128_CHAR_DISCOV, is_success %d\n\r", + conn_id, discov_result.is_success); + + for (i = 0; i < discov_result.result_num; i++) { + p_result_table = &(discov_result.p_result_table[i]); + switch (p_result_table->result_type) { + case DISC_RESULT_BY_UUID128_CHAR: + properties = p_result_table->result_data.char_uuid128_disc_data.properties; + APP_PRINT_INFO5("UUID128 CHAR[%d]: Characteristics by uuid128, decl hndl=0x%x, prop=0x%x, value hndl=0x%x, uuid128=<%b>", + i, p_result_table->result_data.char_uuid128_disc_data.decl_handle, + p_result_table->result_data.char_uuid128_disc_data.properties, + p_result_table->result_data.char_uuid128_disc_data.value_handle, + TRACE_BINARY(16, p_result_table->result_data.char_uuid128_disc_data.uuid128)); + APP_PRINT_INFO5("properties:indicate %d, read %d, write cmd %d, write %d, notify %d", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY + ); + printf("UUID128 CHAR[%d]: Characteristics by uuid128, decl hndl=0x%x, prop=0x%x, value hndl=0x%x, uuid128="UUID_128_FORMAT"\n\r", + i, p_result_table->result_data.char_uuid128_disc_data.decl_handle, + p_result_table->result_data.char_uuid128_disc_data.properties, + p_result_table->result_data.char_uuid128_disc_data.value_handle, + UUID_128(p_result_table->result_data.char_uuid128_disc_data.uuid128)); + printf("properties:indicate %d, read %d, write cmd %d, write %d, notify %d\n\r", + properties & GATT_CHAR_PROP_INDICATE, + properties & GATT_CHAR_PROP_READ, + properties & GATT_CHAR_PROP_WRITE_NO_RSP, + properties & GATT_CHAR_PROP_WRITE, + properties & GATT_CHAR_PROP_NOTIFY + ); + + break; + + default: + APP_PRINT_ERROR0("Invalid Discovery Result Type!"); + BLE_PRINT("Invalid Discovery Result Type!\n\r"); + break; + } + } + break; + + case GCS_ALL_CHAR_DESC_DISCOV: + APP_PRINT_INFO2("conn_id %d, GCS_ALL_CHAR_DESC_DISCOV, is_success %d\r\n", + conn_id, discov_result.is_success); + printf("conn_id %d, GCS_ALL_CHAR_DESC_DISCOV, is_success %d\n\r", + conn_id, discov_result.is_success); + for (i = 0; i < discov_result.result_num; i++) { + p_result_table = &(discov_result.p_result_table[i]); + switch (p_result_table->result_type) { + case DISC_RESULT_CHAR_DESC_UUID16: + APP_PRINT_INFO3("DESC UUID16[%d]: Descriptors handle=0x%x, uuid16=<0x%x>", + i, p_result_table->result_data.char_desc_uuid16_disc_data.handle, + p_result_table->result_data.char_desc_uuid16_disc_data.uuid16); + printf("DESC UUID16[%d]: Descriptors handle=0x%x, uuid16=<0x%x>\n\r", + i, p_result_table->result_data.char_desc_uuid16_disc_data.handle, + p_result_table->result_data.char_desc_uuid16_disc_data.uuid16); + + break; + case DISC_RESULT_CHAR_DESC_UUID128: + APP_PRINT_INFO3("DESC UUID128[%d]: Descriptors handle=0x%x, uuid128=<%b>", + i, p_result_table->result_data.char_desc_uuid128_disc_data.handle, + TRACE_BINARY(16, p_result_table->result_data.char_desc_uuid128_disc_data.uuid128)); + printf("DESC UUID128[%d]: Descriptors handle=0x%x, uuid128="UUID_128_FORMAT"\n\r", + i, p_result_table->result_data.char_desc_uuid128_disc_data.handle, + UUID_128(p_result_table->result_data.char_desc_uuid128_disc_data.uuid128)); + + break; + + default: + APP_PRINT_ERROR0("Invalid Discovery Result Type!"); + printf("Invalid Discovery Result Type!\n\r"); + break; + } + } + break; + + default: + APP_PRINT_ERROR2("Invalid disc type: conn_id %d, discov_type %d", + conn_id, discov_result.discov_type); + printf("Invalid disc type: conn_id %d, discov_type %d\n\r", + conn_id, discov_result.discov_type); + break; + } +} +/** + * @brief Callback will be called when data sent from gcs client. + * @param client_id the ID distinguish which module sent the data. + * @param conn_id connection ID. + * @param p_data pointer to data. + * @retval result @ref T_APP_RESULT + */ +T_APP_RESULT ble_matter_adapter_gcs_client_callback(T_CLIENT_ID client_id, uint8_t conn_id, void *p_data) +{ + T_APP_RESULT result = APP_RESULT_SUCCESS; + APP_PRINT_INFO2("ble_matter_adapter_gcs_client_callback: client_id %d, conn_id %d", + client_id, conn_id); + if (client_id == ble_matter_adapter_gcs_client_id) { + T_GCS_CLIENT_CB_DATA *p_gcs_cb_data = (T_GCS_CLIENT_CB_DATA *)p_data; + switch (p_gcs_cb_data->cb_type) { + case GCS_CLIENT_CB_TYPE_DISC_RESULT: + ble_matter_adapter_gcs_handle_discovery_result(conn_id, p_gcs_cb_data->cb_content.discov_result); + break; + case GCS_CLIENT_CB_TYPE_READ_RESULT: + APP_PRINT_INFO3("READ RESULT: cause 0x%x, handle 0x%x, value_len %d", + p_gcs_cb_data->cb_content.read_result.cause, + p_gcs_cb_data->cb_content.read_result.handle, + p_gcs_cb_data->cb_content.read_result.value_size); + printf("READ RESULT: cause 0x%x, handle 0x%x, value_len %d\n\r", + p_gcs_cb_data->cb_content.read_result.cause, + p_gcs_cb_data->cb_content.read_result.handle, + p_gcs_cb_data->cb_content.read_result.value_size); + + if (p_gcs_cb_data->cb_content.read_result.cause == GAP_SUCCESS) { + APP_PRINT_INFO1("READ VALUE: %b", + TRACE_BINARY(p_gcs_cb_data->cb_content.read_result.value_size, + p_gcs_cb_data->cb_content.read_result.p_value)); + printf("READ VALUE: "); + for (int i = 0; i < p_gcs_cb_data->cb_content.read_result.value_size; i++) { + printf("0x%2x ", *(p_gcs_cb_data->cb_content.read_result.p_value + i)); + } + printf("\n\r"); + } + + break; + case GCS_CLIENT_CB_TYPE_WRITE_RESULT: + APP_PRINT_INFO3("WRITE RESULT: cause 0x%x, handle 0x%x, type %d", + p_gcs_cb_data->cb_content.write_result.cause, + p_gcs_cb_data->cb_content.write_result.handle, + p_gcs_cb_data->cb_content.write_result.type); + printf("WRITE RESULT: cause 0x%x, handle 0x%x, type %d\n\r", + p_gcs_cb_data->cb_content.write_result.cause, + p_gcs_cb_data->cb_content.write_result.handle, + p_gcs_cb_data->cb_content.write_result.type); + break; + case GCS_CLIENT_CB_TYPE_NOTIF_IND: + if (p_gcs_cb_data->cb_content.notif_ind.notify == false) { + APP_PRINT_INFO2("INDICATION: handle 0x%x, value_size %d", + p_gcs_cb_data->cb_content.notif_ind.handle, + p_gcs_cb_data->cb_content.notif_ind.value_size); + APP_PRINT_INFO1("INDICATION VALUE: %b", + TRACE_BINARY(p_gcs_cb_data->cb_content.notif_ind.value_size, + p_gcs_cb_data->cb_content.notif_ind.p_value)); + printf("INDICATION: handle 0x%x, value_size %d\r\n", + p_gcs_cb_data->cb_content.notif_ind.handle, + p_gcs_cb_data->cb_content.notif_ind.value_size); + printf("INDICATION VALUE: "); + for (int i = 0; i < p_gcs_cb_data->cb_content.notif_ind.value_size; i++) { + printf("0x%2x ", *(p_gcs_cb_data->cb_content.notif_ind.p_value + i)); + } + printf("\n\r"); + } else { + APP_PRINT_INFO2("NOTIFICATION: handle 0x%x, value_size %d", + p_gcs_cb_data->cb_content.notif_ind.handle, + p_gcs_cb_data->cb_content.notif_ind.value_size); + APP_PRINT_INFO1("NOTIFICATION VALUE: %b", + TRACE_BINARY(p_gcs_cb_data->cb_content.notif_ind.value_size, + p_gcs_cb_data->cb_content.notif_ind.p_value)); + printf("NOTIFICATION: handle 0x%x, value_size %d\r\n", + p_gcs_cb_data->cb_content.notif_ind.handle, + p_gcs_cb_data->cb_content.notif_ind.value_size); + printf("NOTIFICATION VALUE: "); + for (int i = 0; i < p_gcs_cb_data->cb_content.notif_ind.value_size; i++) { + printf("0x%2x ", *(p_gcs_cb_data->cb_content.notif_ind.p_value + i)); + } + printf("\n\r"); + } + break; + default: + break; + } + } + + return result; +} + +/** + * @brief Callback for gap le to notify app + * @param[in] cb_type callback msy type @ref GAP_LE_MSG_Types. + * @param[in] p_cb_data point to callback data @ref T_LE_CB_DATA. + * @retval result @ref T_APP_RESULT + */ +T_APP_RESULT ble_matter_adapter_app_gap_callback(uint8_t cb_type, void *p_cb_data) +{ + T_APP_RESULT result = APP_RESULT_SUCCESS; + T_LE_CB_DATA *p_data = (T_LE_CB_DATA *)p_cb_data; + char adv_type[20]; + char remote_addr_type[10]; + + switch (cb_type) { + /* common msg*/ + case GAP_MSG_LE_READ_RSSI: + APP_PRINT_INFO3("GAP_MSG_LE_READ_RSSI:conn_id 0x%x cause 0x%x rssi %d", + p_data->p_le_read_rssi_rsp->conn_id, + p_data->p_le_read_rssi_rsp->cause, + p_data->p_le_read_rssi_rsp->rssi); + break; + + case GAP_MSG_LE_BOND_MODIFY_INFO: + APP_PRINT_INFO1("GAP_MSG_LE_BOND_MODIFY_INFO: type 0x%x", + p_data->p_le_bond_modify_info->type); + break; + + /* central reference msg*/ + case GAP_MSG_LE_SCAN_INFO: + APP_PRINT_INFO5("GAP_MSG_LE_SCAN_INFO:adv_type 0x%x, bd_addr %s, remote_addr_type %d, rssi %d, data_len %d", + p_data->p_le_scan_info->adv_type, + TRACE_BDADDR(p_data->p_le_scan_info->bd_addr), + p_data->p_le_scan_info->remote_addr_type, + p_data->p_le_scan_info->rssi, + p_data->p_le_scan_info->data_len); + + if (bt_matter_device_matter_scan_state) { + /* If you want to parse the scan info, please reference function ble_central_app_parse_scan_info. */ + sprintf(adv_type, "%s", (p_data->p_le_scan_info->adv_type == GAP_ADV_EVT_TYPE_UNDIRECTED) ? "CON_UNDIRECT" : + (p_data->p_le_scan_info->adv_type == GAP_ADV_EVT_TYPE_DIRECTED) ? "CON_DIRECT" : + (p_data->p_le_scan_info->adv_type == GAP_ADV_EVT_TYPE_SCANNABLE) ? "SCANABLE_UNDIRCT" : + (p_data->p_le_scan_info->adv_type == GAP_ADV_EVT_TYPE_NON_CONNECTABLE) ? "NON_CONNECTABLE" : + (p_data->p_le_scan_info->adv_type == GAP_ADV_EVT_TYPE_SCAN_RSP) ? "SCAN_RSP" : "unknown"); + sprintf(remote_addr_type, "%s", (p_data->p_le_scan_info->remote_addr_type == GAP_REMOTE_ADDR_LE_PUBLIC) ? "public" : + (p_data->p_le_scan_info->remote_addr_type == GAP_REMOTE_ADDR_LE_RANDOM) ? "random" : "unknown"); + + BLE_PRINT("ADVType\t\t\t| AddrType\t|%s\t\t\t|rssi\n\r", "BT_Addr"); + BLE_PRINT("%s\t\t%s\t"BD_ADDR_FMT"\t%d\n\r", adv_type, remote_addr_type, BD_ADDR_ARG(p_data->p_le_scan_info->bd_addr), + p_data->p_le_scan_info->rssi); + + bt_matter_device_matter_app_parse_scan_info(p_data->p_le_scan_info); + } + //gap_sched_handle_adv_report(p_data->p_le_scan_info); + break; + + +#if F_BT_LE_4_2_DATA_LEN_EXT_SUPPORT + case GAP_MSG_LE_DATA_LEN_CHANGE_INFO: + APP_PRINT_INFO3("GAP_MSG_LE_DATA_LEN_CHANGE_INFO: conn_id %d, tx octets 0x%x, max_tx_time 0x%x", + p_data->p_le_data_len_change_info->conn_id, + p_data->p_le_data_len_change_info->max_tx_octets, + p_data->p_le_data_len_change_info->max_tx_time); + break; +#endif + +#if F_BT_LE_GAP_CENTRAL_SUPPORT + case GAP_MSG_LE_CONN_UPDATE_IND: + APP_PRINT_INFO5("GAP_MSG_LE_CONN_UPDATE_IND: conn_id %d, conn_interval_max 0x%x, conn_interval_min 0x%x, conn_latency 0x%x,supervision_timeout 0x%x", + p_data->p_le_conn_update_ind->conn_id, + p_data->p_le_conn_update_ind->conn_interval_max, + p_data->p_le_conn_update_ind->conn_interval_min, + p_data->p_le_conn_update_ind->conn_latency, + p_data->p_le_conn_update_ind->supervision_timeout); + /* if reject the proposed connection parameter from peer device, use APP_RESULT_REJECT. */ + result = APP_RESULT_ACCEPT; + break; + + case GAP_MSG_LE_SET_HOST_CHANN_CLASSIF: + APP_PRINT_INFO1("GAP_MSG_LE_SET_HOST_CHANN_CLASSIF: cause 0x%x", + p_data->p_le_set_host_chann_classif_rsp->cause); + break; +#endif +#if F_BT_LE_5_0_SET_PHY_SUPPORT + case GAP_MSG_LE_PHY_UPDATE_INFO: + APP_PRINT_INFO4("GAP_MSG_LE_PHY_UPDATE_INFO:conn_id %d, cause 0x%x, rx_phy %d, tx_phy %d", + p_data->p_le_phy_update_info->conn_id, + p_data->p_le_phy_update_info->cause, + p_data->p_le_phy_update_info->rx_phy, + p_data->p_le_phy_update_info->tx_phy); + printf("GAP_MSG_LE_PHY_UPDATE_INFO:conn_id %d, cause 0x%x, rx_phy %d, tx_phy %d\n\r", + p_data->p_le_phy_update_info->conn_id, + p_data->p_le_phy_update_info->cause, + p_data->p_le_phy_update_info->rx_phy, + p_data->p_le_phy_update_info->tx_phy); + + break; + + case GAP_MSG_LE_REMOTE_FEATS_INFO: { + uint8_t remote_feats[8]; + APP_PRINT_INFO3("GAP_MSG_LE_REMOTE_FEATS_INFO: conn id %d, cause 0x%x, remote_feats %b", + p_data->p_le_remote_feats_info->conn_id, + p_data->p_le_remote_feats_info->cause, + TRACE_BINARY(8, p_data->p_le_remote_feats_info->remote_feats)); + if (p_data->p_le_remote_feats_info->cause == GAP_SUCCESS) { + memcpy(remote_feats, p_data->p_le_remote_feats_info->remote_feats, 8); + if (remote_feats[LE_SUPPORT_FEATURES_MASK_ARRAY_INDEX1] & LE_SUPPORT_FEATURES_LE_2M_MASK_BIT) { + APP_PRINT_INFO0("GAP_MSG_LE_REMOTE_FEATS_INFO: support 2M"); + printf("GAP_MSG_LE_REMOTE_FEATS_INFO: support 2M\n\r"); + } + if (remote_feats[LE_SUPPORT_FEATURES_MASK_ARRAY_INDEX1] & LE_SUPPORT_FEATURES_LE_CODED_PHY_MASK_BIT) { + APP_PRINT_INFO0("GAP_MSG_LE_REMOTE_FEATS_INFO: support CODED"); + printf("GAP_MSG_LE_REMOTE_FEATS_INFO: support CODED\n\r"); + } + } + } + break; +#endif + + case GAP_MSG_LE_MODIFY_WHITE_LIST: + APP_PRINT_INFO2("GAP_MSG_LE_MODIFY_WHITE_LIST: operation 0x%x, cause 0x%x", + p_data->p_le_modify_white_list_rsp->operation, + p_data->p_le_modify_white_list_rsp->cause); + printf("GAP_MSG_LE_MODIFY_WHITE_LIST: operation 0x%x, cause 0x%x\r\n", + p_data->p_le_modify_white_list_rsp->operation, + p_data->p_le_modify_white_list_rsp->cause); + break; + + case GAP_MSG_LE_ADV_UPDATE_PARAM: + APP_PRINT_INFO1("GAP_MSG_LE_ADV_UPDATE_PARAM: cause 0x%x", + p_data->p_le_adv_update_param_rsp->cause); + //printf("GAP_MSG_LE_ADV_UPDATE_PARAM: cause 0x%x\r\n", + // p_data->p_le_adv_update_param_rsp->cause); + + if (p_data->p_le_adv_update_param_rsp->cause == 0) { + uint8_t adv_stop_flag = 0; + adv_stop_flag = ble_matter_adapter_judge_adv_stop(matter_multi_adapter.adv_id); + if (adv_stop_flag) { + printf("[%s]stop adv flag[%d] is set, give sem and break\r\n", __func__, matter_multi_adapter.adv_id); + matter_multi_adapter.adv_id = MAX_ADV_NUMBER; + if (matter_multi_adapter.sem_handle) { + os_sem_give(matter_multi_adapter.sem_handle); + } + break; + } +#if BT_VENDOR_CMD_ONE_SHOT_SUPPORT + T_GAP_CAUSE ret = GAP_CAUSE_SUCCESS; + ret = le_vendor_one_shot_adv(); + if (ret != GAP_CAUSE_SUCCESS) { + printf(" fail! ret = 0x%x\r\n", ret); + } +#endif + } + + APP_PRINT_INFO1("GAP_MSG_LE_ADV_UPDATE_PARAM: cause 0x%x", + p_data->p_le_adv_update_param_rsp->cause); + //gap_sched_adv_params_set_done(); + break; + + default: + APP_PRINT_ERROR1("ble_matter_adapter_app_gap_callback: unhandled cb_type 0x%x", cb_type); + break; + } + return result; +} +/** + * @brief Callback will be called when data sent from profile client layer. + * @param client_id the ID distinguish which module sent the data. + * @param conn_id connection ID. + * @param p_data pointer to data. + * @retval result @ref T_APP_RESULT + */ +T_APP_RESULT ble_matter_adapter_app_client_callback(T_CLIENT_ID client_id, uint8_t conn_id, void *p_data) +{ + T_APP_RESULT result = APP_RESULT_SUCCESS; + APP_PRINT_INFO2("bt_mesh_device_matter_app_client_callback: client_id %d, conn_id %d", + client_id, conn_id); + if (client_id == CLIENT_PROFILE_GENERAL_ID) { + T_CLIENT_APP_CB_DATA *p_client_app_cb_data = (T_CLIENT_APP_CB_DATA *)p_data; + switch (p_client_app_cb_data->cb_type) { + case CLIENT_APP_CB_TYPE_DISC_STATE: + if (p_client_app_cb_data->cb_content.disc_state_data.disc_state == DISC_STATE_SRV_DONE) { + APP_PRINT_INFO0("Discovery All Service Procedure Done."); + } else { + APP_PRINT_INFO0("Discovery state send to application directly."); + } + break; + case CLIENT_APP_CB_TYPE_DISC_RESULT: + if (p_client_app_cb_data->cb_content.disc_result_data.result_type == DISC_RESULT_ALL_SRV_UUID16) { + APP_PRINT_INFO3("Discovery All Primary Service: UUID16 0x%x, start handle 0x%x, end handle 0x%x.", + p_client_app_cb_data->cb_content.disc_result_data.result_data.p_srv_uuid16_disc_data->uuid16, + p_client_app_cb_data->cb_content.disc_result_data.result_data.p_srv_uuid16_disc_data->att_handle, + p_client_app_cb_data->cb_content.disc_result_data.result_data.p_srv_uuid16_disc_data->end_group_handle); + } else { + APP_PRINT_INFO0("Discovery result send to application directly."); + } + break; + default: + break; + } + + } + return result; +} + +/** @defgroup PERIPH_SEVER_CALLBACK Profile Server Callback Event Handler + * @brief Handle profile server callback event + * @{ + */ +/** + * @brief All the BT Profile service callback events are handled in this function + * @note Then the event handling function shall be called according to the + * service_id + * @param service_id Profile service ID + * @param p_data Pointer to callback data + * @return T_APP_RESULT, which indicates the function call is successful or not + * @retval APP_RESULT_SUCCESS Function run successfully + * @retval others Function run failed, and return number indicates the reason + */ +T_APP_RESULT ble_matter_adapter_app_profile_callback(T_SERVER_ID service_id, void *p_data) +{ + T_APP_RESULT app_result = APP_RESULT_SUCCESS; + if (service_id == SERVICE_PROFILE_GENERAL_ID) { + T_SERVER_APP_CB_DATA *p_param = (T_SERVER_APP_CB_DATA *)p_data; + switch (p_param->eventId) { + case PROFILE_EVT_SRV_REG_COMPLETE:// srv register result event. + APP_PRINT_INFO1("PROFILE_EVT_SRV_REG_COMPLETE: result %d", + p_param->event_data.service_reg_result); + break; + case PROFILE_EVT_SEND_DATA_COMPLETE: + APP_PRINT_INFO5("PROFILE_EVT_SEND_DATA_COMPLETE: conn_id %d, cause 0x%x, service_id %d, attrib_idx 0x%x, credits %d", + p_param->event_data.send_data_result.conn_id, + p_param->event_data.send_data_result.cause, + p_param->event_data.send_data_result.service_id, + p_param->event_data.send_data_result.attrib_idx, + p_param->event_data.send_data_result.credits); + printf("PROFILE_EVT_SEND_DATA_COMPLETE: conn_id %d, cause 0x%x, service_id %d, attrib_idx 0x%x, credits %d\r\n", + p_param->event_data.send_data_result.conn_id, + p_param->event_data.send_data_result.cause, + p_param->event_data.send_data_result.service_id, + p_param->event_data.send_data_result.attrib_idx, + p_param->event_data.send_data_result.credits); + if (p_param->event_data.send_data_result.cause == GAP_SUCCESS) { + APP_PRINT_INFO0("PROFILE_EVT_SEND_DATA_COMPLETE success"); + printf("PROFILE_EVT_SEND_DATA_COMPLETE success\r\n"); +//send msg to matter + + if (p_param->event_data.send_data_result.service_id == ble_matter_adapter_service_id) { + T_MATTER_BLEMGR_TX_COMPLETE_CB_ARG *indication_complete_msg_matter = (T_MATTER_BLEMGR_TX_COMPLETE_CB_ARG *) os_mem_alloc(0, + sizeof(T_MATTER_BLEMGR_TX_COMPLETE_CB_ARG)); + memset(indication_complete_msg_matter, 0, sizeof(T_MATTER_BLEMGR_TX_COMPLETE_CB_ARG)); + indication_complete_msg_matter->conn_id = p_param->event_data.send_data_result.conn_id; + + if (ble_matter_adapter_send_callback_msg(BLE_MATTER_MSG_SEND_DATA_COMPLETE_MULTI_ADV, NULL, indication_complete_msg_matter) == false) { + printf("\n\r[%s] send callback msg fail\r\n", __func__); + os_mem_free(indication_complete_msg_matter); + } + } + } else { + APP_PRINT_ERROR0("PROFILE_EVT_SEND_DATA_COMPLETE failed"); + printf("PROFILE_EVT_SEND_DATA_COMPLETE failed\r\n"); + } + break; + + default: + break; + } + } else if (service_id == ble_matter_adapter_service_id) { + + T_MATTER_CALLBACK_DATA *p_ms_cb_data = (T_MATTER_CALLBACK_DATA *)p_data; + + switch (p_ms_cb_data->msg_type) { + + case SERVICE_CALLBACK_TYPE_INDIFICATION_NOTIFICATION: { + + switch (p_ms_cb_data->msg_data.notification_indification_index) { + case MATTER_NOTIFY_INDICATE_V3_ENABLE: { + APP_PRINT_INFO0("MATTER_NOTIFY_INDICATE_V3_ENABLE"); + printf("\n\rMATTER_NOTIFY_INDICATE_V3_ENABLE\r\n"); + //send msg to matter + T_MATTER_CALLBACK_DATA *indication_notification_enable = os_mem_alloc(0, sizeof(T_MATTER_CALLBACK_DATA)); + + if (indication_notification_enable) { + memcpy(indication_notification_enable, p_ms_cb_data, sizeof(T_MATTER_CALLBACK_DATA)); + printf("L2055,BT_MATTER_SEND_CB_MSG_IND_NTF_ENABLE=%d\r\n", BT_MATTER_SEND_CB_MSG_IND_NTF_ENABLE); + //if(ble_matter_adapter_send_callback_msg(BMS_CALLBACK_MSG_CMP_CCCD_RECV_ENABLE_MATTER, service_id, indication_notification_enable)==false) + if (ble_matter_adapter_send_callback_msg(BLE_MATTER_MSG_CCCD_RECV_ENABLE_MULTI_ADV, service_id, indication_notification_enable) == false) { + os_mem_free(indication_notification_enable); + indication_notification_enable = NULL; + } + } else { + printf("Malloc failed\r\n"); + } + } + break; + + case MATTER_NOTIFY_INDICATE_V3_DISABLE: { + APP_PRINT_INFO0("MATTER_NOTIFY_INDICATE_V3_DISABLE"); + printf("\n\rMATTER_NOTIFY_INDICATE_V3_DISABLE\r\n"); + + //send msg to matter + T_MATTER_CALLBACK_DATA *indication_notification_disable = os_mem_alloc(0, sizeof(T_MATTER_CALLBACK_DATA)); + if (indication_notification_disable) { + memcpy(indication_notification_disable, p_ms_cb_data, sizeof(T_MATTER_CALLBACK_DATA)); + //if(ble_matter_adapter_send_callback_msg(BMS_CALLBACK_MSG_CMP_CCCD_RECV_DISABLE_MATTER, service_id, indication_notification_disable)==false) + if (ble_matter_adapter_send_callback_msg(BLE_MATTER_MSG_CCCD_RECV_DISABLE_MULTI_ADV, service_id, indication_notification_disable) == false) { + os_mem_free(indication_notification_disable); + indication_notification_disable = NULL; + } + } else { + printf("Malloc failed\r\n"); + } + } + break; + default: + break; + } + + } + break; + case SERVICE_CALLBACK_TYPE_READ_CHAR_VALUE: { + T_MATTER_BLEMGR_C3_CHAR_READ_CB_ARG c3_char_read_cb_arg; + c3_char_read_cb_arg.pp_value = &p_ms_cb_data->msg_data.write_read.p_value; + c3_char_read_cb_arg.p_len = &p_ms_cb_data->msg_data.write_read.len; + if (matter_blemgr_callback_func) { + matter_blemgr_callback_func(matter_blemgr_callback_data, MATTER_BLEMGR_C3_CHAR_READ_CB, &c3_char_read_cb_arg); + } + } + break; + + case SERVICE_CALLBACK_TYPE_WRITE_CHAR_VALUE: { + //send msg to matter + T_MATTER_CALLBACK_DATA *write_char_val = os_mem_alloc(0, sizeof(T_MATTER_CALLBACK_DATA)); + if (write_char_val) { + memcpy(write_char_val, p_ms_cb_data, sizeof(T_MATTER_CALLBACK_DATA)); + + //Make sure not malloc size of 0 + if (write_char_val->msg_data.write_read.len != 0) { + write_char_val->msg_data.write_read.p_value = os_mem_alloc(0, write_char_val->msg_data.write_read.len); + memcpy(write_char_val->msg_data.write_read.p_value, p_ms_cb_data->msg_data.write_read.p_value, p_ms_cb_data->msg_data.write_read.len); + } + if (ble_matter_adapter_send_callback_msg(BLE_MATTER_MSG_WRITE_CHAR_MULTI_ADV, service_id, write_char_val) == false) { + if (write_char_val->msg_data.write_read.len != 0) { + os_mem_free(write_char_val->msg_data.write_read.p_value); + write_char_val->msg_data.write_read.p_value = NULL; + } + os_mem_free(write_char_val); + write_char_val = NULL; + } + } else { + printf("Malloc failed\r\n"); + } + } + break; + default: + break; + } + } + + return app_result; +} + +void ble_matter_adapter_app_vendor_callback(uint8_t cb_type, void *p_cb_data) +{ + T_GAP_VENDOR_CB_DATA cb_data; + memcpy(&cb_data, p_cb_data, sizeof(T_GAP_VENDOR_CB_DATA)); + APP_PRINT_INFO1("app_vendor_callback: command 0x%x", cb_data.p_gap_vendor_cmd_rsp->command); + //printf(); + switch (cb_type) { + case GAP_MSG_VENDOR_CMD_RSP: + switch (cb_data.p_gap_vendor_cmd_rsp->command) { +#if BT_VENDOR_CMD_ONE_SHOT_SUPPORT + case HCI_LE_VENDOR_EXTENSION_FEATURE2: + //if(cb_data.p_gap_vendor_cmd_rsp->param[0] == HCI_EXT_SUB_ONE_SHOT_ADV) + { + APP_PRINT_ERROR1("One shot adv resp: cause 0x%x", cb_data.p_gap_vendor_cmd_rsp->cause); + if (cb_data.p_gap_vendor_cmd_rsp->cause == 0) { + if (matter_multi_adapter.sem_handle) { + os_sem_give(matter_multi_adapter.sem_handle); + } + } else { + printf("One shot adv resp: cause 0x%x\r\n", cb_data.p_gap_vendor_cmd_rsp->cause); + } + } + break; +#endif + default: + break; + } + break; + + default: + break; + } + + return; +} + +#if F_BT_GAPS_CHAR_WRITEABLE +/** @defgroup SCATTERNET_GAPS_WRITE GAP Service Callback Handler + * @brief Use @ref F_BT_GAPS_CHAR_WRITEABLE to open + * @{ + */ +/** + * @brief All the BT GAP service callback events are handled in this function + * @param[in] service_id Profile service ID + * @param[in] p_para Pointer to callback data + * @return Indicates the function call is successful or not + * @retval result @ref T_APP_RESULT + */ +T_APP_RESULT ble_matter_adapter_gap_service_callback(T_SERVER_ID service_id, void *p_para) +{ + (void) service_id; + T_APP_RESULT result = APP_RESULT_SUCCESS; + T_GAPS_CALLBACK_DATA *p_gap_data = (T_GAPS_CALLBACK_DATA *)p_para; + APP_PRINT_INFO2("gap_service_callback: conn_id = %d msg_type = %d\n", p_gap_data->conn_id, + p_gap_data->msg_type); + APP_PRINT_INFO2("gap_service_callback: len = 0x%x,opcode = %d\n", p_gap_data->msg_data.len, + p_gap_data->msg_data.opcode); + if (p_gap_data->msg_type == SERVICE_CALLBACK_TYPE_WRITE_CHAR_VALUE) { + switch (p_gap_data->msg_data.opcode) { + case GAPS_WRITE_DEVICE_NAME: { + T_LOCAL_NAME device_name; + memcpy(device_name.local_name, p_gap_data->msg_data.p_value, p_gap_data->msg_data.len); + device_name.local_name[p_gap_data->msg_data.len] = 0; + printf("GAPS_WRITE_DEVICE_NAME:device_name = %s\r\n", device_name.local_name); + flash_save_local_name(&device_name); + } + break; + + case GAPS_WRITE_APPEARANCE: { + uint16_t appearance_val; + T_LOCAL_APPEARANCE appearance; + LE_ARRAY_TO_UINT16(appearance_val, p_gap_data->msg_data.p_value); + appearance.local_appearance = appearance_val; + //printf("GAPS_WRITE_APPEARANCE:appearance = %s\r\n",appearance.local_appearance); + flash_save_local_appearance(&appearance); + } + break; + default: + APP_PRINT_ERROR1("gap_service_callback: unhandled msg_data.opcode 0x%x", p_gap_data->msg_data.opcode); + //printf("gap_service_callback: unhandled msg_data.opcode 0x%x\r\n", p_gap_data->msg_data.opcode); + break; + } + } + return result; +} +#endif +/** @} */ /* End of group PERIPH_SEVER_CALLBACK */ +/** @} */ /* End of group PERIPH_APP */ +#endif diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.h b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.h new file mode 100755 index 0000000..cbe6ce5 --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.h @@ -0,0 +1,214 @@ +/** +***************************************************************************************** +* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved. +***************************************************************************************** + * @file central_client_app.h + * @brief This file handles BLE central client application routines. + * @author jane + * @date 2017-06-06 + * @version v1.0 + ************************************************************************************** + * @attention + *

© COPYRIGHT 2017 Realtek Semiconductor Corporation

+ ************************************************************************************** + */ + +#ifndef _BLE_MATTER_ADAPTER_APP_H_ +#define _BLE_MATTER_ADAPTER_APP_H_ + +#ifdef __cplusplus +extern "C" { +#endif +/*============================================================================* + * Header Files + *============================================================================*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include "ble_matter_adapter_service.h" + +#define BLE_PRINT printf +#define BD_ADDR_FMT "%02x:%02x:%02x:%02x:%02x:%02x" +#define BD_ADDR_ARG(x) (x)[5],(x)[4],(x)[3],(x)[2],(x)[1],(x)[0] +#define UUID_128_FORMAT "0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X:0x%2X" +#define UUID_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15] + +#define MAX_REGISRABLE_SERVICE_NUMBER 12 + +#define MAX_ADV_NUMBER 2 +#define MATTER_MULTI_TASK_STACK_SIZE 256*10 +#define MATTER_MULTI_TASK_PRIORITY 4 +#define MATTER_MULTI_ADV_DATA_QUEUE_SIZE 0x60 + +/*============================================================================* + * Variables + *============================================================================*/ +extern T_CLIENT_ID ble_matter_adapter_gcs_client_id; /**< General Common Services client client id*/ + +typedef struct { + uint8_t conn_id; + uint8_t service_id; + uint16_t attrib_index; + uint8_t *p_data; + uint16_t data_len; + uint8_t type; +} BT_MATTER_SERVER_SEND_DATA; + +typedef struct { + uint8_t conn_id; + uint8_t new_state; + uint16_t disc_cause; +} BT_MATTER_CONN_EVENT; + +typedef struct { + T_GAP_CONN_STATE conn_state; /**< Connection state. */ + T_GAP_REMOTE_ADDR_TYPE bd_type; /**< remote BD type*/ + uint8_t bd_addr[GAP_BD_ADDR_LEN]; /**< remote BD */ + T_GAP_ROLE role; //!< Device role +} T_APP_LINK; +/** @} */ +/* End of group */ +/** @addtogroup CENTRAL_CLIENT_SCAN_MGR + * @brief Device list block definition. + */ +typedef struct { + uint8_t bd_addr[GAP_BD_ADDR_LEN]; /**< remote BD */ + uint8_t bd_type; /**< remote BD type*/ +} T_DEV_INFO; + +typedef enum { + BT_MATTER_MSG_START_ADV = 12, + BT_MATTER_MSG_STOP_ADV, + BT_MATTER_MSG_SEND_DATA, +} BT_MATTER_SERVER_MSG_TYPE; + +typedef enum { + BT_MATTER_SEND_CB_MSG_DISCONNECTED = 1, + BT_MATTER_SEND_CB_MSG_CONNECTED, + BT_MATTER_SEND_CB_MSG_SEND_DATA_COMPLETE, + BT_MATTER_SEND_CB_MSG_IND_NTF_ENABLE, + BT_MATTER_SEND_CB_MSG_IND_NTF_DISABLE, + BT_MATTER_SEND_CB_MSG_WRITE_CHAR, + BLE_MATTER_MSG_CONNECTED_MULTI_ADV, + BLE_MATTER_MSG_DISCONNECTED_MULTI_ADV, + BLE_MATTER_MSG_WRITE_CHAR_MULTI_ADV, + BLE_MATTER_MSG_CCCD_RECV_ENABLE_MULTI_ADV, + BLE_MATTER_MSG_CCCD_RECV_DISABLE_MULTI_ADV, + BLE_MATTER_MSG_SEND_DATA_COMPLETE_MULTI_ADV, +} BT_MATTER_SEND_MSG_TYPE; + +typedef enum { + CB_PROFILE_CALLBACK = 0x01, /**< bt_matter_adapter_app_profile_callback */ + CB_GAP_CALLBACK = 0x02, /**< bt_matter_adapter_app_gap_callback */ + CB_GAP_MSG_CONN_EVENT = 0x3, /**< bt_matter_adapter_app_handle_gap_msg */ +} T_CHIP_BLEMGR_CALLBACK_TYPE; + +typedef struct { + uint8_t adv_datalen; + uint8_t scanrsp_datalen; + uint8_t adv_data[31]; + uint8_t scanrsp_data[31]; + uint16_t H_adv_intval; + uint8_t local_bd_type; + uint8_t is_used; + uint8_t type; //1 means matter 2 means customer + uint8_t adv_id; + void *one_shot_timer; + void *update_adv_mutex; + uint16_t adv_int_min; + uint16_t adv_int_max; + bool connect_flag; +} M_MULTI_ADV_PARAM; + +typedef struct { + void *task_handle; + void *sem_handle; + void *queue_handle; + bool deinit_flag; + uint8_t customer_sta_sto_flag; //for customer + uint8_t matter_sta_sto_flag; //for matter + uint8_t adv_id; +} T_MULTI_ADV_CONCURRENT; +/*============================================================================* + * Functions + *============================================================================*/ +uint8_t matter_get_unused_adv_index(int type); + +bool matter_matter_ble_adv_stop_by_adv_id(uint8_t *adv_id); + +bool customer_matter_ble_adv_start_by_adv_id(uint8_t *adv_id, uint8_t *adv_data, uint16_t adv_len, uint8_t *rsp_data, uint16_t rsp_len, uint8_t type); + +uint8_t ble_matter_adapter_judge_adv_stop(uint8_t adv_id); + +void ble_matter_adapter_multi_adv_task_func(void *arg); + +void ble_matter_adapter_multi_adv_init(); + +void ble_matter_adapter_multi_adv_deinit(); + +void ble_matter_adapter_send_multi_adv_msg(uint8_t adv_id); + +void ble_matter_adapter_legacy_start_adv_callback(void *data); + +void ble_matter_adapter_delete_adv(uint8_t adv_id); + + +int ble_matter_adapter_app_handle_upstream_msg(uint16_t subtype, void *pdata); + +void ble_matter_adapter_app_handle_callback_msg(T_IO_MSG callback_msg); + +void ble_matter_adapter_app_handle_io_msg(T_IO_MSG io_msg); + +void ble_matter_adapter_app_handle_dev_state_evt(T_GAP_DEV_STATE new_state, uint16_t cause); + +void ble_matter_adapter_app_handle_conn_state_evt(uint8_t conn_id, T_GAP_CONN_STATE new_state, uint16_t disc_cause); + +void ble_matter_adapter_app_handle_authen_state_evt(uint8_t conn_id, uint8_t new_state, uint16_t cause); + +void ble_matter_adapter_app_handle_conn_mtu_info_evt(uint8_t conn_id, uint16_t mtu_size); + +void ble_matter_adapter_app_handle_conn_param_update_evt(uint8_t conn_id, uint8_t status, uint16_t cause); + +void ble_matter_adapter_app_handle_gap_msg(T_IO_MSG *p_gap_msg); + +void bt_matter_device_matter_app_parse_scan_info(T_LE_SCAN_INFO *scan_info); + +void ble_matter_adapter_gcs_handle_discovery_result(uint8_t conn_id, T_GCS_DISCOVERY_RESULT discov_result); + +/** + * @brief Callback will be called when data sent from profile client layer. + * @param client_id the ID distinguish which module sent the data. + * @param conn_id connection ID. + * @param p_data pointer to data. + * @retval result @ref T_APP_RESULT + */ +T_APP_RESULT ble_matter_adapter_gcs_client_callback(T_CLIENT_ID client_id, uint8_t conn_id, void *p_data); + +/** + * @brief Callback for gap le to notify app + * @param[in] cb_type callback msy type @ref GAP_LE_MSG_Types. + * @param[in] p_cb_data point to callback data @ref T_LE_CB_DATA. + * @retval result @ref T_APP_RESULT + */ +T_APP_RESULT ble_matter_adapter_app_gap_callback(uint8_t cb_type, void *p_cb_data); + +T_APP_RESULT ble_matter_adapter_app_client_callback(T_CLIENT_ID client_id, uint8_t conn_id, void *p_data); + +T_APP_RESULT ble_matter_adapter_app_profile_callback(T_SERVER_ID service_id, void *p_data); + +void ble_matter_adapter_app_vendor_callback(uint8_t cb_type, void *p_cb_data); + +#if F_BT_GAPS_CHAR_WRITEABLE +T_APP_RESULT ble_matter_adapter_gap_service_callback(T_SERVER_ID service_id, void *p_para) +#endif + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_flags.h b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_flags.h new file mode 100755 index 0000000..94e0c29 --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_flags.h @@ -0,0 +1,44 @@ +/** +***************************************************************************************** +* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved. +***************************************************************************************** + * @file app_flags.h + * @brief This file is used to config app functions. + * @author jane + * @date 2017-06-06 + * @version v1.0 + ************************************************************************************** + * @attention + *

© COPYRIGHT 2017 Realtek Semiconductor Corporation

+ ************************************************************************************** + */ +#ifndef _BLE_MATTER_ADAPTER_APP_FLAGS_H_ +#define _BLE_MATTER_ADAPTER_APP_FLAGS_H_ + +#include +#include + +/** @defgroup CENTRAL_CLIENT_Config Central Client App Configuration + * @brief This file is used to config app functions. + * @{ + */ +/*============================================================================* + * Constants + *============================================================================*/ +/** @brief Config APP LE link number */ +#if defined(CONFIG_PLATFORM_8721D) +#define BLE_MATTER_ADAPTER_APP_MAX_LINKS 4 +#define BLE_MATTER_ADAPTER_PERIPHERAL_APP_MAX_LINKS 1 //for max slave link num +#define BLE_MATTER_ADAPTER_CENTRAL_APP_MAX_LINKS 3 //for max master link num +#elif defined(CONFIG_PLATFORM_8710C) +#define BLE_MATTER_ADAPTER_APP_MAX_LINKS 2 +#define BLE_MATTER_ADAPTER_PERIPHERAL_APP_MAX_LINKS 1 //for max slave link num +#define BLE_MATTER_ADAPTER_CENTRAL_APP_MAX_LINKS 1 //for max master link num +#endif + +/** @brief Config the discovery table number of gcs_client */ +#define BLE_MATTER_ADAPTER_APP_MAX_DISCOV_TABLE_NUM 40 + +/** @} */ /* End of group CENTRAL_CLIENT_Config */ + +#endif diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.c b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.c new file mode 100755 index 0000000..ae2343a --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.c @@ -0,0 +1,333 @@ +/** +***************************************************************************************** +* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved. +***************************************************************************************** + * @file main.c + * @brief Source file for BLE central client project, mainly used for initialize modules + * @author jane + * @date 2017-06-12 + * @version v1.0 + ************************************************************************************** + * @attention + *

© COPYRIGHT 2017 Realtek Semiconductor Corporation

+ ************************************************************************************** + */ + +/*============================================================================* + * Header Files + *============================================================================*/ +#include "platform_opts_bt.h" +#if defined(CONFIG_BLE_MATTER_ADAPTER) && CONFIG_BLE_MATTER_ADAPTER +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "trace_uart.h" +#include +#include "wifi_constants.h" +#include +#include +#include +#include +#include +#include +#include "rtk_coex.h" +#include "matter_blemgr_common.h" +#include +#include +#include +#include "vendor_cmd_bt.h" + +#if (F_BT_LE_USE_RANDOM_ADDR==1) +#include + +typedef struct { + uint8_t is_exist; + uint8_t reserved; /**< remote BD type*/ + uint8_t bd_addr[GAP_BD_ADDR_LEN]; /**< remote BD */ +} T_APP_STATIC_RANDOM_ADDR; +#endif + +/** @defgroup CENTRAL_CLIENT_DEMO_MAIN Central Client Main + * @brief Main file to initialize hardware and BT stack and start task scheduling + * @{ + */ + +/*============================================================================* + * Constants + *============================================================================*/ +/** @brief Default scan interval (units of 0.625ms, 0x520=820ms) */ +#define DEFAULT_SCAN_INTERVAL 0x520 +/** @brief Default scan window (units of 0.625ms, 0x520=820ms) */ +#define DEFAULT_SCAN_WINDOW 0x520 + +/** @brief Default minimum advertising interval when device is discoverable (units of 625us, 160=100ms) */ +#define DEFAULT_ADVERTISING_INTERVAL_MIN 192 //120ms +/** @brief Default maximum advertising interval */ +#define DEFAULT_ADVERTISING_INTERVAL_MAX 192 //120ms + +extern T_SERVER_ID ble_matter_adapter_service_id;//from app.c +extern T_GAP_DEV_STATE ble_matter_adapter_gap_dev_state; +extern uint8_t matter_local_static_random_addr[6]; + +/*============================================================================* + * Functions + *============================================================================*/ +/** + * @brief Config bt stack related feature + * + * NOTE: This function shall be called before @ref bte_init is invoked. + * @return void + */ +#ifndef PLATFORM_OHOS +extern void gap_config_hci_task_secure_context(uint32_t size); +void ble_matter_adapter_bt_stack_config_init(void) +{ + gap_config_max_le_link_num(BLE_MATTER_ADAPTER_APP_MAX_LINKS); + gap_config_max_le_paired_device(BLE_MATTER_ADAPTER_APP_MAX_LINKS); + gap_config_hci_task_secure_context(280); +} +#else +extern void gap_config_deinit_flow(uint8_t deinit_flow); +void ble_matter_adapter_bt_stack_config_init(void) +{ + gap_config_max_le_link_num(BLE_MATTER_ADAPTER_APP_MAX_LINKS); + gap_config_max_le_paired_device(BLE_MATTER_ADAPTER_APP_MAX_LINKS); + gap_config_deinit_flow(1); +} +#endif + +/** + * @brief Initialize central and gap bond manager related parameters + * @return void + */ +void ble_matter_adapter_app_le_gap_init(void) +{ + /* Device name and device appearance */ + uint8_t device_name[GAP_DEVICE_NAME_LEN] = "BLE_MATTER_ADAPTER"; + uint16_t appearance = GAP_GATT_APPEARANCE_UNKNOWN; + + /* Advertising parameters */ + uint8_t adv_evt_type = GAP_ADTYPE_ADV_IND; + uint8_t adv_direct_type = GAP_REMOTE_ADDR_LE_PUBLIC; + uint8_t adv_direct_addr[GAP_BD_ADDR_LEN] = {0}; + uint8_t adv_chann_map = GAP_ADVCHAN_ALL; + uint8_t adv_filter_policy = GAP_ADV_FILTER_ANY; + uint16_t adv_int_min = DEFAULT_ADVERTISING_INTERVAL_MIN; + uint16_t adv_int_max = DEFAULT_ADVERTISING_INTERVAL_MAX; + + /* Scan parameters */ + uint8_t scan_mode = GAP_SCAN_MODE_ACTIVE; + uint16_t scan_interval = DEFAULT_SCAN_INTERVAL; + uint16_t scan_window = DEFAULT_SCAN_WINDOW; + uint8_t scan_filter_policy = GAP_SCAN_FILTER_ANY; + uint8_t scan_filter_duplicate = GAP_SCAN_FILTER_DUPLICATE_ENABLE; + + /* GAP Bond Manager parameters */ + uint8_t auth_pair_mode = GAP_PAIRING_MODE_PAIRABLE; + uint16_t auth_flags = GAP_AUTHEN_BIT_BONDING_FLAG; + uint8_t auth_io_cap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT; +#if F_BT_LE_SMP_OOB_SUPPORT + uint8_t auth_oob = false; +#endif + uint8_t auth_use_fix_passkey = false; + uint32_t auth_fix_passkey = 0; + uint8_t auth_sec_req_enable = false; + uint16_t auth_sec_req_flags = GAP_AUTHEN_BIT_BONDING_FLAG; + + /* Set device name and device appearance */ + le_set_gap_param(GAP_PARAM_DEVICE_NAME, GAP_DEVICE_NAME_LEN, device_name); + le_set_gap_param(GAP_PARAM_APPEARANCE, sizeof(appearance), &appearance); + + /* Set advertising parameters */ + le_adv_set_param(GAP_PARAM_ADV_EVENT_TYPE, sizeof(adv_evt_type), &adv_evt_type); + le_adv_set_param(GAP_PARAM_ADV_DIRECT_ADDR_TYPE, sizeof(adv_direct_type), &adv_direct_type); + le_adv_set_param(GAP_PARAM_ADV_DIRECT_ADDR, sizeof(adv_direct_addr), adv_direct_addr); + le_adv_set_param(GAP_PARAM_ADV_CHANNEL_MAP, sizeof(adv_chann_map), &adv_chann_map); + le_adv_set_param(GAP_PARAM_ADV_FILTER_POLICY, sizeof(adv_filter_policy), &adv_filter_policy); + le_adv_set_param(GAP_PARAM_ADV_INTERVAL_MIN, sizeof(adv_int_min), &adv_int_min); + le_adv_set_param(GAP_PARAM_ADV_INTERVAL_MAX, sizeof(adv_int_max), &adv_int_max); + + /* Set scan parameters */ + le_scan_set_param(GAP_PARAM_SCAN_MODE, sizeof(scan_mode), &scan_mode); + le_scan_set_param(GAP_PARAM_SCAN_INTERVAL, sizeof(scan_interval), &scan_interval); + le_scan_set_param(GAP_PARAM_SCAN_WINDOW, sizeof(scan_window), &scan_window); + le_scan_set_param(GAP_PARAM_SCAN_FILTER_POLICY, sizeof(scan_filter_policy), + &scan_filter_policy); + le_scan_set_param(GAP_PARAM_SCAN_FILTER_DUPLICATES, sizeof(scan_filter_duplicate), + &scan_filter_duplicate); + + /* Setup the GAP Bond Manager */ + gap_set_param(GAP_PARAM_BOND_PAIRING_MODE, sizeof(auth_pair_mode), &auth_pair_mode); + gap_set_param(GAP_PARAM_BOND_AUTHEN_REQUIREMENTS_FLAGS, sizeof(auth_flags), &auth_flags); + gap_set_param(GAP_PARAM_BOND_IO_CAPABILITIES, sizeof(auth_io_cap), &auth_io_cap); +#if F_BT_LE_SMP_OOB_SUPPORT + gap_set_param(GAP_PARAM_BOND_OOB_ENABLED, sizeof(auth_oob), &auth_oob); +#endif + le_bond_set_param(GAP_PARAM_BOND_FIXED_PASSKEY, sizeof(auth_fix_passkey), &auth_fix_passkey); + le_bond_set_param(GAP_PARAM_BOND_FIXED_PASSKEY_ENABLE, sizeof(auth_use_fix_passkey), + &auth_use_fix_passkey); + le_bond_set_param(GAP_PARAM_BOND_SEC_REQ_ENABLE, sizeof(auth_sec_req_enable), &auth_sec_req_enable); + le_bond_set_param(GAP_PARAM_BOND_SEC_REQ_REQUIREMENT, sizeof(auth_sec_req_flags), + &auth_sec_req_flags); + + /* register gap message callback */ + le_register_app_cb(ble_matter_adapter_app_gap_callback); + +#if F_BT_GAPS_CHAR_WRITEABLE + uint8_t appearance_prop = GAPS_PROPERTY_WRITE_ENABLE; + uint8_t device_name_prop = GAPS_PROPERTY_WRITE_ENABLE; + T_LOCAL_APPEARANCE appearance_local; + T_LOCAL_NAME local_device_name; + if (flash_load_local_appearance(&appearance_local) == 0) { + gaps_set_parameter(GAPS_PARAM_APPEARANCE, sizeof(uint16_t), &appearance_local.local_appearance); + } + + if (flash_load_local_name(&local_device_name) == 0) { + gaps_set_parameter(GAPS_PARAM_DEVICE_NAME, GAP_DEVICE_NAME_LEN, local_device_name.local_name); + } + gaps_set_parameter(GAPS_PARAM_APPEARANCE_PROPERTY, sizeof(appearance_prop), &appearance_prop); + gaps_set_parameter(GAPS_PARAM_DEVICE_NAME_PROPERTY, sizeof(device_name_prop), &device_name_prop); + gatt_register_callback((void *)ble_matter_adapter_gap_service_callback); +#endif + +#if (F_BT_LE_USE_RANDOM_ADDR==1) + T_APP_STATIC_RANDOM_ADDR random_addr; + uint8_t local_bd_type = GAP_LOCAL_ADDR_LE_RANDOM; + + bool gen_addr = true; + if (gen_addr) { + if (le_gen_rand_addr(GAP_RAND_ADDR_STATIC, random_addr.bd_addr) == GAP_CAUSE_SUCCESS) { + random_addr.is_exist = true; + //ble_matter_adapter_app_save_static_random_address(&random_addr); + } + } + printf("random_addr.bd_addr = 0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\r\n", \ + random_addr.bd_addr[5], random_addr.bd_addr[4], random_addr.bd_addr[3], random_addr.bd_addr[2], random_addr.bd_addr[1], random_addr.bd_addr[0]); + le_set_gap_param(GAP_PARAM_RANDOM_ADDR, 6, random_addr.bd_addr); + + memcpy(matter_local_static_random_addr, random_addr.bd_addr, 6); +#endif + +#if F_BT_LE_5_0_SET_PHY_SUPPORT + uint8_t phys_prefer = GAP_PHYS_PREFER_ALL; + uint8_t tx_phys_prefer = GAP_PHYS_PREFER_1M_BIT | GAP_PHYS_PREFER_2M_BIT; + uint8_t rx_phys_prefer = GAP_PHYS_PREFER_1M_BIT | GAP_PHYS_PREFER_2M_BIT; + le_set_gap_param(GAP_PARAM_DEFAULT_PHYS_PREFER, sizeof(phys_prefer), &phys_prefer); + le_set_gap_param(GAP_PARAM_DEFAULT_TX_PHYS_PREFER, sizeof(tx_phys_prefer), &tx_phys_prefer); + le_set_gap_param(GAP_PARAM_DEFAULT_RX_PHYS_PREFER, sizeof(rx_phys_prefer), &rx_phys_prefer); +#endif + + vendor_cmd_init(ble_matter_adapter_app_vendor_callback); +} + +/** + * @brief Add GATT clients and register callbacks + * @return void + */ +void ble_matter_adapter_app_le_profile_init(void) +{ + /* Register Server Callback */ + server_init(1); + ble_matter_adapter_service_id = ble_matter_adapter_service_add_service((void *)ble_matter_adapter_app_profile_callback); + + server_register_app_cb(ble_matter_adapter_app_profile_callback); + + /* Add Client Module */ + client_init(1); + ble_matter_adapter_gcs_client_id = gcs_add_client(ble_matter_adapter_gcs_client_callback, BLE_MATTER_ADAPTER_APP_MAX_LINKS, + BLE_MATTER_ADAPTER_APP_MAX_DISCOV_TABLE_NUM); + /* Register Client Callback--App_ClientCallback to handle events from Profile Client layer. */ + client_register_general_client_cb(ble_matter_adapter_app_client_callback); +} + + +/** + * @brief Contains the initialization of all tasks + * @note There is only one task in BLE Central Client APP, thus only one APP task is init here + * @return void + */ +void ble_matter_adapter_task_init(void) +{ + ble_matter_adapter_app_task_init(); +} + +/** + * @brief Entry of APP code + * @return int (To avoid compile warning) + */ +int ble_matter_adapter_app_main(void) +{ + bt_trace_init(); + ble_matter_adapter_bt_stack_config_init(); + bte_init(); + le_gap_init(BLE_MATTER_ADAPTER_APP_MAX_LINKS); + ble_matter_adapter_app_le_gap_init(); + ble_matter_adapter_app_le_profile_init(); + ble_matter_adapter_task_init(); + + return 0; +} + +int ble_matter_adapter_app_init(void) +{ + //(void) bt_stack_already_on; + T_GAP_DEV_STATE new_state; + + /*Wait WIFI init complete*/ + while (!(wifi_is_up(RTW_STA_INTERFACE) || wifi_is_up(RTW_AP_INTERFACE))) { + os_delay(1000); + } + + //judge BLE central is already on + le_get_gap_param(GAP_PARAM_DEV_STATE, &new_state); + if (new_state.gap_init_state == GAP_INIT_STATE_STACK_READY) { + printf("[BLE Matter Adapter]BT Stack already on\n\r"); + return 0; + } else { + ble_matter_adapter_app_main(); + } + + bt_coex_init(); + + /*Wait BT init complete*/ + do { + os_delay(100); + le_get_gap_param(GAP_PARAM_DEV_STATE, &new_state); + } while (new_state.gap_init_state != GAP_INIT_STATE_STACK_READY); + + return 0; + +} + +void ble_matter_adapter_app_deinit(void) +{ + + T_GAP_DEV_STATE state; + ble_matter_adapter_app_task_deinit(); + le_get_gap_param(GAP_PARAM_DEV_STATE, &state); + if (state.gap_init_state != GAP_INIT_STATE_STACK_READY) { + printf("[BLE Matter Adapter]BT Stack is not running\n\r"); + ble_matter_adapter_gap_dev_state.gap_init_state = GAP_INIT_STATE_INIT; + } + +#if F_BT_DEINIT + else { + gcs_delete_client(); + bte_deinit(); + bt_trace_uninit(); + printf("[BLE Matter Adapter]BT Stack deinitalized\n\r"); + } +#endif + ble_matter_adapter_gap_dev_state.gap_init_state = GAP_INIT_STATE_INIT; +} + +/** @} */ /* End of group CENTRAL_CLIENT_DEMO_MAIN */ +#endif + diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.h b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.h new file mode 100755 index 0000000..d0913b2 --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.h @@ -0,0 +1,59 @@ +/** +***************************************************************************************** +* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved. +***************************************************************************************** + * @file bt_matter_adapter_peripheral_app.h + * @brief This file handles BLE peripheral application routines. + * @author jane + * @date 2017-06-06 + * @version v1.0 + ************************************************************************************** + * @attention + *

© COPYRIGHT 2017 Realtek Semiconductor Corporation

+ ************************************************************************************** + */ +#ifndef _BLE_MATTER_ADAPTER_APP_MAIN_H__ +#define _BLE_MATTER_ADAPTER_APP_MAIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif +/*============================================================================* + * Header Files + *============================================================================*/ +#include +#include + +/*============================================================================* + * Variables + *============================================================================*/ + + +/*============================================================================* + * Functions + *============================================================================*/ +#ifndef PLATFORM_OHOS +void ble_matter_adapter_bt_stack_config_init(void); +#else +void ble_matter_adapter_bt_stack_config_init(void); +#endif + +void ble_matter_adapter_app_le_gap_init(void); + +void ble_matter_adapter_app_le_gap_init(void); + +void ble_matter_adapter_app_le_profile_init(void); + +void ble_matter_adapter_task_init(void); + +int ble_matter_adapter_app_main(void); + +int ble_matter_adapter_app_init(void); + +void ble_matter_adapter_app_deinit(void); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.c b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.c new file mode 100755 index 0000000..1bf34ba --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.c @@ -0,0 +1,236 @@ +/** +***************************************************************************************** +* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved. +***************************************************************************************** + * @file app_task.c + * @brief Routines to create App task and handle events & messages + * @author jane + * @date 2017-06-02 + * @version v1.0 + ************************************************************************************** + * @attention + *

© COPYRIGHT 2017 Realtek Semiconductor Corporation

+ ************************************************************************************** + */ + +/*============================================================================* + * Header Files + *============================================================================*/ +#include +#if defined(CONFIG_BLE_MATTER_ADAPTER) && CONFIG_BLE_MATTER_ADAPTER //to be fixed +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** @defgroup CENTRAL_CLIENT_APP_TASK Central Client App Task + * @brief This file handles the implementation of application task related functions. + * + * Create App task and handle events & messages + * @{ + */ +/*============================================================================* + * Macros + *============================================================================*/ +#define BLE_MATTER_ADAPTER_APP_TASK_PRIORITY 4 //!< Task priorities +#define BLE_MATTER_ADAPTER_APP_TASK_STACK_SIZE 256 * 6 //!< Task stack size +#define BLE_MATTER_ADAPTER_MAX_NUMBER_OF_GAP_MESSAGE 0x20 //!< GAP message queue size +#define BLE_MATTER_ADAPTER_MAX_NUMBER_OF_IO_MESSAGE 0x20 //!< IO message queue size +#define BLE_MATTER_ADAPTER_MAX_NUMBER_OF_EVENT_MESSAGE (BLE_MATTER_ADAPTER_MAX_NUMBER_OF_GAP_MESSAGE + BLE_MATTER_ADAPTER_MAX_NUMBER_OF_IO_MESSAGE) //!< Event message queue size +//ble matter +#define BLE_MATTER_ADAPTER_CALLBACK_TASK_PRIORITY 4 //!< Task priorities +#define BLE_MATTER_ADAPTER_CALLBACK_TASK_STACK_SIZE 256 * 6 //!< Task stack size +#define BLE_MATTER_ADAPTER_MAX_NUMBER_OF_CALLBACK_MESSAGE 0x20 //!< Callback message queue size +/*============================================================================* + * Variables + *============================================================================*/ +void *ble_matter_adapter_app_task_handle; //!< APP Task handle +void *ble_matter_adapter_evt_queue_handle; //!< Event queue handle +void *ble_matter_adapter_io_queue_handle; //!< IO queue handle + +void *ble_matter_adapter_callback_task_handle = NULL; //!< Callback task handle +void *ble_matter_adapter_callback_queue_handle = NULL; //!< Callback queue handle + +extern T_GAP_DEV_STATE ble_matter_adapter_gap_dev_state; +extern int ble_matter_adapter_central_app_max_links; +extern int ble_matter_adapter_peripheral_app_max_links; +/*============================================================================* + * Functions + *============================================================================*/ +bool ble_matter_adapter_app_send_api_msg(uint16_t sub_type, void *arg) +{ + T_IO_MSG io_msg; + + uint8_t event = EVENT_IO_TO_APP; + + io_msg.type = IO_MSG_TYPE_QDECODE; + io_msg.subtype = sub_type; + io_msg.u.buf = arg; + + if (ble_matter_adapter_evt_queue_handle != NULL && ble_matter_adapter_io_queue_handle != NULL) { + if (os_msg_send(ble_matter_adapter_io_queue_handle, &io_msg, 0) == false) { + printf("[%s] send io queue fail! type = 0x%x\r\n", __FUNCTION__, io_msg.subtype); + return false; + } else if (os_msg_send(ble_matter_adapter_evt_queue_handle, &event, 0) == false) { + printf("[%s] send event queue fail! type = 0x%x\r\n", __FUNCTION__, io_msg.subtype); + return false; + } + } else { + printf("[%s] queue is empty! type = 0x%x\r\n", __FUNCTION__, io_msg.subtype); + return false; + } + + return true; +} + +bool ble_matter_adapter_send_callback_msg(uint16_t msg_type, uint8_t cb_type, void *arg) +{ + T_IO_MSG callback_msg; + callback_msg.type = msg_type; + + if ((msg_type == BT_MATTER_SEND_CB_MSG_SEND_DATA_COMPLETE) || (msg_type == BT_MATTER_SEND_CB_MSG_IND_NTF_ENABLE) || \ + (msg_type == BT_MATTER_SEND_CB_MSG_IND_NTF_DISABLE) || (msg_type == BT_MATTER_SEND_CB_MSG_WRITE_CHAR)) { + callback_msg.subtype = cb_type; + } + + callback_msg.u.buf = arg; + if (ble_matter_adapter_callback_queue_handle != NULL) { + if (os_msg_send(ble_matter_adapter_callback_queue_handle, &callback_msg, 0) == false) { + printf("bt matter send msg fail: subtype 0x%x", callback_msg.type); + return false; + } + + return true; + } + + return false; +} + +void ble_matter_adapter_callback_main_task(void *p_param) +{ + (void)p_param; + T_IO_MSG callback_msg; + os_msg_queue_create(&ble_matter_adapter_callback_queue_handle, BLE_MATTER_ADAPTER_MAX_NUMBER_OF_CALLBACK_MESSAGE, sizeof(T_IO_MSG)); + + while (true) { + if (os_msg_recv(ble_matter_adapter_callback_queue_handle, &callback_msg, 0xFFFFFFFF) == true) { + ble_matter_adapter_app_handle_callback_msg(callback_msg); + } + } +} +/** + * @brief Initialize App task + * @return void + */ +void ble_matter_adapter_app_task_init(void) +{ + os_task_create(&ble_matter_adapter_app_task_handle, "ble_matter_adapter_app", ble_matter_adapter_app_main_task, 0, BLE_MATTER_ADAPTER_APP_TASK_STACK_SIZE, + BLE_MATTER_ADAPTER_APP_TASK_PRIORITY); + os_task_create(&ble_matter_adapter_callback_task_handle, "ble_matter_adapter_callback", ble_matter_adapter_callback_main_task, 0, + BLE_MATTER_ADAPTER_CALLBACK_TASK_STACK_SIZE, + BLE_MATTER_ADAPTER_CALLBACK_TASK_PRIORITY); +} + +/** + * @brief App task to handle events & messages + * @param[in] p_param Parameters sending to the task + * @return void + */ +void ble_matter_adapter_app_main_task(void *p_param) +{ + (void) p_param; + uint8_t event; + +#if defined(configENABLE_TRUSTZONE) && (configENABLE_TRUSTZONE == 1) + osif_create_secure_context(configMINIMAL_SECURE_STACK_SIZE + 256); +#endif + + os_msg_queue_create(&ble_matter_adapter_io_queue_handle, BLE_MATTER_ADAPTER_MAX_NUMBER_OF_IO_MESSAGE, sizeof(T_IO_MSG)); + os_msg_queue_create(&ble_matter_adapter_evt_queue_handle, BLE_MATTER_ADAPTER_MAX_NUMBER_OF_EVENT_MESSAGE, sizeof(uint8_t)); + + gap_start_bt_stack(ble_matter_adapter_evt_queue_handle, ble_matter_adapter_io_queue_handle, BLE_MATTER_ADAPTER_MAX_NUMBER_OF_GAP_MESSAGE); + + while (true) { + if (os_msg_recv(ble_matter_adapter_evt_queue_handle, &event, 0xFFFFFFFF) == true) { + if (event == EVENT_IO_TO_APP) { + T_IO_MSG io_msg; + if (os_msg_recv(ble_matter_adapter_io_queue_handle, &io_msg, 0) == true) { + ble_matter_adapter_app_handle_io_msg(io_msg); + } + } else { + gap_handle_msg(event); + } + } + } +} + +void ble_matter_adapter_app_task_deinit(void) +{ +#ifndef PLATFORM_OHOS + if (ble_matter_adapter_io_queue_handle) { + os_msg_queue_delete(ble_matter_adapter_io_queue_handle); + } + if (ble_matter_adapter_evt_queue_handle) { + os_msg_queue_delete(ble_matter_adapter_evt_queue_handle); + } + if (ble_matter_adapter_callback_queue_handle) { + os_msg_queue_delete(ble_matter_adapter_callback_queue_handle); + } + if (ble_matter_adapter_app_task_handle) { + os_task_delete(ble_matter_adapter_app_task_handle); + } + if (ble_matter_adapter_callback_task_handle) { + os_task_delete(ble_matter_adapter_callback_task_handle); + } +#else + if (ble_matter_adapter_app_task_handle) { + os_task_delete(ble_matter_adapter_app_task_handle); + } + if (ble_matter_adapter_callback_task_handle) { + os_task_delete(ble_matter_adapter_callback_task_handle); + } + if (ble_matter_adapter_io_queue_handle) { + os_msg_queue_delete(ble_matter_adapter_io_queue_handle); + } + if (ble_matter_adapter_evt_queue_handle) { + os_msg_queue_delete(ble_matter_adapter_evt_queue_handle); + } + if (ble_matter_adapter_callback_queue_handle) { + os_msg_queue_delete(ble_matter_adapter_callback_queue_handle); + } +#endif + ble_matter_adapter_io_queue_handle = NULL; + ble_matter_adapter_evt_queue_handle = NULL; + ble_matter_adapter_callback_queue_handle = NULL; + ble_matter_adapter_app_task_handle = NULL; + ble_matter_adapter_callback_task_handle = NULL; + + ble_matter_adapter_gap_dev_state.gap_init_state = 0; + ble_matter_adapter_gap_dev_state.gap_adv_sub_state = 0; + ble_matter_adapter_gap_dev_state.gap_adv_state = 0; + ble_matter_adapter_gap_dev_state.gap_scan_state = 0; + ble_matter_adapter_gap_dev_state.gap_conn_state = 0; + + ble_matter_adapter_central_app_max_links = 0; + ble_matter_adapter_peripheral_app_max_links = 0; + + //bt matter + if (ble_matter_adapter_callback_task_handle) { + os_task_delete(ble_matter_adapter_callback_task_handle); + } + if (ble_matter_adapter_callback_queue_handle) { + os_msg_queue_delete(ble_matter_adapter_callback_queue_handle); + } + +} + + +/** @} */ /* End of group CENTRAL_CLIENT_APP_TASK */ +#endif + diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.h b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.h new file mode 100755 index 0000000..f15abbb --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.h @@ -0,0 +1,36 @@ +/** +***************************************************************************************** +* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved. +***************************************************************************************** + * @file app_task.h + * @brief Routines to create App task and handle events & messages + * @author jane + * @date 2017-06-02 + * @version v1.0 + ************************************************************************************** + * @attention + *

© COPYRIGHT 2017 Realtek Semiconductor Corporation

+ ************************************************************************************** + */ +#ifndef __BLE_MATTER_ADAPTER_APP_TASK_H_ +#define __BLE_MATTER_ADAPTER_APP_TASK_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize App task + * @return void + */ +bool ble_matter_adapter_app_send_api_msg(uint16_t sub_type, void *arg); +bool ble_matter_adapter_send_callback_msg(uint16_t msg_type, uint8_t cb_type, void *arg); +void ble_matter_adapter_callback_main_task(void *p_param); +void ble_matter_adapter_app_main_task(void *p_param); +void ble_matter_adapter_app_task_init(void); +void ble_matter_adapter_app_task_deinit(void); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.c b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.c new file mode 100755 index 0000000..f3c1a2a --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.c @@ -0,0 +1,278 @@ +#include +#if defined(CONFIG_BLE_MATTER_ADAPTER) && CONFIG_BLE_MATTER_ADAPTER +#include +#include +#include +#include +#include "platform_stdlib.h" +#include "os_sync.h" +#include +#include "ble_matter_adapter_service.h" + +/*============================================================================* + * Constants + *============================================================================*/ +#define MATTER_UUID_RX 0x11, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18 +#define MATTER_UUID_TX 0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18 +#define MATTER_UUID_C3 0x04, 0x8F, 0x21, 0x83, 0x8A, 0x74, 0x7D, 0xB8, 0xF2, 0x45, 0x72, 0x87, 0x38, 0x02, 0x63, 0x64 + +#define BT_MATTER_ADAPTER_SERVICE_C3_INDEX 0x07 + +extern T_SERVER_ID ble_matter_adapter_service_id; + +/**< Function pointer used to send event to application from ble config wifi profile. Initiated in bt_matter_adapter_service_add_service. */ +static P_FUN_SERVER_GENERAL_CB ble_matter_adapter_service_cb = NULL; + +/**< @brief profile/service definition. */ +/**should changed according BT team **/ +T_ATTRIB_APPL ble_matter_adapter_service_tbl[] = { + /* <>, .. */ + { + (ATTRIB_FLAG_VALUE_INCL | ATTRIB_FLAG_LE), /* flags */ + { /* type_value */ + LO_WORD(GATT_UUID_PRIMARY_SERVICE), + HI_WORD(GATT_UUID_PRIMARY_SERVICE), + LO_WORD(0xFFF6), /* service UUID */ + HI_WORD(0xFFF6) + }, + UUID_16BIT_SIZE, /* bValueLen */ + NULL, /* p_value_context */ + GATT_PERM_READ /* permissions */ + }, + /* <> Data RX */ + { + ATTRIB_FLAG_VALUE_INCL, /* flags */ + { /* type_value */ + LO_WORD(GATT_UUID_CHARACTERISTIC), + HI_WORD(GATT_UUID_CHARACTERISTIC), + (GATT_CHAR_PROP_WRITE | GATT_CHAR_PROP_WRITE_NO_RSP) /* characteristic properties */ + /* characteristic UUID not needed here, is UUID of next attrib. */ + }, + 1, /* bValueLen */ + NULL, + GATT_PERM_READ /* permissions */ + }, + { + ATTRIB_FLAG_VALUE_APPL | ATTRIB_FLAG_UUID_128BIT, /* flags */ + { /* type_value */ + MATTER_UUID_RX + }, + 0, /* bValueLen */ + NULL, + GATT_PERM_WRITE /* permissions */ + }, + /* <> Data TX */ + { + ATTRIB_FLAG_VALUE_INCL, /* flags */ + { /* type_value */ + LO_WORD(GATT_UUID_CHARACTERISTIC), + HI_WORD(GATT_UUID_CHARACTERISTIC), + (GATT_CHAR_PROP_READ | GATT_CHAR_PROP_INDICATE) /* characteristic properties */ + /* characteristic UUID not needed here, is UUID of next attrib. */ + }, + 1, /* bValueLen */ + NULL, + GATT_PERM_READ /* permissions */ + }, + { + ATTRIB_FLAG_VALUE_APPL | ATTRIB_FLAG_UUID_128BIT, /* flags */ + { /* type_value */ + MATTER_UUID_TX + }, + 0, /* bValueLen */ + NULL, + GATT_PERM_READ //GATT_PERM_NONE // permissions + }, + /* client characteristic configuration */ + { + ATTRIB_FLAG_VALUE_INCL | ATTRIB_FLAG_CCCD_APPL, /* flags */ + { /* type_value */ + LO_WORD(GATT_UUID_CHAR_CLIENT_CONFIG), + HI_WORD(GATT_UUID_CHAR_CLIENT_CONFIG), + /* NOTE: this value has an instantiation for each client, a write to */ + /* this attribute does not modify this default value: */ + LO_WORD(GATT_CLIENT_CHAR_CONFIG_DEFAULT), /* client char. config. bit field */ + HI_WORD(GATT_CLIENT_CHAR_CONFIG_DEFAULT) + }, + 2, /* bValueLen */ + NULL, + (GATT_PERM_READ | GATT_PERM_WRITE) /* permissions */ + }, + + /* <> C3 Data TX */ + { + ATTRIB_FLAG_VALUE_INCL, /* flags */ + { /* type_value */ + LO_WORD(GATT_UUID_CHARACTERISTIC), + HI_WORD(GATT_UUID_CHARACTERISTIC), + (GATT_CHAR_PROP_READ) /* characteristic properties */ + /* characteristic UUID not needed here, is UUID of next attrib. */ + }, + 1, /* bValueLen */ + NULL, + GATT_PERM_READ /* permissions */ + }, + { + ATTRIB_FLAG_VALUE_APPL | ATTRIB_FLAG_UUID_128BIT, /* flags */ + { /* type_value */ + MATTER_UUID_C3 + }, + 0, /* bValueLen */ + NULL, + GATT_PERM_READ //GATT_PERM_NONE // permissions + }, +}; +/*============================================================================* + * Functions + *============================================================================*/ +/** + * @brief read characteristic data from service. + * + * @param service_id ServiceID of characteristic data. + * @param attrib_index Attribute index of getting characteristic data. + * @param offset Used for Blob Read. + * @param p_length length of getting characteristic data. + * @param pp_value data got from service. + * @return Profile procedure result +*/ +T_APP_RESULT ble_matter_adapter_service_attr_read_cb(uint8_t conn_id, T_SERVER_ID service_id, + uint16_t attrib_index, uint16_t offset, uint16_t *p_length, uint8_t **pp_value) +{ + T_APP_RESULT cause = APP_RESULT_SUCCESS; + switch (attrib_index) { + case BT_MATTER_ADAPTER_SERVICE_C3_INDEX: { + T_MATTER_CALLBACK_DATA callback_data; + callback_data.msg_type = SERVICE_CALLBACK_TYPE_READ_CHAR_VALUE; + callback_data.conn_id = conn_id; + if (ble_matter_adapter_service_cb) { + ble_matter_adapter_service_cb(service_id, (void *)&callback_data); + } + *pp_value = callback_data.msg_data.write_read.p_value; + *p_length = callback_data.msg_data.write_read.len; + } + break; + default: + printf("bt_matter_adapter_service_attr_read_cb, Attr not found, index %d", attrib_index); + cause = APP_RESULT_ATTR_NOT_FOUND; + break; + } + + return (cause); +} + +/** + * @brief write characteristic data from service. + * + * @param conn_id + * @param service_id ServiceID to be written. + * @param attrib_index Attribute index of characteristic. + * @param length length of value to be written. + * @param p_value value to be written. + * @return Profile procedure result +*/ +T_APP_RESULT ble_matter_adapter_service_attr_write_cb(uint8_t conn_id, T_SERVER_ID service_id, + uint16_t attrib_index, T_WRITE_TYPE write_type, uint16_t length, uint8_t *p_value, + P_FUN_WRITE_IND_POST_PROC *p_write_ind_post_proc) +{ + T_MATTER_CALLBACK_DATA callback_data; + T_APP_RESULT cause = APP_RESULT_SUCCESS; + APP_PRINT_INFO1("bt_matter_adapter_service_attr_write_cb write_type = 0x%x", write_type); + *p_write_ind_post_proc = NULL; + + if (BT_MATTER_ADAPTER_SERVICE_CHAR_RX_INDEX == attrib_index) { + /* Make sure written value size is valid. */ + if (p_value == NULL) { + cause = APP_RESULT_INVALID_VALUE_SIZE; + } else { + /* Notify Application. */ + callback_data.msg_type = SERVICE_CALLBACK_TYPE_WRITE_CHAR_VALUE; + callback_data.conn_id = conn_id; + callback_data.msg_data.write_read.len = length; + callback_data.msg_data.write_read.p_value = p_value; + + //handle_bt_matter_adapter_app_data(p_value, length); + if (ble_matter_adapter_service_cb) { + ble_matter_adapter_service_cb(service_id, (void *)&callback_data); + } + } + } else { + APP_PRINT_ERROR2("bt_matter_adapter_service_attr_write_cb Error: attrib_index 0x%x, length %d", + attrib_index, length); + cause = APP_RESULT_ATTR_NOT_FOUND; + } + + return cause; +} + +/** + * @brief update CCCD bits from stack. + * + * @param conn_id connection id. + * @param service_id Service ID. + * @param index Attribute index of characteristic data. + * @param cccbits CCCD bits from stack. + * @return None +*/ +void ble_matter_adapter_service_cccd_update_cb(uint8_t conn_id, T_SERVER_ID service_id, uint16_t index, + uint16_t cccbits) +{ + T_MATTER_CALLBACK_DATA callback_data; + bool is_handled = false; + callback_data.conn_id = conn_id; + callback_data.msg_type = SERVICE_CALLBACK_TYPE_INDIFICATION_NOTIFICATION; + switch (index) { + case BT_MATTER_ADAPTER_SERVICE_CHAR_INDICATE_CCCD_INDEX: { + if (cccbits & GATT_CLIENT_CHAR_CONFIG_INDICATE) { + // Enable Notification + callback_data.msg_data.notification_indification_index = MATTER_NOTIFY_INDICATE_V3_ENABLE; + } else { + // Disable Notification + callback_data.msg_data.notification_indification_index = MATTER_NOTIFY_INDICATE_V3_DISABLE; + } + is_handled = true; + } + break; + default: + break; + } + /* Notify Application. */ + if (ble_matter_adapter_service_cb && (is_handled == true)) { + ble_matter_adapter_service_cb(service_id, (void *)&callback_data); + } +} + +/** + * @brief Simple ble Service Callbacks. +*/ +const T_FUN_GATT_SERVICE_CBS ble_matter_adapter_service_cbs = { + ble_matter_adapter_service_attr_read_cb, // Read callback function pointer + ble_matter_adapter_service_attr_write_cb, // Write callback function pointer + ble_matter_adapter_service_cccd_update_cb // CCCD update callback function pointer +}; + + + +/** + * @brief Add simple BLE service to the BLE stack database. + * + * @param[in] p_func Callback when service attribute was read, write or cccd update. + * @return Service id generated by the BLE stack: @ref T_SERVER_ID. + * @retval 0xFF Operation failure. + * @retval others Service id assigned by stack. + * + */ +T_SERVER_ID ble_matter_adapter_service_add_service(void *p_func) +{ + if (false == server_add_service(&ble_matter_adapter_service_id, + (uint8_t *)ble_matter_adapter_service_tbl, + sizeof(ble_matter_adapter_service_tbl), + ble_matter_adapter_service_cbs)) { + APP_PRINT_ERROR0("ble_matter_adapter_service_add_service: fail"); + ble_matter_adapter_service_id = 0xff; + return ble_matter_adapter_service_id; + } + + ble_matter_adapter_service_cb = (P_FUN_SERVER_GENERAL_CB)p_func; + return ble_matter_adapter_service_id; +} +#endif diff --git a/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.h b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.h new file mode 100755 index 0000000..8f007e2 --- /dev/null +++ b/component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.h @@ -0,0 +1,67 @@ +/* Define to prevent recursive inclusion */ +#ifndef _BLE_MATTER_ADAPTER_SERVICE_H_ +#define _BLE_MATTER_ADAPTER_SERVICE_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "platform_opts_bt.h" +/*============================================================================* + * Constants + *============================================================================*/ +#define MATTER_NOTIFY_INDICATE_V3_ENABLE 1 +#define MATTER_NOTIFY_INDICATE_V3_DISABLE 2 +//#define SIMP_NOTIFY_INDICATE_V4_ENABLE 3 +//#define SIMP_NOTIFY_INDICATE_V4_DISABLE 4 + +#define BT_MATTER_ADAPTER_SERVICE_CHAR_RX_INDEX 0x02 +#define BT_MATTER_ADAPTER_SERVICE_CHAR_TX_INDEX 0x04 +#define BT_MATTER_ADAPTER_SERVICE_CHAR_INDICATE_CCCD_INDEX (BT_MATTER_ADAPTER_SERVICE_CHAR_TX_INDEX + 1) +#define BT_MATTER_ADAPTER_SERVICE_C3_INDEX 0x07 + +typedef struct { + uint16_t len; + uint8_t *p_value; +} T_MATTER_WRITE_READ_MSG; +/** @} End of TSIMP_WRITE_MSG */ + +/** @defgroup TSIMP_UPSTREAM_MSG_DATA TSIMP_UPSTREAM_MSG_DATA + * @brief Simple BLE service callback message content. + * @{ + */ +typedef union { + uint8_t notification_indification_index; //!< ref: @ref SIMP_Service_Notify_Indicate_Info + T_MATTER_WRITE_READ_MSG write_read; +} T_MATTER_UPSTREAM_MSG_DATA; + +/** @defgroup TSIMP_CALLBACK_DATA TSIMP_CALLBACK_DATA + * @brief Simple BLE service data to inform application. + * @{ + */ +typedef struct { + uint8_t conn_id; + T_SERVICE_CALLBACK_TYPE msg_type; + T_MATTER_UPSTREAM_MSG_DATA msg_data; +} T_MATTER_CALLBACK_DATA; +/*============================================================================* + * Functions + *============================================================================*/ +T_APP_RESULT ble_matter_adapter_service_attr_read_cb(uint8_t conn_id, T_SERVER_ID service_id, + uint16_t attrib_index, uint16_t offset, uint16_t *p_length, uint8_t **pp_value); + +T_APP_RESULT ble_matter_adapter_service_attr_write_cb(uint8_t conn_id, T_SERVER_ID service_id, + uint16_t attrib_index, T_WRITE_TYPE write_type, uint16_t length, uint8_t *p_value, + P_FUN_WRITE_IND_POST_PROC *p_write_ind_post_proc); + +void ble_matter_adapter_service_cccd_update_cb(uint8_t conn_id, T_SERVER_ID service_id, uint16_t index, + uint16_t cccbits); + +T_SERVER_ID ble_matter_adapter_service_add_service(void *p_func); + +#ifdef __cplusplus +} +#endif + +#endif /* _BT_MATTER_ADAPTER_WIFI_SERVICE_H_ */ diff --git a/component/common/bluetooth/realtek/sdk/inc/app/app_common_flags.h b/component/common/bluetooth/realtek/sdk/inc/app/app_common_flags.h index 1263922..8bbcac3 100644 --- a/component/common/bluetooth/realtek/sdk/inc/app/app_common_flags.h +++ b/component/common/bluetooth/realtek/sdk/inc/app/app_common_flags.h @@ -28,4 +28,7 @@ #define F_BT_LE_5_0_SET_PHY_SUPPORT 0 #endif +#if defined(CONFIG_MATTER) && ( CONFIG_MATTER==1 ) +#include +#endif #endif diff --git a/component/common/file_system/dct/dct.h b/component/common/file_system/dct/dct.h index aac4c2f..139d172 100644 --- a/component/common/file_system/dct/dct.h +++ b/component/common/file_system/dct/dct.h @@ -195,10 +195,6 @@ int32_t dct_delete_variable_new(dct_handle_t *dct_handle, const char *variable_n */ int32_t dct_remain_variable(dct_handle_t *dct_handle); -#if defined(CONFIG_MATTER) && CONFIG_MATTER -#include -#endif - /*\@}*/ #endif // #ifndef __RTK_DCT_H__ diff --git a/component/common/file_system/dct/dct2.h b/component/common/file_system/dct/dct2.h new file mode 100644 index 0000000..ef9e2e2 --- /dev/null +++ b/component/common/file_system/dct/dct2.h @@ -0,0 +1,160 @@ +/** + ****************************************************************************** + * @file dct.h + * @author + * @version + * @brief Device Configuration Table API for storing information in NVRAM(flash). + ****************************************************************************** + * @attention + * + * This module is a confidential and proprietary property of RealTek and possession or use of this module requires written permission of RealTek. + * + * Copyright(c) 2016, Realtek Semiconductor Corporation. All rights reserved. + ****************************************************************************** + */ +#ifndef __RTK_DCT2_H__ +#define __RTK_DCT2_H__ + +#include +#include +#include + +/** + * @brief Format device configuration table. + * @param[in] begin_address : DCT begin address of flash + * @param[in] module_number : total module number + * @param[in] variable_name_size : size of variable name + * @param[in] variable_value_size : size of variable size + * @param[in] enable_backup : enable backup function to backup module, it need double module size + * @param[in] enable_wear_leveling : enable wear leveling function, it need sextuple module size + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_format2(uint32_t begin_address, uint16_t module_number, uint16_t variable_name_size, uint16_t variable_value_size, uint8_t enable_backup, + uint8_t enable_wear_leveling); + +/** + * @brief Initialize device configuration table. + * @param[in] begin_address : DCT begin address of flash + * @param[in] module_number : total module number + * @param[in] variable_name_size : size of variable name + * @param[in] variable_value_size : size of variable size + * @param[in] enable_backup : enable backup function to backup module, it need double module size + * @param[in] enable_wear_leveling : enable wear leveling function, it need sextuple module size + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_init2(uint32_t begin_address, uint16_t module_number, uint16_t variable_name_size, uint16_t variable_value_size, uint8_t enable_backup, + uint8_t enable_wear_leveling); + +/** + * @brief Deinitialize device configuration table. + */ +void dct_deinit2(void); + +/** + * @brief Register module in DCT. + * @param[in] module_name : module name + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_register_module2(const char *module_name); + +/** + * @brief Unregister and delete module in DCT. + * @param[in] module_name : module name + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_unregister_module2(const char *module_name); + +/** + * @brief Open module in DCT. + * @param[out] dct_handle : setup module informations in dct handler + * @param[in] module_name : module name + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_open_module2(dct_handle_t *dct_handle, const char *module_name); + +/** + * @brief Close module in DCT. + * @param[in] dct_handle : dct handler + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_close_module2(dct_handle_t *dct_handle); + +/** + * @brief Write variable name and value in opened module. + * @param[in] dct_handle : dct handler + * @param[in] variable_name : variable name which you want to store in module + * @param[in] variable_value : variable value which you want to store in module + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_set_variable2(dct_handle_t *dct_handle, const char *variable_name, const char *variable_value); + +/** + * @brief Write variable name and value in opened module. + * @param[in] dct_handle : dct handler + * @param[in] variable_name : variable name which you want to store in module + * @param[in] variable_value : variable value which you want to store in module + * @param[in] variable_value_length : variable value length which you want to store in module + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_set_variable_new2(dct_handle_t *dct_handle, const char *variable_name, const char *variable_value, uint16_t variable_value_length); + +/** + * @brief read value of variable name in opened module. + * @param[in] dct_handle : dct handler + * @param[in] variable_name : variable name which you want to get from module + * @param[out] buffer : read variable value + * @param[in] buffer_size : the buffer size + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_get_variable2(dct_handle_t *dct_handle, const char *variable_name, const char *buffer, uint16_t buffer_size); + +/** + * @brief read value of variable name in opened module. + * @param[in] dct_handle : dct handler + * @param[in] variable_name : variable name which you want to get from module + * @param[out] buffer : read variable value + * @param[in-out] buffer_size : in: the buffer size, out: the real length of variable value + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_get_variable_new2(dct_handle_t *dct_handle, const char *variable_name, const char *buffer, uint16_t *buffer_size); + +/** + * @brief delete variable name and value in opened module. + * @param[in] dct_handle : dct handler + * @param[in] variable_name : variable name which you want to delete in module + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_delete_variable2(dct_handle_t *dct_handle, const char *variable_name); + +/** + * @brief delete variable name and value in opened module. + * @param[in] dct_handle : dct handler + * @param[in] variable_name : variable name which you want to delete in module + * @return 0 : SUCCESS + * @return <0 : ERROR + */ +int32_t dct_delete_variable_new2(dct_handle_t *dct_handle, const char *variable_name); + +/** + * @brief Remaining variable amount in opened module. + * @param[in] dct_handle : dct handler + * @return integer : Remaining variable amount + * @return <0 : ERROR + */ +int32_t dct_remain_variable2(dct_handle_t *dct_handle); + +/*\@}*/ + +#endif // __RTK_DCT2_H__ + diff --git a/component/common/file_system/littlefs/littlefs_adapter.c b/component/common/file_system/littlefs/littlefs_adapter.c index 53688dd..e185de3 100644 --- a/component/common/file_system/littlefs/littlefs_adapter.c +++ b/component/common/file_system/littlefs/littlefs_adapter.c @@ -17,10 +17,8 @@ struct lfs_config g_lfs_cfg = { .read_size = 1, .prog_size = 1, .block_size = 4096, -#ifndef CONFIG_USE_FLASHCFG .block_count = LFS_DEVICE_SIZE / 4096, .lookahead_size = (LFS_DEVICE_SIZE / 4096 / 8) * 8, -#endif .cache_size = 256, .block_cycles = 100, }; @@ -104,4 +102,4 @@ int lfs_diskio_unlock(const struct lfs_config *c) rtw_mutex_put(&lfs_op_mux); return LFS_ERR_OK; } -#endif \ No newline at end of file +#endif diff --git a/component/common/file_system/littlefs/r2.9.1/lfs_util.h b/component/common/file_system/littlefs/r2.9.1/lfs_util.h index 3287057..a1f866c 100644 --- a/component/common/file_system/littlefs/r2.9.1/lfs_util.h +++ b/component/common/file_system/littlefs/r2.9.1/lfs_util.h @@ -21,6 +21,8 @@ #else // System includes +#include +#include #include #include #include diff --git a/component/common/mbed/hal/pwmout_api.h b/component/common/mbed/hal/pwmout_api.h index 840fff7..2c8049f 100644 --- a/component/common/mbed/hal/pwmout_api.h +++ b/component/common/mbed/hal/pwmout_api.h @@ -124,6 +124,12 @@ void pwmout_pulsewidth_ms(pwmout_t* obj, int ms); */ void pwmout_pulsewidth_us(pwmout_t* obj, int us); +/** + * @brief Start the PWM device of the specified channel. + * @param obj: PWM object define in application software. + * @retval none + */ +void pwmout_start(pwmout_t *obj); ///@} #if (defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)) || (defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1))|| (defined(CONFIG_PLATFORM_8710C) && (CONFIG_PLATFORM_8710C == 1)) diff --git a/component/common/mbed/hal_ext/flash_api.h b/component/common/mbed/hal_ext/flash_api.h index 2dfedda..a36ab17 100644 --- a/component/common/mbed/hal_ext/flash_api.h +++ b/component/common/mbed/hal_ext/flash_api.h @@ -167,11 +167,8 @@ void flash_reset_status(flash_t *obj); * @param data: Pointer to a byte array that is to be written. * @retval 1: Success */ -#if defined(CONFIG_MATTER) && CONFIG_MATTER int flash_burst_write(flash_t *obj, uint32_t address, uint32_t Length, const uint8_t *data); -#else -int flash_burst_write(flash_t *obj, uint32_t address, uint32_t Length, uint8_t *data); -#endif + /** * @brief It is the same with flash_stream_read function which is used to read a stream of data from specified address * @param obj: Flash object define in application software. diff --git a/component/common/mbed/targets/hal/rtl8710c/flash_api.c b/component/common/mbed/targets/hal/rtl8710c/flash_api.c index 265a037..6b4f8c1 100644 --- a/component/common/mbed/targets/hal/rtl8710c/flash_api.c +++ b/component/common/mbed/targets/hal/rtl8710c/flash_api.c @@ -317,16 +317,13 @@ Users can use either of functions depending on their needs. * @retval status: Success:1 or Failure: Others. */ -#if defined(CONFIG_MATTER) && CONFIG_MATTER + int flash_burst_write(flash_t *obj, uint32_t address, uint32_t Length, const uint8_t *data) -#else -int flash_burst_write(flash_t *obj, uint32_t address, uint32_t Length, uint8_t *data) -#endif { flash_init(obj); flash_resource_lock(); - hal_flash_burst_write((obj->phal_spic_adaptor), Length, address, data); + hal_flash_burst_write((obj->phal_spic_adaptor), Length, address, (uint8_t *)data); flash_resource_unlock(); return 1; } diff --git a/component/common/network/lwip/lwip_v2.1.3/src/core/netif.c b/component/common/network/lwip/lwip_v2.1.3/src/core/netif.c index 7d33dc9..426a20c 100644 --- a/component/common/network/lwip/lwip_v2.1.3/src/core/netif.c +++ b/component/common/network/lwip/lwip_v2.1.3/src/core/netif.c @@ -1530,6 +1530,15 @@ netif_create_ip6_linklocal_address(struct netif *netif, u8_t from_mac_48bit) LWIP_ASSERT("netif_create_ip6_linklocal_address: invalid netif", netif != NULL); +#if defined(CONFIG_MATTER) && CONFIG_MATTER + /*Realtek Added Start*/ + if(ip6_addr_isvalid(netif_ip6_addr_state(netif, 0))){ + printf("IPv6 Linklocal address already exist\n"); + return; + } + /*Realtek Added End*/ +#endif + /* Link-local prefix. */ ip_2_ip6(&netif->ip6_addr[0])->addr[0] = PP_HTONL(0xfe800000ul); ip_2_ip6(&netif->ip6_addr[0])->addr[1] = 0; diff --git a/component/common/network/lwip/lwip_v2.1.3/src/include/lwip/inet.h b/component/common/network/lwip/lwip_v2.1.3/src/include/lwip/inet.h index 2982a0f..696cdef 100644 --- a/component/common/network/lwip/lwip_v2.1.3/src/include/lwip/inet.h +++ b/component/common/network/lwip/lwip_v2.1.3/src/include/lwip/inet.h @@ -55,6 +55,10 @@ extern "C" { typedef u32_t in_addr_t; #endif +#if defined(CONFIG_MATTER) && CONFIG_MATTER +typedef __uint32_t in_addr_t; +#endif + struct in_addr { in_addr_t s_addr; }; diff --git a/component/soc/realtek/8710c/cmsis/rtl8710c/include/core_tm9_cache.h b/component/soc/realtek/8710c/cmsis/rtl8710c/include/core_tm9_cache.h index a8b363e..a83405a 100644 --- a/component/soc/realtek/8710c/cmsis/rtl8710c/include/core_tm9_cache.h +++ b/component/soc/realtek/8710c/cmsis/rtl8710c/include/core_tm9_cache.h @@ -195,7 +195,7 @@ __STATIC_INLINE void SCB_NS_EnableDCache (void) __STATIC_INLINE void SCB_DisableDCache (void) { #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) - #if __cplusplus >= 201703L //C++ 17 and above + #if defined(__cplusplus) && (__cplusplus >= 201703L) //C++ 17 and above uint32_t ccsidr; uint32_t sets; uint32_t ways; diff --git a/component/soc/realtek/8710c/misc/bsp/lib/common/GCC/lib_dct.a b/component/soc/realtek/8710c/misc/bsp/lib/common/GCC/lib_dct.a index db477c0778ed68ecf8ac5c836c71f36d7bdf7738..e291a558cd1132b0a764947994287571abced1b8 100644 GIT binary patch delta 9097 zcmcIp3sjR=p1)rJg$S4gVnBR^mxw4PUmhe@1;irRB5DP7_SA_%f>05Zmr-m3wbP=a zRd2_wS{-bAW~|3?q_JJpvDK;Dv8_8(I(Ap5?`^l$U1!9ub=e&|?*D(k`(e0v&hDAc zekb?-?*Dn;&m8`}=A|o^ky=xk(TEICoUs>1C4JttzC$a|~nL zD=%YKR)W6;yqe9m^{ZsE%8O)`zp`bOx6a?{uTxpRD&JZtoJ{7-Dfce+%quG_uXy-D znap1>x1#jHFixmNQ!7QQBa!Zi9TU0}u{C;-6WS5GuO#Sl5wEwnqO7Rgv!KlD&2?EU z4v}Nc6FD|nR#%WT7Q?^qnGE1{?P3ZmD zI}uV3{jDxl8clENQpU%0U5L%lSaZZj0d*h`RI zSZt#o7_xx(onfMMjgC*qcV2JLsX5sBVdsRot>m>=EXAnTQA|$n8z2@bXT+6Jo{`K} z%i@Oqh{*EK$QyK>Hj%D1Mbo1R&nB$-MTw`7XHd*=C0(5Ov$%ixF0%MSPfkF}3EtMy zkw%AfBQ(qSah&uMnv$NJviG5sK+eep{dZ?9EFOLQ%+>y9_IUO%^F4GydWyaa6>q`u0_uCe9c8bjaC z+$P1)ib>O@Uiza+)`z-}ZJsmXIDAko=#6EA4gn<#ChdA7yw)t)%!IVVumQ|VdBwBwFM z?ybIO2lLFF7Hz}%68AEeA}8=b&rUsNVOaoFq_W| zB9k-__U`c0!e4wg_@3th*x$`fwX5oV z%`J_g{0ACFq-IvlFvIx*j|Fx9X7%vmt*r`}XPGU5%w?gYg}O-E(5?lneV}PQ@(ft1C-nfqs>5fg>DuUMXpkWSeSh|J>6K#Pwmi`!GEqxVY z9sK}eJ^dD9BQ=&yl;T5W2RO_+}r%H=kJo{NK!;Y}BRj>+L9pa(d>J(jD^TZRQ)h#-* zy2Z?7%djJ?RrDj%$Co4ohv^MF*2{Uryt_qT_dC~$HL=--Svf7@DcY7N7RWZNa&|cQ zUSINe;oCxjvaAoeMAEZM$8r9!OXK~vfr$~Rdc2bjyEsDUBLDwzaa690Oq<;sY3njO z6jK+G7-aXr?{Rzlo|i|1czYxywBQHXn&3j1Guk%@`CG)d2x;W>9*zeQe?`daoQ{P# zsy$0cBFD*yzb0fRr{{27hzMaLBKUt25&Z8)go%Fy@z*3sUdIGDJkJq#GR;ERY7iF_ zav5bb%uj;FZ%9Yib~tmNpx%&`P9o{&d4UBz)D=i|8s2Spbm z)O{yn7qkK5UKj+=u>`a|$8L@fxo48g_ z$RtE;IgTzwuq#F^1;N8yP>J{tgzV!AM>+o#$4h`%gUg6egO3oOfi6OXF8ngox9abu z5qMkCen_3GH`319%$Sd1Vk74h`dV#J`jk2!y%F;{G&k@x3+b`dTZ0A^pHr?mh`C6g zCB)9L6cJkfhn%kA*vfG$$8JPufTNr~&++%1k9)NCZJ0HPX9*djU?rJ~2{3eVK>^1l zoL|Z5M>)1~?Bw_?$DeY1h2tqi=#BSjU;Xsi&3q)Y$pDjrO$KNNHW@a*n_ zniG$*8VYleA#GjrXsCb9$p~1~UtTvsiK#`3gw(ZlDM}p09{=d~R&AG$289^q#P}1X#=0eed`eHfMt@2(ul*eB&X+cxs2xSX`bnV*~T!rKg+Y zHTQYJN~Xt~lQnMT`O3oHt)Rf|Ey)^(@>1orvj?j@_Rb}_naGWAU-){(U#+b8YG$He zwTzQEhdq*kMjqFMXR@&OD?1}>3eRa_RG#vh#a+V*1YWgF5|rh=Kq5W9K6)?}rM9pl zh@v;vkGLm9ijNPFkK|p5PU421QP8?Npi?ZPl*0t@VuxH@-wTY1ANrIHp3)VYxS?ku z^p~{({cYL*5DjkV(dgz=d1INTWjJF41dkSsL9UYS=Uh2=}HeX@L45zC^b`{2A@plofRmR^W2#dp?2oZ_p@G*Z}KGppHQSjFf%XvF22kNK#dt33R9jwp* zEqvT${DWY=HW79UYykZ=p#Yt9*W;#O47ditV1vyx5`tGl^;5Hp0=@9c>)^K43rbl0 zGze<(vju-uV_;uadxPr%kW9s&lN2BY-vw}p8$UYCfS@{@D>y7258E26P=VrN(8FQc z5j4412>Jog$E&IOsTF!euy{!>n6gH?mpISg7pQO+HMMV3)at@A=mp@<8mL~ zn9G(!AA>5^eJTXC?yrgdQkBCHsIX71%PWe%dyRP+90nj`bckE4>hK-G;e`xBma*ya zmQbXHUVI)=JRqtbu#2!pYL}Wbq3c+8;E6fBQti~&VG91YpnnzgQB(cYD%=*VqgTNA z;x)iSfttS&&UWGXpPzjHCeec)l;+;_I7_7`Oh&t4-k$@TFDpJC+{251oGt?WQbE59 zx+j)3Sc#w?U8Sra*yJ<93hV_vTvq_t_Z)bLL=QB2vrc-B-h9HO@8r3tItLiHTj0Jx z3pbmLCplMb!xzEdXxgVu(Em=5yh3+@{vQPHuRwns(;o?KicP6{`hJ#k`D#Re2{2SqW@NqETz)ZCjDrbv*Gn$HCV1}K@u1& zSCJsu4w875`*JRk`MBN>k^nt7D#6$$ND`*QGZ>TX7bF=VsX&STj3C)SZ$51@;>Lj` zR`Ylt^v5y%_>n^;f24(-FuMirXe<1Q!t|F3l6txe^fw9I)1W_@>F*UJU(nAxP3~TS z`(L16jRoW%CNW$V^t{x%#bmrAa64^;SXpi+SRlgdd6IU3zDwX<2mJ)5zg&>qrF~mW zvswl2URXC<)XB|DhPmt!^y2df@u6SiDM8Wzk~Eg%CxT=bUANUlk8h2RQ~PGAi;y;^ zn*qxx=7ZY?e(%$BTTO;(z=fq~t-^!YO=lmR6z6ioJ3zd0UxfcQ52i$2od@?=Q|%BAJ^OO$%xarocIP?r>~6W*XRq@6svK3W zO4;wvbNJ*ccctHMaaUJ6S9)cOY@cqmPM6)&EbbW=>kK%{`*yFV?b^7|#Uqbs{s)JH B8P5O! delta 1148 zcmb_b&1+LZ5Z`%8w8Tb8Lrqemtkjw+*zWh+6c3exM8tYgC{&2~L_9Shrk(=c1Pj$Y zL_|cvgB~S^Uc7ks;7u$j{tHE_hhE%$wQ1c5UL2U6ncwWpZ)e}zSD)jrH-q(wE|Y|Y zGE^87?Bw8zap)3}+)N^biU`F%?CR(pg#LqG{%e!9X9ykC=a%$e`ewa9509aLJAMmB z_NMA@CSHu}NB56DEq9ebmCD8IiwoB-U0tkHX2O!DK2qX;BAO8GBUJeaAF2}4-xGE{ zdQG(7niA%fQR+9M%qOGV8$(ku)JLka-#Q#B^Y245;*&AP%+jaHW&h|*`IJoi19Rdt z@}Xh4p#5)4spFu`qo3Kh`$ndH_n37`+&Z~{=*UnN8NLe&=^_YiO)h5d)m-T0fS9fA zd_biO0>&f5X_OK!1=7rS@@pc!d!rW{IBV [optional argument]" + echo "IC type: amebaz2 / amebaz2plus / amebad" + exit 1 +fi + +AMEBA="$1" + +files_to_delete=( + "$PWD/component/soc/realtek/8710c/misc/utilities/include/ctype.h" +) + +AMEBAZPLUS_PROJECT="$PWD/project/realtek_amebaz2plus_v0_example" +AMEBAZ2_PROJECT="$PWD/project/realtek_amebaz2_v0_example" +MATTER_AMEBAZ2_DIR="$PWD/component/common/application/matter/project/amebaz2" +MATTER_AMEBAZ2PLUS_DIR="$PWD/component/common/application/matter/project/amebaz2plus" + +if [ ! -d third_party ];then + mkdir third_party +else + rm third_party/connectedhomeip +fi + +cd third_party +rm -rf connectedhomeip +ln -s ../../connectedhomeip connectedhomeip + +cd ../ + +if [ ! -d component/common/application/matter ] || [ -z "$(find component/common/application/matter -mindepth 1)" ]; then + mkdir -p component/common/application/matter + git clone https://github.com/Ameba-AIoT/ameba-rtos-matter.git component/common/application/matter +fi + +delete_files() { + for file_path in "${files_to_delete[@]}"; do + if [ -e "$file_path" ]; then + rm "$file_path" + echo "File $file_path removed." + fi + done +} + +modify_makefiles() { + find "$BASE_DIR" -type f -name "Makefile" | while read -r FILE; do + if grep -q "ENABLE_MATTER = 0" "$FILE"; then + echo "Modifying $FILE" + sed -i 's/^ENABLE_MATTER = 0/ENABLE_MATTER = 1/' "$FILE" + fi + done +} + +case "$AMEBA" in + amebaz2) + BASE_DIR="$AMEBAZ2_PROJECT" + MATTER_DIR="$MATTER_AMEBAZ2_DIR" + echo "Configuring for $AMEBA" + delete_files + modify_makefiles + ;; + amebaz2plus) + BASE_DIR="$AMEBAZPLUS_PROJECT" + MATTER_DIR="$MATTER_AMEBAZ2PLUS_DIR" + echo "Configuring for $AMEBA" + delete_files + modify_makefiles + ;; + amebad) + echo "Configuring for $AMEBA" + ;; + *) + echo "Invalid argument. Expected 'amebaz2', 'amebaz2plus', or 'amebad'." + exit 1 + ;; +esac + +echo "Matter setup complete" diff --git a/project/realtek_amebaz2_v0_example/GCC-RELEASE/Makefile b/project/realtek_amebaz2_v0_example/GCC-RELEASE/Makefile index 19ef8f6..8784c4c 100644 --- a/project/realtek_amebaz2_v0_example/GCC-RELEASE/Makefile +++ b/project/realtek_amebaz2_v0_example/GCC-RELEASE/Makefile @@ -29,3 +29,27 @@ setup: dump: @$(MAKE) -f application.is.mk dump + +#*****************************************************************************# +# MATTER MAKE DEFINES # +#*****************************************************************************# + +ENABLE_MATTER = 0 + +ifeq ($(ENABLE_MATTER), 1) + +BASEDIR = $(shell pwd) +MATTER_BUILDDIR = $(shell pwd)/../../../component/common/application/matter/project/amebaz2 + +include $(MATTER_BUILDDIR)/Makefile + +.PHONY: is_matter +is_matter: toolchain_matter + cp $(MATTER_BUILDDIR)/partition_matter.json partition.json + @$(MAKE) -f application.is.matter.mk + +.PHONY: clean_matter +clean_matter: + @$(MAKE) -f application.is.matter.mk clean + +endif diff --git a/project/realtek_amebaz2_v0_example/GCC-RELEASE/application.is.matter.mk b/project/realtek_amebaz2_v0_example/GCC-RELEASE/application.is.matter.mk new file mode 100644 index 0000000..2945afc --- /dev/null +++ b/project/realtek_amebaz2_v0_example/GCC-RELEASE/application.is.matter.mk @@ -0,0 +1,1117 @@ +SHELL = /bin/bash +OS := $(shell uname) + +# Initialize Directory +# ------------------------------------------------------------------- + +AMEBAZ2_TOOLDIR = ../../../component/soc/realtek/8710c/misc/iar_utility +AMEBAZ2_GCCTOOLDIR = ../../../component/soc/realtek/8710c/misc/gcc_utility +AMEBAZ2_BSPDIR = ../../../component/soc/realtek/8710c/misc/bsp +AMEBAZ2_BOOTLOADERDIR = $(AMEBAZ2_BSPDIR)/image +AMEBAZ2_ROMSYMDIR = $(AMEBAZ2_BSPDIR)/ROM + +# Matter Directory +# ------------------------------------------------------------------- + +BASEDIR := $(shell pwd) +SDKROOTDIR = $(BASEDIR)/../../.. +MATTER_DIR = $(SDKROOTDIR)/component/common/application/matter +MATTER_BUILDDIR = $(MATTER_DIR)/project/amebaz2 + +MATTER_INCLUDE = $(MATTER_BUILDDIR)/Makefile.include.matter +MATTER_INCLUDE_APP = $(MATTER_BUILDDIR)/Makefile.include.app.list + +# Dump addresses +# ------------------------------------------------------------------- + +DUMP_START_ADDRESS = 0x98000000 +DUMP_END_ADDRESS = 0x98200000 + +# Version control +# ------------------------------------------------------------------- + +FREERTOS_VERSION = freertos_v10.0.1 +LWIP_VERSION = lwip_v2.1.3 + +# Initialize Toolchain related +# ------------------------------------------------------------------- + +CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi- + +AR = $(CROSS_COMPILE)ar +CC = $(CROSS_COMPILE)gcc +AS = $(CROSS_COMPILE)as +NM = $(CROSS_COMPILE)nm +LD = $(CROSS_COMPILE)gcc +GDB = $(CROSS_COMPILE)gdb +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump + +LDSCRIPT := $(MATTER_BUILDDIR)/rtl8710c_ram_matter.ld + +# Initialize target name and target object files +# ------------------------------------------------------------------- + +all: build_info application_is manipulate_images + +mp: build_info application_is manipulate_images + +TARGET=application_is + +OBJ_DIR=$(TARGET)/Debug/obj +BIN_DIR=$(TARGET)/Debug/bin +INFO_DIR=$(TARGET)/Debug/info +BOOT_BIN_DIR=bootloader/Debug/bin + +ROMIMG = + +# Decide if 64 bit time wrapper is to be included +# ------------------------------------------------------------------- +#SYSTEM_TIME64_MAKE_OPTION = 1 + +# Include folder list +# ------------------------------------------------------------------- + +INCLUDES = +INCLUDES += -I../inc + +INCLUDES += -I../../../component/common/api +INCLUDES += -I../../../component/common/api/at_cmd +INCLUDES += -I../../../component/common/api/platform +INCLUDES += -I../../../component/common/api/wifi +INCLUDES += -I../../../component/common/api/wifi/rtw_wpa_supplicant/src +INCLUDES += -I../../../component/common/api/wifi/rtw_wpa_supplicant/src/crypto +INCLUDES += -I../../../component/common/api/network/include +INCLUDES += -I../../../component/common/application +INCLUDES += -I../../../component/common/application/mqtt/MQTTClient +INCLUDES += -I../../../component/common/application/mqtt/MQTTPacket/V5 +INCLUDES += -I../../../component/common/application/mqtt/MQTTPacket +INCLUDES += -I../../../component/common/example +INCLUDES += -I../../../component/common/file_system +INCLUDES += -I../../../component/common/file_system/dct +INCLUDES += -I../../../component/common/file_system/fatfs +INCLUDES += -I../../../component/common/file_system/fatfs/r0.10c/include +INCLUDES += -I../../../component/common/file_system/ftl +INCLUDES += -I../../../component/common/file_system/littlefs +INCLUDES += -I../../../component/common/file_system/littlefs/r2.9.1 +INCLUDES += -I../../../component/common/utilities +INCLUDES += -I../../../component/common/mbed/hal +INCLUDES += -I../../../component/common/mbed/hal_ext +INCLUDES += -I../../../component/common/mbed/targets/hal/rtl8710c +INCLUDES += -I../../../component/common/network +INCLUDES += -I../../../component/common/network/coap/include +INCLUDES += -I../../../component/common/network/libcoap/include +INCLUDES += -I../../../component/common/network/http2/nghttp2-1.31.0/includes +INCLUDES += -I../../../component/common/network/ssl/ssl_ram_map/rom +INCLUDES += -I../../../component/common/drivers/wlan/realtek/include +INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/osdep +INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/core/option +INCLUDES += -I../../../component/common/test +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/app +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/gap +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/profile/client +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/profile/server +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/os +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/platform +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/stack +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/lib/GCC +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/os +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/vendor_cmd +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_config +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_central +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_ancs +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/gap +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/inc/amebaz2 +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/platform +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/common +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/provisioner +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_device_rtk_demo +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/common/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config +INCLUDES += -I../../../component/common/application/airsync/1.0.4 +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test +#INCLUDES += -I../../../component/common/application/jdsmart/2.1.22/joylink_ble/include + +INCLUDES += -I../../../component/soc/realtek/8710c/cmsis/rtl8710c/include +INCLUDES += -I../../../component/soc/realtek/8710c/cmsis/rtl8710c/lib/include +INCLUDES += -I../../../component/soc/realtek/8710c/fwlib/include +INCLUDES += -I../../../component/soc/realtek/8710c/fwlib/lib/include +INCLUDES += -I../../../component/soc/realtek/8710c/cmsis/cmsis-core/include +INCLUDES += -I../../../component/soc/realtek/8710c/app/rtl_printf/include +INCLUDES += -I../../../component/soc/realtek/8710c/app/shell +INCLUDES += -I../../../component/soc/realtek/8710c/app/stdio_port +INCLUDES += -I../../../component/soc/realtek/8710c/misc/utilities/include +INCLUDES += -I../../../component/soc/realtek/8710c/mbed-drivers/include +INCLUDES += -I../../../component/soc/realtek/8710c/misc/platform +INCLUDES += -I../../../component/soc/realtek/8710c/misc/driver +INCLUDES += -I../../../component/soc/realtek/8710c/misc/os + +INCLUDES += -I../../../component/os/freertos +INCLUDES += -I../../../component/os/freertos/$(FREERTOS_VERSION)/Source/include +INCLUDES += -I../../../component/os/freertos/$(FREERTOS_VERSION)/Source/portable/GCC/ARM_RTL8710C +INCLUDES += -I../../../component/os/os_dep/include + +INCLUDES += -I../../../component/common/application/amazon/amazon-ffs/ffs_demo/common/include +INCLUDES += -I../../../component/common/application/amazon/amazon-ffs/ffs_demo/realtek/configs + +# Source file list +# ------------------------------------------------------------------- + +SRC_C = +SRAM_C = +ERAM_C = +#bluetooth - board +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/bt_fwconfig.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/bt_mp_patch.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/bt_normal_patch.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/cycle_queue.c +SRC_C += ../../../component/common/file_system/ftl/ftl.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/hci_board.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/hci_uart.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/os/freertos/osif_freertos.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/platform_utils.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/rtk_coex.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/trace_uart.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/vendor_cmd/vendor_cmd.c + +#bluetooth - common +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/ancs_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/bas.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/bas_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/bt_uart_bridge.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/dis.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/gaps_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/hci_adapter.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/hci_process.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hids.c +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hids_kb.c +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hids_rmc.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/simple_ble_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/simple_ble_service.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/ota_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/dfu_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/trace_task.c + +#bluetooth - example - ble_central +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_at_cmd.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_client_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/gcs_client.c + +#bluetooth - example - ble_peripheral +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/ble_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/ble_peripheral_at_cmd.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/peripheral_app.c + +#bluetooth - example - ble_matter_adapter +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.c + +#bluetooth - example - ble_scatternet +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet/ble_scatternet_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet/ble_scatternet_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet/ble_scatternet_app_task.c + +#bluetooth - example - bt_fuzz_test +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_at_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_link_mgr.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_simple_ble_service.c \ + ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/gls.c \ + ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hrs.c \ + ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/ias.c +#bluetooth - example - bt_beacon +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_beacon/bt_beacon_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_beacon/bt_beacon_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_beacon/bt_beacon_app_task.c + +#bluetooth - example - bt_config +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_peripheral_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_service.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_wifi.c + +#bluetooth - example - bt_airsync_config +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config/bt_airsync_config_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config/bt_airsync_config_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config/bt_airsync_config_peripheral_app.c +SRC_C += ../../../component/common/application/airsync/1.0.4/airsync_ble_service.c +SRC_C += ../../../component/common/application/airsync/1.0.4/check_endian.c +SRC_C += ../../../component/common/application/airsync/1.0.4/epb.c +SRC_C += ../../../component/common/application/airsync/1.0.4/epb_MmBp.c +SRC_C += ../../../component/common/application/airsync/1.0.4/epb_WristBand.c +SRC_C += ../../../component/common/application/airsync/1.0.4/wechat_airsync_protocol.c + +#bluetooth - example - bt_ota_central_client +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_link_mgr.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_test_image.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_at_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/insert_write.c + +#bluetooth - example - bt_datatrans +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_app_queue.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_at_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_at_hci_cmd_process.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_central_application.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_module_param_config.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_multilink_manager.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_peripheral_application.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_profile.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_uart.c + +#bluetooth - example - bt_ancs +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs_main.c + +#bluetooth - example - bt_joylink_adapter +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_peripheral_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_service.c + +#bluetooth - example - ble_google_seamless +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/ble_google_seamless_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/ble_google_seamless_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/ble_google_seamless_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/google_seamless.c + +#bluetooth - example - bt_mesh_device_matter +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_adapter_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_cmd.c + +#bluetooth - example - bt_mesh_provisioner +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/provisioner/bt_mesh_provisioner_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/client_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/rmt_prov_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/configuration_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/directed_forwarding_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_distribution_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_property_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/private_beacon_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/light_cwrgb_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/subnet_bridge_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/bt_mesh_provisioner_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/bt_mesh_provisioner_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/provisioner_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/provisioner_cmd.c + +#bluetooth - example - bt_mesh_device +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/bt_mesh_device_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/device_idle_check.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/bt_mesh_device_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/bt_mesh_device_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/device_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/device_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_updater_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scene_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scheduler_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/sensor_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/time_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_execution.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_admin_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_client_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_manufacturer_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_transition_time.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_user_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_temperature_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_hue_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_saturation_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c + +#bluetooth - example - bt_mesh_provisioner_rtk_demo +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/example_bt_mesh_provisioner_rtk_demo.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_app_http_intf.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_app_lib_intf.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_app_list_intf.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_broadcast_demo.c + +#bluetooth - example - bt_mesh_device_rtk_demo +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_device_rtk_demo/example_bt_mesh_device_rtk_demo.c + +#bluetooth - example - bt_mesh_test +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_app_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_datatrans_write_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_device_test.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_malloc_free.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_receive_response.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_test_result.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_timer_handler.c + +#bluetooth - example - provisioner_multiple_profile +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/provisioner/bt_mesh_provisioner_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/client_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/rmt_prov_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/configuration_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/directed_forwarding_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_distribution_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_property_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/private_beacon_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/light_cwrgb_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/subnet_bridge_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/bt_mesh_provisioner_multiple_profile_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/bt_mesh_provisioner_multiple_profile_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/provisioner_multiple_profile_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/provisioner_multiple_profile_cmd.c + +#bluetooth - example - device_multiple_profile +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/bt_mesh_device_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/device_idle_check.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_updater_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scene_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scheduler_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/sensor_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/time_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_execution.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_admin_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_client_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_manufacturer_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_transition_time.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_user_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_temperature_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_hue_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_saturation_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/bt_mesh_device_multiple_profile_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/bt_mesh_device_multiple_profile_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/device_multiple_profile_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/device_multiple_profile_cmd.c + +#bluetooth - example - ble_throughput_test +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_200.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_200_sut.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_link_mgr.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_test_case.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_vendor_tp_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_vendor_tp_service.c + +#bluetooth - example +SRC_C += ../../../component/common/bluetooth/realtek/sdk/bt_example_entry.c + +#cmsis +SRC_C += ../../../component/soc/realtek/8710c/cmsis/rtl8710c/source/ram_s/app_start.c +SRC_C += ../../../component/soc/realtek/8710c/cmsis/rtl8710c/source/ram/mpu_config.c +SRC_C += ../../../component/soc/realtek/8710c/cmsis/rtl8710c/source/ram/sys_irq.c + +#libc api wrapper +SRC_C += ../../../component/soc/realtek/8710c/misc/utilities/source/ram/libc_wrap.c + +#console +SRC_C += ../../../component/common/api/at_cmd/atcmd_bt.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_lwip.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_mp.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_mp_ext2.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_sys.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_wifi.c +SRC_C += ../../../component/soc/realtek/8710c/app/shell/cmd_shell.c +SRC_C += ../../../component/soc/realtek/8710c/app/shell/ram_s/consol_cmds.c +SRC_C += ../../../component/common/api/at_cmd/log_service.c +SRC_C += ../../../component/soc/realtek/8710c/misc/driver/rtl_console.c + +#network - api +SRC_C += ../../../component/common/api/lwip_netconf.c + +#network - api - wifi +SRC_C += ../../../component/common/api/wifi/wifi_conf.c +SRC_C += ../../../component/common/api/wifi/wifi_ind.c +SRC_C += ../../../component/common/api/wifi/wifi_promisc.c +SRC_C += ../../../component/common/api/wifi/wifi_util.c + +#network - api - wifi - rtw_wpa_supplicant +SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/src/crypto/tls_polarssl.c +SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_eap_config.c +SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_wps_config.c + +#network - app +SRC_C += ../../../component/soc/realtek/8710c/misc/platform/ota_8710c.c +SRC_C += ../../../component/common/api/network/src/ping_test.c +SRC_C += ../../../component/common/utilities/ssl_client.c +SRC_C += ../../../component/common/utilities/ssl_client_ext.c +SRC_C += ../../../component/common/utilities/tcptest.c +SRC_C += ../../../component/common/api/network/src/wlan_network.c + +#utilities +SRC_C += ../../../component/common/utilities/cJSON.c +SRC_C += ../../../component/common/utilities/http_client.c +SRC_C += ../../../component/common/utilities/xml.c +SRC_C += ../../../component/common/utilities/gb2unicode.c + +#network - app - mqtt +SRC_C += ../../../component/common/application/mqtt/MQTTClient/MQTTClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTConnectClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTConnectServer.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTDeserializePublish.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTFormat.c +SRC_C += ../../../component/common/application/mqtt/MQTTClient/MQTTFreertos.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTPacket.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSerializePublish.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSubscribeClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSubscribeServer.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeServer.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/V5/MQTTProperties.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/V5/MQTTV5Packet.c + +#network - coap +SRC_C += ../../../component/common/network/coap/sn_coap_ameba_port.c +SRC_C += ../../../component/common/network/coap/sn_coap_builder.c +SRC_C += ../../../component/common/network/coap/sn_coap_header_check.c +SRC_C += ../../../component/common/network/coap/sn_coap_parser.c +SRC_C += ../../../component/common/network/coap/sn_coap_protocol.c + +#network - http +SRC_C += ../../../component/common/network/httpc/httpc_tls.c +SRC_C += ../../../component/common/network/httpd/httpd_tls.c + +#network +SRC_C += ../../../component/common/network/dhcp/dhcps.c +SRC_C += ../../../component/common/network/sntp/sntp.c + +#network - lwip +#network - lwip - api +#lwip definition at component/common/application/matter/project/amebaz2/Makefile.include.app.list + +#network - lwip - port +SRC_C += ../../../component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c + +#network - mdns +SRC_C += ../../../component/common/network/mDNS/mDNSPlatform.c + +#network - ssl - mbedtls +#mbedtls definition at component/common/application/matter/project/amebaz2/Makefile.include.app.list + +#network - ssl - ssl_ram_map +SRC_C += ../../../component/common/network/ssl/ssl_ram_map/rom/rom_ssl_ram_map.c +SRC_C += ../../../component/common/network/ssl/ssl_func_stubs/ssl_func_stubs.c + +#network - websocket +SRC_C += ../../../component/common/network/websocket/wsclient_tls.c +SRC_C += ../../../component/common/network/websocket/wsserver_tls.c + +#os +SRC_C += ../../../component/os/freertos/cmsis_os.c +SRC_C += ../../../component/os/os_dep/device_lock.c +SRC_C += ../../../component/os/freertos/freertos_cb.c +SRC_C += ../../../component/os/freertos/freertos_service.c +SRC_C += ../../../component/os/os_dep/osdep_service.c +SRC_C += ../../../component/os/freertos/freertos_pmu.c + +#os - freertos +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/croutine.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/event_groups.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/list.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/queue.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/stream_buffer.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/tasks.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/timers.c + +#os - freertos - portable +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/portable/MemMang/heap_5.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/portable/GCC/ARM_RTL8710C/port.c + +#peripheral - api +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/crypto_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/dma_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/efuse_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/gpio_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/gpio_irq_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/i2c_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/pinmap.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/pinmap_common.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/port_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/pwmout_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/rtc_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/serial_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/spdio_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/spi_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/sys_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/timer_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/us_ticker.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/us_ticker_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/wait_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/wdt_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/reset_reason_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/external_flash_api.c + +#peripheral - hal +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_s/hal_efuse.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_gdma.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_gpio.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_i2c.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_misc.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_s/hal_pinmux_nsc.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_pwm.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_sdio_dev.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_ssi.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_uart.c + +#peripheral - wlan +#SRC_C += ../../../component/common/drivers/wlan/realtek/src/core/option/rtw_opt_rf_para_rtl8710c.c + +#file_system - fatfs +SRC_C += ../../../component/common/file_system/fatfs/fatfs_ext/src/ff_driver.c +SRC_C += ../../../component/common/file_system/fatfs/r0.10c/src/diskio.c +SRC_C += ../../../component/common/file_system/fatfs/r0.10c/src/ff.c +SRC_C += ../../../component/common/file_system/fatfs/r0.10c/src/option/ccsbcs.c +SRC_C += ../../../component/common/file_system/fatfs/disk_if/src/flash_fatfs.c + +#file_system - littlefs +SRC_C += ../../../component/common/file_system/littlefs/littlefs_adapter.c +SRC_C += ../../../component/common/file_system/littlefs/r2.9.1/lfs.c +SRC_C += ../../../component/common/file_system/littlefs/r2.9.1/lfs_util.c + +#utilities - example +SRC_C += ../../../component/common/example/bcast/example_bcast.c +SRC_C += ../../../component/common/example/cJSON/example_cJSON.c +SRC_C += ../../../component/common/example/coap/example_coap.c +SRC_C += ../../../component/common/example/coap_client/example_coap_client.c +SRC_C += ../../../component/common/example/coap_server/example_coap_server.c +SRC_C += ../../../component/common/example/dct/example_dct.c +SRC_C += ../../../component/common/example/eap/example_eap.c +SRC_C += ../../../component/common/example/example_entry.c +SRC_C += ../../../component/common/example/get_beacon_frame/example_get_beacon_frame.c +SRC_C += ../../../component/common/example/high_load_memory_use/example_high_load_memory_use.c +SRC_C += ../../../component/common/example/http_client/example_http_client.c +SRC_C += ../../../component/common/example/http_download/example_http_download.c +SRC_C += ../../../component/common/example/httpc/example_httpc.c +SRC_C += ../../../component/common/example/httpd/example_httpd.c +SRC_C += ../../../component/common/example/mbedtls_ecdhe/example_mbedtls_ecdhe.c +SRC_C += ../../../component/common/example/mcast/example_mcast.c +SRC_C += ../../../component/common/example/mqtt/example_mqtt.c +SRC_C += ../../../component/common/example/nonblock_connect/example_nonblock_connect.c +SRC_C += ../../../component/common/example/ota_http/example_ota_http.c +SRC_C += ../../../component/common/example/ota_https/example_ota_https.c +SRC_C += ../../../component/common/example/rarp/example_rarp.c +SRC_C += ../../../component/common/example/sntp_showtime/example_sntp_showtime.c +SRC_C += ../../../component/common/example/socket_select/example_socket_select.c +SRC_C += ../../../component/common/example/socket_tcp_trx/example_socket_tcp_trx_1.c +SRC_C += ../../../component/common/example/socket_tcp_trx/example_socket_tcp_trx_2.c +SRC_C += ../../../component/common/example/ssl_download/example_ssl_download.c +SRC_C += ../../../component/common/example/ssl_server/example_ssl_server.c +SRC_C += ../../../component/common/example/tcp_keepalive/example_tcp_keepalive.c +SRC_C += ../../../component/common/example/uart_atcmd/example_uart_atcmd.c +SRC_C += ../../../component/common/example/wifi_mac_monitor/example_wifi_mac_monitor.c +SRC_C += ../../../component/common/example/wifi_roaming/example_wifi_roaming.c +SRC_C += ../../../component/common/example/wlan_fast_connect/example_wlan_fast_connect.c +SRC_C += ../../../component/common/example/websocket_client/example_wsclient.c +SRC_C += ../../../component/common/example/websocket_server/example_ws_server.c +SRC_C += ../../../component/common/example/xml/example_xml.c +SRC_C += ../../../component/common/example/fatfs/example_fatfs.c +SRC_C += ../../../component/common/example/tickless_wifi_roaming/example_tickless_wifi_roaming.c +SRC_C += ../../../component/common/example/ipv6/example_ipv6.c + +#user +SRC_C += ../src/main.c +#SRC_CPP = ../src/main.cpp + +#SRAM +# ------------------------------------------------------------------- +#@SRAM +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/flash_api.c +SRC_C += ../../../component/soc/realtek/8710c/misc/driver/flash_api_ext.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_flash.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_spic.c +SRAM_C += ../../../component/common/mbed/targets/hal/rtl8710c/power_mode_api.c + +# Generate obj list +# ------------------------------------------------------------------- + +SRC_O = $(patsubst %.c,%_$(TARGET).o,$(SRC_C)) +SRAM_O = $(patsubst %.c,%_$(TARGET).o,$(SRAM_C)) +ERAM_O = $(patsubst %.c,%_$(TARGET).o,$(ERAM_C)) + +SRC_C_LIST = $(notdir $(SRC_C)) $(notdir $(SRAM_C)) $(notdir $(ERAM_C)) +OBJ_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%_$(TARGET).o,$(SRC_C_LIST))) +DEPENDENCY_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%_$(TARGET).d,$(SRC_C_LIST))) + +SRC_OO += $(patsubst %.cpp,%_$(TARGET).oo,$(SRC_CPP)) + +SRC_CPP_LIST = $(notdir $(SRC_CPP)) +OBJ_CPP_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.cpp,%_$(TARGET).oo,$(SRC_CPP_LIST))) +DEPENDENCY_LIST += $(addprefix $(OBJ_DIR)/,$(patsubst %.cpp,%_$(TARGET).d,$(SRC_CPP_LIST))) +# Compile options +# ------------------------------------------------------------------- + +CFLAGS = +CFLAGS += -march=armv8-m.main+dsp -mthumb -mcmse -mfloat-abi=soft -D__thumb2__ -g -gdwarf-3 -Os +CFLAGS += -D__ARM_ARCH_8M_MAIN__=1 -gdwarf-3 -fstack-usage -fdata-sections -ffunction-sections +CFLAGS += -fdiagnostics-color=always -Wall -Wpointer-arith -Wundef -Wno-write-strings --save-temps +CFLAGS += -Wno-maybe-uninitialized -c -MMD -fsigned-char +CFLAGS += -DCONFIG_PLATFORM_8710C -DCONFIG_BUILD_RAM=1 +CFLAGS += -DV8M_STKOVF + +CPPFLAGS := $(CFLAGS) + +#for time64 +ifdef SYSTEM_TIME64_MAKE_OPTION +CFLAGS += -DCONFIG_SYSTEM_TIME64=1 +CFLAGS += -include time64.h +else +CFLAGS += -DCONFIG_SYSTEM_TIME64=0 +endif + +CPPFLAGS += -fno-use-cxa-atexit +CPPFLAGS += -std=c++14 +CPPFLAGS += -fno-rtti + +LFLAGS = +LFLAGS += -Os -march=armv8-m.main+dsp -mthumb -mcmse -mfloat-abi=soft -nostartfiles -nodefaultlibs -nostdlib -specs=nosys.specs +LFLAGS += -Wl,--gc-sections -Wl,--warn-section-align -Wl,--cref -Wl,--build-id=none -Wl,--use-blx +LFLAGS += -Wl,-Map=$(BIN_DIR)/$(TARGET).map +# libc api wrapper +LFLAGS += -Wl,-wrap,strcat -Wl,-wrap,strchr -Wl,-wrap,strcmp +LFLAGS += -Wl,-wrap,strncmp -Wl,-wrap,strnicmp -Wl,-wrap,strcpy +LFLAGS += -Wl,-wrap,strncpy -Wl,-wrap,strlcpy -Wl,-wrap,strlen +LFLAGS += -Wl,-wrap,strnlen -Wl,-wrap,strncat -Wl,-wrap,strpbrk +LFLAGS += -Wl,-wrap,strspn -Wl,-wrap,strstr -Wl,-wrap,strtok +LFLAGS += -Wl,-wrap,strxfrm -Wl,-wrap,strsep -Wl,-wrap,strtod +LFLAGS += -Wl,-wrap,strtof -Wl,-wrap,strtold -Wl,-wrap,strtoll +LFLAGS += -Wl,-wrap,strtoul -Wl,-wrap,strtoull -Wl,-wrap,atoi +LFLAGS += -Wl,-wrap,atoui -Wl,-wrap,atol -Wl,-wrap,atoul +LFLAGS += -Wl,-wrap,atoull -Wl,-wrap,atof +LFLAGS += -Wl,-wrap,malloc -Wl,-wrap,realloc +LFLAGS += -Wl,-wrap,calloc -Wl,-wrap,free +LFLAGS += -Wl,-wrap,_malloc_r -Wl,-wrap,_calloc_r -Wl,-wrap,_realloc_r -Wl,-wrap,_free_r +LFLAGS += -Wl,-wrap,memcmp -Wl,-wrap,memcpy +LFLAGS += -Wl,-wrap,memmove -Wl,-wrap,memset +LFLAGS += -Wl,-wrap,printf -Wl,-wrap,sprintf +LFLAGS += -Wl,-wrap,puts -Wl,-wrap,putc -Wl,-wrap,putchar +#LFLAGS += -Wl,-wrap,snprintf -Wl,-wrap,vsnprintf +LFLAGS += -Wl,-wrap,aesccmp_construct_mic_iv +LFLAGS += -Wl,-wrap,aesccmp_construct_mic_header1 +LFLAGS += -Wl,-wrap,aesccmp_construct_ctr_preload +LFLAGS += -Wl,-wrap,rom_psk_CalcGTK +LFLAGS += -Wl,-wrap,rom_psk_CalcPTK +LFLAGS += -Wl,-wrap,aes_80211_encrypt +LFLAGS += -Wl,-wrap,aes_80211_decrypt + +ifdef SYSTEM_TIME64_MAKE_OPTION +LFLAGS += -Wl,-wrap,localtime -Wl,-wrap,mktime -Wl,-wrap,ctime +endif + +LIBFLAGS = +LIBFLAGS += -L$(AMEBAZ2_ROMSYMDIR) +LIBFLAGS += -Wl,--start-group ../../../component/soc/realtek/8710c/fwlib/lib/lib/hal_pmc.a -Wl,--end-group +LIBFLAGS += -Wl,--start-group ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/lib/GCC/btgap.a -Wl,--end-group +#LIBFLAGS += -Wl,--start-group ../../../component/common/application/jdsmart/2.1.22/joylink_ble/lib/libjoylink_ble.a -Wl,--end-group +#LIBFLAGS += -Wl,--start-group ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/lib/amebaz2/btmesh_prov.a -Wl,--end-group +#LIBFLAGS += -Wl,--start-group ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/lib/amebaz2/btmesh_dev.a -Wl,--end-group +all: LIBFLAGS += -Wl,--start-group -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_soc_is -l_wlan -Wl,--end-group +mp: LIBFLAGS += -Wl,--start-group -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_soc_is -l_wlan_mp -Wl,--end-group +LIBFLAGS += -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_http -l_dct -l_eap -l_websocket -l_wps +#LIBFLAGS += -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_coap + +RAMALL_BIN = +OTA_BIN = + +include $(MATTER_INCLUDE_APP) + +# Compile +# ------------------------------------------------------------------- + +.PHONY: application_is +application_is: prerequirement $(SRC_O) $(SRAM_O) $(ERAM_O) $(SRC_OO) + $(LD) $(LFLAGS) -o $(BIN_DIR)/$(TARGET).axf $(OBJ_CPP_LIST) $(OBJ_LIST) $(ROMIMG) $(LIBFLAGS) -lstdc++ -T$(LDSCRIPT) + $(OBJCOPY) -j .bluetooth_trace.text -Obinary $(BIN_DIR)/$(TARGET).axf $(BIN_DIR)/APP.trace + $(OBJCOPY) -R .bluetooth_trace.text $(BIN_DIR)/$(TARGET).axf + $(OBJDUMP) -d $(BIN_DIR)/$(TARGET).axf > $(BIN_DIR)/$(TARGET).asm + +# Manipulate Image +# ------------------------------------------------------------------- + +.PHONY: manipulate_images +manipulate_images: | application_is + @echo =========================================================== + @echo Image manipulating + @echo =========================================================== + cp $(AMEBAZ2_BOOTLOADERDIR)/bootloader.axf $(BOOT_BIN_DIR)/bootloader.axf +ifeq ($(findstring Linux, $(OS)), Linux) + chmod 0774 $(ELF2BIN) $(CHKSUM) +endif + $(ELF2BIN) keygen keycfg.json + $(ELF2BIN) convert amebaz2_bootloader.json BOOTLOADER secure_bit=0 + $(ELF2BIN) convert amebaz2_bootloader.json PARTITIONTABLE secure_bit=0 + $(ELF2BIN) convert amebaz2_firmware_is.json FIRMWARE secure_bit=0 +#ifeq ($(findstring Linux, $(OS)), Linux) +# chmod 777 $(AMEBAZ2_GCCTOOLDIR)/LZMA_GenCompressedFW_linux +#endif +# $(LZMA_PY) $(BIN_DIR)/firmware_is.bin + + $(CHKSUM) $(BIN_DIR)/firmware_is.bin +# $(CHKSUM) $(BIN_DIR)/firmware_is_lzma.bin + $(ELF2BIN) combine $(BIN_DIR)/flash_is.bin PTAB=partition.bin,BOOT=$(BOOT_BIN_DIR)/bootloader.bin,FW1=$(BIN_DIR)/firmware_is.bin + + $(CODE_ANALYZE_PYTHON) +# Generate build info +# ------------------------------------------------------------------- + +.PHONY: build_info +build_info: + @echo \#define RTL_FW_COMPILE_TIME RTL8710CFW_COMPILE_TIME\ > .ver + @echo \#define RTL_FW_COMPILE_DATE RTL8710CFW_COMPILE_DATE\ >> .ver + @echo \#define UTS_VERSION \"`date +%Y/%m/%d-%T`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_TIME \"`date +%Y/%m/%d-%T`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_DATE \"`date +%Y%m%d`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_BY \"`id -u -n`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_HOST \"`$(HOSTNAME_APP)`\" >> .ver + @if [ -x /bin/dnsdomainname ]; then \ + echo \#define RTL8710CFW_COMPILE_DOMAIN \"`dnsdomainname`\"; \ + elif [ -x /bin/domainname ]; then \ + echo \#define RTL8710CFW_COMPILE_DOMAIN \"`domainname`\"; \ + else \ + echo \#define RTL8710CFW_COMPILE_DOMAIN ; \ + fi >> .ver + + @echo \#define RTL8710CFW_COMPILER \"gcc `$(CC) $(CFLAGS) -dumpversion | tr --delete '\r'`\" >> .ver + @mv -f .ver ../inc/$@.h + +.PHONY: prerequirement +prerequirement: + @if [ ! -d $(ARM_GCC_TOOLCHAIN) ]; then \ + echo ===========================================================; \ + echo Toolchain not found, \"make toolchain\" first!; \ + echo ===========================================================; \ + exit -1; \ + fi + @echo =========================================================== + @echo Build $(TARGET) + @echo =========================================================== + mkdir -p $(OBJ_DIR) + mkdir -p $(BIN_DIR) + mkdir -p $(BOOT_BIN_DIR) + mkdir -p $(INFO_DIR) + +$(SRC_OO): %_$(TARGET).oo : %.cpp | prerequirement + $(CC) $(CPPFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.oo,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.ii) $(INFO_DIR) +# mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +$(SRC_O): %_$(TARGET).o : %.c | prerequirement + $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.i) $(INFO_DIR) + mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +$(SRAM_O): %_$(TARGET).o : %.c | prerequirement + $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(OBJCOPY) --prefix-alloc-sections .sram $@ + $(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.i) $(INFO_DIR) + mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +$(ERAM_O): %_$(TARGET).o : %.c | prerequirement + $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(OBJCOPY) --prefix-alloc-sections .psram $@ + $(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.i) $(INFO_DIR) + mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +-include $(DEPENDENCY_LIST) + +# Only needed for FPGA phase +.PHONY: romdebug +romdebug: +ifeq ($(findstring CYGWIN, $(OS)), CYGWIN) +# $(FLASH_TOOLDIR)/Check_Jtag.sh + cmd /c start $(GDB) -x ./rtl_gdb_debug_jlink.txt +else + $(GDB) -x ./rtl_gdb_debug_jlink.txt +endif + +.PHONY: flash +flash: +# @if [ ! -f $(FLASH_TOOLDIR)/rtl_gdb_flash_write.txt ] ; then echo Please do /"make setup GDB_SERVER=[jlink or openocd]/" first; echo && false ; fi +#ifeq ($(findstring CYGWIN, $(OS)), CYGWIN) +# $(FLASH_TOOLDIR)/Check_Jtag.sh +#endif + @if [ ! -e $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt ]; then \ + echo ===========================================================; \ + echo gdb script not found, \"make setup GDB_SERVER=[jlink, pyocd or openocd]\" first!; \ + echo ===========================================================; \ + exit -1; \ + fi + chmod +rx $(AMEBAZ2_GCCTOOLDIR)/flashloader.sh + $(AMEBAZ2_GCCTOOLDIR)/flashloader.sh application_is/Debug/bin/flash_is.bin + $(GDB) -x $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt + +.PHONY: debug +debug: + @if [ ! -e $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt ]; then \ + echo ===========================================================; \ + echo gdb script not found, \"make setup GDB_SERVER=[jlink, pyocd or openocd]\" first!; \ + echo ===========================================================; \ + exit -1; \ + fi + chmod +rx $(AMEBAZ2_GCCTOOLDIR)/debug.sh + $(AMEBAZ2_GCCTOOLDIR)/debug.sh $(BIN_DIR)/$(TARGET).axf + $(GDB) -x $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + +.PHONY: dump +dump: + chmod +rx $(AMEBAZ2_GCCTOOLDIR)/dump.sh + $(AMEBAZ2_GCCTOOLDIR)/dump.sh $(BIN_DIR)/flash_is_dump.bin $(DUMP_START_ADDRESS) $(DUMP_END_ADDRESS) + $(GDB) -x $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_dump_jlink.txt + +.PHONY: setup +setup: + @echo "----------------" + @echo Setup $(GDB_SERVER) + @echo "----------------" +ifeq ($(GDB_SERVER), pyocd) + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug_pyocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader_pyocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt +else ifeq ($(GDB_SERVER), openocd) + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug_openocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader_openocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt +else + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug_jlink.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader_jlink.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt +endif + +.PHONY: clean +clean: + rm -rf $(TARGET) + rm -f $(SRC_O) $(SRAM_O) $(ERAM_O) $(SRC_OO) + rm -f $(patsubst %.o,%.d,$(SRC_O)) $(patsubst %.o,%.d,$(SRAM_O)) $(patsubst %.o,%.d,$(ERAM_O)) $(patsubst %.oo,%.d,$(SRC_OO)) + rm -f $(patsubst %.o,%.su,$(SRC_O)) $(patsubst %.o,%.su,$(SRAM_O)) $(patsubst %.o,%.su,$(ERAM_O)) $(patsubst %.oo,%.su,$(SRC_OO)) + rm -f *.i + rm -f *.s diff --git a/project/realtek_amebaz2_v0_example/inc/FreeRTOSConfig.h b/project/realtek_amebaz2_v0_example/inc/FreeRTOSConfig.h index a5b2044..c0a803b 100644 --- a/project/realtek_amebaz2_v0_example/inc/FreeRTOSConfig.h +++ b/project/realtek_amebaz2_v0_example/inc/FreeRTOSConfig.h @@ -83,28 +83,29 @@ extern uint32_t SystemCoreClock; /* Constants that build features in or out. */ #define configUSE_MUTEXES 1 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_NEWLIB_REENTRANT 0 -#define configUSE_CO_ROUTINES 0 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_QUEUE_SETS 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_NEWLIB_REENTRANT 0 +#define configUSE_CO_ROUTINES 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_QUEUE_SETS 1 #define configUSE_TASK_NOTIFICATIONS 1 -#define configUSE_TRACE_FACILITY 0 +#define configUSE_TRACE_FACILITY 1 /* Constants that define which hook (callback) functions should be used. */ -#define configUSE_IDLE_HOOK 0 -#define configUSE_TICK_HOOK 0 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 #define configUSE_MALLOC_FAILED_HOOK 1 -#define secureconfigUSE_MALLOC_FAILED_HOOK 1 +#define secureconfigUSE_MALLOC_FAILED_HOOK 1 /* Constants provided for debugging and optimisation assistance. */ -#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configRECORD_STACK_HIGH_ADDRESS 1 /* Software timer definitions. */ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) -#define configTIMER_QUEUE_LENGTH ( 10 + 64) +#define configTIMER_QUEUE_LENGTH ( 10 + 64 ) #define configTIMER_TASK_STACK_DEPTH ( 512 ) /* Set the following definitions to 1 to include the API function, or zero @@ -112,20 +113,22 @@ extern uint32_t SystemCoreClock; * only necessary if the linker does not automatically remove functions that are * not referenced anyway. */ #define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_pcTaskGetTaskName 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 0 -#define INCLUDE_xTaskGetIdleTaskHandle 0 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xTaskResumeFromISR 0 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xSemaphoreGetMutexHolder 1 -#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_pcTaskGetTaskName 1 +#define INCLUDE_uxTaskGetStackSize 1 +#define INCLUDE_uxTaskGetFreeStackSize 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 0 +#define INCLUDE_xTaskGetIdleTaskHandle 0 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTaskResumeFromISR 0 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xSemaphoreGetMutexHolder 1 +#define INCLUDE_xTimerPendFunctionCall 1 /* This demo makes use of one or more example stats formatting functions. These * format the raw data provided by the uxTaskGetSystemState() function in to @@ -300,8 +303,4 @@ warnings. */ #if defined(ENABLE_AMAZON_COMMON) #include "FreeRTOSConfig_Amazon.h" #endif - -#if defined(CONFIG_MATTER) && CONFIG_MATTER -#include "FreeRTOSConfig_Matter.h" -#endif #endif /* FREERTOS_CONFIG_H */ diff --git a/project/realtek_amebaz2plus_v0_example/GCC-RELEASE/Makefile b/project/realtek_amebaz2plus_v0_example/GCC-RELEASE/Makefile index 19ef8f6..7aaea38 100644 --- a/project/realtek_amebaz2plus_v0_example/GCC-RELEASE/Makefile +++ b/project/realtek_amebaz2plus_v0_example/GCC-RELEASE/Makefile @@ -29,3 +29,27 @@ setup: dump: @$(MAKE) -f application.is.mk dump + +#*****************************************************************************# +# MATTER MAKE DEFINES # +#*****************************************************************************# + +ENABLE_MATTER = 0 + +ifeq ($(ENABLE_MATTER), 1) + +BASEDIR = $(shell pwd) +MATTER_BUILDDIR = $(shell pwd)/../../../component/common/application/matter/project/amebaz2plus + +include $(MATTER_BUILDDIR)/Makefile + +.PHONY: is_matter +is_matter: toolchain_matter + cp $(MATTER_BUILDDIR)/partition_matter.json partition.json + @$(MAKE) -f application.is.matter.mk + +.PHONY: clean_matter +clean_matter: + @$(MAKE) -f application.is.matter.mk clean + +endif diff --git a/project/realtek_amebaz2plus_v0_example/GCC-RELEASE/application.is.matter.mk b/project/realtek_amebaz2plus_v0_example/GCC-RELEASE/application.is.matter.mk new file mode 100644 index 0000000..252d601 --- /dev/null +++ b/project/realtek_amebaz2plus_v0_example/GCC-RELEASE/application.is.matter.mk @@ -0,0 +1,1118 @@ +SHELL = /bin/bash +OS := $(shell uname) + +# Initialize Directory +# ------------------------------------------------------------------- + +AMEBAZ2_TOOLDIR = ../../../component/soc/realtek/8710c/misc/iar_utility +AMEBAZ2_GCCTOOLDIR = ../../../component/soc/realtek/8710c/misc/gcc_utility +AMEBAZ2_BSPDIR = ../../../component/soc/realtek/8710c/misc/bsp +AMEBAZ2_BOOTLOADERDIR = $(AMEBAZ2_BSPDIR)/image_z2plus +AMEBAZ2_ROMSYMDIR = $(AMEBAZ2_BSPDIR)/ROM + +# Matter Directory +# ------------------------------------------------------------------- + +BASEDIR := $(shell pwd) +SDKROOTDIR = $(BASEDIR)/../../.. +MATTER_DIR = $(SDKROOTDIR)/component/common/application/matter +MATTER_BUILDDIR = $(MATTER_DIR)/project/amebaz2plus + +MATTER_INCLUDE = $(MATTER_BUILDDIR)/Makefile.include.matter +MATTER_INCLUDE_APP = $(MATTER_BUILDDIR)/Makefile.include.app.list + +# Dump addresses +# ------------------------------------------------------------------- + +DUMP_START_ADDRESS = 0x98000000 +DUMP_END_ADDRESS = 0x98200000 + +# Version control +# ------------------------------------------------------------------- + +FREERTOS_VERSION = freertos_v10.0.1 +LWIP_VERSION = lwip_v2.1.3 + +# Initialize Toolchain related +# ------------------------------------------------------------------- + +CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi- + +AR = $(CROSS_COMPILE)ar +CC = $(CROSS_COMPILE)gcc +AS = $(CROSS_COMPILE)as +NM = $(CROSS_COMPILE)nm +LD = $(CROSS_COMPILE)gcc +GDB = $(CROSS_COMPILE)gdb +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump + +LDSCRIPT := $(MATTER_BUILDDIR)/rtl8710c_ram_matter.ld + +# Initialize target name and target object files +# ------------------------------------------------------------------- + +all: build_info application_is manipulate_images + +mp: build_info application_is manipulate_images + +TARGET=application_is + +OBJ_DIR=$(TARGET)/Debug/obj +BIN_DIR=$(TARGET)/Debug/bin +INFO_DIR=$(TARGET)/Debug/info +BOOT_BIN_DIR=bootloader/Debug/bin + +ROMIMG = + +# Decide if 64 bit time wrapper is to be included +# ------------------------------------------------------------------- +#SYSTEM_TIME64_MAKE_OPTION = 1 + +# Include folder list +# ------------------------------------------------------------------- + +INCLUDES = +INCLUDES += -I../inc + +INCLUDES += -I../../../component/common/api +INCLUDES += -I../../../component/common/api/at_cmd +INCLUDES += -I../../../component/common/api/platform +INCLUDES += -I../../../component/common/api/wifi +INCLUDES += -I../../../component/common/api/wifi/rtw_wpa_supplicant/src +INCLUDES += -I../../../component/common/api/wifi/rtw_wpa_supplicant/src/crypto +INCLUDES += -I../../../component/common/api/network/include +INCLUDES += -I../../../component/common/application +INCLUDES += -I../../../component/common/application/mqtt/MQTTClient +INCLUDES += -I../../../component/common/application/mqtt/MQTTPacket/V5 +INCLUDES += -I../../../component/common/application/mqtt/MQTTPacket +INCLUDES += -I../../../component/common/example +INCLUDES += -I../../../component/common/file_system +INCLUDES += -I../../../component/common/file_system/dct +INCLUDES += -I../../../component/common/file_system/fatfs +INCLUDES += -I../../../component/common/file_system/fatfs/r0.10c/include +INCLUDES += -I../../../component/common/file_system/ftl +INCLUDES += -I../../../component/common/file_system/littlefs +INCLUDES += -I../../../component/common/file_system/littlefs/r2.9.1 +INCLUDES += -I../../../component/common/utilities +INCLUDES += -I../../../component/common/mbed/hal +INCLUDES += -I../../../component/common/mbed/hal_ext +INCLUDES += -I../../../component/common/mbed/targets/hal/rtl8710c +INCLUDES += -I../../../component/common/network +INCLUDES += -I../../../component/common/network/coap/include +INCLUDES += -I../../../component/common/network/libcoap/include +INCLUDES += -I../../../component/common/network/http2/nghttp2-1.31.0/includes +INCLUDES += -I../../../component/common/network/ssl/ssl_ram_map/rom +INCLUDES += -I../../../component/common/drivers/wlan/realtek/include +INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/osdep +INCLUDES += -I../../../component/common/drivers/wlan/realtek/src/core/option +INCLUDES += -I../../../component/common/test +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/app +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/gap +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/profile/client +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/bluetooth/profile/server +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/os +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/platform +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/inc/stack +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/lib/GCC +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/os +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/vendor_cmd +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_config +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_central +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_ancs +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/gap +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/inc/amebaz2 +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/platform +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/common +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/provisioner +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_device_rtk_demo +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/board/common/inc +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config +INCLUDES += -I../../../component/common/application/airsync/1.0.4 +INCLUDES += -I../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test +#INCLUDES += -I../../../component/common/application/jdsmart/2.1.22/joylink_ble/include + +INCLUDES += -I../../../component/soc/realtek/8710c/cmsis/rtl8710c/include +INCLUDES += -I../../../component/soc/realtek/8710c/cmsis/rtl8710c/lib/include +INCLUDES += -I../../../component/soc/realtek/8710c/fwlib/include +INCLUDES += -I../../../component/soc/realtek/8710c/fwlib/lib/include +INCLUDES += -I../../../component/soc/realtek/8710c/cmsis/cmsis-core/include +INCLUDES += -I../../../component/soc/realtek/8710c/app/rtl_printf/include +INCLUDES += -I../../../component/soc/realtek/8710c/app/shell +INCLUDES += -I../../../component/soc/realtek/8710c/app/stdio_port +INCLUDES += -I../../../component/soc/realtek/8710c/misc/utilities/include +INCLUDES += -I../../../component/soc/realtek/8710c/mbed-drivers/include +INCLUDES += -I../../../component/soc/realtek/8710c/misc/platform +INCLUDES += -I../../../component/soc/realtek/8710c/misc/driver +INCLUDES += -I../../../component/soc/realtek/8710c/misc/os + +INCLUDES += -I../../../component/os/freertos +INCLUDES += -I../../../component/os/freertos/$(FREERTOS_VERSION)/Source/include +INCLUDES += -I../../../component/os/freertos/$(FREERTOS_VERSION)/Source/portable/GCC/ARM_RTL8710C +INCLUDES += -I../../../component/os/os_dep/include + +INCLUDES += -I../../../component/common/application/amazon/amazon-ffs/ffs_demo/common/include +INCLUDES += -I../../../component/common/application/amazon/amazon-ffs/ffs_demo/realtek/configs + +# Source file list +# ------------------------------------------------------------------- + +SRC_C = +SRAM_C = +ERAM_C = +#bluetooth - board +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/bt_fwconfig.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/bt_mp_patch_z2plus.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/bt_normal_patch_z2plus.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/cycle_queue.c +SRC_C += ../../../component/common/file_system/ftl/ftl.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/hci_board.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/hci/hci_uart.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/os/freertos/osif_freertos.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/platform_utils.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/rtk_coex.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/trace_uart.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/src/vendor_cmd/vendor_cmd.c + +#bluetooth - common +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/ancs_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/bas.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/bas_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/bt_uart_bridge.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/dis.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/gaps_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/hci_adapter.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/hci_process.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hids.c +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hids_kb.c +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hids_rmc.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/simple_ble_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/simple_ble_service.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/ota_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/dfu_client.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/board/common/src/trace_task.c + +#bluetooth - example - ble_central +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_at_cmd.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_central/ble_central_client_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/client/gcs_client.c + +#bluetooth - example - ble_peripheral +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/ble_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/ble_peripheral_at_cmd.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_peripheral/peripheral_app.c + +#bluetooth - example - ble_matter_adapter +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_service.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_matter_adapter/ble_matter_adapter_app.c + +#bluetooth - example - ble_scatternet +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet/ble_scatternet_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet/ble_scatternet_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_scatternet/ble_scatternet_app_task.c + +#bluetooth - example - bt_fuzz_test +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_at_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_link_mgr.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_fuzz_test/bt_fuzz_test_simple_ble_service.c \ + ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/gls.c \ + ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/hrs.c \ + ../../../component/common/bluetooth/realtek/sdk/src/ble/profile/server/ias.c +#bluetooth - example - bt_beacon +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_beacon/bt_beacon_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_beacon/bt_beacon_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_beacon/bt_beacon_app_task.c + +#bluetooth - example - bt_config +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_peripheral_app.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_service.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_config/bt_config_wifi.c + +#bluetooth - example - bt_airsync_config +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config/bt_airsync_config_app_main.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config/bt_airsync_config_app_task.c +SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_airsync_config/bt_airsync_config_peripheral_app.c +SRC_C += ../../../component/common/application/airsync/1.0.4/airsync_ble_service.c +SRC_C += ../../../component/common/application/airsync/1.0.4/check_endian.c +SRC_C += ../../../component/common/application/airsync/1.0.4/epb.c +SRC_C += ../../../component/common/application/airsync/1.0.4/epb_MmBp.c +SRC_C += ../../../component/common/application/airsync/1.0.4/epb_WristBand.c +SRC_C += ../../../component/common/application/airsync/1.0.4/wechat_airsync_protocol.c + +#bluetooth - example - bt_ota_central_client +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_link_mgr.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_test_image.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/bt_ota_central_client_at_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ota_central_client/insert_write.c + +#bluetooth - example - bt_datatrans +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_app_queue.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_at_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_at_hci_cmd_process.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_central_application.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_module_param_config.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_multilink_manager.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_peripheral_application.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_profile.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_datatrans/bt_datatrans_uart.c + +#bluetooth - example - bt_ancs +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_ancs/bt_ancs_main.c + +#bluetooth - example - bt_joylink_adapter +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_peripheral_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_joylink_adapter/bt_joylink_adapter_service.c + +#bluetooth - example - ble_google_seamless +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/ble_google_seamless_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/ble_google_seamless_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/ble_google_seamless_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_google_seamless/google_seamless.c + +#bluetooth - example - bt_mesh_device_matter +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_adapter_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/bt_mesh_device_matter/bt_mesh_device_matter_cmd.c + +#bluetooth - example - bt_mesh_provisioner +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/provisioner/bt_mesh_provisioner_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/client_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/rmt_prov_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/configuration_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/directed_forwarding_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_distribution_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_property_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/private_beacon_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/light_cwrgb_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/subnet_bridge_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/bt_mesh_provisioner_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/bt_mesh_provisioner_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/provisioner_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/provisioner/provisioner_cmd.c + +#bluetooth - example - bt_mesh_device +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/bt_mesh_device_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/device_idle_check.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/bt_mesh_device_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/bt_mesh_device_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/device_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/device/device_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_updater_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scene_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scheduler_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/sensor_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/time_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_execution.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_admin_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_client_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_manufacturer_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_transition_time.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_user_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_temperature_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_hue_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_saturation_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c + +#bluetooth - example - bt_mesh_provisioner_rtk_demo +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/example_bt_mesh_provisioner_rtk_demo.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_app_http_intf.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_app_lib_intf.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_app_list_intf.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_provisioner_rtk_demo/src/bt_mesh_broadcast_demo.c + +#bluetooth - example - bt_mesh_device_rtk_demo +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_device_rtk_demo/example_bt_mesh_device_rtk_demo.c + +#bluetooth - example - bt_mesh_test +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_app_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_datatrans_write_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_device_test.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_malloc_free.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_receive_response.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_test_result.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_test/bt_mesh_timer_handler.c + +#bluetooth - example - provisioner_multiple_profile +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/provisioner/bt_mesh_provisioner_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/client_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/rmt_prov_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/configuration_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/directed_forwarding_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_distribution_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_property_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/private_beacon_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/light_cwrgb_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/subnet_bridge_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/bt_mesh_provisioner_multiple_profile_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/bt_mesh_provisioner_multiple_profile_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/provisioner_multiple_profile_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/provisioner_multiple_profile/provisioner_multiple_profile_cmd.c + +#bluetooth - example - device_multiple_profile +#SRC_C += \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/bt_mesh_user_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/bt_mesh_device_api.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/api/device/device_idle_check.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/mesh_user_cmd_parse.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/cmd/test_cmd.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/blob_client_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/customer_dfu_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/datatrans_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_distributor_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_initiator_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfu_updater_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/dfudep_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/generic_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/light_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/ping_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scene_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/scheduler_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/sensor_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/common/time_server_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/blob_transfer_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_execution.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/delay_msg_rsp.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/firmware_update_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/health_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_admin_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_battery_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_client_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_default_transition_time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_location_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_manufacturer_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_level_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_power_on_off_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_transition_time.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/generic_user_property_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_ctl_temperature_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_hue_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_saturation_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_hsl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lc_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_lightness_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/light_xyl_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/datatrans_model.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/ping_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/realtek/tp_control.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/sensor_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scene_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/scheduler_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/model/time_setup_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_server.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/profile/datatrans_service.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/utility/mesh_data_dump.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/bt_mesh_device_multiple_profile_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/bt_mesh_device_multiple_profile_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/device_multiple_profile_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh_multiple_profile/device_multiple_profile/device_multiple_profile_cmd.c + +#bluetooth - example - ble_throughput_test +#SRC_C += ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_200.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_200_sut.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_app.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_app_main.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_app_task.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_link_mgr.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_test_case.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_vendor_tp_client.c \ + ../../../component/common/bluetooth/realtek/sdk/example/ble_throughput_test/ble_throughput_vendor_tp_service.c + +#bluetooth - example +SRC_C += ../../../component/common/bluetooth/realtek/sdk/bt_example_entry.c + +#cmsis +SRC_C += ../../../component/soc/realtek/8710c/cmsis/rtl8710c/source/ram_s/app_start.c +SRC_C += ../../../component/soc/realtek/8710c/cmsis/rtl8710c/source/ram/mpu_config.c +SRC_C += ../../../component/soc/realtek/8710c/cmsis/rtl8710c/source/ram/sys_irq.c + +#libc api wrapper +SRC_C += ../../../component/soc/realtek/8710c/misc/utilities/source/ram/libc_wrap.c + +#console +SRC_C += ../../../component/common/api/at_cmd/atcmd_bt.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_lwip.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_mp.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_mp_ext2.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_sys.c +SRC_C += ../../../component/common/api/at_cmd/atcmd_wifi.c +SRC_C += ../../../component/soc/realtek/8710c/app/shell/cmd_shell.c +SRC_C += ../../../component/soc/realtek/8710c/app/shell/ram_s/consol_cmds.c +SRC_C += ../../../component/common/api/at_cmd/log_service.c +SRC_C += ../../../component/soc/realtek/8710c/misc/driver/rtl_console.c + +#network - api +SRC_C += ../../../component/common/api/lwip_netconf.c + +#network - api - wifi +SRC_C += ../../../component/common/api/wifi/wifi_conf.c +SRC_C += ../../../component/common/api/wifi/wifi_ind.c +SRC_C += ../../../component/common/api/wifi/wifi_promisc.c +SRC_C += ../../../component/common/api/wifi/wifi_util.c + +#network - api - wifi - rtw_wpa_supplicant +SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/src/crypto/tls_polarssl.c +SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_eap_config.c +SRC_C += ../../../component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_wps_config.c + +#network - app +SRC_C += ../../../component/soc/realtek/8710c/misc/platform/ota_8710c.c +SRC_C += ../../../component/common/api/network/src/ping_test.c +SRC_C += ../../../component/common/utilities/ssl_client.c +SRC_C += ../../../component/common/utilities/ssl_client_ext.c +SRC_C += ../../../component/common/utilities/tcptest.c +SRC_C += ../../../component/common/api/network/src/wlan_network.c + +#utilities +SRC_C += ../../../component/common/utilities/cJSON.c +SRC_C += ../../../component/common/utilities/http_client.c +SRC_C += ../../../component/common/utilities/xml.c +SRC_C += ../../../component/common/utilities/gb2unicode.c + +#network - app - mqtt +SRC_C += ../../../component/common/application/mqtt/MQTTClient/MQTTClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTConnectClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTConnectServer.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTDeserializePublish.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTFormat.c +SRC_C += ../../../component/common/application/mqtt/MQTTClient/MQTTFreertos.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTPacket.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSerializePublish.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSubscribeClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTSubscribeServer.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeClient.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/MQTTUnsubscribeServer.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/V5/MQTTProperties.c +SRC_C += ../../../component/common/application/mqtt/MQTTPacket/V5/MQTTV5Packet.c + +#network - coap +SRC_C += ../../../component/common/network/coap/sn_coap_ameba_port.c +SRC_C += ../../../component/common/network/coap/sn_coap_builder.c +SRC_C += ../../../component/common/network/coap/sn_coap_header_check.c +SRC_C += ../../../component/common/network/coap/sn_coap_parser.c +SRC_C += ../../../component/common/network/coap/sn_coap_protocol.c + +#network - http +SRC_C += ../../../component/common/network/httpc/httpc_tls.c +SRC_C += ../../../component/common/network/httpd/httpd_tls.c + +#network +SRC_C += ../../../component/common/network/dhcp/dhcps.c +SRC_C += ../../../component/common/network/sntp/sntp.c + +#network - lwip +#network - lwip - api +#lwip definition at component/common/application/matter/project/amebaz2/Makefile.include.app.list + +#network - lwip - port +SRC_C += ../../../component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c + +#network - mdns +SRC_C += ../../../component/common/network/mDNS/mDNSPlatform.c + +#network - ssl - mbedtls +#mbedtls definition at component/common/application/matter/project/amebaz2/Makefile.include.app.list + +#network - ssl - ssl_ram_map +SRC_C += ../../../component/common/network/ssl/ssl_ram_map/rom/rom_ssl_ram_map.c +SRC_C += ../../../component/common/network/ssl/ssl_func_stubs/ssl_func_stubs.c + +#network - websocket +SRC_C += ../../../component/common/network/websocket/wsclient_tls.c +SRC_C += ../../../component/common/network/websocket/wsserver_tls.c + +#os +SRC_C += ../../../component/os/freertos/cmsis_os.c +SRC_C += ../../../component/os/os_dep/device_lock.c +SRC_C += ../../../component/os/freertos/freertos_cb.c +SRC_C += ../../../component/os/freertos/freertos_service.c +SRC_C += ../../../component/os/os_dep/osdep_service.c +SRC_C += ../../../component/os/freertos/freertos_pmu.c + +#os - freertos +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/croutine.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/event_groups.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/list.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/queue.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/stream_buffer.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/tasks.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/timers.c + +#os - freertos - portable +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/portable/MemMang/heap_5.c +SRC_C += ../../../component/os/freertos/$(FREERTOS_VERSION)/Source/portable/GCC/ARM_RTL8710C/port.c + +#peripheral - api +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/crypto_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/dma_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/efuse_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/gpio_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/gpio_irq_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/i2c_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/pinmap.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/pinmap_common.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/port_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/pwmout_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/rtc_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/serial_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/spdio_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/spi_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/sys_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/timer_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/us_ticker.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/us_ticker_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/wait_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/wdt_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/reset_reason_api.c +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/external_flash_api.c + +#peripheral - hal +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_s/hal_efuse.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_gdma.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_gpio.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_i2c.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_misc.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_s/hal_pinmux_nsc.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_pwm.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_sdio_dev.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_ssi.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram/hal_uart.c + +#peripheral - wlan +#SRC_C += ../../../component/common/drivers/wlan/realtek/src/core/option/rtw_opt_rf_para_rtl8710c.c + +#file_system - fatfs +SRC_C += ../../../component/common/file_system/fatfs/fatfs_ext/src/ff_driver.c +SRC_C += ../../../component/common/file_system/fatfs/r0.10c/src/diskio.c +SRC_C += ../../../component/common/file_system/fatfs/r0.10c/src/ff.c +SRC_C += ../../../component/common/file_system/fatfs/r0.10c/src/option/ccsbcs.c +SRC_C += ../../../component/common/file_system/fatfs/disk_if/src/flash_fatfs.c + +#file_system - littlefs +SRC_C += ../../../component/common/file_system/littlefs/littlefs_adapter.c +SRC_C += ../../../component/common/file_system/littlefs/r2.9.1/lfs.c +SRC_C += ../../../component/common/file_system/littlefs/r2.9.1/lfs_util.c + +#utilities - example +SRC_C += ../../../component/common/example/bcast/example_bcast.c +SRC_C += ../../../component/common/example/cJSON/example_cJSON.c +SRC_C += ../../../component/common/example/coap/example_coap.c +SRC_C += ../../../component/common/example/coap_client/example_coap_client.c +SRC_C += ../../../component/common/example/coap_server/example_coap_server.c +SRC_C += ../../../component/common/example/dct/example_dct.c +SRC_C += ../../../component/common/example/eap/example_eap.c +SRC_C += ../../../component/common/example/example_entry.c +SRC_C += ../../../component/common/example/get_beacon_frame/example_get_beacon_frame.c +SRC_C += ../../../component/common/example/high_load_memory_use/example_high_load_memory_use.c +SRC_C += ../../../component/common/example/http_client/example_http_client.c +SRC_C += ../../../component/common/example/http_download/example_http_download.c +SRC_C += ../../../component/common/example/httpc/example_httpc.c +SRC_C += ../../../component/common/example/httpd/example_httpd.c +SRC_C += ../../../component/common/example/mbedtls_ecdhe/example_mbedtls_ecdhe.c +SRC_C += ../../../component/common/example/mcast/example_mcast.c +SRC_C += ../../../component/common/example/mqtt/example_mqtt.c +SRC_C += ../../../component/common/example/nonblock_connect/example_nonblock_connect.c +SRC_C += ../../../component/common/example/ota_http/example_ota_http.c +SRC_C += ../../../component/common/example/ota_https/example_ota_https.c +SRC_C += ../../../component/common/example/rarp/example_rarp.c +SRC_C += ../../../component/common/example/sntp_showtime/example_sntp_showtime.c +SRC_C += ../../../component/common/example/socket_select/example_socket_select.c +SRC_C += ../../../component/common/example/socket_tcp_trx/example_socket_tcp_trx_1.c +SRC_C += ../../../component/common/example/socket_tcp_trx/example_socket_tcp_trx_2.c +SRC_C += ../../../component/common/example/ssl_download/example_ssl_download.c +SRC_C += ../../../component/common/example/ssl_server/example_ssl_server.c +SRC_C += ../../../component/common/example/tcp_keepalive/example_tcp_keepalive.c +SRC_C += ../../../component/common/example/uart_atcmd/example_uart_atcmd.c +SRC_C += ../../../component/common/example/wifi_mac_monitor/example_wifi_mac_monitor.c +SRC_C += ../../../component/common/example/wifi_roaming/example_wifi_roaming.c +SRC_C += ../../../component/common/example/wlan_fast_connect/example_wlan_fast_connect.c +SRC_C += ../../../component/common/example/websocket_client/example_wsclient.c +SRC_C += ../../../component/common/example/websocket_server/example_ws_server.c +SRC_C += ../../../component/common/example/xml/example_xml.c +SRC_C += ../../../component/common/example/fatfs/example_fatfs.c +SRC_C += ../../../component/common/example/tickless_wifi_roaming/example_tickless_wifi_roaming.c +SRC_C += ../../../component/common/example/ipv6/example_ipv6.c + +#user +SRC_C += ../src/main.c +#SRC_CPP = ../src/main.cpp + +#SRAM +# ------------------------------------------------------------------- +#@SRAM +SRC_C += ../../../component/common/mbed/targets/hal/rtl8710c/flash_api.c +SRC_C += ../../../component/soc/realtek/8710c/misc/driver/flash_api_ext.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_flash.c +SRC_C += ../../../component/soc/realtek/8710c/fwlib/source/ram_ns/hal_spic.c +SRAM_C += ../../../component/common/mbed/targets/hal/rtl8710c/power_mode_api.c + +# Generate obj list +# ------------------------------------------------------------------- + +SRC_O = $(patsubst %.c,%_$(TARGET).o,$(SRC_C)) +SRAM_O = $(patsubst %.c,%_$(TARGET).o,$(SRAM_C)) +ERAM_O = $(patsubst %.c,%_$(TARGET).o,$(ERAM_C)) + +SRC_C_LIST = $(notdir $(SRC_C)) $(notdir $(SRAM_C)) $(notdir $(ERAM_C)) +OBJ_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%_$(TARGET).o,$(SRC_C_LIST))) +DEPENDENCY_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%_$(TARGET).d,$(SRC_C_LIST))) + +SRC_OO += $(patsubst %.cpp,%_$(TARGET).oo,$(SRC_CPP)) + +SRC_CPP_LIST = $(notdir $(SRC_CPP)) +OBJ_CPP_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.cpp,%_$(TARGET).oo,$(SRC_CPP_LIST))) +DEPENDENCY_LIST += $(addprefix $(OBJ_DIR)/,$(patsubst %.cpp,%_$(TARGET).d,$(SRC_CPP_LIST))) +# Compile options +# ------------------------------------------------------------------- + +CFLAGS = +CFLAGS += -march=armv8-m.main+dsp -mthumb -mcmse -mfloat-abi=soft -D__thumb2__ -g -gdwarf-3 -Os +CFLAGS += -D__ARM_ARCH_8M_MAIN__=1 -gdwarf-3 -fstack-usage -fdata-sections -ffunction-sections +CFLAGS += -fdiagnostics-color=always -Wall -Wpointer-arith -Wundef -Wno-write-strings --save-temps +CFLAGS += -Wno-maybe-uninitialized -c -MMD -fsigned-char +CFLAGS += -DCONFIG_PLATFORM_8710C -DCONFIG_BUILD_RAM=1 +CFLAGS += -DCONFIG_PLATFORM_Z2PLUS +CFLAGS += -DV8M_STKOVF + +CPPFLAGS := $(CFLAGS) + +#for time64 +ifdef SYSTEM_TIME64_MAKE_OPTION +CFLAGS += -DCONFIG_SYSTEM_TIME64=1 +CFLAGS += -include time64.h +else +CFLAGS += -DCONFIG_SYSTEM_TIME64=0 +endif + +CPPFLAGS += -fno-use-cxa-atexit +CPPFLAGS += -std=c++14 +CPPFLAGS += -fno-rtti + +LFLAGS = +LFLAGS += -Os -march=armv8-m.main+dsp -mthumb -mcmse -mfloat-abi=soft -nostartfiles -nodefaultlibs -nostdlib -specs=nosys.specs +LFLAGS += -Wl,--gc-sections -Wl,--warn-section-align -Wl,--cref -Wl,--build-id=none -Wl,--use-blx +LFLAGS += -Wl,-Map=$(BIN_DIR)/$(TARGET).map +# libc api wrapper +LFLAGS += -Wl,-wrap,strcat -Wl,-wrap,strchr -Wl,-wrap,strcmp +LFLAGS += -Wl,-wrap,strncmp -Wl,-wrap,strnicmp -Wl,-wrap,strcpy +LFLAGS += -Wl,-wrap,strncpy -Wl,-wrap,strlcpy -Wl,-wrap,strlen +LFLAGS += -Wl,-wrap,strnlen -Wl,-wrap,strncat -Wl,-wrap,strpbrk +LFLAGS += -Wl,-wrap,strspn -Wl,-wrap,strstr -Wl,-wrap,strtok +LFLAGS += -Wl,-wrap,strxfrm -Wl,-wrap,strsep -Wl,-wrap,strtod +LFLAGS += -Wl,-wrap,strtof -Wl,-wrap,strtold -Wl,-wrap,strtoll +LFLAGS += -Wl,-wrap,strtoul -Wl,-wrap,strtoull -Wl,-wrap,atoi +LFLAGS += -Wl,-wrap,atoui -Wl,-wrap,atol -Wl,-wrap,atoul +LFLAGS += -Wl,-wrap,atoull -Wl,-wrap,atof +LFLAGS += -Wl,-wrap,malloc -Wl,-wrap,realloc +LFLAGS += -Wl,-wrap,calloc -Wl,-wrap,free +LFLAGS += -Wl,-wrap,_malloc_r -Wl,-wrap,_calloc_r -Wl,-wrap,_realloc_r -Wl,-wrap,_free_r +LFLAGS += -Wl,-wrap,memcmp -Wl,-wrap,memcpy +LFLAGS += -Wl,-wrap,memmove -Wl,-wrap,memset +LFLAGS += -Wl,-wrap,printf -Wl,-wrap,sprintf +LFLAGS += -Wl,-wrap,puts -Wl,-wrap,putc -Wl,-wrap,putchar +#LFLAGS += -Wl,-wrap,snprintf -Wl,-wrap,vsnprintf +LFLAGS += -Wl,-wrap,aesccmp_construct_mic_iv +LFLAGS += -Wl,-wrap,aesccmp_construct_mic_header1 +LFLAGS += -Wl,-wrap,aesccmp_construct_ctr_preload +LFLAGS += -Wl,-wrap,rom_psk_CalcGTK +LFLAGS += -Wl,-wrap,rom_psk_CalcPTK +LFLAGS += -Wl,-wrap,aes_80211_encrypt +LFLAGS += -Wl,-wrap,aes_80211_decrypt + +ifdef SYSTEM_TIME64_MAKE_OPTION +LFLAGS += -Wl,-wrap,localtime -Wl,-wrap,mktime -Wl,-wrap,ctime +endif + +LIBFLAGS = +LIBFLAGS += -L$(AMEBAZ2_ROMSYMDIR) +LIBFLAGS += -Wl,--start-group ../../../component/soc/realtek/8710c/fwlib/lib/lib/hal_pmc.a -Wl,--end-group +LIBFLAGS += -Wl,--start-group ../../../component/common/bluetooth/realtek/sdk/board/amebaz2/lib/GCC/btgap.a -Wl,--end-group +#LIBFLAGS += -Wl,--start-group ../../../component/common/application/jdsmart/2.1.22/joylink_ble/lib/libjoylink_ble.a -Wl,--end-group +#LIBFLAGS += -Wl,--start-group ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/lib/amebaz2/btmesh_prov.a -Wl,--end-group +#LIBFLAGS += -Wl,--start-group ../../../component/common/bluetooth/realtek/sdk/example/bt_mesh/lib/lib/amebaz2/btmesh_dev.a -Wl,--end-group +all: LIBFLAGS += -Wl,--start-group -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_soc_is -l_wlan_z2plus -Wl,--end-group +mp: LIBFLAGS += -Wl,--start-group -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_soc_is -l_wlan_mp_z2plus -Wl,--end-group +LIBFLAGS += -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_http -l_dct -l_eap -l_websocket -l_wps +#LIBFLAGS += -L../../../component/soc/realtek/8710c/misc/bsp/lib/common/GCC -l_coap + +RAMALL_BIN = +OTA_BIN = + +include $(MATTER_INCLUDE_APP) + +# Compile +# ------------------------------------------------------------------- + +.PHONY: application_is +application_is: prerequirement $(SRC_O) $(SRAM_O) $(ERAM_O) $(SRC_OO) + $(LD) $(LFLAGS) -o $(BIN_DIR)/$(TARGET).axf $(OBJ_CPP_LIST) $(OBJ_LIST) $(ROMIMG) $(LIBFLAGS) -lstdc++ -T$(LDSCRIPT) + $(OBJCOPY) -j .bluetooth_trace.text -Obinary $(BIN_DIR)/$(TARGET).axf $(BIN_DIR)/APP.trace + $(OBJCOPY) -R .bluetooth_trace.text $(BIN_DIR)/$(TARGET).axf + $(OBJDUMP) -d $(BIN_DIR)/$(TARGET).axf > $(BIN_DIR)/$(TARGET).asm + +# Manipulate Image +# ------------------------------------------------------------------- + +.PHONY: manipulate_images +manipulate_images: | application_is + @echo =========================================================== + @echo Image manipulating + @echo =========================================================== + cp $(AMEBAZ2_BOOTLOADERDIR)/bootloader.axf $(BOOT_BIN_DIR)/bootloader.axf +ifeq ($(findstring Linux, $(OS)), Linux) + chmod 0774 $(ELF2BIN) $(CHKSUM) +endif + $(ELF2BIN) keygen keycfg.json + $(ELF2BIN) convert amebaz2_bootloader.json BOOTLOADER secure_bit=0 + $(ELF2BIN) convert amebaz2_bootloader.json PARTITIONTABLE secure_bit=0 + $(ELF2BIN) convert amebaz2_firmware_is.json FIRMWARE secure_bit=0 +#ifeq ($(findstring Linux, $(OS)), Linux) +# chmod 777 $(AMEBAZ2_GCCTOOLDIR)/LZMA_GenCompressedFW_linux +#endif +# $(LZMA_PY) $(BIN_DIR)/firmware_is.bin + + $(CHKSUM) $(BIN_DIR)/firmware_is.bin +# $(CHKSUM) $(BIN_DIR)/firmware_is_lzma.bin + $(ELF2BIN) combine $(BIN_DIR)/flash_is.bin PTAB=partition.bin,BOOT=$(BOOT_BIN_DIR)/bootloader.bin,FW1=$(BIN_DIR)/firmware_is.bin + + $(CODE_ANALYZE_PYTHON) +# Generate build info +# ------------------------------------------------------------------- + +.PHONY: build_info +build_info: + @echo \#define RTL_FW_COMPILE_TIME RTL8710CFW_COMPILE_TIME\ > .ver + @echo \#define RTL_FW_COMPILE_DATE RTL8710CFW_COMPILE_DATE\ >> .ver + @echo \#define UTS_VERSION \"`date +%Y/%m/%d-%T`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_TIME \"`date +%Y/%m/%d-%T`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_DATE \"`date +%Y%m%d`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_BY \"`id -u -n`\" >> .ver + @echo \#define RTL8710CFW_COMPILE_HOST \"`$(HOSTNAME_APP)`\" >> .ver + @if [ -x /bin/dnsdomainname ]; then \ + echo \#define RTL8710CFW_COMPILE_DOMAIN \"`dnsdomainname`\"; \ + elif [ -x /bin/domainname ]; then \ + echo \#define RTL8710CFW_COMPILE_DOMAIN \"`domainname`\"; \ + else \ + echo \#define RTL8710CFW_COMPILE_DOMAIN ; \ + fi >> .ver + + @echo \#define RTL8710CFW_COMPILER \"gcc `$(CC) $(CFLAGS) -dumpversion | tr --delete '\r'`\" >> .ver + @mv -f .ver ../inc/$@.h + +.PHONY: prerequirement +prerequirement: + @if [ ! -d $(ARM_GCC_TOOLCHAIN) ]; then \ + echo ===========================================================; \ + echo Toolchain not found, \"make toolchain\" first!; \ + echo ===========================================================; \ + exit -1; \ + fi + @echo =========================================================== + @echo Build $(TARGET) + @echo =========================================================== + mkdir -p $(OBJ_DIR) + mkdir -p $(BIN_DIR) + mkdir -p $(BOOT_BIN_DIR) + mkdir -p $(INFO_DIR) + +$(SRC_OO): %_$(TARGET).oo : %.cpp | prerequirement + $(CC) $(CPPFLAGS) -c $< -o $@ + $(CC) $(CPPFLAGS) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.oo,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.ii) $(INFO_DIR) +# mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +$(SRC_O): %_$(TARGET).o : %.c | prerequirement + $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.i) $(INFO_DIR) + mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +$(SRAM_O): %_$(TARGET).o : %.c | prerequirement + $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(OBJCOPY) --prefix-alloc-sections .sram $@ + $(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.i) $(INFO_DIR) + mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +$(ERAM_O): %_$(TARGET).o : %.c | prerequirement + $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(OBJCOPY) --prefix-alloc-sections .psram $@ + $(CC) $(CFLAGS) $(INCLUDES) -c $< -MM -MT $@ -MF $(OBJ_DIR)/$(notdir $(patsubst %.o,%.d,$@)) + cp $@ $(OBJ_DIR)/$(notdir $@) + mv $(notdir $*.i) $(INFO_DIR) + mv $(notdir $*.s) $(INFO_DIR) + chmod 777 $(OBJ_DIR)/$(notdir $@) + +-include $(DEPENDENCY_LIST) + +# Only needed for FPGA phase +.PHONY: romdebug +romdebug: +ifeq ($(findstring CYGWIN, $(OS)), CYGWIN) +# $(FLASH_TOOLDIR)/Check_Jtag.sh + cmd /c start $(GDB) -x ./rtl_gdb_debug_jlink.txt +else + $(GDB) -x ./rtl_gdb_debug_jlink.txt +endif + +.PHONY: flash +flash: +# @if [ ! -f $(FLASH_TOOLDIR)/rtl_gdb_flash_write.txt ] ; then echo Please do /"make setup GDB_SERVER=[jlink or openocd]/" first; echo && false ; fi +#ifeq ($(findstring CYGWIN, $(OS)), CYGWIN) +# $(FLASH_TOOLDIR)/Check_Jtag.sh +#endif + @if [ ! -e $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt ]; then \ + echo ===========================================================; \ + echo gdb script not found, \"make setup GDB_SERVER=[jlink, pyocd or openocd]\" first!; \ + echo ===========================================================; \ + exit -1; \ + fi + chmod +rx $(AMEBAZ2_GCCTOOLDIR)/flashloader.sh + $(AMEBAZ2_GCCTOOLDIR)/flashloader.sh application_is/Debug/bin/flash_is.bin + $(GDB) -x $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt + +.PHONY: debug +debug: + @if [ ! -e $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt ]; then \ + echo ===========================================================; \ + echo gdb script not found, \"make setup GDB_SERVER=[jlink, pyocd or openocd]\" first!; \ + echo ===========================================================; \ + exit -1; \ + fi + chmod +rx $(AMEBAZ2_GCCTOOLDIR)/debug.sh + $(AMEBAZ2_GCCTOOLDIR)/debug.sh $(BIN_DIR)/$(TARGET).axf + $(GDB) -x $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + +.PHONY: dump +dump: + chmod +rx $(AMEBAZ2_GCCTOOLDIR)/dump.sh + $(AMEBAZ2_GCCTOOLDIR)/dump.sh $(BIN_DIR)/flash_is_dump.bin $(DUMP_START_ADDRESS) $(DUMP_END_ADDRESS) + $(GDB) -x $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_dump_jlink.txt + +.PHONY: setup +setup: + @echo "----------------" + @echo Setup $(GDB_SERVER) + @echo "----------------" +ifeq ($(GDB_SERVER), pyocd) + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug_pyocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader_pyocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt +else ifeq ($(GDB_SERVER), openocd) + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug_openocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader_openocd.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt +else + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug_jlink.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_debug.txt + cp -p $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader_jlink.txt $(AMEBAZ2_GCCTOOLDIR)/rtl_gdb_flashloader.txt +endif + +.PHONY: clean +clean: + rm -rf $(TARGET) + rm -f $(SRC_O) $(SRAM_O) $(ERAM_O) $(SRC_OO) + rm -f $(patsubst %.o,%.d,$(SRC_O)) $(patsubst %.o,%.d,$(SRAM_O)) $(patsubst %.o,%.d,$(ERAM_O)) $(patsubst %.oo,%.d,$(SRC_OO)) + rm -f $(patsubst %.o,%.su,$(SRC_O)) $(patsubst %.o,%.su,$(SRAM_O)) $(patsubst %.o,%.su,$(ERAM_O)) $(patsubst %.oo,%.su,$(SRC_OO)) + rm -f *.i + rm -f *.s diff --git a/project/realtek_amebaz2plus_v0_example/inc/FreeRTOSConfig.h b/project/realtek_amebaz2plus_v0_example/inc/FreeRTOSConfig.h index a5b2044..c0a803b 100644 --- a/project/realtek_amebaz2plus_v0_example/inc/FreeRTOSConfig.h +++ b/project/realtek_amebaz2plus_v0_example/inc/FreeRTOSConfig.h @@ -83,28 +83,29 @@ extern uint32_t SystemCoreClock; /* Constants that build features in or out. */ #define configUSE_MUTEXES 1 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_NEWLIB_REENTRANT 0 -#define configUSE_CO_ROUTINES 0 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_QUEUE_SETS 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_NEWLIB_REENTRANT 0 +#define configUSE_CO_ROUTINES 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_QUEUE_SETS 1 #define configUSE_TASK_NOTIFICATIONS 1 -#define configUSE_TRACE_FACILITY 0 +#define configUSE_TRACE_FACILITY 1 /* Constants that define which hook (callback) functions should be used. */ -#define configUSE_IDLE_HOOK 0 -#define configUSE_TICK_HOOK 0 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 #define configUSE_MALLOC_FAILED_HOOK 1 -#define secureconfigUSE_MALLOC_FAILED_HOOK 1 +#define secureconfigUSE_MALLOC_FAILED_HOOK 1 /* Constants provided for debugging and optimisation assistance. */ -#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configRECORD_STACK_HIGH_ADDRESS 1 /* Software timer definitions. */ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) -#define configTIMER_QUEUE_LENGTH ( 10 + 64) +#define configTIMER_QUEUE_LENGTH ( 10 + 64 ) #define configTIMER_TASK_STACK_DEPTH ( 512 ) /* Set the following definitions to 1 to include the API function, or zero @@ -112,20 +113,22 @@ extern uint32_t SystemCoreClock; * only necessary if the linker does not automatically remove functions that are * not referenced anyway. */ #define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_pcTaskGetTaskName 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 0 -#define INCLUDE_xTaskGetIdleTaskHandle 0 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xTaskResumeFromISR 0 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xSemaphoreGetMutexHolder 1 -#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_pcTaskGetTaskName 1 +#define INCLUDE_uxTaskGetStackSize 1 +#define INCLUDE_uxTaskGetFreeStackSize 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 0 +#define INCLUDE_xTaskGetIdleTaskHandle 0 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTaskResumeFromISR 0 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xSemaphoreGetMutexHolder 1 +#define INCLUDE_xTimerPendFunctionCall 1 /* This demo makes use of one or more example stats formatting functions. These * format the raw data provided by the uxTaskGetSystemState() function in to @@ -300,8 +303,4 @@ warnings. */ #if defined(ENABLE_AMAZON_COMMON) #include "FreeRTOSConfig_Amazon.h" #endif - -#if defined(CONFIG_MATTER) && CONFIG_MATTER -#include "FreeRTOSConfig_Matter.h" -#endif #endif /* FREERTOS_CONFIG_H */